All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] arm64: dts: ti: k3-am62p: fix pinctrl settings
@ 2025-02-21  9:14 Michael Walle
  2025-02-21  9:14 ` [PATCH 2/2] arm64: dts: ti: k3-j722s: " Michael Walle
  2025-03-07 10:35 ` [PATCH 1/2] arm64: dts: ti: k3-am62p: " Vignesh Raghavendra
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Walle @ 2025-02-21  9:14 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Linus Walleij,
	Bartosz Golaszewski, Jared McArthur
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-gpio,
	Michael Walle

It appears that pinctrl-single is misused on this SoC to control both
the mux and the input and output and bias settings. This results in
non-working pinctrl configurations for GPIOs within the device tree.

This is what happens:
 (1) During startup the pinctrl settings are applied according to the
     device tree. I.e. the pin is configured as output and with
     pull-ups enabled.
 (2) During startup a device driver requests a GPIO.
 (3) pinctrl-single is applying the default GPIO setting according to
     the pinctrl-single,gpio-range property.

This would work as expected if the pinctrl-single is only controlling
the function mux, but it also controls the input/output buffer enable,
the pull-up and pull-down settings etc (pinctrl-single,function-mask
covers the entire pad setting instead of just the mux field).

Remove the pinctrl-single,gpio-range property, so that no settings are
applied during a gpio_request() call.

Fixes: d72d73a44c3c ("arm64: dts: ti: k3-am62p: Add gpio-ranges properties")
Signed-off-by: Michael Walle <mwalle@kernel.org>
---

Maybe one could also switch the pinctrl-single to a pinconf-single node
which is able to control all the bias settings and restrict
"pinctrl-single,function-mask" to just the actual function. Not
sure.

 .../boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi     |  8 --------
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi          | 14 --------------
 2 files changed, 22 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi
