Skip to contentSkip to conversation

Make EN2 pin optional in the TRF7970A driver

PATCH Applied Heiko Schocher 3 participants 8 messages Feb 7, 2017 – Apr 1, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make EN2 pin optional in the TRF7970A driver

From: Guan Ben <[email protected]>

Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground.

---

 .../devicetree/bindings/net/nfc/trf7970a.txt       |  4 ++--
 drivers/nfc/trf7970a.c                             | 26 ++++++++++++----------
 2 files changed, 16 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +2 -2
index 32b35a0..5889a3d 100644
@@ -5,8 +5,8 @@ Required properties:
 - spi-max-frequency: Maximum SPI frequency (<= 2000000).
 - interrupt-parent: phandle of parent interrupt handler.
 - interrupts: A single interrupt specifier.
-- ti,enable-gpios: Two GPIO entries used for 'EN' and 'EN2' pins on the
-  TRF7970A.
+- ti,enable-gpios: One or two GPIO entries used for 'EN' and 'EN2' pins on the
+  TRF7970A. EN2 is optional.
 - vin-supply: Regulator for supply voltage to VIN pin
 
 Optional SoC Specific Properties:
drivers/nfc/trf7970a.c +14 -12
index 26c9dbb..75079fb 100644
@@ -1885,8 +1885,10 @@ static int trf7970a_power_up(struct trf7970a *trf)
 	usleep_range(5000, 6000);
 
 	if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
-		gpio_set_value(trf->en2_gpio, 1);
-		usleep_range(1000, 2000);
+		if (gpio_is_valid(trf->en2_gpio)) {
+			gpio_set_value(trf->en2_gpio, 1);
+			usleep_range(1000, 2000);
+		}
 	}
 
 	gpio_set_value(trf->en_gpio, 1);
@@ -1914,7 +1916,8 @@ static int trf7970a_power_down(struct trf7970a *trf)
 	}
 
 	gpio_set_value(trf->en_gpio, 0);
-	gpio_set_value(trf->en2_gpio, 0);
+	if (gpio_is_valid(trf->en2_gpio))
+		gpio_set_value(trf->en2_gpio, 0);
 
 	ret = regulator_disable(trf->regulator);
 	if (ret)
@@ -2032,15 +2035,14 @@ static int trf7970a_probe(struct spi_device *spi)
 
 	trf->en2_gpio = of_get_named_gpio(np, "ti,enable-gpios", 1);
 	if (!gpio_is_valid(trf->en2_gpio)) {
-		dev_err(trf->dev, "No EN2 GPIO property\n");
-		return trf->en2_gpio;
-	}
-
-	ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
-			GPIOF_DIR_OUT | GPIOF_INIT_LOW, "trf7970a EN2");
-	if (ret) {
-		dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
-		return ret;
+		dev_info(trf->dev, "No EN2 GPIO property\n");
+	} else {
+		ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
+				GPIOF_DIR_OUT | GPIOF_INIT_LOW, "trf7970a EN2");
+		if (ret) {
+			dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
+			return ret;
+		}
 	}
 
 	if (of_property_read_bool(np, "en2-rf-quirk"))
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 20 lines · Heiko Schocher

From: Guan Ben <[email protected]>

Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground.

---

 .../devicetree/bindings/net/nfc/trf7970a.txt       |  4 ++--
 drivers/nfc/trf7970a.c                             | 26 ++++++++++++----------
 2 files changed, 16 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +0 -0
index 32b35a0..5889a3d 100644

Documentation/devicetree/bindings/net/nfc/trf7970a.txt Required properties: · line 9

Quoted 7 lines
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +2 -2
@@ -5,8 +5,8 @@ Required properties:
 - spi-max-frequency: Maximum SPI frequency (<= 2000000).
 - interrupt-parent: phandle of parent interrupt handler.
 - interrupts: A single interrupt specifier.
-- ti,enable-gpios: Two GPIO entries used for 'EN' and 'EN2' pins on the
-  TRF7970A.
+- ti,enable-gpios: One or two GPIO entries used for 'EN' and 'EN2' pins on the
+  TRF7970A. EN2 is optional.

