diff options
author | Tony Lindgren <tony@atomide.com> | 2009-11-22 13:08:43 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-11-22 13:08:43 -0500 |
commit | a76df42a675c9936e8bf3607226e74c8a5e2d847 (patch) | |
tree | 96d93706d884dea956393653452fa4d78d8d7f76 /arch/arm/plat-omap/gpio.c | |
parent | 648f4e3e50c4793d9dbf9a09afa193631f76fa26 (diff) | |
parent | 8171d88089ad63fc442b2bf32af7c18653adc5cb (diff) |
Merge 7xx-iosplit-plat-merge with omap-fixes
Merge branch '7xx-iosplit-plat-merge' into omap-for-linus
Diffstat (limited to 'arch/arm/plat-omap/gpio.c')
-rw-r--r-- | arch/arm/plat-omap/gpio.c | 517 |
1 files changed, 269 insertions, 248 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 7c345b757df1..4f81ea35b733 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 |
@@ -68,52 +68,36 @@ | |||
68 | #define OMAP1610_GPIO_SET_DATAOUT 0x00f0 | 68 | #define OMAP1610_GPIO_SET_DATAOUT 0x00f0 |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * OMAP730 specific GPIO registers | 71 | * OMAP7XX specific GPIO registers |
72 | */ | 72 | */ |
73 | #define OMAP730_GPIO1_BASE OMAP1_IO_ADDRESS(0xfffbc000) | 73 | #define OMAP7XX_GPIO1_BASE 0xfffbc000 |
74 | #define OMAP730_GPIO2_BASE OMAP1_IO_ADDRESS(0xfffbc800) | 74 | #define OMAP7XX_GPIO2_BASE 0xfffbc800 |
75 | #define OMAP730_GPIO3_BASE OMAP1_IO_ADDRESS(0xfffbd000) | 75 | #define OMAP7XX_GPIO3_BASE 0xfffbd000 |
76 | #define OMAP730_GPIO4_BASE OMAP1_IO_ADDRESS(0xfffbd800) | 76 | #define OMAP7XX_GPIO4_BASE 0xfffbd800 |
77 | #define OMAP730_GPIO5_BASE OMAP1_IO_ADDRESS(0xfffbe000) | 77 | #define OMAP7XX_GPIO5_BASE 0xfffbe000 |
78 | #define OMAP730_GPIO6_BASE OMAP1_IO_ADDRESS(0xfffbe800) | 78 | #define OMAP7XX_GPIO6_BASE 0xfffbe800 |
79 | #define OMAP730_GPIO_DATA_INPUT 0x00 | 79 | #define OMAP7XX_GPIO_DATA_INPUT 0x00 |
80 | #define OMAP730_GPIO_DATA_OUTPUT 0x04 | 80 | #define OMAP7XX_GPIO_DATA_OUTPUT 0x04 |
81 | #define OMAP730_GPIO_DIR_CONTROL 0x08 | 81 | #define OMAP7XX_GPIO_DIR_CONTROL 0x08 |
82 | #define OMAP730_GPIO_INT_CONTROL 0x0c | 82 | #define OMAP7XX_GPIO_INT_CONTROL 0x0c |
83 | #define OMAP730_GPIO_INT_MASK 0x10 | 83 | #define OMAP7XX_GPIO_INT_MASK 0x10 |
84 | #define OMAP730_GPIO_INT_STATUS 0x14 | 84 | #define OMAP7XX_GPIO_INT_STATUS 0x14 |
85 | 85 | ||
86 | /* | 86 | #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE |
87 | * OMAP850 specific GPIO registers | ||
88 | */ | ||
89 | #define OMAP850_GPIO1_BASE OMAP1_IO_ADDRESS(0xfffbc000) | ||
90 | #define OMAP850_GPIO2_BASE OMAP1_IO_ADDRESS(0xfffbc800) | ||
91 | #define OMAP850_GPIO3_BASE OMAP1_IO_ADDRESS(0xfffbd000) | ||
92 | #define OMAP850_GPIO4_BASE OMAP1_IO_ADDRESS(0xfffbd800) | ||
93 | #define OMAP850_GPIO5_BASE OMAP1_IO_ADDRESS(0xfffbe000) | ||
94 | #define OMAP850_GPIO6_BASE OMAP1_IO_ADDRESS(0xfffbe800) | ||
95 | #define OMAP850_GPIO_DATA_INPUT 0x00 | ||
96 | #define OMAP850_GPIO_DATA_OUTPUT 0x04 | ||
97 | #define OMAP850_GPIO_DIR_CONTROL 0x08 | ||
98 | #define OMAP850_GPIO_INT_CONTROL 0x0c | ||
99 | #define OMAP850_GPIO_INT_MASK 0x10 | ||
100 | #define OMAP850_GPIO_INT_STATUS 0x14 | ||
101 | |||
102 | #define OMAP1_MPUIO_VBASE OMAP1_IO_ADDRESS(OMAP1_MPUIO_BASE) | ||
103 | 87 | ||
104 | /* | 88 | /* |
105 | * omap24xx specific GPIO registers | 89 | * omap24xx specific GPIO registers |
106 | */ | 90 | */ |
107 | #define OMAP242X_GPIO1_BASE OMAP2_IO_ADDRESS(0x48018000) | 91 | #define OMAP242X_GPIO1_BASE 0x48018000 |
108 | #define OMAP242X_GPIO2_BASE OMAP2_IO_ADDRESS(0x4801a000) | 92 | #define OMAP242X_GPIO2_BASE 0x4801a000 |
109 | #define OMAP242X_GPIO3_BASE OMAP2_IO_ADDRESS(0x4801c000) | 93 | #define OMAP242X_GPIO3_BASE 0x4801c000 |
110 | #define OMAP242X_GPIO4_BASE OMAP2_IO_ADDRESS(0x4801e000) | 94 | #define OMAP242X_GPIO4_BASE 0x4801e000 |
111 | 95 | ||
112 | #define OMAP243X_GPIO1_BASE OMAP2_IO_ADDRESS(0x4900C000) | 96 | #define OMAP243X_GPIO1_BASE 0x4900C000 |
113 | #define OMAP243X_GPIO2_BASE OMAP2_IO_ADDRESS(0x4900E000) | 97 | #define OMAP243X_GPIO2_BASE 0x4900E000 |
114 | #define OMAP243X_GPIO3_BASE OMAP2_IO_ADDRESS(0x49010000) | 98 | #define OMAP243X_GPIO3_BASE 0x49010000 |
115 | #define OMAP243X_GPIO4_BASE OMAP2_IO_ADDRESS(0x49012000) | 99 | #define OMAP243X_GPIO4_BASE 0x49012000 |
116 | #define OMAP243X_GPIO5_BASE OMAP2_IO_ADDRESS(0x480B6000) | 100 | #define OMAP243X_GPIO5_BASE 0x480B6000 |
117 | 101 | ||
118 | #define OMAP24XX_GPIO_REVISION 0x0000 | 102 | #define OMAP24XX_GPIO_REVISION 0x0000 |
119 | #define OMAP24XX_GPIO_SYSCONFIG 0x0010 | 103 | #define OMAP24XX_GPIO_SYSCONFIG 0x0010 |
@@ -170,24 +154,25 @@ | |||
170 | * omap34xx specific GPIO registers | 154 | * omap34xx specific GPIO registers |
171 | */ | 155 | */ |
172 | 156 | ||
173 | #define OMAP34XX_GPIO1_BASE OMAP2_IO_ADDRESS(0x48310000) | 157 | #define OMAP34XX_GPIO1_BASE 0x48310000 |
174 | #define OMAP34XX_GPIO2_BASE OMAP2_IO_ADDRESS(0x49050000) | 158 | #define OMAP34XX_GPIO2_BASE 0x49050000 |
175 | #define OMAP34XX_GPIO3_BASE OMAP2_IO_ADDRESS(0x49052000) | 159 | #define OMAP34XX_GPIO3_BASE 0x49052000 |
176 | #define OMAP34XX_GPIO4_BASE OMAP2_IO_ADDRESS(0x49054000) | 160 | #define OMAP34XX_GPIO4_BASE 0x49054000 |
177 | #define OMAP34XX_GPIO5_BASE OMAP2_IO_ADDRESS(0x49056000) | 161 | #define OMAP34XX_GPIO5_BASE 0x49056000 |
178 | #define OMAP34XX_GPIO6_BASE OMAP2_IO_ADDRESS(0x49058000) | 162 | #define OMAP34XX_GPIO6_BASE 0x49058000 |
179 | 163 | ||
180 | /* | 164 | /* |
181 | * OMAP44XX specific GPIO registers | 165 | * OMAP44XX specific GPIO registers |
182 | */ | 166 | */ |
183 | #define OMAP44XX_GPIO1_BASE OMAP2_IO_ADDRESS(0x4a310000) | 167 | #define OMAP44XX_GPIO1_BASE 0x4a310000 |
184 | #define OMAP44XX_GPIO2_BASE OMAP2_IO_ADDRESS(0x48055000) | 168 | #define OMAP44XX_GPIO2_BASE 0x48055000 |
185 | #define OMAP44XX_GPIO3_BASE OMAP2_IO_ADDRESS(0x48057000) | 169 | #define OMAP44XX_GPIO3_BASE 0x48057000 |
186 | #define OMAP44XX_GPIO4_BASE OMAP2_IO_ADDRESS(0x48059000) | 170 | #define OMAP44XX_GPIO4_BASE 0x48059000 |
187 | #define OMAP44XX_GPIO5_BASE OMAP2_IO_ADDRESS(0x4805B000) | 171 | #define OMAP44XX_GPIO5_BASE 0x4805B000 |
188 | #define OMAP44XX_GPIO6_BASE OMAP2_IO_ADDRESS(0x4805D000) | 172 | #define OMAP44XX_GPIO6_BASE 0x4805D000 |
189 | 173 | ||
190 | struct gpio_bank { | 174 | struct gpio_bank { |
175 | unsigned long pbase; | ||
191 | void __iomem *base; | 176 | void __iomem *base; |
192 | u16 irq; | 177 | u16 irq; |
193 | u16 virtual_irq_start; | 178 | u16 virtual_irq_start; |
@@ -215,96 +200,128 @@ struct gpio_bank { | |||
215 | #define METHOD_MPUIO 0 | 200 | #define METHOD_MPUIO 0 |
216 | #define METHOD_GPIO_1510 1 | 201 | #define METHOD_GPIO_1510 1 |
217 | #define METHOD_GPIO_1610 2 | 202 | #define METHOD_GPIO_1610 2 |
218 | #define METHOD_GPIO_730 3 | 203 | #define METHOD_GPIO_7XX 3 |
219 | #define METHOD_GPIO_850 4 | ||
220 | #define METHOD_GPIO_24XX 5 | 204 | #define METHOD_GPIO_24XX 5 |
221 | 205 | ||
222 | #ifdef CONFIG_ARCH_OMAP16XX | 206 | #ifdef CONFIG_ARCH_OMAP16XX |
223 | static struct gpio_bank gpio_bank_1610[5] = { | 207 | static struct gpio_bank gpio_bank_1610[5] = { |
224 | { OMAP1_MPUIO_VBASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO}, | 208 | { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE, |
225 | { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 }, | 209 | METHOD_MPUIO }, |
226 | { 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, |
227 | { OMAP1610_GPIO3_BASE, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32, METHOD_GPIO_1610 }, | 211 | METHOD_GPIO_1610 }, |
228 | { 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 }, | ||
229 | }; | 218 | }; |
230 | #endif | 219 | #endif |
231 | 220 | ||
232 | #ifdef CONFIG_ARCH_OMAP15XX | 221 | #ifdef CONFIG_ARCH_OMAP15XX |
233 | static struct gpio_bank gpio_bank_1510[2] = { | 222 | static struct gpio_bank gpio_bank_1510[2] = { |
234 | { OMAP1_MPUIO_VBASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO }, | 223 | { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE, |
235 | { 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 } | ||
236 | }; | 227 | }; |
237 | #endif | 228 | #endif |
238 | 229 | ||
239 | #ifdef CONFIG_ARCH_OMAP730 | 230 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
240 | static struct gpio_bank gpio_bank_730[7] = { | 231 | static struct gpio_bank gpio_bank_7xx[7] = { |
241 | { OMAP1_MPUIO_VBASE, INT_730_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO }, | 232 | { OMAP1_MPUIO_VBASE, NULL, INT_7XX_MPUIO, IH_MPUIO_BASE, |
242 | { OMAP730_GPIO1_BASE, INT_730_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_730 }, | 233 | METHOD_MPUIO }, |
243 | { OMAP730_GPIO2_BASE, INT_730_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_730 }, | 234 | { OMAP7XX_GPIO1_BASE, NULL, INT_7XX_GPIO_BANK1, IH_GPIO_BASE, |
244 | { OMAP730_GPIO3_BASE, INT_730_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_730 }, | 235 | METHOD_GPIO_7XX }, |
245 | { OMAP730_GPIO4_BASE, INT_730_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_730 }, | 236 | { OMAP7XX_GPIO2_BASE, NULL, INT_7XX_GPIO_BANK2, IH_GPIO_BASE + 32, |
246 | { OMAP730_GPIO5_BASE, INT_730_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_730 }, | 237 | METHOD_GPIO_7XX }, |
247 | { OMAP730_GPIO6_BASE, INT_730_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_730 }, | 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 }, | ||
248 | }; | 246 | }; |
249 | #endif | 247 | #endif |
250 | 248 | ||
251 | #ifdef CONFIG_ARCH_OMAP850 | ||
252 | static struct gpio_bank gpio_bank_850[7] = { | ||
253 | { OMAP1_MPUIO_VBASE, INT_850_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO }, | ||
254 | { OMAP850_GPIO1_BASE, INT_850_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_850 }, | ||
255 | { OMAP850_GPIO2_BASE, INT_850_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_850 }, | ||
256 | { OMAP850_GPIO3_BASE, INT_850_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_850 }, | ||
257 | { OMAP850_GPIO4_BASE, INT_850_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_850 }, | ||
258 | { OMAP850_GPIO5_BASE, INT_850_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_850 }, | ||
259 | { OMAP850_GPIO6_BASE, INT_850_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_850 }, | ||
260 | }; | ||
261 | #endif | ||
262 | |||
263 | |||
264 | #ifdef CONFIG_ARCH_OMAP24XX | 249 | #ifdef CONFIG_ARCH_OMAP24XX |
265 | 250 | ||
266 | static struct gpio_bank gpio_bank_242x[4] = { | 251 | static struct gpio_bank gpio_bank_242x[4] = { |
267 | { 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, |
268 | { OMAP242X_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX }, | 253 | METHOD_GPIO_24XX }, |
269 | { 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, |
270 | { 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 }, | ||
271 | }; | 260 | }; |
272 | 261 | ||
273 | static struct gpio_bank gpio_bank_243x[5] = { | 262 | static struct gpio_bank gpio_bank_243x[5] = { |
274 | { 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, |
275 | { OMAP243X_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX }, | 264 | METHOD_GPIO_24XX }, |
276 | { 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, |
277 | { OMAP243X_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX }, | 266 | METHOD_GPIO_24XX }, |
278 | { 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 }, | ||
279 | }; | 273 | }; |
280 | 274 | ||
281 | #endif | 275 | #endif |
282 | 276 | ||
283 | #ifdef CONFIG_ARCH_OMAP34XX | 277 | #ifdef CONFIG_ARCH_OMAP34XX |
284 | static struct gpio_bank gpio_bank_34xx[6] = { | 278 | static struct gpio_bank gpio_bank_34xx[6] = { |
285 | { 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, |
286 | { OMAP34XX_GPIO2_BASE, INT_34XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX }, | 280 | METHOD_GPIO_24XX }, |
287 | { 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, |
288 | { OMAP34XX_GPIO4_BASE, INT_34XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX }, | 282 | METHOD_GPIO_24XX }, |
289 | { 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, |
290 | { 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 }, | ||
291 | }; | ||
292 | |||
293 | struct omap3_gpio_regs { | ||
294 | u32 sysconfig; | ||
295 | u32 irqenable1; | ||
296 | u32 irqenable2; | ||
297 | u32 wake_en; | ||
298 | u32 ctrl; | ||
299 | u32 oe; | ||
300 | u32 leveldetect0; | ||
301 | u32 leveldetect1; | ||
302 | u32 risingdetect; | ||
303 | u32 fallingdetect; | ||
304 | u32 dataout; | ||
305 | u32 setwkuena; | ||
306 | u32 setdataout; | ||
291 | }; | 307 | }; |
292 | 308 | ||
309 | static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS]; | ||
293 | #endif | 310 | #endif |
294 | 311 | ||
295 | #ifdef CONFIG_ARCH_OMAP4 | 312 | #ifdef CONFIG_ARCH_OMAP4 |
296 | static struct gpio_bank gpio_bank_44xx[6] = { | 313 | static struct gpio_bank gpio_bank_44xx[6] = { |
297 | { OMAP44XX_GPIO1_BASE, INT_44XX_GPIO_BANK1, IH_GPIO_BASE, \ | 314 | { OMAP44XX_GPIO1_BASE, NULL, INT_44XX_GPIO_BANK1, IH_GPIO_BASE, |
298 | METHOD_GPIO_24XX }, | 315 | METHOD_GPIO_24XX }, |
299 | { OMAP44XX_GPIO2_BASE, INT_44XX_GPIO_BANK2, IH_GPIO_BASE + 32, \ | 316 | { OMAP44XX_GPIO2_BASE, NULL, INT_44XX_GPIO_BANK2, IH_GPIO_BASE + 32, |
300 | METHOD_GPIO_24XX }, | 317 | METHOD_GPIO_24XX }, |
301 | { OMAP44XX_GPIO3_BASE, INT_44XX_GPIO_BANK3, IH_GPIO_BASE + 64, \ | 318 | { OMAP44XX_GPIO3_BASE, NULL, INT_44XX_GPIO_BANK3, IH_GPIO_BASE + 64, |
302 | METHOD_GPIO_24XX }, | 319 | METHOD_GPIO_24XX }, |
303 | { OMAP44XX_GPIO4_BASE, INT_44XX_GPIO_BANK4, IH_GPIO_BASE + 96, \ | 320 | { OMAP44XX_GPIO4_BASE, NULL, INT_44XX_GPIO_BANK4, IH_GPIO_BASE + 96, |
304 | METHOD_GPIO_24XX }, | 321 | METHOD_GPIO_24XX }, |
305 | { OMAP44XX_GPIO5_BASE, INT_44XX_GPIO_BANK5, IH_GPIO_BASE + 128, \ | 322 | { OMAP44XX_GPIO5_BASE, NULL, INT_44XX_GPIO_BANK5, IH_GPIO_BASE + 128, |
306 | METHOD_GPIO_24XX }, | 323 | METHOD_GPIO_24XX }, |
307 | { OMAP44XX_GPIO6_BASE, INT_44XX_GPIO_BANK6, IH_GPIO_BASE + 160, \ | 324 | { OMAP44XX_GPIO6_BASE, NULL, INT_44XX_GPIO_BANK6, IH_GPIO_BASE + 160, |
308 | METHOD_GPIO_24XX }, | 325 | METHOD_GPIO_24XX }, |
309 | }; | 326 | }; |
310 | 327 | ||
@@ -402,14 +419,9 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input) | |||
402 | reg += OMAP1610_GPIO_DIRECTION; | 419 | reg += OMAP1610_GPIO_DIRECTION; |
403 | break; | 420 | break; |
404 | #endif | 421 | #endif |
405 | #ifdef CONFIG_ARCH_OMAP730 | 422 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
406 | case METHOD_GPIO_730: | 423 | case METHOD_GPIO_7XX: |
407 | reg += OMAP730_GPIO_DIR_CONTROL; | 424 | reg += OMAP7XX_GPIO_DIR_CONTROL; |
408 | break; | ||
409 | #endif | ||
410 | #ifdef CONFIG_ARCH_OMAP850 | ||
411 | case METHOD_GPIO_850: | ||
412 | reg += OMAP850_GPIO_DIR_CONTROL; | ||
413 | break; | 425 | break; |
414 | #endif | 426 | #endif |
415 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | 427 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) |
@@ -469,19 +481,9 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) | |||
469 | l = 1 << gpio; | 481 | l = 1 << gpio; |
470 | break; | 482 | break; |
471 | #endif | 483 | #endif |
472 | #ifdef CONFIG_ARCH_OMAP730 | 484 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
473 | case METHOD_GPIO_730: | 485 | case METHOD_GPIO_7XX: |
474 | reg += OMAP730_GPIO_DATA_OUTPUT; | 486 | reg += OMAP7XX_GPIO_DATA_OUTPUT; |
475 | l = __raw_readl(reg); | ||
476 | if (enable) | ||
477 | l |= 1 << gpio; | ||
478 | else | ||
479 | l &= ~(1 << gpio); | ||
480 | break; | ||
481 | #endif | ||
482 | #ifdef CONFIG_ARCH_OMAP850 | ||
483 | case METHOD_GPIO_850: | ||
484 | reg += OMAP850_GPIO_DATA_OUTPUT; | ||
485 | l = __raw_readl(reg); | 487 | l = __raw_readl(reg); |
486 | if (enable) | 488 | if (enable) |
487 | l |= 1 << gpio; | 489 | l |= 1 << gpio; |
@@ -537,14 +539,9 @@ static int _get_gpio_datain(struct gpio_bank *bank, int gpio) | |||
537 | reg += OMAP1610_GPIO_DATAIN; | 539 | reg += OMAP1610_GPIO_DATAIN; |
538 | break; | 540 | break; |
539 | #endif | 541 | #endif |
540 | #ifdef CONFIG_ARCH_OMAP730 | 542 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
541 | case METHOD_GPIO_730: | 543 | case METHOD_GPIO_7XX: |
542 | reg += OMAP730_GPIO_DATA_INPUT; | 544 | reg += OMAP7XX_GPIO_DATA_INPUT; |
543 | break; | ||
544 | #endif | ||
545 | #ifdef CONFIG_ARCH_OMAP850 | ||
546 | case METHOD_GPIO_850: | ||
547 | reg += OMAP850_GPIO_DATA_INPUT; | ||
548 | break; | 545 | break; |
549 | #endif | 546 | #endif |
550 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | 547 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) |
@@ -588,14 +585,9 @@ static int _get_gpio_dataout(struct gpio_bank *bank, int gpio) | |||
588 | reg += OMAP1610_GPIO_DATAOUT; | 585 | reg += OMAP1610_GPIO_DATAOUT; |
589 | break; | 586 | break; |
590 | #endif | 587 | #endif |
591 | #ifdef CONFIG_ARCH_OMAP730 | 588 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
592 | case METHOD_GPIO_730: | 589 | case METHOD_GPIO_7XX: |
593 | reg += OMAP730_GPIO_DATA_OUTPUT; | 590 | reg += OMAP7XX_GPIO_DATA_OUTPUT; |
594 | break; | ||
595 | #endif | ||
596 | #ifdef CONFIG_ARCH_OMAP850 | ||
597 | case METHOD_GPIO_850: | ||
598 | reg += OMAP850_GPIO_DATA_OUTPUT; | ||
599 | break; | 591 | break; |
600 | #endif | 592 | #endif |
601 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ | 593 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ |
@@ -797,21 +789,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) | |||
797 | __raw_writel(1 << gpio, bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA); | 789 | __raw_writel(1 << gpio, bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA); |
798 | break; | 790 | break; |
799 | #endif | 791 | #endif |
800 | #ifdef CONFIG_ARCH_OMAP730 | 792 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
801 | case METHOD_GPIO_730: | 793 | case METHOD_GPIO_7XX: |
802 | reg += OMAP730_GPIO_INT_CONTROL; | 794 | reg += OMAP7XX_GPIO_INT_CONTROL; |
803 | l = __raw_readl(reg); | ||
804 | if (trigger & IRQ_TYPE_EDGE_RISING) | ||
805 | l |= 1 << gpio; | ||
806 | else if (trigger & IRQ_TYPE_EDGE_FALLING) | ||
807 | l &= ~(1 << gpio); | ||
808 | else | ||
809 | goto bad; | ||
810 | break; | ||
811 | #endif | ||
812 | #ifdef CONFIG_ARCH_OMAP850 | ||
813 | case METHOD_GPIO_850: | ||
814 | reg += OMAP850_GPIO_INT_CONTROL; | ||
815 | l = __raw_readl(reg); | 795 | l = __raw_readl(reg); |
816 | if (trigger & IRQ_TYPE_EDGE_RISING) | 796 | if (trigger & IRQ_TYPE_EDGE_RISING) |
817 | l |= 1 << gpio; | 797 | l |= 1 << gpio; |
@@ -897,14 +877,9 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask) | |||
897 | reg += OMAP1610_GPIO_IRQSTATUS1; | 877 | reg += OMAP1610_GPIO_IRQSTATUS1; |
898 | break; | 878 | break; |
899 | #endif | 879 | #endif |
900 | #ifdef CONFIG_ARCH_OMAP730 | 880 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
901 | case METHOD_GPIO_730: | 881 | case METHOD_GPIO_7XX: |
902 | reg += OMAP730_GPIO_INT_STATUS; | 882 | reg += OMAP7XX_GPIO_INT_STATUS; |
903 | break; | ||
904 | #endif | ||
905 | #ifdef CONFIG_ARCH_OMAP850 | ||
906 | case METHOD_GPIO_850: | ||
907 | reg += OMAP850_GPIO_INT_STATUS; | ||
908 | break; | 883 | break; |
909 | #endif | 884 | #endif |
910 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | 885 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) |
@@ -971,16 +946,9 @@ static u32 _get_gpio_irqbank_mask(struct gpio_bank *bank) | |||
971 | mask = 0xffff; | 946 | mask = 0xffff; |
972 | break; | 947 | break; |
973 | #endif | 948 | #endif |
974 | #ifdef CONFIG_ARCH_OMAP730 | 949 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
975 | case METHOD_GPIO_730: | 950 | case METHOD_GPIO_7XX: |
976 | reg += OMAP730_GPIO_INT_MASK; | 951 | reg += OMAP7XX_GPIO_INT_MASK; |
977 | mask = 0xffffffff; | ||
978 | inv = 1; | ||
979 | break; | ||
980 | #endif | ||
981 | #ifdef CONFIG_ARCH_OMAP850 | ||
982 | case METHOD_GPIO_850: | ||
983 | reg += OMAP850_GPIO_INT_MASK; | ||
984 | mask = 0xffffffff; | 952 | mask = 0xffffffff; |
985 | inv = 1; | 953 | inv = 1; |
986 | break; | 954 | break; |
@@ -1044,19 +1012,9 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab | |||
1044 | l = gpio_mask; | 1012 | l = gpio_mask; |
1045 | break; | 1013 | break; |
1046 | #endif | 1014 | #endif |
1047 | #ifdef CONFIG_ARCH_OMAP730 | 1015 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
1048 | case METHOD_GPIO_730: | 1016 | case METHOD_GPIO_7XX: |
1049 | reg += OMAP730_GPIO_INT_MASK; | 1017 | reg += OMAP7XX_GPIO_INT_MASK; |
1050 | l = __raw_readl(reg); | ||
1051 | if (enable) | ||
1052 | l &= ~(gpio_mask); | ||
1053 | else | ||
1054 | l |= gpio_mask; | ||
1055 | break; | ||
1056 | #endif | ||
1057 | #ifdef CONFIG_ARCH_OMAP850 | ||
1058 | case METHOD_GPIO_850: | ||
1059 | reg += OMAP850_GPIO_INT_MASK; | ||
1060 | l = __raw_readl(reg); | 1018 | l = __raw_readl(reg); |
1061 | if (enable) | 1019 | if (enable) |
1062 | l &= ~(gpio_mask); | 1020 | l &= ~(gpio_mask); |
@@ -1249,13 +1207,9 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
1249 | if (bank->method == METHOD_GPIO_1610) | 1207 | if (bank->method == METHOD_GPIO_1610) |
1250 | isr_reg = bank->base + OMAP1610_GPIO_IRQSTATUS1; | 1208 | isr_reg = bank->base + OMAP1610_GPIO_IRQSTATUS1; |
1251 | #endif | 1209 | #endif |
1252 | #ifdef CONFIG_ARCH_OMAP730 | 1210 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
1253 | if (bank->method == METHOD_GPIO_730) | 1211 | if (bank->method == METHOD_GPIO_7XX) |
1254 | isr_reg = bank->base + OMAP730_GPIO_INT_STATUS; | 1212 | isr_reg = bank->base + OMAP7XX_GPIO_INT_STATUS; |
1255 | #endif | ||
1256 | #ifdef CONFIG_ARCH_OMAP850 | ||
1257 | if (bank->method == METHOD_GPIO_850) | ||
1258 | isr_reg = bank->base + OMAP850_GPIO_INT_STATUS; | ||
1259 | #endif | 1213 | #endif |
1260 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | 1214 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) |
1261 | if (bank->method == METHOD_GPIO_24XX) | 1215 | if (bank->method == METHOD_GPIO_24XX) |
@@ -1524,11 +1478,8 @@ static int gpio_is_input(struct gpio_bank *bank, int mask) | |||
1524 | case METHOD_GPIO_1610: | 1478 | case METHOD_GPIO_1610: |
1525 | reg += OMAP1610_GPIO_DIRECTION; | 1479 | reg += OMAP1610_GPIO_DIRECTION; |
1526 | break; | 1480 | break; |
1527 | case METHOD_GPIO_730: | 1481 | case METHOD_GPIO_7XX: |
1528 | reg += OMAP730_GPIO_DIR_CONTROL; | 1482 | reg += OMAP7XX_GPIO_DIR_CONTROL; |
1529 | break; | ||
1530 | case METHOD_GPIO_850: | ||
1531 | reg += OMAP850_GPIO_DIR_CONTROL; | ||
1532 | break; | 1483 | break; |
1533 | case METHOD_GPIO_24XX: | 1484 | case METHOD_GPIO_24XX: |
1534 | reg += OMAP24XX_GPIO_OE; | 1485 | reg += OMAP24XX_GPIO_OE; |
@@ -1607,6 +1558,23 @@ static struct clk * gpio5_fck; | |||
1607 | static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; | 1558 | static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; |
1608 | #endif | 1559 | #endif |
1609 | 1560 | ||
1561 | static void __init omap_gpio_show_rev(void) | ||
1562 | { | ||
1563 | u32 rev; | ||
1564 | |||
1565 | if (cpu_is_omap16xx()) | ||
1566 | rev = __raw_readw(gpio_bank[1].base + OMAP1610_GPIO_REVISION); | ||
1567 | else if (cpu_is_omap24xx() || cpu_is_omap34xx()) | ||
1568 | rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); | ||
1569 | else if (cpu_is_omap44xx()) | ||
1570 | rev = __raw_readl(gpio_bank[0].base + OMAP4_GPIO_REVISION); | ||
1571 | else | ||
1572 | return; | ||
1573 | |||
1574 | printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n", | ||
1575 | (rev >> 4) & 0x0f, rev & 0x0f); | ||
1576 | } | ||
1577 | |||
1610 | /* This lock class tells lockdep that GPIO irqs are in a different | 1578 | /* This lock class tells lockdep that GPIO irqs are in a different |
1611 | * category than their parents, so it won't report false recursion. | 1579 | * category than their parents, so it won't report false recursion. |
1612 | */ | 1580 | */ |
@@ -1617,6 +1585,7 @@ static int __init _omap_gpio_init(void) | |||
1617 | int i; | 1585 | int i; |
1618 | int gpio = 0; | 1586 | int gpio = 0; |
1619 | struct gpio_bank *bank; | 1587 | struct gpio_bank *bank; |
1588 | int bank_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */ | ||
1620 | char clk_name[11]; | 1589 | char clk_name[11]; |
1621 | 1590 | ||
1622 | initialized = 1; | 1591 | initialized = 1; |
@@ -1679,77 +1648,45 @@ static int __init _omap_gpio_init(void) | |||
1679 | 1648 | ||
1680 | #ifdef CONFIG_ARCH_OMAP15XX | 1649 | #ifdef CONFIG_ARCH_OMAP15XX |
1681 | if (cpu_is_omap15xx()) { | 1650 | if (cpu_is_omap15xx()) { |
1682 | printk(KERN_INFO "OMAP1510 GPIO hardware\n"); | ||
1683 | gpio_bank_count = 2; | 1651 | gpio_bank_count = 2; |
1684 | gpio_bank = gpio_bank_1510; | 1652 | gpio_bank = gpio_bank_1510; |
1653 | bank_size = SZ_2K; | ||
1685 | } | 1654 | } |
1686 | #endif | 1655 | #endif |
1687 | #if defined(CONFIG_ARCH_OMAP16XX) | 1656 | #if defined(CONFIG_ARCH_OMAP16XX) |
1688 | if (cpu_is_omap16xx()) { | 1657 | if (cpu_is_omap16xx()) { |
1689 | u32 rev; | ||
1690 | |||
1691 | gpio_bank_count = 5; | 1658 | gpio_bank_count = 5; |
1692 | gpio_bank = gpio_bank_1610; | 1659 | gpio_bank = gpio_bank_1610; |
1693 | rev = __raw_readw(gpio_bank[1].base + OMAP1610_GPIO_REVISION); | 1660 | bank_size = SZ_2K; |
1694 | printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n", | ||
1695 | (rev >> 4) & 0x0f, rev & 0x0f); | ||
1696 | } | 1661 | } |
1697 | #endif | 1662 | #endif |
1698 | #ifdef CONFIG_ARCH_OMAP730 | 1663 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
1699 | if (cpu_is_omap730()) { | 1664 | if (cpu_is_omap7xx()) { |
1700 | printk(KERN_INFO "OMAP730 GPIO hardware\n"); | ||
1701 | gpio_bank_count = 7; | ||
1702 | gpio_bank = gpio_bank_730; | ||
1703 | } | ||
1704 | #endif | ||
1705 | #ifdef CONFIG_ARCH_OMAP850 | ||
1706 | if (cpu_is_omap850()) { | ||
1707 | printk(KERN_INFO "OMAP850 GPIO hardware\n"); | ||
1708 | gpio_bank_count = 7; | 1665 | gpio_bank_count = 7; |
1709 | gpio_bank = gpio_bank_850; | 1666 | gpio_bank = gpio_bank_7xx; |
1667 | bank_size = SZ_2K; | ||
1710 | } | 1668 | } |
1711 | #endif | 1669 | #endif |
1712 | |||
1713 | #ifdef CONFIG_ARCH_OMAP24XX | 1670 | #ifdef CONFIG_ARCH_OMAP24XX |
1714 | if (cpu_is_omap242x()) { | 1671 | if (cpu_is_omap242x()) { |
1715 | int rev; | ||
1716 | |||
1717 | gpio_bank_count = 4; | 1672 | gpio_bank_count = 4; |
1718 | gpio_bank = gpio_bank_242x; | 1673 | gpio_bank = gpio_bank_242x; |
1719 | rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); | ||
1720 | printk(KERN_INFO "OMAP242x GPIO hardware version %d.%d\n", | ||
1721 | (rev >> 4) & 0x0f, rev & 0x0f); | ||
1722 | } | 1674 | } |
1723 | if (cpu_is_omap243x()) { | 1675 | if (cpu_is_omap243x()) { |
1724 | int rev; | ||
1725 | |||
1726 | gpio_bank_count = 5; | 1676 | gpio_bank_count = 5; |
1727 | gpio_bank = gpio_bank_243x; | 1677 | gpio_bank = gpio_bank_243x; |
1728 | rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); | ||
1729 | printk(KERN_INFO "OMAP243x GPIO hardware version %d.%d\n", | ||
1730 | (rev >> 4) & 0x0f, rev & 0x0f); | ||
1731 | } | 1678 | } |
1732 | #endif | 1679 | #endif |
1733 | #ifdef CONFIG_ARCH_OMAP34XX | 1680 | #ifdef CONFIG_ARCH_OMAP34XX |
1734 | if (cpu_is_omap34xx()) { | 1681 | if (cpu_is_omap34xx()) { |
1735 | int rev; | ||
1736 | |||
1737 | gpio_bank_count = OMAP34XX_NR_GPIOS; | 1682 | gpio_bank_count = OMAP34XX_NR_GPIOS; |
1738 | gpio_bank = gpio_bank_34xx; | 1683 | gpio_bank = gpio_bank_34xx; |
1739 | rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); | ||
1740 | printk(KERN_INFO "OMAP34xx GPIO hardware version %d.%d\n", | ||
1741 | (rev >> 4) & 0x0f, rev & 0x0f); | ||
1742 | } | 1684 | } |
1743 | #endif | 1685 | #endif |
1744 | #ifdef CONFIG_ARCH_OMAP4 | 1686 | #ifdef CONFIG_ARCH_OMAP4 |
1745 | if (cpu_is_omap44xx()) { | 1687 | if (cpu_is_omap44xx()) { |
1746 | int rev; | ||
1747 | |||
1748 | gpio_bank_count = OMAP34XX_NR_GPIOS; | 1688 | gpio_bank_count = OMAP34XX_NR_GPIOS; |
1749 | gpio_bank = gpio_bank_44xx; | 1689 | gpio_bank = gpio_bank_44xx; |
1750 | rev = __raw_readl(gpio_bank[0].base + OMAP4_GPIO_REVISION); | ||
1751 | printk(KERN_INFO "OMAP44xx GPIO hardware version %d.%d\n", | ||
1752 | (rev >> 4) & 0x0f, rev & 0x0f); | ||
1753 | } | 1690 | } |
1754 | #endif | 1691 | #endif |
1755 | for (i = 0; i < gpio_bank_count; i++) { | 1692 | for (i = 0; i < gpio_bank_count; i++) { |
@@ -1757,6 +1694,14 @@ static int __init _omap_gpio_init(void) | |||
1757 | 1694 | ||
1758 | bank = &gpio_bank[i]; | 1695 | bank = &gpio_bank[i]; |
1759 | spin_lock_init(&bank->lock); | 1696 | spin_lock_init(&bank->lock); |
1697 | |||
1698 | /* Static mapping, never released */ | ||
1699 | bank->base = ioremap(bank->pbase, bank_size); | ||
1700 | if (!bank->base) { | ||
1701 | printk(KERN_ERR "Could not ioremap gpio bank%i\n", i); | ||
1702 | continue; | ||
1703 | } | ||
1704 | |||
1760 | if (bank_is_mpuio(bank)) | 1705 | if (bank_is_mpuio(bank)) |
1761 | __raw_writew(0xffff, bank->base + OMAP_MPUIO_GPIO_MASKIT); | 1706 | __raw_writew(0xffff, bank->base + OMAP_MPUIO_GPIO_MASKIT); |
1762 | if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) { | 1707 | if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) { |
@@ -1768,11 +1713,11 @@ static int __init _omap_gpio_init(void) | |||
1768 | __raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1); | 1713 | __raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1); |
1769 | __raw_writew(0x0014, bank->base + OMAP1610_GPIO_SYSCONFIG); | 1714 | __raw_writew(0x0014, bank->base + OMAP1610_GPIO_SYSCONFIG); |
1770 | } | 1715 | } |
1771 | if (cpu_is_omap7xx() && bank->method == METHOD_GPIO_730) { | 1716 | if (cpu_is_omap7xx() && bank->method == METHOD_GPIO_7XX) { |
1772 | __raw_writel(0xffffffff, bank->base + OMAP730_GPIO_INT_MASK); | 1717 | __raw_writel(0xffffffff, bank->base + OMAP7XX_GPIO_INT_MASK); |
1773 | __raw_writel(0x00000000, bank->base + OMAP730_GPIO_INT_STATUS); | 1718 | __raw_writel(0x00000000, bank->base + OMAP7XX_GPIO_INT_STATUS); |
1774 | 1719 | ||
1775 | gpio_count = 32; /* 730 has 32-bit GPIOs */ | 1720 | gpio_count = 32; /* 7xx has 32-bit GPIOs */ |
1776 | } | 1721 | } |
1777 | 1722 | ||
1778 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ | 1723 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ |
@@ -1862,6 +1807,8 @@ static int __init _omap_gpio_init(void) | |||
1862 | if (cpu_is_omap34xx()) | 1807 | if (cpu_is_omap34xx()) |
1863 | omap_writel(1 << 0, 0x48306814); | 1808 | omap_writel(1 << 0, 0x48306814); |
1864 | 1809 | ||
1810 | omap_gpio_show_rev(); | ||
1811 | |||
1865 | return 0; | 1812 | return 0; |
1866 | } | 1813 | } |
1867 | 1814 | ||
@@ -2106,6 +2053,81 @@ void omap2_gpio_resume_after_retention(void) | |||
2106 | 2053 | ||
2107 | #endif | 2054 | #endif |
2108 | 2055 | ||
2056 | #ifdef CONFIG_ARCH_OMAP34XX | ||
2057 | /* save the registers of bank 2-6 */ | ||
2058 | void omap_gpio_save_context(void) | ||
2059 | { | ||
2060 | int i; | ||
2061 | |||
2062 | /* saving banks from 2-6 only since GPIO1 is in WKUP */ | ||
2063 | for (i = 1; i < gpio_bank_count; i++) { | ||
2064 | struct gpio_bank *bank = &gpio_bank[i]; | ||
2065 | gpio_context[i].sysconfig = | ||
2066 | __raw_readl(bank->base + OMAP24XX_GPIO_SYSCONFIG); | ||
2067 | gpio_context[i].irqenable1 = | ||
2068 | __raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE1); | ||
2069 | gpio_context[i].irqenable2 = | ||
2070 | __raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE2); | ||
2071 | gpio_context[i].wake_en = | ||
2072 | __raw_readl(bank->base + OMAP24XX_GPIO_WAKE_EN); | ||
2073 | gpio_context[i].ctrl = | ||
2074 | __raw_readl(bank->base + OMAP24XX_GPIO_CTRL); | ||
2075 | gpio_context[i].oe = | ||
2076 | __raw_readl(bank->base + OMAP24XX_GPIO_OE); | ||
2077 | gpio_context[i].leveldetect0 = | ||
2078 | __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0); | ||
2079 | gpio_context[i].leveldetect1 = | ||
2080 | __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1); | ||
2081 | gpio_context[i].risingdetect = | ||
2082 | __raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT); | ||
2083 | gpio_context[i].fallingdetect = | ||
2084 | __raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT); | ||
2085 | gpio_context[i].dataout = | ||
2086 | __raw_readl(bank->base + OMAP24XX_GPIO_DATAOUT); | ||
2087 | gpio_context[i].setwkuena = | ||
2088 | __raw_readl(bank->base + OMAP24XX_GPIO_SETWKUENA); | ||
2089 | gpio_context[i].setdataout = | ||
2090 | __raw_readl(bank->base + OMAP24XX_GPIO_SETDATAOUT); | ||
2091 | } | ||
2092 | } | ||
2093 | |||
2094 | /* restore the required registers of bank 2-6 */ | ||
2095 | void omap_gpio_restore_context(void) | ||
2096 | { | ||
2097 | int i; | ||
2098 | |||
2099 | for (i = 1; i < gpio_bank_count; i++) { | ||
2100 | struct gpio_bank *bank = &gpio_bank[i]; | ||
2101 | __raw_writel(gpio_context[i].sysconfig, | ||
2102 | bank->base + OMAP24XX_GPIO_SYSCONFIG); | ||
2103 | __raw_writel(gpio_context[i].irqenable1, | ||
2104 | bank->base + OMAP24XX_GPIO_IRQENABLE1); | ||
2105 | __raw_writel(gpio_context[i].irqenable2, | ||
2106 | bank->base + OMAP24XX_GPIO_IRQENABLE2); | ||
2107 | __raw_writel(gpio_context[i].wake_en, | ||
2108 | bank->base + OMAP24XX_GPIO_WAKE_EN); | ||
2109 | __raw_writel(gpio_context[i].ctrl, | ||
2110 | bank->base + OMAP24XX_GPIO_CTRL); | ||
2111 | __raw_writel(gpio_context[i].oe, | ||
2112 | bank->base + OMAP24XX_GPIO_OE); | ||
2113 | __raw_writel(gpio_context[i].leveldetect0, | ||
2114 | bank->base + OMAP24XX_GPIO_LEVELDETECT0); | ||
2115 | __raw_writel(gpio_context[i].leveldetect1, | ||
2116 | bank->base + OMAP24XX_GPIO_LEVELDETECT1); | ||
2117 | __raw_writel(gpio_context[i].risingdetect, | ||
2118 | bank->base + OMAP24XX_GPIO_RISINGDETECT); | ||
2119 | __raw_writel(gpio_context[i].fallingdetect, | ||
2120 | bank->base + OMAP24XX_GPIO_FALLINGDETECT); | ||
2121 | __raw_writel(gpio_context[i].dataout, | ||
2122 | bank->base + OMAP24XX_GPIO_DATAOUT); | ||
2123 | __raw_writel(gpio_context[i].setwkuena, | ||
2124 | bank->base + OMAP24XX_GPIO_SETWKUENA); | ||
2125 | __raw_writel(gpio_context[i].setdataout, | ||
2126 | bank->base + OMAP24XX_GPIO_SETDATAOUT); | ||
2127 | } | ||
2128 | } | ||
2129 | #endif | ||
2130 | |||
2109 | /* | 2131 | /* |
2110 | * This may get called early from board specific init | 2132 | * This may get called early from board specific init |
2111 | * for boards that have interrupts routed via FPGA. | 2133 | * for boards that have interrupts routed via FPGA. |
@@ -2160,8 +2182,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused) | |||
2160 | 2182 | ||
2161 | if (bank_is_mpuio(bank)) | 2183 | if (bank_is_mpuio(bank)) |
2162 | gpio = OMAP_MPUIO(0); | 2184 | gpio = OMAP_MPUIO(0); |
2163 | else if (cpu_class_is_omap2() || cpu_is_omap730() || | 2185 | else if (cpu_class_is_omap2() || cpu_is_omap7xx()) |
2164 | cpu_is_omap850()) | ||
2165 | bankwidth = 32; | 2186 | bankwidth = 32; |
2166 | 2187 | ||
2167 | for (j = 0; j < bankwidth; j++, gpio++, mask <<= 1) { | 2188 | for (j = 0; j < bankwidth; j++, gpio++, mask <<= 1) { |