Skip to contentSkip to conversation

pinctrl: tegra: define GPIO compatible node per SoC

PATCH In review Stefan Agner 3 participants 8 messages Jul 26, 2018 – Aug 16, 2018

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

PATCH 1/2 pinctrl: tegra: define GPIO compatible node per SoC

Tegra 2 uses a different GPIO controller which uses "tegra20-gpio" as compatible string.

Make the compatible string the GPIO node is using a SoC specific property. This prevents the kernel from registering the GPIO range twice in case the GPIO range is specified in the device tree.

Fixes 9462510ce31e ("pinctrl: tegra: Only set the gpio range if needed")
---
 drivers/pinctrl/tegra/pinctrl-tegra.c    | 6 +++---
 drivers/pinctrl/tegra/pinctrl-tegra.h    | 1 +
 drivers/pinctrl/tegra/pinctrl-tegra114.c | 1 +
 drivers/pinctrl/tegra/pinctrl-tegra124.c | 1 +
 drivers/pinctrl/tegra/pinctrl-tegra20.c  | 1 +
 drivers/pinctrl/tegra/pinctrl-tegra210.c | 1 +
 drivers/pinctrl/tegra/pinctrl-tegra30.c  | 1 +
 7 files changed, 9 insertions(+), 3 deletions(-)
drivers/pinctrl/tegra/pinctrl-tegra.c +3 -3
index f974eee29a19..1aba75897d14 100644
@@ -629,12 +629,12 @@ static void tegra_pinctrl_clear_parked_bits(struct tegra_pmx *pmx)
 	}
 }
 