Could EN ever be optional/fixed? If so, perhaps deprecate this property and do 2 properties, one for each pin.

Rob

#2 lore raw

Hello Rob,

Am 10.02.2017 um 16:51 schrieb Rob Herring:

Quoted 16 lines · Heiko Schocher
Quoted 15 lines

From: Guan Ben <ben.guan-dUNdQdTMQaZWk0Htik3J/[email protected]>

Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground.

---

  .../devicetree/bindings/net/nfc/trf7970a.txt       |  4 ++--
  drivers/nfc/trf7970a.c                             | 26 ++++++++++++----------
  2 files changed, 16 insertions(+), 14 deletions(-)
Quoted 15 lines

Documentation/devicetree/bindings/net/nfc/trf7970a.txt Required properties: · line 9

Quoted 12 lines
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +2 -2
index 32b35a0..5889a3d 100644
@@ -5,8 +5,8 @@ Required properties:
  - spi-max-frequency: Maximum SPI frequency (<= 2000000).
  - interrupt-parent: phandle of parent interrupt handler.
  - interrupts: A single interrupt specifier.
-- ti,enable-gpios: Two GPIO entries used for 'EN' and 'EN2' pins on the
-  TRF7970A.
+- ti,enable-gpios: One or two GPIO entries used for 'EN' and 'EN2' pins on the
+  TRF7970A. EN2 is optional.

Could EN ever be optional/fixed? If so, perhaps deprecate this property and do 2 properties, one for each pin.

The hardware I have has the EN2 pin fix connected to ground. Looking into http://www.ti.com/lit/ds/slos743k/slos743k.pdf page 19 table 6-3 and 6-4 the EN2 pin is a don;t core if EN = 1. If EN = 0 EN2 pin selects between Power Down and Sleep Mode ... I see no reason why this is not possible/allowed ...

Hmm.. I do not like the idea of deprecating the "ti,enable-gpios" property into 2 seperate properties ... but if this would be a reason for not accepting this patch, I can do this ... How should I name the 2 new properties?

"ti,pin-enable" and "ti,pin-enable2" ?

bye,
Heiko

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Acked-by
#3 lore raw
Quoted 49 lines · Heiko Schocher

Hello Rob,

Am 10.02.2017 um 16:51 schrieb Rob Herring:

Quoted 29 lines · Heiko Schocher
Quoted 27 lines

From: Guan Ben <[email protected]>

Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground.

---

  .../devicetree/bindings/net/nfc/trf7970a.txt       |  4 ++--
  drivers/nfc/trf7970a.c                             | 26
++++++++++++----------
  2 files changed, 16 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +0 -1
index 32b35a0..5889a3d 100644
@@ -5,8 +5,8 @@ Required properties:
  - spi-max-frequency: Maximum SPI frequency (<= 2000000).
  - interrupt-parent: phandle of parent interrupt handler.
  - interrupts: A single interrupt specifier.
-- ti,enable-gpios: Two GPIO entries used for 'EN' and 'EN2' pins on the
Quoted 8 lines
Quoted 4 lines
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +1 -1
-  TRF7970A.
+- ti,enable-gpios: One or two GPIO entries used for 'EN' and 'EN2' pins

on the
+ TRF7970A. EN2 is optional.

Could EN ever be optional/fixed? If so, perhaps deprecate this property and do 2 properties, one for each pin.

The hardware I have has the EN2 pin fix connected to ground. Looking into http://www.ti.com/lit/ds/slos743k/slos743k.pdf page 19 table 6-3 and 6-4 the EN2 pin is a don;t core if EN = 1. If EN = 0 EN2 pin selects between Power Down and Sleep Mode ... I see no reason why this is not possible/allowed ...

Quoted 4 lines

Hmm.. I do not like the idea of deprecating the "ti,enable-gpios" property into 2 seperate properties ... but if this would be a reason for not accepting this patch, I can do this ... How should I name the 2 new properties?

