All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
	linux-arm-msm@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org,
	Stephan Gerhold <stephan@gerhold.net>
Subject: [PATCH v2 06/15] arm64: dts: qcom: msm8916-samsung-serranove: Add NFC
Date: Mon,  4 Oct 2021 22:19:12 +0200	[thread overview]
Message-ID: <20211004201921.18526-7-stephan@gerhold.net> (raw)
In-Reply-To: <20211004201921.18526-1-stephan@gerhold.net>

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>
---
Changes in v2: None.
---
 .../dts/qcom/msm8916-samsung-serranove.dts    | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts
index 3ef00bdc043e..a78f87a5bf4f 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts
@@ -168,6 +168,32 @@ touchkey@20 {
 			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 {
@@ -434,6 +460,30 @@ muic_irq_default: muic-irq-default {
 		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";
-- 
2.33.0


WARNING: multiple messages have this Message-ID (diff)
From: Stephan Gerhold <stephan@gerhold.net>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
	linux-arm-msm@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org,
	Stephan Gerhold <stephan@gerhold.net>
Subject: [PATCH v2 06/15] arm64: dts: qcom: msm8916-samsung-serranove: Add NFC
Date: Mon,  4 Oct 2021 22:19:12 +0200	[thread overview]
Message-ID: <20211004201921.18526-7-stephan@gerhold.net> (raw)
In-Reply-To: <20211004201921.18526-1-stephan@gerhold.net>

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>
---
Changes in v2: None.
---
 .../dts/qcom/msm8916-samsung-serranove.dts    | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts
index 3ef00bdc043e..a78f87a5bf4f 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts
@@ -168,6 +168,32 @@ touchkey@20 {
 			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 {
@@ -434,6 +460,30 @@ muic_irq_default: muic-irq-default {
 		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";
-- 
2.33.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-10-04 20:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 20:19 [PATCH v2 00/15] Add support for Samsung Galaxy S4 Mini Value Edition Stephan Gerhold
2021-10-04 20:19 ` Stephan Gerhold
2021-10-04 20:19 ` [PATCH v2 01/15] arm64: dts: qcom: Add device tree " Stephan Gerhold
2021-10-04 20:19   ` Stephan Gerhold
2021-10-04 20:19 ` [PATCH v2 02/15] arm64: dts: qcom: msm8916-samsung-serranove: Add touch screen Stephan Gerhold
2021-10-04 20:19   ` Stephan Gerhold
2021-10-04 20:19 ` [PATCH v2 03/15] arm64: dts: qcom: msm8916-samsung-serranove: Add touch key Stephan Gerhold
2021-10-04 20:19   ` Stephan Gerhold
2021-10-04 20:19 ` [PATCH v2 04/15] arm64: dts: qcom: msm8916-samsung-serranove: Add IMU Stephan Gerhold
2021-10-04 20:19   ` Stephan Gerhold
2021-10-04 20:19 ` [PATCH v2 05/15] arm64: dts: qcom: msm8916-samsung-serranove: Add rt5033 battery Stephan Gerhold
2021-10-04 20:19   ` Stephan Gerhold
2021-10-04 20:19 ` Stephan Gerhold [this message]
2021-10-04 20:19   ` [PATCH v2 06/15] arm64: dts: qcom: msm8916-samsung-serranove: Add NFC Stephan Gerhold
2021-10-04 20:49 ` [PATCH v2 07/15] ARM: qcom: Add ARCH_MSM8916 for MSM8916 on ARM32 Stephan Gerhold
2021-10-04 20:49   ` Stephan Gerhold
2021-10-04 20:49 ` [PATCH v2 08/15] dt-bindings: arm: cpus: Document qcom,msm8916-smp enable-method Stephan Gerhold
2021-10-04 20:49   ` [PATCH v2 08/15] dt-bindings: arm: cpus: Document qcom, msm8916-smp enable-method Stephan Gerhold
2021-10-14 16:40   ` [PATCH v2 08/15] dt-bindings: arm: cpus: Document qcom,msm8916-smp enable-method Rob Herring
2021-10-14 16:40     ` Rob Herring
2021-10-04 20:49 ` [PATCH v2 09/15] ARM: qcom: Add qcom,msm8916-smp enable-method identical to MSM8226 Stephan Gerhold
2021-10-04 20:49   ` [PATCH v2 09/15] ARM: qcom: Add qcom, msm8916-smp " Stephan Gerhold
2021-10-04 20:49 ` [PATCH v2 10/15] dt-bindings: soc: qcom: spm: Document qcom,msm8916-saw2-v3.0-cpu Stephan Gerhold
2021-10-04 20:49   ` [PATCH v2 10/15] dt-bindings: soc: qcom: spm: Document qcom, msm8916-saw2-v3.0-cpu Stephan Gerhold
2021-10-04 20:49 ` [PATCH v2 11/15] soc: qcom: spm: Add 8916 SPM register data Stephan Gerhold
2021-10-04 20:49   ` Stephan Gerhold
2021-10-04 20:49 ` [PATCH v2 12/15] firmware: qcom: scm: Add support for MC boot address API Stephan Gerhold
2021-10-04 20:49   ` Stephan Gerhold
2021-10-04 20:49 ` [PATCH v2 13/15] arm64: dts: qcom: msm8916: Add CPU ACC and SAW/SPM Stephan Gerhold
2021-10-04 20:49   ` Stephan Gerhold
2021-10-04 20:49 ` [PATCH v2 14/15] ARM: dts: qcom: msm8916: Add include for SMP without PSCI on ARM32 Stephan Gerhold
2021-10-04 20:49   ` Stephan Gerhold
2021-10-04 20:49 ` [PATCH v2 15/15] ARM: dts: qcom: msm8916-samsung-serranove: Include dts from arm64 Stephan Gerhold
2021-10-04 20:49   ` Stephan Gerhold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211004201921.18526-7-stephan@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.