devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: document how to order GPIO controllers
@ 2016-07-01  6:42 Uwe Kleine-König
  2016-07-05 14:05 ` Rob Herring
  0 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2016-07-01  6:42 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Rob Herring, Mark Rutland
  Cc: kernel, linux-gpio, devicetree, linux-arm-kernel

This uses the same approach that is already used for spi, i2c and
several other controllers to ensure a consistent numbering independent
of probe order. This is in use for several gpio drivers that already now
use of_alias_get_id(np, "gpio").

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

Linus requested such a patch as part of a change that introduces
this mechanism to the gpio-omap driver[1]. IMHO this is better done in a
separate patch, so here it comes.

Best regards
Uwe

[1] http://thread.gmane.org/gmane.linux.kernel.gpio/17399/focus=17629

 Documentation/devicetree/bindings/gpio/gpio.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
index 68d28f62a6f4..5dbacc8f094a 100644
--- a/Documentation/devicetree/bindings/gpio/gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
@@ -227,6 +227,24 @@ Example of two SOC GPIO banks defined as gpio-controller nodes:
 		#gpio-cells = <2>;
 	};
 
+Usually the GPIO banks in SoCs are ordered, that is there is a dedicated "first
+gpio bank". To fix this ordering in the device tree use aliases starting at 0
+(even if the first bank is called "GPIO1" in the hardware reference).
+This is necessary/handy to ensure deterministical numbering of GPIOs and GPIO
+controllers.
+
+Example of a machine having 4 GPIO banks.
+
+	/ {
+		aliases {
+			...
+			gpio0 = &gpio1;
+			gpio1 = &gpio2;
+			gpio2 = &gpio3;
+			gpio3 = &gpio4;
+		};
+	};
+
 2.1) gpio- and pin-controller interaction
 -----------------------------------------
 
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-07-22 14:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-01  6:42 [PATCH] gpio: document how to order GPIO controllers Uwe Kleine-König
2016-07-05 14:05 ` Rob Herring
2016-07-05 18:04   ` Uwe Kleine-König
2016-07-06  7:24     ` Lothar Waßmann
2016-07-06  7:54     ` Alexander Stein
2016-07-06  9:34     ` Linus Walleij
2016-07-06 10:27       ` Johan Hovold
2016-07-06 12:34         ` Linus Walleij
2016-07-06 14:12           ` Permissions for GPIOs [Was: [PATCH] gpio: document how to order GPIO controllers] Jan Lübbe
     [not found]             ` <1467814334.2472.154.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2016-07-08 11:25               ` Linus Walleij
2016-07-13 13:14           ` [PATCH] gpio: document how to order GPIO controllers Johan Hovold
2016-07-22 14:34             ` Linus Walleij
2016-07-17 22:03       ` Rob Herring

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).