diff options
author | Alessandro Rubini <rubini@gnudd.com> | 2009-07-02 10:29:12 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-07-02 16:20:45 -0400 |
commit | 2ec1d3594563e0283873e24bb5d100dffee5d568 (patch) | |
tree | 30b6ac6d374fac8fdf97caa7fc025015c52d0ffa /arch/arm/mach-nomadik/cpu-8815.c | |
parent | 28ad94ec61dc60207dbffdb95ff870c617fbb832 (diff) |
[ARM] 5584/1: nomadik: add gpio driver and devices
Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-nomadik/cpu-8815.c')
-rw-r--r-- | arch/arm/mach-nomadik/cpu-8815.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index dec42da6956a..9917a9abdb52 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c | |||
@@ -19,12 +19,87 @@ | |||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/device.h> | 21 | #include <linux/device.h> |
22 | #include <linux/amba/bus.h> | ||
23 | #include <linux/gpio.h> | ||
22 | 24 | ||
23 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
24 | #include <mach/irqs.h> | 26 | #include <mach/irqs.h> |
25 | #include <asm/mach/map.h> | 27 | #include <asm/mach/map.h> |
26 | #include <asm/hardware/vic.h> | 28 | #include <asm/hardware/vic.h> |
27 | 29 | ||
30 | /* The 8815 has 4 GPIO blocks, let's register them immediately */ | ||
31 | static struct nmk_gpio_platform_data cpu8815_gpio[] = { | ||
32 | { | ||
33 | .name = "GPIO-0-31", | ||
34 | .first_gpio = 0, | ||
35 | .first_irq = NOMADIK_GPIO_TO_IRQ(0), | ||
36 | .parent_irq = IRQ_GPIO0, | ||
37 | }, { | ||
38 | .name = "GPIO-32-63", | ||
39 | .first_gpio = 32, | ||
40 | .first_irq = NOMADIK_GPIO_TO_IRQ(32), | ||
41 | .parent_irq = IRQ_GPIO1, | ||
42 | }, { | ||
43 | .name = "GPIO-64-95", | ||
44 | .first_gpio = 64, | ||
45 | .first_irq = NOMADIK_GPIO_TO_IRQ(64), | ||
46 | .parent_irq = IRQ_GPIO2, | ||
47 | }, { | ||
48 | .name = "GPIO-96-127", /* 124..127 not routed to pin */ | ||
49 | .first_gpio = 96, | ||
50 | .first_irq = NOMADIK_GPIO_TO_IRQ(96), | ||
51 | .parent_irq = IRQ_GPIO3, | ||
52 | } | ||
53 | }; | ||
54 | |||
55 | #define __MEM_4K_RESOURCE(x) \ | ||
56 | .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} | ||
57 | |||
58 | static struct amba_device cpu8815_amba_gpio[] = { | ||
59 | { | ||
60 | .dev = { | ||
61 | .init_name = "gpio0", | ||
62 | .platform_data = cpu8815_gpio + 0, | ||
63 | }, | ||
64 | __MEM_4K_RESOURCE(NOMADIK_GPIO0_BASE), | ||
65 | }, { | ||
66 | .dev = { | ||
67 | .init_name = "gpio1", | ||
68 | .platform_data = cpu8815_gpio + 1, | ||
69 | }, | ||
70 | __MEM_4K_RESOURCE(NOMADIK_GPIO1_BASE), | ||
71 | }, { | ||
72 | .dev = { | ||
73 | .init_name = "gpio2", | ||
74 | .platform_data = cpu8815_gpio + 2, | ||
75 | }, | ||
76 | __MEM_4K_RESOURCE(NOMADIK_GPIO2_BASE), | ||
77 | }, { | ||
78 | .dev = { | ||
79 | .init_name = "gpio3", | ||
80 | .platform_data = cpu8815_gpio + 3, | ||
81 | }, | ||
82 | __MEM_4K_RESOURCE(NOMADIK_GPIO3_BASE), | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | static struct amba_device *amba_devs[] __initdata = { | ||
87 | cpu8815_amba_gpio + 0, | ||
88 | cpu8815_amba_gpio + 1, | ||
89 | cpu8815_amba_gpio + 2, | ||
90 | cpu8815_amba_gpio + 3, | ||
91 | }; | ||
92 | |||
93 | static int __init cpu8815_init(void) | ||
94 | { | ||
95 | int i; | ||
96 | |||
97 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) | ||
98 | amba_device_register(amba_devs[i], &iomem_resource); | ||
99 | return 0; | ||
100 | } | ||
101 | arch_initcall(cpu8815_init); | ||
102 | |||
28 | /* All SoC devices live in the same area (see hardware.h) */ | 103 | /* All SoC devices live in the same area (see hardware.h) */ |
29 | static struct map_desc nomadik_io_desc[] __initdata = { | 104 | static struct map_desc nomadik_io_desc[] __initdata = { |
30 | { | 105 | { |