arm64: dts: qcom: msm8916-samsung-serranove: Add NFC
authorStephan Gerhold <stephan@gerhold.net>
Mon, 4 Oct 2021 20:19:12 +0000 (22:19 +0200)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Sun, 24 Oct 2021 03:23:02 +0000 (22:23 -0500)
The LTE version of the S4 Mini VE has a NXP PN547, which is supported
by the nxp-nci-i2c driver in mainline. It seems to detect NFC tags
using "nfctool" just fine, although more testing is difficult given
there seem to be very few useful applications making use of the
Linux NFC subsystem. :(

Note that for some reason Samsung decided to connect the I2C pins
to GPIOs where no hardware I2C bus is available, so we need to
fall back to software bit-banging with i2c-gpio.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211004201921.18526-7-stephan@gerhold.net
arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts

index 3ef00bdc043ec02768289a00056c81c4a7155bd5..a78f87a5bf4f40e5f3a1574db6995e16cd103866 100644 (file)
                        pinctrl-0 = <&tkey_default>;
                };
        };
+
+       i2c-nfc {
+               compatible = "i2c-gpio";
+               sda-gpios = <&msmgpio 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&msmgpio 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&nfc_i2c_default>;
+
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               nfc@2b {
+                       compatible = "nxp,pn547", "nxp,nxp-nci-i2c";
+                       reg = <0x2b>;
+
+                       interrupt-parent = <&msmgpio>;
+                       interrupts = <21 IRQ_TYPE_EDGE_RISING>;
+
+                       enable-gpios = <&msmgpio 20 GPIO_ACTIVE_HIGH>;
+                       firmware-gpios = <&msmgpio 49 GPIO_ACTIVE_HIGH>;
+
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&nfc_default>;
+               };
+       };
 };
 
 &blsp_i2c2 {
                bias-disable;
        };
 
+       nfc_default: nfc-default {
+               pins = "gpio20", "gpio49";
+               function = "gpio";
+
+               drive-strength = <2>;
+               bias-disable;
+
+               irq {
+                       pins = "gpio21";
+                       function = "gpio";
+
+                       drive-strength = <2>;
+                       bias-pull-down;
+               };
+       };
+
+       nfc_i2c_default: nfc-i2c-default {
+               pins = "gpio0", "gpio1";
+               function = "gpio";
+
+               drive-strength = <2>;
+               bias-disable;
+       };
+
        tkey_default: tkey-default {
                pins = "gpio98";
                function = "gpio";