diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-03-02 22:54:37 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-03-19 14:29:45 -0400 |
commit | 94bdc0e2d76c5f2467346bf14e7e16d6d8e0395d (patch) | |
tree | 00f98df7579a1fb53766a34d5ee3339b68908776 /arch/arm/mach-ux500/cpu-u8500.c | |
parent | 1df20afce51e7af2a587425d1aafca2608fe0066 (diff) |
ARM: 5973/1: ux500: add gpio support
Add support for the GPIOs on the U8500, using the plat-nomadik GPIO
driver.
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ux500/cpu-u8500.c')
-rw-r--r-- | arch/arm/mach-ux500/cpu-u8500.c | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/arch/arm/mach-ux500/cpu-u8500.c b/arch/arm/mach-ux500/cpu-u8500.c index 09bcba1ccef1..5fb44661adaf 100644 --- a/arch/arm/mach-ux500/cpu-u8500.c +++ b/arch/arm/mach-ux500/cpu-u8500.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <linux/amba/bus.h> | 14 | #include <linux/amba/bus.h> |
15 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
16 | #include <linux/gpio.h> | ||
16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
17 | #include <linux/io.h> | 18 | #include <linux/io.h> |
18 | 19 | ||
@@ -23,9 +24,82 @@ | |||
23 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
24 | #include <mach/setup.h> | 25 | #include <mach/setup.h> |
25 | 26 | ||
26 | /* add any platform devices here - TODO */ | 27 | #define GPIO_RESOURCE(block) \ |
28 | { \ | ||
29 | .start = U8500_GPIOBANK##block##_BASE, \ | ||
30 | .end = U8500_GPIOBANK##block##_BASE + 127, \ | ||
31 | .flags = IORESOURCE_MEM, \ | ||
32 | }, \ | ||
33 | { \ | ||
34 | .start = IRQ_GPIO##block, \ | ||
35 | .end = IRQ_GPIO##block, \ | ||
36 | .flags = IORESOURCE_IRQ, \ | ||
37 | } | ||
38 | |||
39 | #define GPIO_DEVICE(block) \ | ||
40 | { \ | ||
41 | .name = "gpio", \ | ||
42 | .id = block, \ | ||
43 | .num_resources = 2, \ | ||
44 | .resource = &u8500_gpio_resources[block * 2], \ | ||
45 | .dev = { \ | ||
46 | .platform_data = &u8500_gpio_data[block], \ | ||
47 | }, \ | ||
48 | } | ||
49 | |||
50 | #define GPIO_DATA(_name, first) \ | ||
51 | { \ | ||
52 | .name = _name, \ | ||
53 | .first_gpio = first, \ | ||
54 | .first_irq = NOMADIK_GPIO_TO_IRQ(first), \ | ||
55 | } | ||
56 | |||
57 | static struct nmk_gpio_platform_data u8500_gpio_data[] = { | ||
58 | GPIO_DATA("GPIO-0-31", 0), | ||
59 | GPIO_DATA("GPIO-32-63", 32), /* 37..63 not routed to pin */ | ||
60 | GPIO_DATA("GPIO-64-95", 64), | ||
61 | GPIO_DATA("GPIO-96-127", 96), /* 97..127 not routed to pin */ | ||
62 | GPIO_DATA("GPIO-128-159", 128), | ||
63 | GPIO_DATA("GPIO-160-191", 160), /* 172..191 not routed to pin */ | ||
64 | GPIO_DATA("GPIO-192-223", 192), | ||
65 | GPIO_DATA("GPIO-224-255", 224), /* 231..255 not routed to pin */ | ||
66 | GPIO_DATA("GPIO-256-288", 256), /* 258..288 not routed to pin */ | ||
67 | }; | ||
68 | |||
69 | static struct resource u8500_gpio_resources[] = { | ||
70 | GPIO_RESOURCE(0), | ||
71 | GPIO_RESOURCE(1), | ||
72 | GPIO_RESOURCE(2), | ||
73 | GPIO_RESOURCE(3), | ||
74 | GPIO_RESOURCE(4), | ||
75 | GPIO_RESOURCE(5), | ||
76 | GPIO_RESOURCE(6), | ||
77 | GPIO_RESOURCE(7), | ||
78 | GPIO_RESOURCE(8), | ||
79 | }; | ||
80 | |||
81 | static struct platform_device u8500_gpio_devs[] = { | ||
82 | GPIO_DEVICE(0), | ||
83 | GPIO_DEVICE(1), | ||
84 | GPIO_DEVICE(2), | ||
85 | GPIO_DEVICE(3), | ||
86 | GPIO_DEVICE(4), | ||
87 | GPIO_DEVICE(5), | ||
88 | GPIO_DEVICE(6), | ||
89 | GPIO_DEVICE(7), | ||
90 | GPIO_DEVICE(8), | ||
91 | }; | ||
92 | |||
27 | static struct platform_device *platform_devs[] __initdata = { | 93 | static struct platform_device *platform_devs[] __initdata = { |
28 | /* yet to be added, add i2c0, gpio.. */ | 94 | &u8500_gpio_devs[0], |
95 | &u8500_gpio_devs[1], | ||
96 | &u8500_gpio_devs[2], | ||
97 | &u8500_gpio_devs[3], | ||
98 | &u8500_gpio_devs[4], | ||
99 | &u8500_gpio_devs[5], | ||
100 | &u8500_gpio_devs[6], | ||
101 | &u8500_gpio_devs[7], | ||
102 | &u8500_gpio_devs[8], | ||
29 | }; | 103 | }; |
30 | 104 | ||
31 | #define __IO_DEV_DESC(x, sz) { \ | 105 | #define __IO_DEV_DESC(x, sz) { \ |
@@ -49,6 +123,10 @@ static struct map_desc u8500_io_desc[] __initdata = { | |||
49 | __IO_DEV_DESC(U8500_CLKRST3_BASE, SZ_4K), | 123 | __IO_DEV_DESC(U8500_CLKRST3_BASE, SZ_4K), |
50 | __IO_DEV_DESC(U8500_CLKRST5_BASE, SZ_4K), | 124 | __IO_DEV_DESC(U8500_CLKRST5_BASE, SZ_4K), |
51 | __IO_DEV_DESC(U8500_CLKRST6_BASE, SZ_4K), | 125 | __IO_DEV_DESC(U8500_CLKRST6_BASE, SZ_4K), |
126 | __IO_DEV_DESC(U8500_GPIO1_BASE, SZ_4K), | ||
127 | __IO_DEV_DESC(U8500_GPIO2_BASE, SZ_4K), | ||
128 | __IO_DEV_DESC(U8500_GPIO3_BASE, SZ_4K), | ||
129 | __IO_DEV_DESC(U8500_GPIO5_BASE, SZ_4K), | ||
52 | }; | 130 | }; |
53 | 131 | ||
54 | static struct map_desc u8500ed_io_desc[] __initdata = { | 132 | static struct map_desc u8500ed_io_desc[] __initdata = { |