-static bool gpio_node_has_range(void)
+static bool gpio_node_has_range(const char *compatible)
 {
 	struct device_node *np;
 	bool has_prop = false;
 
-	np = of_find_compatible_node(NULL, NULL, "nvidia,tegra30-gpio");
+	np = of_find_compatible_node(NULL, NULL, compatible);
 	if (!np)
 		return has_prop;
 
@@ -728,7 +728,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
 
 	tegra_pinctrl_clear_parked_bits(pmx);
 
-	if (!gpio_node_has_range())
+	if (!gpio_node_has_range(pmx->soc->gpio_compatible))
 		pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
 
 	platform_set_drvdata(pdev, pmx);
drivers/pinctrl/tegra/pinctrl-tegra.h +1 -0
index aa33c20766c4..44c71941b5f8 100644
@@ -189,6 +189,7 @@ struct tegra_pingroup {
  */
 struct tegra_pinctrl_soc_data {
 	unsigned ngpios;
+	const char *gpio_compatible;
 	const struct pinctrl_pin_desc *pins;
 	unsigned npins;
 	struct tegra_function *functions;
drivers/pinctrl/tegra/pinctrl-tegra114.c +1 -0
index 56b33fca1bfc..511a8774fd8d 100644
@@ -1839,6 +1839,7 @@ static const struct tegra_pingroup tegra114_groups[] = {
 
 static const struct tegra_pinctrl_soc_data tegra114_pinctrl = {
 	.ngpios = NUM_GPIOS,
+	.gpio_compatible = "nvidia,tegra30-gpio",
 	.pins = tegra114_pins,
 	.npins = ARRAY_SIZE(tegra114_pins),
 	.functions = tegra114_functions,
drivers/pinctrl/tegra/pinctrl-tegra124.c +1 -0
index 7bc998ace0d5..57e3cdcf4503 100644
@@ -2051,6 +2051,7 @@ static const struct tegra_pingroup tegra124_groups[] = {
 
 static const struct tegra_pinctrl_soc_data tegra124_pinctrl = {
 	.ngpios = NUM_GPIOS,
+	.gpio_compatible = "nvidia,tegra30-gpio",
 	.pins = tegra124_pins,
 	.npins = ARRAY_SIZE(tegra124_pins),
 	.functions = tegra124_functions,
drivers/pinctrl/tegra/pinctrl-tegra20.c +1 -0
index b6dd939d32cc..624889ed3a9d 100644
@@ -2221,6 +2221,7 @@ static const struct tegra_pingroup tegra20_groups[] = {
 
 static const struct tegra_pinctrl_soc_data tegra20_pinctrl = {
 	.ngpios = NUM_GPIOS,
+	.gpio_compatible = "nvidia,tegra20-gpio",
 	.pins = tegra20_pins,
 	.npins = ARRAY_SIZE(tegra20_pins),
 	.functions = tegra20_functions,
drivers/pinctrl/tegra/pinctrl-tegra210.c +1 -0
index c244e5b17bd6..0956a1c73391 100644
@@ -1553,6 +1553,7 @@ static const struct tegra_pingroup tegra210_groups[] = {
 
 static const struct tegra_pinctrl_soc_data tegra210_pinctrl = {
 	.ngpios = NUM_GPIOS,
+	.gpio_compatible = "nvidia,tegra30-gpio",
 	.pins = tegra210_pins,
 	.npins = ARRAY_SIZE(tegra210_pins),
 	.functions = tegra210_functions,
drivers/pinctrl/tegra/pinctrl-tegra30.c +1 -0
index 1f180a20f2ab..c923ad58af84 100644
@@ -2474,6 +2474,7 @@ static const struct tegra_pingroup tegra30_groups[] = {
 
 static const struct tegra_pinctrl_soc_data tegra30_pinctrl = {
 	.ngpios = NUM_GPIOS,
+	.gpio_compatible = "nvidia,tegra30-gpio",
 	.pins = tegra30_pins,
 	.npins = ARRAY_SIZE(tegra30_pins),
 	.functions = tegra30_functions,
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/2 ARM: tegra: readd gpio-ranges properties

The properties have been commented out to prevent a regression a while ago. The first regression should be resolved by commit 44af7927316e ("spi: Map SPI OF client IRQ at probe time").

The second regression is probably addressed by
commit 494fd7b7ad10 ("PM / core: fix deferred probe breaking suspend resume order") and/or maybe others. Readd the gpio-ranges properties to see whether regressions still get reported.

This reverts commit 4f1d841475e1f6e9e32496dda11215db56f4ea73 ("ARM: tegra: Comment out gpio-ranges properties").

---
 arch/arm/boot/dts/tegra114.dtsi | 2 --
 arch/arm/boot/dts/tegra124.dtsi | 2 --
 arch/arm/boot/dts/tegra20.dtsi  | 2 --
 arch/arm/boot/dts/tegra30.dtsi  | 2 --
 4 files changed, 8 deletions(-)
arch/arm/boot/dts/tegra114.dtsi +0 -2
index 84c4358dacac..39253450a974 100644
@@ -240,9 +240,7 @@
 		gpio-controller;
 		#interrupt-cells = <2>;
 		interrupt-controller;
-		/*
 		gpio-ranges = <&pinmux 0 0 246>;
-		*/
 	};
 
 	apbmisc@70000800 {
arch/arm/boot/dts/tegra124.dtsi +0 -2
index 174092bfac90..47b51376ed36 100644
@@ -263,9 +263,7 @@
 		gpio-controller;
 		#interrupt-cells = <2>;
 		interrupt-controller;
-		/*
 		gpio-ranges = <&pinmux 0 0 251>;
-		*/
 	};
 
 	apbdma: dma@60020000 {
arch/arm/boot/dts/tegra20.dtsi +0 -2
index 983dd5c14794..cdf018a7568c 100644
@@ -258,9 +258,7 @@
 		gpio-controller;
 		#interrupt-cells = <2>;
 		interrupt-controller;
-		/*
 		gpio-ranges = <&pinmux 0 0 224>;
-		*/
 	};
 
 	vde@6001a000 {
arch/arm/boot/dts/tegra30.dtsi +0 -2
index 09087b9c5e26..b80f35411d72 100644
@@ -380,9 +380,7 @@
 		gpio-controller;
 		#interrupt-cells = <2>;
 		interrupt-controller;
-		/*
 		gpio-ranges = <&pinmux 0 0 248>;
-		*/
 	};
 
 	vde@6001a000 {
Signature · 1 line
2.18.0
#7 lore raw
In reply to Stefan Agner
Quoted 9 lines · Stefan Agner

Tegra 2 uses a different GPIO controller which uses "tegra20-gpio" as compatible string.

Make the compatible string the GPIO node is using a SoC specific property. This prevents the kernel from registering the GPIO range twice in case the GPIO range is specified in the device tree.

Fixes 9462510ce31e ("pinctrl: tegra: Only set the gpio range if needed")

Patch applied.

Yours,
Linus Walleij

#2 lore raw

Re: [PATCH 2/2] ARM: tegra: readd gpio-ranges properties

In reply to Stefan Agner
Quoted 9 lines · On Thursday, 26 July 2018 18:40:25 MSK Stefan Agner wrote:

The properties have been commented out to prevent a regression a while ago. The first regression should be resolved by commit 44af7927316e ("spi: Map SPI OF client IRQ at probe time").

The second regression is probably addressed by
commit 494fd7b7ad10 ("PM / core: fix deferred probe breaking suspend resume order") and/or maybe others. Readd the gpio-ranges properties to see whether regressions still get reported.

Quoted 5 lines

This reverts commit 4f1d841475e1f6e9e32496dda11215db56f4ea73 ("ARM: tegra: Comment out gpio-ranges properties").

---

Unfortunately the second regression hasn't been addressed yet, this patch still breaks wake-up using GPIO key. BTW, better to spell "readd" as "re-add".

#3 lore raw

Re: [PATCH 2/2] ARM: tegra: readd gpio-ranges properties

Quoted 10 lines · Dmitry Osipenko
Quoted 9 lines · On Thursday, 26 July 2018 18:40:25 MSK Stefan Agner wrote:

The properties have been commented out to prevent a regression a while ago. The first regression should be resolved by commit 44af7927316e ("spi: Map SPI OF client IRQ at probe time").

The second regression is probably addressed by
commit 494fd7b7ad10 ("PM / core: fix deferred probe breaking suspend resume order") and/or maybe others. Readd the gpio-ranges properties to see whether regressions still get reported.

Quoted 8 lines
Quoted 5 lines

This reverts commit 4f1d841475e1f6e9e32496dda11215db56f4ea73 ("ARM: tegra: Comment out gpio-ranges properties").

---

Unfortunately the second regression hasn't been addressed yet, this patch still breaks wake-up using GPIO key. BTW, better to spell "readd" as "re-add".

You do have the hardware and could test it?

Hm, that is unfortunate. I think this was the patch which should address the issue:
https://lkml.org/lkml/2015/9/10/218

--
Stefan

#4 lore raw

Re: [PATCH 2/2] ARM: tegra: readd gpio-ranges properties

Quoted 15 lines · On Thursday, 2 August 2018 01:51:42 MSK Stefan Agner wrote:
Quoted 14 lines · Dmitry Osipenko
Quoted 13 lines · On Thursday, 26 July 2018 18:40:25 MSK Stefan Agner wrote:

The properties have been commented out to prevent a regression a while ago. The first regression should be resolved by commit 44af7927316e ("spi: Map SPI OF client IRQ at probe time").

The second regression is probably addressed by
commit 494fd7b7ad10 ("PM / core: fix deferred probe breaking suspend resume
order") and/or maybe others. Readd the gpio-ranges properties to see whether regressions still get reported.

This reverts commit 4f1d841475e1f6e9e32496dda11215db56f4ea73 ("ARM: tegra: Comment out gpio-ranges properties").

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

---

Unfortunately the second regression hasn't been addressed yet, this patch still breaks wake-up using GPIO key. BTW, better to spell "readd" as "re-add".

You do have the hardware and could test it?

Yes, I have.

Quoted 3 lines

Hm, that is unfortunate. I think this was the patch which should address the issue:
https://lkml.org/lkml/2015/9/10/218

I've tested the patch and it is still actual, i.e. it fixes the wake-up. Welcome back to 2015 :-)

#5 lore raw

Re: [PATCH 2/2] ARM: tegra: readd gpio-ranges properties

Quoted 26 lines · On Thursday, 2 August 2018 02:11:23 MSK Dmitry Osipenko wrote:
Quoted 18 lines · On Thursday, 2 August 2018 01:51:42 MSK Stefan Agner wrote:
Quoted 17 lines · Dmitry Osipenko
Quoted 15 lines · On Thursday, 26 July 2018 18:40:25 MSK Stefan Agner wrote:

The properties have been commented out to prevent a regression a while ago. The first regression should be resolved by commit 44af7927316e ("spi: Map SPI OF client IRQ at probe time").

The second regression is probably addressed by
commit 494fd7b7ad10 ("PM / core: fix deferred probe breaking suspend resume
order") and/or maybe others. Readd the gpio-ranges properties to see whether regressions still get reported.

This reverts commit 4f1d841475e1f6e9e32496dda11215db56f4ea73 ("ARM: tegra: Comment out gpio-ranges properties").

---

Quoted 6 lines
Quoted 4 lines

Unfortunately the second regression hasn't been addressed yet, this patch
still breaks wake-up using GPIO key. BTW, better to spell "readd" as "re-add".

You do have the hardware and could test it?

Quoted 8 lines

Yes, I have.

Quoted 3 lines

Hm, that is unfortunate. I think this was the patch which should address the issue:
https://lkml.org/lkml/2015/9/10/218

I've tested the patch and it is still actual, i.e. it fixes the wake-up. Welcome back to 2015 :-)

Actually, the pinctrl-gpio probe order is easily fixable by reshuffling the drivers registration order within the kernel. I'll send patches.

Reviewed-by Tested-by
#6 lore raw

Re: [PATCH 2/2] ARM: tegra: readd gpio-ranges properties

Quoted 33 lines · On Thursday, 2 August 2018 13:35:46 MSK Dmitry Osipenko wrote:
Quoted 32 lines · On Thursday, 2 August 2018 02:11:23 MSK Dmitry Osipenko wrote:
Quoted 18 lines · On Thursday, 2 August 2018 01:51:42 MSK Stefan Agner wrote:
Quoted 17 lines · Dmitry Osipenko
Quoted 15 lines · On Thursday, 26 July 2018 18:40:25 MSK Stefan Agner wrote:

The properties have been commented out to prevent a regression a while ago. The first regression should be resolved by commit 44af7927316e ("spi: Map SPI OF client IRQ at probe time").

The second regression is probably addressed by
commit 494fd7b7ad10 ("PM / core: fix deferred probe breaking suspend resume
order") and/or maybe others. Readd the gpio-ranges properties to see whether regressions still get reported.

This reverts commit 4f1d841475e1f6e9e32496dda11215db56f4ea73 ("ARM: tegra: Comment out gpio-ranges properties").

---

Quoted 6 lines
Quoted 4 lines

Unfortunately the second regression hasn't been addressed yet, this patch
still breaks wake-up using GPIO key. BTW, better to spell "readd" as "re-add".

You do have the hardware and could test it?

Yes, I have.

Quoted 3 lines

Hm, that is unfortunate. I think this was the patch which should address the issue:
https://lkml.org/lkml/2015/9/10/218

Quoted 5 lines
Quoted 2 lines

I've tested the patch and it is still actual, i.e. it fixes the wake-up. Welcome back to 2015 :-)

Actually, the pinctrl-gpio probe order is easily fixable by reshuffling the drivers registration order within the kernel. I'll send patches.

Linus applied the GPIO / PINCTRL drivers probe-reorder patches for-next, so this DT patch should be good for 4.20.