aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-03-02 22:54:37 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-03-19 14:29:45 -0400
commit94bdc0e2d76c5f2467346bf14e7e16d6d8e0395d (patch)
tree00f98df7579a1fb53766a34d5ee3339b68908776 /arch
parent1df20afce51e7af2a587425d1aafca2608fe0066 (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')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-ux500/Kconfig1
-rw-r--r--arch/arm/mach-ux500/cpu-u8500.c82
-rw-r--r--arch/arm/mach-ux500/include/mach/gpio.h12
-rw-r--r--arch/arm/mach-ux500/include/mach/hardware.h12
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs.h8
6 files changed, 113 insertions, 3 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c5408bf1bf43..540f85922113 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -756,6 +756,7 @@ config ARCH_U8500
756 select GENERIC_TIME 756 select GENERIC_TIME
757 select GENERIC_CLOCKEVENTS 757 select GENERIC_CLOCKEVENTS
758 select COMMON_CLKDEV 758 select COMMON_CLKDEV
759 select ARCH_REQUIRE_GPIOLIB
759 help 760 help
760 Support for ST-Ericsson's Ux500 architecture 761 Support for ST-Ericsson's Ux500 architecture
761 762
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 03625d744857..cd412a3e0ab8 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -8,6 +8,7 @@ config MACH_U8500_MOP
8 default y 8 default y
9 select ARM_GIC 9 select ARM_GIC
10 select HAS_MTU 10 select HAS_MTU
11 select NOMADIK_GPIO
11 help 12 help
12 Include support for mop500 development platform 13 Include support for mop500 development platform
13 based on U8500 architecture. The platform is based 14 based on U8500 architecture. The platform is based
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
57static 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
69static 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
81static 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
27static struct platform_device *platform_devs[] __initdata = { 93static 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
54static struct map_desc u8500ed_io_desc[] __initdata = { 132static struct map_desc u8500ed_io_desc[] __initdata = {
diff --git a/arch/arm/mach-ux500/include/mach/gpio.h b/arch/arm/mach-ux500/include/mach/gpio.h
new file mode 100644
index 000000000000..3c4cd31ad9f7
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/gpio.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_ARCH_GPIO_H
2#define __ASM_ARCH_GPIO_H
3
4/*
5 * 288 (#267 is the highest one actually hooked up) onchip GPIOs, plus enough
6 * room for a couple of GPIO expanders.
7 */
8#define ARCH_NR_GPIOS 350
9
10#include <plat/gpio.h>
11
12#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h
index f29a43d9d45a..99ca89fe9b30 100644
--- a/arch/arm/mach-ux500/include/mach/hardware.h
+++ b/arch/arm/mach-ux500/include/mach/hardware.h
@@ -23,6 +23,8 @@
23 23
24/* typesafe io address */ 24/* typesafe io address */
25#define __io_address(n) __io(IO_ADDRESS(n)) 25#define __io_address(n) __io(IO_ADDRESS(n))
26/* used by some plat-nomadik code */
27#define io_p2v(n) __io_address(n)
26 28
27/* 29/*
28 * Base address definitions for U8500 Onchip IPs. All the 30 * Base address definitions for U8500 Onchip IPs. All the
@@ -128,6 +130,16 @@
128#define U8500_GPIO1_BASE (U8500_PER1_BASE + 0xe000) 130#define U8500_GPIO1_BASE (U8500_PER1_BASE + 0xe000)
129#define U8500_CLKRST1_BASE (U8500_PER1_BASE + 0xf000) 131#define U8500_CLKRST1_BASE (U8500_PER1_BASE + 0xf000)
130 132
133#define U8500_GPIOBANK0_BASE U8500_GPIO1_BASE
134#define U8500_GPIOBANK1_BASE (U8500_GPIO1_BASE + 0x80)
135#define U8500_GPIOBANK2_BASE U8500_GPIO3_BASE
136#define U8500_GPIOBANK3_BASE (U8500_GPIO3_BASE + 0x80)
137#define U8500_GPIOBANK4_BASE (U8500_GPIO3_BASE + 0x100)
138#define U8500_GPIOBANK5_BASE (U8500_GPIO3_BASE + 0x180)
139#define U8500_GPIOBANK6_BASE U8500_GPIO2_BASE
140#define U8500_GPIOBANK7_BASE (U8500_GPIO2_BASE + 0x80)
141#define U8500_GPIOBANK8_BASE U8500_GPIO5_BASE
142
131/* ST-Ericsson modified pl022 id */ 143/* ST-Ericsson modified pl022 id */
132#define SSP_PER_ID 0x01080022 144#define SSP_PER_ID 0x01080022
133 145
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h
index 394b5dd2200f..8a1f6976c245 100644
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/include/mach/irqs.h
@@ -66,6 +66,12 @@
66/* There are 128 shared peripheral interrupts assigned to 66/* There are 128 shared peripheral interrupts assigned to
67 * INTID[160:32]. The first 32 interrupts are reserved. 67 * INTID[160:32]. The first 32 interrupts are reserved.
68 */ 68 */
69#define NR_IRQS 161 69#define U8500_SOC_NR_IRQS 161
70
71/* After chip-specific IRQ numbers we have the GPIO ones */
72#define NOMADIK_NR_GPIO 288
73#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + U8500_SOC_NR_IRQS)
74#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - U8500_SOC_NR_IRQS)
75#define NR_IRQS NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO)
70 76
71#endif /*ASM_ARCH_IRQS_H*/ 77#endif /*ASM_ARCH_IRQS_H*/