[linux-yocto] [PATCH 15/52] gpio: pl061: specify gpio base via device tree
Daniel Dragomir
daniel.dragomir at windriver.com
Wed Jan 28 09:18:29 PST 2015
From: Anders Berg <anders.berg at avagotech.com>
Use DT alias to allow the gpio base to be selected. This solves compatibility
with user-space programs that expects a fixed numbering scheme from non-DT
system. If an alias for the device node is not defined in device tree, the
fallback is to use the dynamically allocated number.
Signed-off-by: Anders Berg <anders.berg at avagotech.com>
---
drivers/gpio/gpio-pl061.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index c13f8d1..d1c3b15 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -298,7 +298,11 @@ static int pl061_probe(struct device *dev,
if (irq_base <= 0)
return -ENODEV;
} else if (dev->of_node) {
- chip->gc.base = -1;
+ int id = of_alias_get_id(dev->of_node, "gpio");
+ if (id < 0)
+ chip->gc.base = -1;
+ else
+ chip->gc.base = id * PL061_GPIO_NR;
irq_base = 0;
} else {
if (retchip)
--
1.8.1.4
More information about the linux-yocto
mailing list