I guess if this ever happens, then we just add "ti,enable2-gpios" and ti,enable-gpios continues to point to EN. We don't need to deprecate anything (or maybe just deprecate having both GPIOs on single property).

In that case,

Quoted 8 lines

"ti,pin-enable" and "ti,pin-enable2" ?

bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

#4 lore raw

Hello all,

Am 13.02.2017 um 22:31 schrieb Rob Herring:

Quoted 55 lines · Heiko Schocher
Quoted 49 lines

Hello Rob,

Am 10.02.2017 um 16:51 schrieb Rob Herring:

Quoted 29 lines · Heiko Schocher
Quoted 27 lines

From: Guan Ben <[email protected]>

Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground.

---

   .../devicetree/bindings/net/nfc/trf7970a.txt       |  4 ++--
   drivers/nfc/trf7970a.c                             | 26
++++++++++++----------
   2 files changed, 16 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +0 -1
index 32b35a0..5889a3d 100644
@@ -5,8 +5,8 @@ Required properties:
   - spi-max-frequency: Maximum SPI frequency (<= 2000000).
   - interrupt-parent: phandle of parent interrupt handler.
   - interrupts: A single interrupt specifier.
-- ti,enable-gpios: Two GPIO entries used for 'EN' and 'EN2' pins on the
Quoted 8 lines
Quoted 4 lines
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +1 -1
-  TRF7970A.
+- ti,enable-gpios: One or two GPIO entries used for 'EN' and 'EN2' pins

on the
+ TRF7970A. EN2 is optional.

Could EN ever be optional/fixed? If so, perhaps deprecate this property and do 2 properties, one for each pin.

The hardware I have has the EN2 pin fix connected to ground. Looking into http://www.ti.com/lit/ds/slos743k/slos743k.pdf page 19 table 6-3 and 6-4 the EN2 pin is a don;t core if EN = 1. If EN = 0 EN2 pin selects between Power Down and Sleep Mode ... I see no reason why this is not possible/allowed ...

Quoted 4 lines

Hmm.. I do not like the idea of deprecating the "ti,enable-gpios" property into 2 seperate properties ... but if this would be a reason for not accepting this patch, I can do this ... How should I name the 2 new properties?

Quoted 8 lines

I guess if this ever happens, then we just add "ti,enable2-gpios" and ti,enable-gpios continues to point to EN. We don't need to deprecate anything (or maybe just deprecate having both GPIOs on single property).

In that case,

gentle ping.

Are there any more comments to this patch? Is it acceptable as it is?

Thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
maintainer
#5 lore raw
Quoted 74 lines · Heiko Schocher

Hello all,

Am 13.02.2017 um 22:31 schrieb Rob Herring:

Quoted 71 lines · Heiko Schocher
Quoted 56 lines

Hello Rob,

Am 10.02.2017 um 16:51 schrieb Rob Herring:

Quoted 34 lines · Heiko Schocher
Quoted 31 lines

From: Guan Ben <ben.guan-dUNdQdTMQaZWk0Htik3J/[email protected]>

Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground.

---

   .../devicetree/bindings/net/nfc/trf7970a.txt       |  4 ++--
   drivers/nfc/trf7970a.c                             | 26
++++++++++++----------
   2 files changed, 16 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +0 -1
index 32b35a0..5889a3d 100644
@@ -5,8 +5,8 @@ Required properties:
   - spi-max-frequency: Maximum SPI frequency (<= 2000000).
   - interrupt-parent: phandle of parent interrupt handler.
   - interrupts: A single interrupt specifier.
-- ti,enable-gpios: Two GPIO entries used for 'EN' and 'EN2' pins on

the
- TRF7970A.
+- ti,enable-gpios: One or two GPIO entries used for 'EN' and 'EN2'

Quoted 8 lines
Quoted 3 lines

pins
on the
+ TRF7970A. EN2 is optional.

Could EN ever be optional/fixed? If so, perhaps deprecate this property and do 2 properties, one for each pin.

