Skip to contentSkip to conversation

DT: kirkwood: Fix Openblock A6 external GPIO pins

RFC PATCH New Jason Cooper 3 participants 4 messages Aug 15, 2016 – Aug 26, 2016 Device tree bindings

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 DT: kirkwood: Fix Openblock A6 external GPIO pins

By assigning the pin hog to the pinctrl node, we correctly configure the MPPs. However, they are not available to userspace.

Fix this by assigning the hogs to the gpio node.

After this, the following works as expected:

  # echo 28 >/sys/class/gpio/export
  # echo low >/sys/class/gpio/gpio28/direction

---
I'm submitting this as RFC because it's clear no one is using this, so I'm not sure how far we need to take this. The dip switches should probably be under gpio-keys to make them input only. Thoughts?

thx,

Jason.

 arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/boot/dts/kirkwood-openblocks_a6.dts +7 -3
index 0db0e3edc88f..ddb17b1cdfe0 100644
@@ -41,9 +41,6 @@
 		};
 
 		pinctrl: pin-controller at 10000 {
-			pinctrl-0 = <&pmx_dip_switches &pmx_gpio_header>;
-			pinctrl-names = "default";
-
 			pmx_uart0: pmx-uart0 {
 				marvell,pins = "mpp10", "mpp11", "mpp15",
 					"mpp16";
@@ -174,3 +171,10 @@
 		phy-handle = <&ethphy0>;
 	};
 };
+
+&gpio0 {
+	status = "okay";
+
+	pinctrl-0 = <&pmx_dip_switches &pmx_gpio_header>;
+	pinctrl-names = "default";
+};
Signature · 1 line
2.9.2
#1 lore raw

PATCH 1/1 DT: kirkwood: Fix Openblock A6 external GPIO pins

By assigning the pin hog to the pinctrl node, we correctly configure the MPPs. However, they are not available to userspace.

Fix this by assigning the hogs to the gpio node.

After this, the following works as expected:

  # echo 28 >/sys/class/gpio/export
  # echo low >/sys/class/gpio/gpio28/direction

---
After sleeping on it a night, I decided to leave the dip switches alone.

 arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm/boot/dts/kirkwood-openblocks_a6.dts +8 -1
index 0db0e3edc88f..94e49f32d5f9 100644
@@ -41,7 +41,7 @@
 		};
 
 		pinctrl: pin-controller at 10000 {
-			pinctrl-0 = <&pmx_dip_switches &pmx_gpio_header>;
+			pinctrl-0 = <&pmx_dip_switches>;
 			pinctrl-names = "default";
 
 			pmx_uart0: pmx-uart0 {
@@ -174,3 +174,10 @@
 		phy-handle = <&ethphy0>;
 	};
 };
+
+&gpio0 {
+	status = "okay";
+
+	pinctrl-0 = <&pmx_gpio_header>;
+	pinctrl-names = "default";
+};
Signature · 1 line
2.9.2
#2 lore raw

PATCH 1/1 DT: kirkwood: Fix Openblock A6 external GPIO pins

Quoted 11 lines · Jason Cooper

By assigning the pin hog to the pinctrl node, we correctly configure the MPPs. However, they are not available to userspace.

Fix this by assigning the hogs to the gpio node.

After this, the following works as expected:

  # echo 28 >/sys/class/gpio/export
  # echo low >/sys/class/gpio/gpio28/direction

Andrew

#3 lore raw

PATCH 1/1 DT: kirkwood: Fix Openblock A6 external GPIO pins

In reply to Jason Cooper

Hi Jason,

Quoted 11 lines · Jason Cooper

By assigning the pin hog to the pinctrl node, we correctly configure the MPPs. However, they are not available to userspace.

Fix this by assigning the hogs to the gpio node.

After this, the following works as expected:

  # echo 28 >/sys/class/gpio/export
  # echo low >/sys/class/gpio/gpio28/direction

Applied on mvebu/dt with Reviewed-by flag from Andrew and I changed the title to "ARM: dts: kirkwood: ..."

Thanks,

Gregory

Quoted 33 lines

---
After sleeping on it a night, I decided to leave the dip switches alone.

 arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm/boot/dts/kirkwood-openblocks_a6.dts +8 -1
index 0db0e3edc88f..94e49f32d5f9 100644
@@ -41,7 +41,7 @@
 		};
 
 		pinctrl: pin-controller at 10000 {
-			pinctrl-0 = <&pmx_dip_switches &pmx_gpio_header>;
+			pinctrl-0 = <&pmx_dip_switches>;
 			pinctrl-names = "default";
 
 			pmx_uart0: pmx-uart0 {
@@ -174,3 +174,10 @@
 		phy-handle = <&ethphy0>;
 	};
 };
+
+&gpio0 {
+	status = "okay";
+
+	pinctrl-0 = <&pmx_gpio_header>;
+	pinctrl-names = "default";
+};
Signature · 1 line
2.9.2
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com