index b33aff0d65c9..bd6a00d13aea 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi
@@ -12,15 +12,7 @@ mcu_pmx0: pinctrl@4084000 {
 		#pinctrl-cells = <1>;
 		pinctrl-single,register-width = <32>;
 		pinctrl-single,function-mask = <0xffffffff>;
-		pinctrl-single,gpio-range =
-			<&mcu_pmx_range 0 21 PIN_GPIO_RANGE_IOPAD>,
-			<&mcu_pmx_range 23 1 PIN_GPIO_RANGE_IOPAD>,
-			<&mcu_pmx_range 32 2 PIN_GPIO_RANGE_IOPAD>;
 		bootph-all;
-
-		mcu_pmx_range: gpio-range {
-			#pinctrl-single,gpio-range-cells = <3>;
-		};
 	};
 
 	mcu_esm: esm@4100000 {
diff --git a/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
index 420c77c8e9e5..0a888392137c 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
@@ -42,20 +42,6 @@ &inta_main_dmss {
 	ti,interrupt-ranges = <5 69 35>;
 };
 
-&main_pmx0 {
-	pinctrl-single,gpio-range =
-		<&main_pmx0_range 0 32 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 33 38 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 72 22 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 137 5 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 143 3 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 149 2 PIN_GPIO_RANGE_IOPAD>;
-
-	main_pmx0_range: gpio-range {
-		#pinctrl-single,gpio-range-cells = <3>;
-	};
-};
-
 &main_gpio0 {
 	gpio-ranges = <&main_pmx0 0 0 32>, <&main_pmx0 32 33 38>,
 			<&main_pmx0 70 72 22>;
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] arm64: dts: ti: k3-j722s: fix pinctrl settings
  2025-02-21  9:14 [PATCH 1/2] arm64: dts: ti: k3-am62p: fix pinctrl settings Michael Walle
@ 2025-02-21  9:14 ` Michael Walle
  2025-03-07 10:35 ` [PATCH 1/2] arm64: dts: ti: k3-am62p: " Vignesh Raghavendra
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Walle @ 2025-02-21  9:14 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Linus Walleij,
	Bartosz Golaszewski, Jared McArthur
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-gpio,
	Michael Walle

It appears that pinctrl-single is misused on this SoC to control both
the mux and the input and output and bias settings. This results in
non-working pinctrl configurations for GPIOs within the device tree.

This is what happens:
 (1) During startup the pinctrl settings are applied according to the
     device tree. I.e. the pin is configured as output and with
     pull-ups enabled.
 (2) During startup a device driver requests a GPIO.
 (3) pinctrl-single is applying the default GPIO setting according to
     the pinctrl-single,gpio-range property.

This would work as expected if the pinctrl-single is only controlling
the function mux, but it also controls the input/output buffer enable,
the pull-up and pull-down settings etc (pinctrl-single,function-mask
covers the entire pad setting instead of just the mux field).

Remove the pinctrl-single,gpio-range property, so that no settings are
applied during a gpio_request() call.

Fixes: 5e5c50964e2e ("arm64: dts: ti: k3-j722s: Add gpio-ranges properties")
Signed-off-by: Michael Walle <mwalle@kernel.org>
---
 arch/arm64/boot/dts/ti/k3-j722s-main.dtsi | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-j722s-main.dtsi b/arch/arm64/boot/dts/ti/k3-j722s-main.dtsi
index 3ac2d45a0558..6da7b3a2943c 100644
--- a/arch/arm64/boot/dts/ti/k3-j722s-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j722s-main.dtsi
@@ -251,21 +251,6 @@ &inta_main_dmss {
 	ti,interrupt-ranges = <7 71 21>;
 };
 
-&main_pmx0 {
-	pinctrl-single,gpio-range =
-		<&main_pmx0_range 0 32 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 33 38 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 72 17 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 101 25 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 137 5 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 143 3 PIN_GPIO_RANGE_IOPAD>,
-		<&main_pmx0_range 149 2 PIN_GPIO_RANGE_IOPAD>;
-
-	main_pmx0_range: gpio-range {
-		#pinctrl-single,gpio-range-cells = <3>;
-	};
-};
-
 &main_gpio0 {
 	gpio-ranges = <&main_pmx0 0 0 32>, <&main_pmx0 32 33 38>,
 			<&main_pmx0 70 72 17>;
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] arm64: dts: ti: k3-am62p: fix pinctrl settings
  2025-02-21  9:14 [PATCH 1/2] arm64: dts: ti: k3-am62p: fix pinctrl settings Michael Walle
  2025-02-21  9:14 ` [PATCH 2/2] arm64: dts: ti: k3-j722s: " Michael Walle
@ 2025-03-07 10:35 ` Vignesh Raghavendra
  1 sibling, 0 replies; 3+ messages in thread
From: Vignesh Raghavendra @ 2025-03-07 10:35 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Linus Walleij, Bartosz Golaszewski, Jared McArthur,
	Michael Walle
  Cc: Vignesh Raghavendra, linux-arm-kernel, devicetree, linux-kernel,
	linux-gpio

Hi Michael Walle,

On Fri, 21 Feb 2025 10:14:46 +0100, Michael Walle wrote:
> It appears that pinctrl-single is misused on this SoC to control both
> the mux and the input and output and bias settings. This results in
> non-working pinctrl configurations for GPIOs within the device tree.
> 
> This is what happens:
>  (1) During startup the pinctrl settings are applied according to the
>      device tree. I.e. the pin is configured as output and with
>      pull-ups enabled.
>  (2) During startup a device driver requests a GPIO.
>  (3) pinctrl-single is applying the default GPIO setting according to
>      the pinctrl-single,gpio-range property.
> 
> [...]

> Maybe one could also switch the pinctrl-single to a pinconf-single node
> which is able to control all the bias settings and restrict
> "pinctrl-single,function-mask" to just the actual function. Not
> sure

I agree, we should probably migrate to pinconf-single bindings in long
term. There is just too much legacy code and tools relying on current
bindings though. Something for look at for next SoC. Thanks for the
patch!


I have applied the following to branch ti-k3-dts-next on [1].
Thank you!

[1/2] arm64: dts: ti: k3-am62p: fix pinctrl settings
      commit: 33bab9d84e52188cf73c3573fd7cf3ec0e01d007
[2/2] arm64: dts: ti: k3-j722s: fix pinctrl settings
      commit: 06daad327d043c23bc1ab4cdb519f589094b9e98

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent up the chain during
the next merge window (or sooner if it is a relevant bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
--
Vignesh



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-07 10:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-21  9:14 [PATCH 1/2] arm64: dts: ti: k3-am62p: fix pinctrl settings Michael Walle
2025-02-21  9:14 ` [PATCH 2/2] arm64: dts: ti: k3-j722s: " Michael Walle
2025-03-07 10:35 ` [PATCH 1/2] arm64: dts: ti: k3-am62p: " Vignesh Raghavendra

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.