diff options
author | Haojian Zhuang <haojian.zhuang@linaro.org> | 2013-10-22 12:42:55 +0800 |
---|---|---|
committer | Andrey Konovalov <andrey.konovalov@linaro.org> | 2014-04-16 23:52:22 +0400 |
commit | 364da50736a9ac8016c65a50aa63235a7c7cde5f (patch) | |
tree | 59cb932d274a82624547f454626e96d8d08ba0ae /drivers/gpio | |
parent | bd872d36be186fbc9009020b2d3efe32be60f836 (diff) |
gpio: pl061: add new property for gpio base
If gpio base number isn't specified, the gpio base will be find from
the end of gpio number. In order to keep with schematics, add a new
property "linux,gpio-base" to specify the gpio number in DTS file.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pl061.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index b4d42112d02..23f27fd6123 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -256,6 +256,19 @@ static const struct irq_domain_ops pl061_domain_ops = { .xlate = irq_domain_xlate_twocell, }; +/* Parse gpio base from DT */ +static int pl061_parse_gpio_base(struct device *dev) +{ + struct device_node *np = dev->of_node; + int ret; + + if (of_property_read_u32(np, "linux,gpio-base", &ret)) + return -ENOENT; + if (ret >= 0) + return ret; + return -EINVAL; +} + static int pl061_probe(struct amba_device *adev, const struct amba_id *id) { struct device *dev = &adev->dev; @@ -273,7 +286,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) if (irq_base <= 0) return -ENODEV; } else { - chip->gc.base = -1; + chip->gc.base = pl061_parse_gpio_base(dev); irq_base = 0; } |