devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: dts: sunxi: h3/h5: add gpio-ranges for pio and r_pio
@ 2022-05-22 17:20 Andrei Lalaev
  2022-05-22 21:26 ` Andre Przywara
  0 siblings, 1 reply; 5+ messages in thread
From: Andrei Lalaev @ 2022-05-22 17:20 UTC (permalink / raw)
  To: wens, jernej.skrabec, samuel
  Cc: krzysztof.kozlowski+dt, robh+dt, devicetree, linux-sunxi,
	Andrei Lalaev

Without this property the next node can't be hogged:
&r_pio {
	test_hog {
		gpio-hog;
		gpios = <0 6 GPIO_ACTIVE_HIGH>;
		output-high;
	};
};
And the appropriate error message:
"requesting hog GPIO test_hog (chip 1f02c00.pinctrl, offset 6) failed, -517"

This problem occurs because the "pinctrl-sunxi" calls
"gpiochip_add_data" that parses "gpio-ranges"
(using "of_gpiochip_add_pin_range") and registers hogs
(using "of_gpiochip_scan_gpios").
So when the gpiolib tries to register hogs it can't find any ranges and
fails.

Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
---
 arch/arm/boot/dts/sunxi-h3-h5.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
index d7e9f977f986..4193bf962b7d 100644
--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
+++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
@@ -404,6 +404,9 @@ pio: pinctrl@1c20800 {
 			#gpio-cells = <3>;
 			interrupt-controller;
 			#interrupt-cells = <3>;
+			gpio-ranges = <&pio 0 0 22>, <&pio 64 64 17>,
+				      <&pio 96 96 18>, <&pio 128 128 16>,
+				      <&pio 160 160 7>, <&pio 192 192 14>;
 
 			csi_pins: csi-pins {
 				pins = "PE0", "PE2", "PE3", "PE4", "PE5",
@@ -937,6 +940,7 @@ r_pio: pinctrl@1f02c00 {
 			#gpio-cells = <3>;
 			interrupt-controller;
 			#interrupt-cells = <3>;
+			gpio-ranges = <&r_pio 0 352 12>;
 
 			r_ir_rx_pin: r-ir-rx-pin {
 				pins = "PL11";
-- 
2.25.1


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

end of thread, other threads:[~2022-07-05  4:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-22 17:20 [PATCH] arm: dts: sunxi: h3/h5: add gpio-ranges for pio and r_pio Andrei Lalaev
2022-05-22 21:26 ` Andre Przywara
2022-05-23  5:55   ` Andrei Lalaev
2022-05-23 19:19   ` Andrei Lalaev
2022-07-05  4:28     ` Samuel Holland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).