Skip to contentSkip to conversation

arm64: dts: ti: k3-am62p/j722s: Add gpio-ranges properties

PATCH Applied Nishanth Menon 2 participants 5 messages Jun 27, 2024 – Jul 3, 2024

Subsystems (2)
lore
Share & tools
lore

Nishanth Menon

author maintainer
#0 lore raw

v2 cover arm64: dts: ti: k3-am62p/j722s: Add gpio-ranges properties

Hi,

This series was tested on BeagleY-AI[1] using the script[2].

This allows gpiod to request for a gpio that is not in the default GPIO mux mode and the framework controls the mux over to required GPIO mode.

The series is based off next-20240617.

NOTE: there is also a dtb_warning that is added, The fix for which is in the binding[3].

Changes since V1:
- Mux definition PIN_GPIO_RANGE_IOPAD instead of PIN_GPIO_MUX_MODE
- Refactored on top of next-20240626
- Note: since the patches have changed, I have skipped Dhruva's reviewed-by

V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

Jared McArthur (1):
arm64: dts: ti: k3-j722s: Add gpio-ranges properties

Nishanth Menon (2):
arm64: dts: ti: k3-pinctrl: Define a generic GPIO MUX Mode
arm64: dts: ti: k3-am62p: Add gpio-ranges properties

 .../boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi |  8 ++++++++
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi      | 17 +++++++++++++++++
 arch/arm64/boot/dts/ti/k3-j722s-main.dtsi      | 18 ++++++++++++++++++
 arch/arm64/boot/dts/ti/k3-pinctrl.h            |  3 +++
 4 files changed, 46 insertions(+)

base-commit: df9574a57d02b265322e77fb8628d4d33641dda9

[1] https://www.beagleboard.org/boards/beagley-ai
[2] https://gist.github.com/nmenon/4973770cf0df3f02c2e4f7f3d048d80d
[3] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v2 1/3 arm64: dts: ti: k3-pinctrl: Define a generic GPIO MUX Mode

Introduce a GPIO mux mode macro for easier readability. All K3 devices use mux mode 7 to switch to GPIO mux and this allows the gpio-ranges to be defined for pinctrl-single clearly.

---
Changes since V1:
- Mux definition PIN_GPIO_RANGE_IOPAD instead of PIN_GPIO_MUX_MODE
- Added documentation as well to clarify the usage.

V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

 arch/arm64/boot/dts/ti/k3-pinctrl.h | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/ti/k3-pinctrl.h +3 -0
index 4cd2df467d0b..22b8d73cfd32 100644
@@ -38,6 +38,9 @@
 #define PIN_DEBOUNCE_CONF5	(5 << DEBOUNCE_SHIFT)
 #define PIN_DEBOUNCE_CONF6	(6 << DEBOUNCE_SHIFT)
 
+/* Default mux configuration for gpio-ranges to use with pinctrl */
+#define PIN_GPIO_RANGE_IOPAD	(PIN_INPUT | 7)
+
 #define AM62AX_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
 #define AM62AX_MCU_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
 
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH v2 2/3 arm64: dts: ti: k3-am62p: Add gpio-ranges properties

In reply to Nishanth Menon

On the AM62P platform we have no single 1:1 relation regarding index of GPIO and pin controller. The GPIOs and pin controller registers have mapping and holes in the map. These have been extracted from the AM62P data sheet.

MCU pinctrl definition is shared as it is common between AM62P and J722S, but that is not the case for main domain.

Ref: AM62P Data sheet https://www.ti.com/lit/gpn/am62p

---
Changes since V1:
- Use PIN_GPIO_RANGE_IOPAD instead of PIN_GPIO_MUX_MODE
- Refactored on top of next-20240626 (new common files)
- Since the patch had to be refactored as well as new define used, I have skipped picking up Dhruva's Reviewed-by.

V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

 .../boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi  |  8 ++++++++
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi       | 17 +++++++++++++++++
 2 files changed, 25 insertions(+)
arch/arm64/boot/dts/ti/k3-am62p-j722s-common-mcu.dtsi +8 -0
index 1d4e5fc8b4e0..e65db6ce02bf 100644
@@ -12,7 +12,15 @@ 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 {
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +17 -0
index f8a7f0cbd327..57383bd2eaeb 100644
@@ -42,10 +42,27 @@ &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 92 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>;
 	ti,ngpio = <92>;
 };
 
 &main_gpio1 {
+	gpio-ranges = <&main_pmx0 0 94 32>, <&main_pmx0 42 137 5>,
+			<&main_pmx0 47 143 3>, <&main_pmx0 50 149 2>;
 	ti,ngpio = <52>;
 };
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH v2 3/3 arm64: dts: ti: k3-j722s: Add gpio-ranges properties

In reply to Nishanth Menon

From: Jared McArthur <[email protected]>

The AM67A/J722S/TDA4AEN platform is a derivative of AM62P platform and we have no single 1:1 relation regarding index of GPIO and pin controller. The GPIOs and pin controller registers have mapping and holes in the map. These have been extracted from the J722S data sheet. The MCU mapping is carried forward as is with J722S, however the main GPIO block has differences that needs to be accounted for.

Mux mode input is selected as it is bi-directional. In case a specific pull type or a specific pin level drive setting is desired, the board device tree files will have to explicitly mux those pins for the GPIO with the desired setting.

Ref: J722S Data sheet https://www.ti.com/lit/gpn/tda4aen-q1

---
Changes since V1:
- Use PIN_GPIO_RANGE_IOPAD instead of PIN_GPIO_MUX_MODE
- Refactored on top of next-20240626 (refactored files)

V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

 arch/arm64/boot/dts/ti/k3-j722s-main.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/ti/k3-j722s-main.dtsi +18 -0
index 228c6c89245c..28aac43aae45 100644
@@ -181,10 +181,28 @@ &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 55 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>;
 	ti,ngpio = <87>;
 };
 
 &main_gpio1 {
+	gpio-ranges = <&main_pmx0 7 101 25>, <&main_pmx0 42 137 5>,
+			<&main_pmx0 47 143 3>, <&main_pmx0 50 149 2>;
 	ti,ngpio = <73>;
 };
Signature · 1 line
2.43.0
maintainer Applied
#4 lore raw
In reply to Nishanth Menon

Hi Nishanth Menon,

Quoted 8 lines · Nishanth Menon

This series was tested on BeagleY-AI[1] using the script[2].

This allows gpiod to request for a gpio that is not in the default GPIO mux mode and the framework controls the mux over to required GPIO mode.

The series is based off next-20240617.

[...]

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

[1/3] arm64: dts: ti: k3-pinctrl: Define a generic GPIO MUX Mode

      commit: 50d9981fa12212cdc0110c42db0411209bb5d765
[2/3] arm64: dts: ti: k3-am62p: Add gpio-ranges properties
      commit: d72d73a44c3c98109764bfb56c329cd628c518cc
[3/3] arm64: dts: ti: k3-j722s: Add gpio-ranges properties
      commit: 90d3d2eed998fef92f7bbc8557a843360516ccee

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