diff mbox series

[2/3] arm64: dts: ti: k3-am62p: Add gpio-ranges properties

Message ID 20240618173123.2592074-3-nm@ti.com (mailing list archive)
State New, archived
Headers show
Series arm64: dts: ti: k3-am62p/j722s: Add gpio-ranges properties | expand

Commit Message

Nishanth Menon June 18, 2024, 5:31 p.m. UTC
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.

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: AM62P Data sheet https://www.ti.com/lit/gpn/am62p

Signed-off-by: Nishanth Menon <nm@ti.com>
---

Note: this generates a 'too large' warning for
pinctrl-single,gpio-ranges -
https://lore.kernel.org/r/20240618165102.2380159-1-nm@ti.com/ for more
details

 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi | 14 ++++++++++++++
 arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi  | 10 ++++++++++
 2 files changed, 24 insertions(+)

Comments

Dhruva Gole June 19, 2024, 8 a.m. UTC | #1
On Jun 18, 2024 at 12:31:22 -0500, Nishanth Menon wrote:
> 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.
> 
> 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: AM62P Data sheet https://www.ti.com/lit/gpn/am62p
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> 
> Note: this generates a 'too large' warning for
> pinctrl-single,gpio-ranges -
> https://lore.kernel.org/r/20240618165102.2380159-1-nm@ti.com/ for more
> details
> 
>  arch/arm64/boot/dts/ti/k3-am62p-main.dtsi | 14 ++++++++++++++
>  arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi  | 10 ++++++++++
>  2 files changed, 24 insertions(+)


Reviewed-by: Dhruva Gole <d-gole@ti.com>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
index eed06506f617..573c85486db1 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
@@ -258,7 +258,17 @@  main_pmx0: pinctrl@f4000 {
 		#pinctrl-cells = <1>;
 		pinctrl-single,register-width = <32>;
 		pinctrl-single,function-mask = <0xffffffff>;
+		pinctrl-single,gpio-range =
+			<&main_pmx0_range 0 32 (PIN_INPUT | PIN_GPIO_MUX_MODE)>,
+			<&main_pmx0_range 33 92 (PIN_INPUT | PIN_GPIO_MUX_MODE)>,
+			<&main_pmx0_range 137 5 (PIN_INPUT | PIN_GPIO_MUX_MODE)>,
+			<&main_pmx0_range 143 3 (PIN_INPUT | PIN_GPIO_MUX_MODE)>,
+			<&main_pmx0_range 149 2 (PIN_INPUT | PIN_GPIO_MUX_MODE)>;
 		bootph-all;
+
+		main_pmx0_range: gpio-range {
+			#pinctrl-single,gpio-range-cells = <3>;
+		};
 	};
 
 	main_esm: esm@420000 {
@@ -543,6 +553,8 @@  main_gpio0: gpio@600000 {
 		power-domains = <&k3_pds 77 TI_SCI_PD_EXCLUSIVE>;
 		clocks = <&k3_clks 77 0>;
 		clock-names = "gpio";
+		gpio-ranges = <&main_pmx0 0 0 32>, <&main_pmx0 32 33 38>,
+				<&main_pmx0 70 72 22>;
 	};
 
 	main_gpio1: gpio@601000 {
@@ -560,6 +572,8 @@  main_gpio1: gpio@601000 {
 		power-domains = <&k3_pds 78 TI_SCI_PD_EXCLUSIVE>;
 		clocks = <&k3_clks 78 0>;
 		clock-names = "gpio";
+		gpio-ranges = <&main_pmx0 0 94 32>, <&main_pmx0 42 137 5>,
+				<&main_pmx0 47 143 3>, <&main_pmx0 50 149 2>;
 	};
 
 	sdhci0: mmc@fa10000 {
diff --git a/arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi
index b973b550eb9d..a27dd12b44ac 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi
@@ -11,7 +11,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_INPUT | PIN_GPIO_MUX_MODE)>,
+			<&mcu_pmx_range 23 1 (PIN_INPUT | PIN_GPIO_MUX_MODE)>,
+			<&mcu_pmx_range 32 2 (PIN_INPUT | PIN_GPIO_MUX_MODE)>;
 		bootph-all;
+
+		mcu_pmx_range: gpio-range {
+			#pinctrl-single,gpio-range-cells = <3>;
+		};
 	};
 
 	mcu_esm: esm@4100000 {
@@ -137,6 +145,8 @@  mcu_gpio0: gpio@4201000 {
 		power-domains = <&k3_pds 79 TI_SCI_PD_EXCLUSIVE>;
 		clocks = <&k3_clks 79 0>;
 		clock-names = "gpio";
+		gpio-ranges = <&mcu_pmx0 0 0 21>, <&mcu_pmx0 21 23 1>,
+				<&mcu_pmx0 22 32 2>;
 	};
 
 	mcu_rti0: watchdog@4880000 {