diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-12-08 11:07:55 +0530 |
---|---|---|
committer | Linus Walleij <linus.walleij@stericsson.com> | 2010-12-08 13:25:00 +0100 |
commit | 01afdd1353ca83904f430be4f6202d1a20912f4d (patch) | |
tree | ffcd53087d10ec63bd42fe3e95ac93cd7e9f4a2a /arch/arm/mach-ux500/devices-common.c | |
parent | 8d568ae5362c00c5b0b8e61bceb1829c8051002e (diff) | |
download | blackbird-op-linux-01afdd1353ca83904f430be4f6202d1a20912f4d.tar.gz blackbird-op-linux-01afdd1353ca83904f430be4f6202d1a20912f4d.zip |
ux500: rework gpio registration
Rework gpio registration to remove build-time
changing macros.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Diffstat (limited to 'arch/arm/mach-ux500/devices-common.c')
-rw-r--r-- | arch/arm/mach-ux500/devices-common.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c index 9376a246f862..fe69f5fac1bb 100644 --- a/arch/arm/mach-ux500/devices-common.c +++ b/arch/arm/mach-ux500/devices-common.c @@ -13,6 +13,8 @@ #include <linux/platform_device.h> #include <linux/amba/bus.h> +#include <plat/gpio.h> + #include <mach/hardware.h> #include "devices-common.h" @@ -105,3 +107,39 @@ dbx500_add_platform_device_4k1irq(const char *name, int id, return dbx500_add_platform_device(name, id, pdata, resources, ARRAY_SIZE(resources)); } + +static struct platform_device * +dbx500_add_gpio(int id, resource_size_t addr, int irq, + struct nmk_gpio_platform_data *pdata) +{ + struct resource resources[] = { + { + .start = addr, + .end = addr + 127, + .flags = IORESOURCE_MEM, + }, + { + .start = irq, + .end = irq, + .flags = IORESOURCE_IRQ, + } + }; + + return platform_device_register_resndata(NULL, "gpio", id, + resources, ARRAY_SIZE(resources), + pdata, sizeof(*pdata)); +} + +void dbx500_add_gpios(resource_size_t *base, int num, int irq, + struct nmk_gpio_platform_data *pdata) +{ + int first = 0; + int i; + + for (i = 0; i < num; i++, first += 32, irq++) { + pdata->first_gpio = first; + pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first); + + dbx500_add_gpio(i, base[i], irq, pdata); + } +} |