Commit 62ae64ce authored by Joe Mason's avatar Joe Mason Committed by Bjorn Andersson

arm64: dts: qcom: msm8916-samsung-gprimeltecan: Add NFC

The Samsung Galaxy Grand Prime CAN has a Samsung S3FWRN5 NFC chip that
works quite well with the s3fwrn5 driver in the Linux NFC subsystem.

The clock setup for the NFC chip is a bit special (although this
seems to be a common approach used for Qualcomm devices with NFC):

The NFC chip has an output GPIO that is asserted whenever the clock
is needed to function properly. On the A3/A5 this is wired up to
PM8916 GPIO2, which is then configured with a special function
(NFC_CLK_REQ or BB_CLK2_REQ).

Enabling the rpmcc RPM_SMD_BB_CLK2_PIN clock will then instruct
PM8916 to automatically enable the clock whenever the NFC chip
requests it. The advantage is that the clock is only enabled when
needed and we don't need to manage it ourselves from the NFC driver.
Signed-off-by: default avatarJoe Mason <buddyjojo06@outlook.com>
[Stephan: Put NFC pinctrl into common dtsi to share it with other variants]
Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
[Raymond: Use interrupts-extended. Keep &blsp_i2c6 enabled by default]
Signed-off-by: default avatarRaymond Hackley <raymondhackley@protonmail.com>
Link: https://lore.kernel.org/r/20240601115321.25314-2-raymondhackley@protonmail.comSigned-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent 336e26f8
......@@ -6,6 +6,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
/ {
aliases {
......@@ -227,6 +228,10 @@ touchscreen: touchscreen@20 {
};
};
&blsp_i2c6 {
status = "okay";
};
&blsp_uart2 {
status = "okay";
};
......@@ -346,6 +351,29 @@ muic_int_default: muic-int-default-state {
bias-disable;
};
nfc_default: nfc-default-state {
irq-pins {
pins = "gpio21";
function = "gpio";
drive-strength = <2>;
bias-pull-down;
};
nfc-pins {
pins = "gpio20", "gpio49";
function = "gpio";
drive-strength = <2>;
bias-disable;
};
};
nfc_i2c_default: nfc-i2c-default-state {
pins = "gpio0", "gpio1";
function = "gpio";
drive-strength = <2>;
bias-disable;
};
sdc2_cd_default: sdc2-cd-default-state {
pins = "gpio38";
function = "gpio";
......@@ -367,3 +395,13 @@ tsp_int_default: tsp-int-default-state {
bias-disable;
};
};
&pm8916_gpios {
nfc_clk_req: nfc-clk-req-state {
pins = "gpio2";
function = "func1";
power-source = <PM8916_GPIO_L2>;
bias-disable;
input-enable;
};
};
......@@ -29,6 +29,23 @@ &bosch_magn {
status = "okay";
};
&blsp_i2c6 {
nfc@27 {
compatible = "samsung,s3fwrn5-i2c";
reg = <0x27>;
interrupts-extended = <&tlmm 21 IRQ_TYPE_EDGE_RISING>;
en-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>;
wake-gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>;
clocks = <&rpmcc RPM_SMD_BB_CLK2_PIN>;
pinctrl-0 = <&nfc_default>, <&nfc_clk_req>;
pinctrl-names = "default";
};
};
&mpss_mem {
/* Firmware for gprimeltecan needs more space */
reg = <0x0 0x86800000 0x0 0x5400000>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment