aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/gpio.c')
-rw-r--r--arch/arm/plat-omap/gpio.c224
1 files changed, 129 insertions, 95 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index b0c73613a4e9..35a59ce5a2b4 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -31,7 +31,7 @@
31/* 31/*
32 * OMAP1510 GPIO registers 32 * OMAP1510 GPIO registers
33 */ 33 */
34#define OMAP1510_GPIO_BASE OMAP1_IO_ADDRESS(0xfffce000) 34#define OMAP1510_GPIO_BASE 0xfffce000
35#define OMAP1510_GPIO_DATA_INPUT 0x00 35#define OMAP1510_GPIO_DATA_INPUT 0x00
36#define OMAP1510_GPIO_DATA_OUTPUT 0x04 36#define OMAP1510_GPIO_DATA_OUTPUT 0x04
37#define OMAP1510_GPIO_DIR_CONTROL 0x08 37#define OMAP1510_GPIO_DIR_CONTROL 0x08
@@ -45,10 +45,10 @@
45/* 45/*
46 * OMAP1610 specific GPIO registers 46 * OMAP1610 specific GPIO registers
47 */ 47 */
48#define OMAP1610_GPIO1_BASE OMAP1_IO_ADDRESS(0xfffbe400) 48#define OMAP1610_GPIO1_BASE 0xfffbe400
49#define OMAP1610_GPIO2_BASE OMAP1_IO_ADDRESS(0xfffbec00) 49#define OMAP1610_GPIO2_BASE 0xfffbec00
50#define OMAP1610_GPIO3_BASE OMAP1_IO_ADDRESS(0xfffbb400) 50#define OMAP1610_GPIO3_BASE 0xfffbb400
51#define OMAP1610_GPIO4_BASE OMAP1_IO_ADDRESS(0xfffbbc00) 51#define OMAP1610_GPIO4_BASE 0xfffbbc00
52#define OMAP1610_GPIO_REVISION 0x0000 52#define OMAP1610_GPIO_REVISION 0x0000
53#define OMAP1610_GPIO_SYSCONFIG 0x0010 53#define OMAP1610_GPIO_SYSCONFIG 0x0010
54#define OMAP1610_GPIO_SYSSTATUS 0x0014 54#define OMAP1610_GPIO_SYSSTATUS 0x0014
@@ -70,12 +70,12 @@
70/* 70/*
71 * OMAP7XX specific GPIO registers 71 * OMAP7XX specific GPIO registers
72 */ 72 */
73#define OMAP7XX_GPIO1_BASE OMAP1_IO_ADDRESS(0xfffbc000) 73#define OMAP7XX_GPIO1_BASE 0xfffbc000
74#define OMAP7XX_GPIO2_BASE OMAP1_IO_ADDRESS(0xfffbc800) 74#define OMAP7XX_GPIO2_BASE 0xfffbc800
75#define OMAP7XX_GPIO3_BASE OMAP1_IO_ADDRESS(0xfffbd000) 75#define OMAP7XX_GPIO3_BASE 0xfffbd000
76#define OMAP7XX_GPIO4_BASE OMAP1_IO_ADDRESS(0xfffbd800) 76#define OMAP7XX_GPIO4_BASE 0xfffbd800
77#define OMAP7XX_GPIO5_BASE OMAP1_IO_ADDRESS(0xfffbe000) 77#define OMAP7XX_GPIO5_BASE 0xfffbe000
78#define OMAP7XX_GPIO6_BASE OMAP1_IO_ADDRESS(0xfffbe800) 78#define OMAP7XX_GPIO6_BASE 0xfffbe800
79#define OMAP7XX_GPIO_DATA_INPUT 0x00 79#define OMAP7XX_GPIO_DATA_INPUT 0x00
80#define OMAP7XX_GPIO_DATA_OUTPUT 0x04 80#define OMAP7XX_GPIO_DATA_OUTPUT 0x04
81#define OMAP7XX_GPIO_DIR_CONTROL 0x08 81#define OMAP7XX_GPIO_DIR_CONTROL 0x08
@@ -83,21 +83,21 @@
83#define OMAP7XX_GPIO_INT_MASK 0x10 83#define OMAP7XX_GPIO_INT_MASK 0x10
84#define OMAP7XX_GPIO_INT_STATUS 0x14 84#define OMAP7XX_GPIO_INT_STATUS 0x14
85 85
86#define OMAP1_MPUIO_VBASE OMAP1_IO_ADDRESS(OMAP1_MPUIO_BASE) 86#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
87 87
88/* 88/*
89 * omap24xx specific GPIO registers 89 * omap24xx specific GPIO registers
90 */ 90 */
91#define OMAP242X_GPIO1_BASE OMAP2_IO_ADDRESS(0x48018000) 91#define OMAP242X_GPIO1_BASE 0x48018000
92#define OMAP242X_GPIO2_BASE OMAP2_IO_ADDRESS(0x4801a000) 92#define OMAP242X_GPIO2_BASE 0x4801a000
93#define OMAP242X_GPIO3_BASE OMAP2_IO_ADDRESS(0x4801c000) 93#define OMAP242X_GPIO3_BASE 0x4801c000
94#define OMAP242X_GPIO4_BASE OMAP2_IO_ADDRESS(0x4801e000) 94#define OMAP242X_GPIO4_BASE 0x4801e000
95 95
96#define OMAP243X_GPIO1_BASE OMAP2_IO_ADDRESS(0x4900C000) 96#define OMAP243X_GPIO1_BASE 0x4900C000
97#define OMAP243X_GPIO2_BASE OMAP2_IO_ADDRESS(0x4900E000) 97#define OMAP243X_GPIO2_BASE 0x4900E000
98#define OMAP243X_GPIO3_BASE OMAP2_IO_ADDRESS(0x49010000) 98#define OMAP243X_GPIO3_BASE 0x49010000
99#define OMAP243X_GPIO4_BASE OMAP2_IO_ADDRESS(0x49012000) 99#define OMAP243X_GPIO4_BASE 0x49012000
100#define OMAP243X_GPIO5_BASE OMAP2_IO_ADDRESS(0x480B6000) 100#define OMAP243X_GPIO5_BASE 0x480B6000
101 101
102#define OMAP24XX_GPIO_REVISION 0x0000 102#define OMAP24XX_GPIO_REVISION 0x0000
103#define OMAP24XX_GPIO_SYSCONFIG 0x0010 103#define OMAP24XX_GPIO_SYSCONFIG 0x0010
@@ -154,24 +154,25 @@
154 * omap34xx specific GPIO registers 154 * omap34xx specific GPIO registers
155 */ 155 */
156 156
157#define OMAP34XX_GPIO1_BASE OMAP2_IO_ADDRESS(0x48310000) 157#define OMAP34XX_GPIO1_BASE 0x48310000
158#define OMAP34XX_GPIO2_BASE OMAP2_IO_ADDRESS(0x49050000) 158#define OMAP34XX_GPIO2_BASE 0x49050000
159#define OMAP34XX_GPIO3_BASE OMAP2_IO_ADDRESS(0x49052000) 159#define OMAP34XX_GPIO3_BASE 0x49052000
160#define OMAP34XX_GPIO4_BASE OMAP2_IO_ADDRESS(0x49054000) 160#define OMAP34XX_GPIO4_BASE 0x49054000
161#define OMAP34XX_GPIO5_BASE OMAP2_IO_ADDRESS(0x49056000) 161#define OMAP34XX_GPIO5_BASE 0x49056000
162#define OMAP34XX_GPIO6_BASE OMAP2_IO_ADDRESS(0x49058000) 162#define OMAP34XX_GPIO6_BASE 0x49058000
163 163
164/* 164/*
165 * OMAP44XX specific GPIO registers 165 * OMAP44XX specific GPIO registers
166 */ 166 */
167#define OMAP44XX_GPIO1_BASE OMAP2_IO_ADDRESS(0x4a310000) 167#define OMAP44XX_GPIO1_BASE 0x4a310000
168#define OMAP44XX_GPIO2_BASE OMAP2_IO_ADDRESS(0x48055000) 168#define OMAP44XX_GPIO2_BASE 0x48055000
169#define OMAP44XX_GPIO3_BASE OMAP2_IO_ADDRESS(0x48057000) 169#define OMAP44XX_GPIO3_BASE 0x48057000
170#define OMAP44XX_GPIO4_BASE OMAP2_IO_ADDRESS(0x48059000) 170#define OMAP44XX_GPIO4_BASE 0x48059000
171#define OMAP44XX_GPIO5_BASE OMAP2_IO_ADDRESS(0x4805B000) 171#define OMAP44XX_GPIO5_BASE 0x4805B000
172#define OMAP44XX_GPIO6_BASE OMAP2_IO_ADDRESS(0x4805D000) 172#define OMAP44XX_GPIO6_BASE 0x4805D000
173 173
174struct gpio_bank { 174struct gpio_bank {
175 unsigned long pbase;
175 void __iomem *base; 176 void __iomem *base;
176 u16 irq; 177 u16 irq;
177 u16 virtual_irq_start; 178 u16 virtual_irq_start;
@@ -204,77 +205,106 @@ struct gpio_bank {
204 205
205#ifdef CONFIG_ARCH_OMAP16XX 206#ifdef CONFIG_ARCH_OMAP16XX
206static struct gpio_bank gpio_bank_1610[5] = { 207static struct gpio_bank gpio_bank_1610[5] = {
207 { OMAP1_MPUIO_VBASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO}, 208 { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE,
208 { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 }, 209 METHOD_MPUIO },
209 { OMAP1610_GPIO2_BASE, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16, METHOD_GPIO_1610 }, 210 { OMAP1610_GPIO1_BASE, NULL, INT_GPIO_BANK1, IH_GPIO_BASE,
210 { OMAP1610_GPIO3_BASE, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32, METHOD_GPIO_1610 }, 211 METHOD_GPIO_1610 },
211 { OMAP1610_GPIO4_BASE, INT_1610_GPIO_BANK4, IH_GPIO_BASE + 48, METHOD_GPIO_1610 }, 212 { OMAP1610_GPIO2_BASE, NULL, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16,
213 METHOD_GPIO_1610 },
214 { OMAP1610_GPIO3_BASE, NULL, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32,
215 METHOD_GPIO_1610 },
216 { OMAP1610_GPIO4_BASE, NULL, INT_1610_GPIO_BANK4, IH_GPIO_BASE + 48,
217 METHOD_GPIO_1610 },
212}; 218};
213#endif 219#endif
214 220
215#ifdef CONFIG_ARCH_OMAP15XX 221#ifdef CONFIG_ARCH_OMAP15XX
216static struct gpio_bank gpio_bank_1510[2] = { 222static struct gpio_bank gpio_bank_1510[2] = {
217 { OMAP1_MPUIO_VBASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO }, 223 { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE,
218 { OMAP1510_GPIO_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1510 } 224 METHOD_MPUIO },
225 { OMAP1510_GPIO_BASE, NULL, INT_GPIO_BANK1, IH_GPIO_BASE,
226 METHOD_GPIO_1510 }
219}; 227};
220#endif 228#endif
221 229
222#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 230#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
223static struct gpio_bank gpio_bank_7xx[7] = { 231static struct gpio_bank gpio_bank_7xx[7] = {
224 { OMAP1_MPUIO_VBASE, INT_7XX_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO }, 232 { OMAP1_MPUIO_VBASE, NULL, INT_7XX_MPUIO, IH_MPUIO_BASE,
225 { OMAP7XX_GPIO1_BASE, INT_7XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_7XX }, 233 METHOD_MPUIO },
226 { OMAP7XX_GPIO2_BASE, INT_7XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_7XX }, 234 { OMAP7XX_GPIO1_BASE, NULL, INT_7XX_GPIO_BANK1, IH_GPIO_BASE,
227 { OMAP7XX_GPIO3_BASE, INT_7XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_7XX }, 235 METHOD_GPIO_7XX },
228 { OMAP7XX_GPIO4_BASE, INT_7XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_7XX }, 236 { OMAP7XX_GPIO2_BASE, NULL, INT_7XX_GPIO_BANK2, IH_GPIO_BASE + 32,
229 { OMAP7XX_GPIO5_BASE, INT_7XX_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_7XX }, 237 METHOD_GPIO_7XX },
230 { OMAP7XX_GPIO6_BASE, INT_7XX_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_7XX }, 238 { OMAP7XX_GPIO3_BASE, NULL, INT_7XX_GPIO_BANK3, IH_GPIO_BASE + 64,
239 METHOD_GPIO_7XX },
240 { OMAP7XX_GPIO4_BASE, NULL, INT_7XX_GPIO_BANK4, IH_GPIO_BASE + 96,
241 METHOD_GPIO_7XX },
242 { OMAP7XX_GPIO5_BASE, NULL, INT_7XX_GPIO_BANK5, IH_GPIO_BASE + 128,
243 METHOD_GPIO_7XX },
244 { OMAP7XX_GPIO6_BASE, NULL, INT_7XX_GPIO_BANK6, IH_GPIO_BASE + 160,
245 METHOD_GPIO_7XX },
231}; 246};
232#endif 247#endif
233 248
234#ifdef CONFIG_ARCH_OMAP24XX 249#ifdef CONFIG_ARCH_OMAP24XX
235 250
236static struct gpio_bank gpio_bank_242x[4] = { 251static struct gpio_bank gpio_bank_242x[4] = {
237 { OMAP242X_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX }, 252 { OMAP242X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
238 { OMAP242X_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX }, 253 METHOD_GPIO_24XX },
239 { OMAP242X_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX }, 254 { OMAP242X_GPIO2_BASE, NULL, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,
240 { OMAP242X_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX }, 255 METHOD_GPIO_24XX },
256 { OMAP242X_GPIO3_BASE, NULL, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,
257 METHOD_GPIO_24XX },
258 { OMAP242X_GPIO4_BASE, NULL, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,
259 METHOD_GPIO_24XX },
241}; 260};
242 261
243static struct gpio_bank gpio_bank_243x[5] = { 262static struct gpio_bank gpio_bank_243x[5] = {
244 { OMAP243X_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX }, 263 { OMAP243X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
245 { OMAP243X_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX }, 264 METHOD_GPIO_24XX },
246 { OMAP243X_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX }, 265 { OMAP243X_GPIO2_BASE, NULL, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,
247 { OMAP243X_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX }, 266 METHOD_GPIO_24XX },
248 { OMAP243X_GPIO5_BASE, INT_24XX_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_24XX }, 267 { OMAP243X_GPIO3_BASE, NULL, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,
268 METHOD_GPIO_24XX },
269 { OMAP243X_GPIO4_BASE, NULL, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,
270 METHOD_GPIO_24XX },
271 { OMAP243X_GPIO5_BASE, NULL, INT_24XX_GPIO_BANK5, IH_GPIO_BASE + 128,
272 METHOD_GPIO_24XX },
249}; 273};
250 274
251#endif 275#endif
252 276
253#ifdef CONFIG_ARCH_OMAP34XX 277#ifdef CONFIG_ARCH_OMAP34XX
254static struct gpio_bank gpio_bank_34xx[6] = { 278static struct gpio_bank gpio_bank_34xx[6] = {
255 { OMAP34XX_GPIO1_BASE, INT_34XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX }, 279 { OMAP34XX_GPIO1_BASE, NULL, INT_34XX_GPIO_BANK1, IH_GPIO_BASE,
256 { OMAP34XX_GPIO2_BASE, INT_34XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX }, 280 METHOD_GPIO_24XX },
257 { OMAP34XX_GPIO3_BASE, INT_34XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX }, 281 { OMAP34XX_GPIO2_BASE, NULL, INT_34XX_GPIO_BANK2, IH_GPIO_BASE + 32,
258 { OMAP34XX_GPIO4_BASE, INT_34XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX }, 282 METHOD_GPIO_24XX },
259 { OMAP34XX_GPIO5_BASE, INT_34XX_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_24XX }, 283 { OMAP34XX_GPIO3_BASE, NULL, INT_34XX_GPIO_BANK3, IH_GPIO_BASE + 64,
260 { OMAP34XX_GPIO6_BASE, INT_34XX_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_24XX }, 284 METHOD_GPIO_24XX },
285 { OMAP34XX_GPIO4_BASE, NULL, INT_34XX_GPIO_BANK4, IH_GPIO_BASE + 96,
286 METHOD_GPIO_24XX },
287 { OMAP34XX_GPIO5_BASE, NULL, INT_34XX_GPIO_BANK5, IH_GPIO_BASE + 128,
288 METHOD_GPIO_24XX },
289 { OMAP34XX_GPIO6_BASE, NULL, INT_34XX_GPIO_BANK6, IH_GPIO_BASE + 160,
290 METHOD_GPIO_24XX },
261}; 291};
262 292
263#endif 293#endif
264 294
265#ifdef CONFIG_ARCH_OMAP4 295#ifdef CONFIG_ARCH_OMAP4
266static struct gpio_bank gpio_bank_44xx[6] = { 296static struct gpio_bank gpio_bank_44xx[6] = {
267 { OMAP44XX_GPIO1_BASE, INT_44XX_GPIO_BANK1, IH_GPIO_BASE, \ 297 { OMAP44XX_GPIO1_BASE, NULL, INT_44XX_GPIO_BANK1, IH_GPIO_BASE,
268 METHOD_GPIO_24XX }, 298 METHOD_GPIO_24XX },
269 { OMAP44XX_GPIO2_BASE, INT_44XX_GPIO_BANK2, IH_GPIO_BASE + 32, \ 299 { OMAP44XX_GPIO2_BASE, NULL, INT_44XX_GPIO_BANK2, IH_GPIO_BASE + 32,
270 METHOD_GPIO_24XX }, 300 METHOD_GPIO_24XX },
271 { OMAP44XX_GPIO3_BASE, INT_44XX_GPIO_BANK3, IH_GPIO_BASE + 64, \ 301 { OMAP44XX_GPIO3_BASE, NULL, INT_44XX_GPIO_BANK3, IH_GPIO_BASE + 64,
272 METHOD_GPIO_24XX }, 302 METHOD_GPIO_24XX },
273 { OMAP44XX_GPIO4_BASE, INT_44XX_GPIO_BANK4, IH_GPIO_BASE + 96, \ 303 { OMAP44XX_GPIO4_BASE, NULL, INT_44XX_GPIO_BANK4, IH_GPIO_BASE + 96,
274 METHOD_GPIO_24XX }, 304 METHOD_GPIO_24XX },
275 { OMAP44XX_GPIO5_BASE, INT_44XX_GPIO_BANK5, IH_GPIO_BASE + 128, \ 305 { OMAP44XX_GPIO5_BASE, NULL, INT_44XX_GPIO_BANK5, IH_GPIO_BASE + 128,
276 METHOD_GPIO_24XX }, 306 METHOD_GPIO_24XX },
277 { OMAP44XX_GPIO6_BASE, INT_44XX_GPIO_BANK6, IH_GPIO_BASE + 160, \ 307 { OMAP44XX_GPIO6_BASE, NULL, INT_44XX_GPIO_BANK6, IH_GPIO_BASE + 160,
278 METHOD_GPIO_24XX }, 308 METHOD_GPIO_24XX },
279}; 309};
280 310
@@ -1511,6 +1541,23 @@ static struct clk * gpio5_fck;
1511static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; 1541static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS];
1512#endif 1542#endif
1513 1543
1544static void __init omap_gpio_show_rev(void)
1545{
1546 u32 rev;
1547
1548 if (cpu_is_omap16xx())
1549 rev = __raw_readw(gpio_bank[1].base + OMAP1610_GPIO_REVISION);
1550 else if (cpu_is_omap24xx() || cpu_is_omap34xx())
1551 rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1552 else if (cpu_is_omap44xx())
1553 rev = __raw_readl(gpio_bank[0].base + OMAP4_GPIO_REVISION);
1554 else
1555 return;
1556
1557 printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n",
1558 (rev >> 4) & 0x0f, rev & 0x0f);
1559}
1560
1514/* This lock class tells lockdep that GPIO irqs are in a different 1561/* This lock class tells lockdep that GPIO irqs are in a different
1515 * category than their parents, so it won't report false recursion. 1562 * category than their parents, so it won't report false recursion.
1516 */ 1563 */
@@ -1521,6 +1568,7 @@ static int __init _omap_gpio_init(void)
1521 int i; 1568 int i;
1522 int gpio = 0; 1569 int gpio = 0;
1523 struct gpio_bank *bank; 1570 struct gpio_bank *bank;
1571 int bank_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */
1524 char clk_name[11]; 1572 char clk_name[11];
1525 1573
1526 initialized = 1; 1574 initialized = 1;
@@ -1583,69 +1631,45 @@ static int __init _omap_gpio_init(void)
1583 1631
1584#ifdef CONFIG_ARCH_OMAP15XX 1632#ifdef CONFIG_ARCH_OMAP15XX
1585 if (cpu_is_omap15xx()) { 1633 if (cpu_is_omap15xx()) {
1586 printk(KERN_INFO "OMAP1510 GPIO hardware\n");
1587 gpio_bank_count = 2; 1634 gpio_bank_count = 2;
1588 gpio_bank = gpio_bank_1510; 1635 gpio_bank = gpio_bank_1510;
1636 bank_size = SZ_2K;
1589 } 1637 }
1590#endif 1638#endif
1591#if defined(CONFIG_ARCH_OMAP16XX) 1639#if defined(CONFIG_ARCH_OMAP16XX)
1592 if (cpu_is_omap16xx()) { 1640 if (cpu_is_omap16xx()) {
1593 u32 rev;
1594
1595 gpio_bank_count = 5; 1641 gpio_bank_count = 5;
1596 gpio_bank = gpio_bank_1610; 1642 gpio_bank = gpio_bank_1610;
1597 rev = __raw_readw(gpio_bank[1].base + OMAP1610_GPIO_REVISION); 1643 bank_size = SZ_2K;
1598 printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n",
1599 (rev >> 4) & 0x0f, rev & 0x0f);
1600 } 1644 }
1601#endif 1645#endif
1602#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 1646#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
1603 if (cpu_is_omap7xx()) { 1647 if (cpu_is_omap7xx()) {
1604 printk(KERN_INFO "OMAP7XX GPIO hardware\n");
1605 gpio_bank_count = 7; 1648 gpio_bank_count = 7;
1606 gpio_bank = gpio_bank_7xx; 1649 gpio_bank = gpio_bank_7xx;
1650 bank_size = SZ_2K;
1607 } 1651 }
1608#endif 1652#endif
1609#ifdef CONFIG_ARCH_OMAP24XX 1653#ifdef CONFIG_ARCH_OMAP24XX
1610 if (cpu_is_omap242x()) { 1654 if (cpu_is_omap242x()) {
1611 int rev;
1612
1613 gpio_bank_count = 4; 1655 gpio_bank_count = 4;
1614 gpio_bank = gpio_bank_242x; 1656 gpio_bank = gpio_bank_242x;
1615 rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1616 printk(KERN_INFO "OMAP242x GPIO hardware version %d.%d\n",
1617 (rev >> 4) & 0x0f, rev & 0x0f);
1618 } 1657 }
1619 if (cpu_is_omap243x()) { 1658 if (cpu_is_omap243x()) {
1620 int rev;
1621
1622 gpio_bank_count = 5; 1659 gpio_bank_count = 5;
1623 gpio_bank = gpio_bank_243x; 1660 gpio_bank = gpio_bank_243x;
1624 rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1625 printk(KERN_INFO "OMAP243x GPIO hardware version %d.%d\n",
1626 (rev >> 4) & 0x0f, rev & 0x0f);
1627 } 1661 }
1628#endif 1662#endif
1629#ifdef CONFIG_ARCH_OMAP34XX 1663#ifdef CONFIG_ARCH_OMAP34XX
1630 if (cpu_is_omap34xx()) { 1664 if (cpu_is_omap34xx()) {
1631 int rev;
1632
1633 gpio_bank_count = OMAP34XX_NR_GPIOS; 1665 gpio_bank_count = OMAP34XX_NR_GPIOS;
1634 gpio_bank = gpio_bank_34xx; 1666 gpio_bank = gpio_bank_34xx;
1635 rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1636 printk(KERN_INFO "OMAP34xx GPIO hardware version %d.%d\n",
1637 (rev >> 4) & 0x0f, rev & 0x0f);
1638 } 1667 }
1639#endif 1668#endif
1640#ifdef CONFIG_ARCH_OMAP4 1669#ifdef CONFIG_ARCH_OMAP4
1641 if (cpu_is_omap44xx()) { 1670 if (cpu_is_omap44xx()) {
1642 int rev;
1643
1644 gpio_bank_count = OMAP34XX_NR_GPIOS; 1671 gpio_bank_count = OMAP34XX_NR_GPIOS;
1645 gpio_bank = gpio_bank_44xx; 1672 gpio_bank = gpio_bank_44xx;
1646 rev = __raw_readl(gpio_bank[0].base + OMAP4_GPIO_REVISION);
1647 printk(KERN_INFO "OMAP44xx GPIO hardware version %d.%d\n",
1648 (rev >> 4) & 0x0f, rev & 0x0f);
1649 } 1673 }
1650#endif 1674#endif
1651 for (i = 0; i < gpio_bank_count; i++) { 1675 for (i = 0; i < gpio_bank_count; i++) {
@@ -1653,6 +1677,14 @@ static int __init _omap_gpio_init(void)
1653 1677
1654 bank = &gpio_bank[i]; 1678 bank = &gpio_bank[i];
1655 spin_lock_init(&bank->lock); 1679 spin_lock_init(&bank->lock);
1680
1681 /* Static mapping, never released */
1682 bank->base = ioremap(bank->pbase, bank_size);
1683 if (!bank->base) {
1684 printk(KERN_ERR "Could not ioremap gpio bank%i\n", i);
1685 continue;
1686 }
1687
1656 if (bank_is_mpuio(bank)) 1688 if (bank_is_mpuio(bank))
1657 __raw_writew(0xffff, bank->base + OMAP_MPUIO_GPIO_MASKIT); 1689 __raw_writew(0xffff, bank->base + OMAP_MPUIO_GPIO_MASKIT);
1658 if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) { 1690 if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) {
@@ -1758,6 +1790,8 @@ static int __init _omap_gpio_init(void)
1758 if (cpu_is_omap34xx()) 1790 if (cpu_is_omap34xx())
1759 omap_writel(1 << 0, 0x48306814); 1791 omap_writel(1 << 0, 0x48306814);
1760 1792
1793 omap_gpio_show_rev();
1794
1761 return 0; 1795 return 0;
1762} 1796}
1763 1797