The hardware I have has the EN2 pin fix connected to ground. Looking into http://www.ti.com/lit/ds/slos743k/slos743k.pdf page 19 table 6-3 and 6-4 the EN2 pin is a don;t core if EN = 1. If EN = 0 EN2 pin selects between Power Down and Sleep Mode ... I see no reason why this is not possible/allowed ...

Quoted 4 lines

Hmm.. I do not like the idea of deprecating the "ti,enable-gpios" property into 2 seperate properties ... but if this would be a reason for not accepting this patch, I can do this ... How should I name the 2 new properties?

I guess if this ever happens, then we just add "ti,enable2-gpios" and ti,enable-gpios continues to point to EN. We don't need to deprecate anything (or maybe just deprecate having both GPIOs on single property).

In that case,

Quoted 7 lines
Quoted 1 line

gentle ping.

Are there any more comments to this patch? Is it acceptable as it is?

I acked it, so yes, it is fine.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

Hello all,

Am 21.02.2017 um 17:43 schrieb Rob Herring:

Quoted 78 lines · Heiko Schocher
Quoted 77 lines

Hello all,

Am 13.02.2017 um 22:31 schrieb Rob Herring:

Quoted 72 lines · Heiko Schocher
Quoted 56 lines

Hello Rob,

Am 10.02.2017 um 16:51 schrieb Rob Herring:

Quoted 34 lines · Heiko Schocher
Quoted 31 lines

From: Guan Ben <ben.guan-dUNdQdTMQaZWk0Htik3J/[email protected]>

Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground.

---

    .../devicetree/bindings/net/nfc/trf7970a.txt       |  4 ++--
    drivers/nfc/trf7970a.c                             | 26
++++++++++++----------
    2 files changed, 16 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/net/nfc/trf7970a.txt +0 -1
index 32b35a0..5889a3d 100644
@@ -5,8 +5,8 @@ Required properties:
    - spi-max-frequency: Maximum SPI frequency (<= 2000000).
    - interrupt-parent: phandle of parent interrupt handler.
    - interrupts: A single interrupt specifier.
-- ti,enable-gpios: Two GPIO entries used for 'EN' and 'EN2' pins on

the
- TRF7970A.
+- ti,enable-gpios: One or two GPIO entries used for 'EN' and 'EN2'

Quoted 8 lines
Quoted 3 lines

pins
on the
+ TRF7970A. EN2 is optional.

Could EN ever be optional/fixed? If so, perhaps deprecate this property and do 2 properties, one for each pin.

The hardware I have has the EN2 pin fix connected to ground. Looking into http://www.ti.com/lit/ds/slos743k/slos743k.pdf page 19 table 6-3 and 6-4 the EN2 pin is a don;t core if EN = 1. If EN = 0 EN2 pin selects between Power Down and Sleep Mode ... I see no reason why this is not possible/allowed ...

Quoted 4 lines

Hmm.. I do not like the idea of deprecating the "ti,enable-gpios" property into 2 seperate properties ... but if this would be a reason for not accepting this patch, I can do this ... How should I name the 2 new properties?

I guess if this ever happens, then we just add "ti,enable2-gpios" and ti,enable-gpios continues to point to EN. We don't need to deprecate anything (or maybe just deprecate having both GPIOs on single property).

In that case,

Quoted 6 lines
Quoted 4 lines

gentle ping.

Are there any more comments to this patch? Is it acceptable as it is?

I acked it, so yes, it is fine.

Gentle ping. Any more issues or can this patch go into mainline?

bye,
Heiko

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Applied
#7 lore raw
In reply to Heiko Schocher

Hi Heiko,

Quoted 9 lines · Heiko Schocher

From: Guan Ben <[email protected]>

Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground.

Quoted 5 lines

---

 .../devicetree/bindings/net/nfc/trf7970a.txt       |  4 ++--
 drivers/nfc/trf7970a.c                             | 26 ++++++++++++----------
 2 files changed, 16 insertions(+), 14 deletions(-)

Applied to nfc-next, thanks.

Cheers,
Samuel.