diff options
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/debug-devices.c | 8 | ||||
-rw-r--r-- | arch/arm/plat-omap/debug-leds.c | 10 | ||||
-rw-r--r-- | arch/arm/plat-omap/devices.c | 225 | ||||
-rw-r--r-- | arch/arm/plat-omap/dma.c | 17 | ||||
-rw-r--r-- | arch/arm/plat-omap/dmtimer.c | 11 | ||||
-rw-r--r-- | arch/arm/plat-omap/gpio.c | 127 | ||||
-rw-r--r-- | arch/arm/plat-omap/i2c.c | 55 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/board-apollon.h | 4 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/board-h2.h | 6 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/board-ldp.h | 5 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/board.h | 22 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/control.h | 17 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/cpu.h | 82 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/gpio.h | 31 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/io.h | 6 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/memory.h | 17 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/mmc.h | 74 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/mux.h | 41 | ||||
-rw-r--r-- | arch/arm/plat-omap/sram.c | 3 |
20 files changed, 344 insertions, 419 deletions
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index a94f0c44ebc8..46d3b0b9ce69 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -14,9 +14,11 @@ config ARCH_OMAP1 | |||
14 | 14 | ||
15 | config ARCH_OMAP2 | 15 | config ARCH_OMAP2 |
16 | bool "TI OMAP2" | 16 | bool "TI OMAP2" |
17 | select CPU_V6 | ||
17 | 18 | ||
18 | config ARCH_OMAP3 | 19 | config ARCH_OMAP3 |
19 | bool "TI OMAP3" | 20 | bool "TI OMAP3" |
21 | select CPU_V7 | ||
20 | 22 | ||
21 | endchoice | 23 | endchoice |
22 | 24 | ||
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c index e31154b15d9e..f6684832ca8f 100644 --- a/arch/arm/plat-omap/debug-devices.c +++ b/arch/arm/plat-omap/debug-devices.c | |||
@@ -69,15 +69,15 @@ int __init debug_card_init(u32 addr, unsigned gpio) | |||
69 | smc91x_resources[0].start = addr + 0x300; | 69 | smc91x_resources[0].start = addr + 0x300; |
70 | smc91x_resources[0].end = addr + 0x30f; | 70 | smc91x_resources[0].end = addr + 0x30f; |
71 | 71 | ||
72 | smc91x_resources[1].start = OMAP_GPIO_IRQ(gpio); | 72 | smc91x_resources[1].start = gpio_to_irq(gpio); |
73 | smc91x_resources[1].end = OMAP_GPIO_IRQ(gpio); | 73 | smc91x_resources[1].end = gpio_to_irq(gpio); |
74 | 74 | ||
75 | status = omap_request_gpio(gpio); | 75 | status = gpio_request(gpio, "SMC91x irq"); |
76 | if (status < 0) { | 76 | if (status < 0) { |
77 | printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio); | 77 | printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio); |
78 | return status; | 78 | return status; |
79 | } | 79 | } |
80 | omap_set_gpio_direction(gpio, 1); | 80 | gpio_direction_input(gpio); |
81 | 81 | ||
82 | led_resources[0].start = addr; | 82 | led_resources[0].start = addr; |
83 | led_resources[0].end = addr + SZ_4K - 1; | 83 | led_resources[0].end = addr + SZ_4K - 1; |
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c index 2f4c0cabfd34..be4eefda4767 100644 --- a/arch/arm/plat-omap/debug-leds.c +++ b/arch/arm/plat-omap/debug-leds.c | |||
@@ -83,8 +83,8 @@ static void h2p2_dbg_leds_event(led_event_t evt) | |||
83 | /* all leds off during suspend or shutdown */ | 83 | /* all leds off during suspend or shutdown */ |
84 | 84 | ||
85 | if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) { | 85 | if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) { |
86 | omap_set_gpio_dataout(GPIO_TIMER, 0); | 86 | gpio_set_value(GPIO_TIMER, 0); |
87 | omap_set_gpio_dataout(GPIO_IDLE, 0); | 87 | gpio_set_value(GPIO_IDLE, 0); |
88 | } | 88 | } |
89 | 89 | ||
90 | __raw_writew(~0, &fpga->leds); | 90 | __raw_writew(~0, &fpga->leds); |
@@ -107,7 +107,7 @@ static void h2p2_dbg_leds_event(led_event_t evt) | |||
107 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | 107 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) |
108 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; | 108 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; |
109 | else { | 109 | else { |
110 | omap_set_gpio_dataout(GPIO_TIMER, | 110 | gpio_set_value(GPIO_TIMER, |
111 | led_state & LED_TIMER_ON); | 111 | led_state & LED_TIMER_ON); |
112 | goto done; | 112 | goto done; |
113 | } | 113 | } |
@@ -121,7 +121,7 @@ static void h2p2_dbg_leds_event(led_event_t evt) | |||
121 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | 121 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) |
122 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; | 122 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; |
123 | else { | 123 | else { |
124 | omap_set_gpio_dataout(GPIO_IDLE, 1); | 124 | gpio_set_value(GPIO_IDLE, 1); |
125 | goto done; | 125 | goto done; |
126 | } | 126 | } |
127 | 127 | ||
@@ -131,7 +131,7 @@ static void h2p2_dbg_leds_event(led_event_t evt) | |||
131 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | 131 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) |
132 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; | 132 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; |
133 | else { | 133 | else { |
134 | omap_set_gpio_dataout(GPIO_IDLE, 0); | 134 | gpio_set_value(GPIO_IDLE, 0); |
135 | goto done; | 135 | goto done; |
136 | } | 136 | } |
137 | 137 | ||
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index 0cb2b22388e9..ac15c23fd5da 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c | |||
@@ -192,202 +192,48 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, | |||
192 | 192 | ||
193 | /*-------------------------------------------------------------------------*/ | 193 | /*-------------------------------------------------------------------------*/ |
194 | 194 | ||
195 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ | 195 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ |
196 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) | 196 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) |
197 | 197 | ||
198 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | 198 | #define OMAP_MMC_NR_RES 2 |
199 | #define OMAP_MMC1_BASE 0x4809c000 | ||
200 | #define OMAP_MMC1_END (OMAP_MMC1_BASE + 0x1fc) | ||
201 | #define OMAP_MMC1_INT INT_24XX_MMC_IRQ | ||
202 | 199 | ||
203 | #define OMAP_MMC2_BASE 0x480b4000 | 200 | /* |
204 | #define OMAP_MMC2_END (OMAP_MMC2_BASE + 0x1fc) | 201 | * Register MMC devices. Called from mach-omap1 and mach-omap2 device init. |
205 | #define OMAP_MMC2_INT INT_24XX_MMC2_IRQ | 202 | */ |
206 | 203 | int __init omap_mmc_add(int id, unsigned long base, unsigned long size, | |
207 | #else | 204 | unsigned int irq, struct omap_mmc_platform_data *data) |
208 | |||
209 | #define OMAP_MMC1_BASE 0xfffb7800 | ||
210 | #define OMAP_MMC1_END (OMAP_MMC1_BASE + 0x7f) | ||
211 | #define OMAP_MMC1_INT INT_MMC | ||
212 | |||
213 | #define OMAP_MMC2_BASE 0xfffb7c00 /* omap16xx only */ | ||
214 | #define OMAP_MMC2_END (OMAP_MMC2_BASE + 0x7f) | ||
215 | #define OMAP_MMC2_INT INT_1610_MMC2 | ||
216 | |||
217 | #endif | ||
218 | |||
219 | static struct omap_mmc_platform_data mmc1_data; | ||
220 | |||
221 | static u64 mmc1_dmamask = 0xffffffff; | ||
222 | |||
223 | static struct resource mmc1_resources[] = { | ||
224 | { | ||
225 | .start = OMAP_MMC1_BASE, | ||
226 | .end = OMAP_MMC1_END, | ||
227 | .flags = IORESOURCE_MEM, | ||
228 | }, | ||
229 | { | ||
230 | .start = OMAP_MMC1_INT, | ||
231 | .flags = IORESOURCE_IRQ, | ||
232 | }, | ||
233 | }; | ||
234 | |||
235 | static struct platform_device mmc_omap_device1 = { | ||
236 | .name = "mmci-omap", | ||
237 | .id = 1, | ||
238 | .dev = { | ||
239 | .dma_mask = &mmc1_dmamask, | ||
240 | .platform_data = &mmc1_data, | ||
241 | }, | ||
242 | .num_resources = ARRAY_SIZE(mmc1_resources), | ||
243 | .resource = mmc1_resources, | ||
244 | }; | ||
245 | |||
246 | #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \ | ||
247 | defined(CONFIG_ARCH_OMAP34XX) | ||
248 | |||
249 | static struct omap_mmc_platform_data mmc2_data; | ||
250 | |||
251 | static u64 mmc2_dmamask = 0xffffffff; | ||
252 | |||
253 | static struct resource mmc2_resources[] = { | ||
254 | { | ||
255 | .start = OMAP_MMC2_BASE, | ||
256 | .end = OMAP_MMC2_END, | ||
257 | .flags = IORESOURCE_MEM, | ||
258 | }, | ||
259 | { | ||
260 | .start = OMAP_MMC2_INT, | ||
261 | .flags = IORESOURCE_IRQ, | ||
262 | }, | ||
263 | }; | ||
264 | |||
265 | static struct platform_device mmc_omap_device2 = { | ||
266 | .name = "mmci-omap", | ||
267 | .id = 2, | ||
268 | .dev = { | ||
269 | .dma_mask = &mmc2_dmamask, | ||
270 | .platform_data = &mmc2_data, | ||
271 | }, | ||
272 | .num_resources = ARRAY_SIZE(mmc2_resources), | ||
273 | .resource = mmc2_resources, | ||
274 | }; | ||
275 | #endif | ||
276 | |||
277 | static inline void omap_init_mmc_conf(const struct omap_mmc_config *mmc_conf) | ||
278 | { | ||
279 | if (cpu_is_omap2430() || cpu_is_omap34xx()) | ||
280 | return; | ||
281 | |||
282 | if (mmc_conf->mmc[0].enabled) { | ||
283 | if (cpu_is_omap24xx()) { | ||
284 | omap_cfg_reg(H18_24XX_MMC_CMD); | ||
285 | omap_cfg_reg(H15_24XX_MMC_CLKI); | ||
286 | omap_cfg_reg(G19_24XX_MMC_CLKO); | ||
287 | omap_cfg_reg(F20_24XX_MMC_DAT0); | ||
288 | omap_cfg_reg(F19_24XX_MMC_DAT_DIR0); | ||
289 | omap_cfg_reg(G18_24XX_MMC_CMD_DIR); | ||
290 | } else { | ||
291 | omap_cfg_reg(MMC_CMD); | ||
292 | omap_cfg_reg(MMC_CLK); | ||
293 | omap_cfg_reg(MMC_DAT0); | ||
294 | if (cpu_is_omap1710()) { | ||
295 | omap_cfg_reg(M15_1710_MMC_CLKI); | ||
296 | omap_cfg_reg(P19_1710_MMC_CMDDIR); | ||
297 | omap_cfg_reg(P20_1710_MMC_DATDIR0); | ||
298 | } | ||
299 | } | ||
300 | if (mmc_conf->mmc[0].wire4) { | ||
301 | if (cpu_is_omap24xx()) { | ||
302 | omap_cfg_reg(H14_24XX_MMC_DAT1); | ||
303 | omap_cfg_reg(E19_24XX_MMC_DAT2); | ||
304 | omap_cfg_reg(D19_24XX_MMC_DAT3); | ||
305 | omap_cfg_reg(E20_24XX_MMC_DAT_DIR1); | ||
306 | omap_cfg_reg(F18_24XX_MMC_DAT_DIR2); | ||
307 | omap_cfg_reg(E18_24XX_MMC_DAT_DIR3); | ||
308 | } else { | ||
309 | omap_cfg_reg(MMC_DAT1); | ||
310 | /* NOTE: DAT2 can be on W10 (here) or M15 */ | ||
311 | if (!mmc_conf->mmc[0].nomux) | ||
312 | omap_cfg_reg(MMC_DAT2); | ||
313 | omap_cfg_reg(MMC_DAT3); | ||
314 | } | ||
315 | } | ||
316 | } | ||
317 | |||
318 | #ifdef CONFIG_ARCH_OMAP16XX | ||
319 | /* block 2 is on newer chips, and has many pinout options */ | ||
320 | if (mmc_conf->mmc[1].enabled) { | ||
321 | if (!mmc_conf->mmc[1].nomux) { | ||
322 | omap_cfg_reg(Y8_1610_MMC2_CMD); | ||
323 | omap_cfg_reg(Y10_1610_MMC2_CLK); | ||
324 | omap_cfg_reg(R18_1610_MMC2_CLKIN); | ||
325 | omap_cfg_reg(W8_1610_MMC2_DAT0); | ||
326 | if (mmc_conf->mmc[1].wire4) { | ||
327 | omap_cfg_reg(V8_1610_MMC2_DAT1); | ||
328 | omap_cfg_reg(W15_1610_MMC2_DAT2); | ||
329 | omap_cfg_reg(R10_1610_MMC2_DAT3); | ||
330 | } | ||
331 | |||
332 | /* These are needed for the level shifter */ | ||
333 | omap_cfg_reg(V9_1610_MMC2_CMDDIR); | ||
334 | omap_cfg_reg(V5_1610_MMC2_DATDIR0); | ||
335 | omap_cfg_reg(W19_1610_MMC2_DATDIR1); | ||
336 | } | ||
337 | |||
338 | /* Feedback clock must be set on OMAP-1710 MMC2 */ | ||
339 | if (cpu_is_omap1710()) | ||
340 | omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24), | ||
341 | MOD_CONF_CTRL_1); | ||
342 | } | ||
343 | #endif | ||
344 | } | ||
345 | |||
346 | static void __init omap_init_mmc(void) | ||
347 | { | 205 | { |
348 | const struct omap_mmc_config *mmc_conf; | 206 | struct platform_device *pdev; |
349 | 207 | struct resource res[OMAP_MMC_NR_RES]; | |
350 | /* NOTE: assumes MMC was never (wrongly) enabled */ | 208 | int ret; |
351 | mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config); | 209 | |
352 | if (!mmc_conf) | 210 | pdev = platform_device_alloc("mmci-omap", id); |
353 | return; | 211 | if (!pdev) |
354 | 212 | return -ENOMEM; | |
355 | omap_init_mmc_conf(mmc_conf); | 213 | |
356 | 214 | memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource)); | |
357 | if (mmc_conf->mmc[0].enabled) { | 215 | res[0].start = base; |
358 | mmc1_data.conf = mmc_conf->mmc[0]; | 216 | res[0].end = base + size - 1; |
359 | (void) platform_device_register(&mmc_omap_device1); | 217 | res[0].flags = IORESOURCE_MEM; |
360 | } | 218 | res[1].start = res[1].end = irq; |
361 | 219 | res[1].flags = IORESOURCE_IRQ; | |
362 | #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \ | 220 | |
363 | defined(CONFIG_ARCH_OMAP34XX) | 221 | ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); |
364 | if (mmc_conf->mmc[1].enabled) { | 222 | if (ret == 0) |
365 | mmc2_data.conf = mmc_conf->mmc[1]; | 223 | ret = platform_device_add_data(pdev, data, sizeof(*data)); |
366 | (void) platform_device_register(&mmc_omap_device2); | 224 | if (ret) |
367 | } | 225 | goto fail; |
368 | #endif | 226 | |
369 | } | 227 | ret = platform_device_add(pdev); |
228 | if (ret) | ||
229 | goto fail; | ||
230 | return 0; | ||
370 | 231 | ||
371 | void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info) | 232 | fail: |
372 | { | 233 | platform_device_put(pdev); |
373 | switch (host) { | 234 | return ret; |
374 | case 1: | ||
375 | mmc1_data = *info; | ||
376 | break; | ||
377 | #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \ | ||
378 | defined(CONFIG_ARCH_OMAP34XX) | ||
379 | case 2: | ||
380 | mmc2_data = *info; | ||
381 | break; | ||
382 | #endif | ||
383 | default: | ||
384 | BUG(); | ||
385 | } | ||
386 | } | 235 | } |
387 | 236 | ||
388 | #else | ||
389 | static inline void omap_init_mmc(void) {} | ||
390 | void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info) {} | ||
391 | #endif | 237 | #endif |
392 | 238 | ||
393 | /*-------------------------------------------------------------------------*/ | 239 | /*-------------------------------------------------------------------------*/ |
@@ -532,7 +378,6 @@ static int __init omap_init_devices(void) | |||
532 | */ | 378 | */ |
533 | omap_init_dsp(); | 379 | omap_init_dsp(); |
534 | omap_init_kp(); | 380 | omap_init_kp(); |
535 | omap_init_mmc(); | ||
536 | omap_init_uwire(); | 381 | omap_init_uwire(); |
537 | omap_init_wdt(); | 382 | omap_init_wdt(); |
538 | omap_init_rng(); | 383 | omap_init_rng(); |
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index 50f8b4ad9a09..692d2b495af3 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | #include <asm/system.h> | 30 | #include <asm/system.h> |
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <asm/dma.h> | 32 | #include <mach/dma.h> |
33 | 33 | ||
34 | #include <mach/tc.h> | 34 | #include <mach/tc.h> |
35 | 35 | ||
@@ -1848,9 +1848,22 @@ static int omap2_dma_handle_ch(int ch) | |||
1848 | printk(KERN_INFO | 1848 | printk(KERN_INFO |
1849 | "DMA synchronization event drop occurred with device " | 1849 | "DMA synchronization event drop occurred with device " |
1850 | "%d\n", dma_chan[ch].dev_id); | 1850 | "%d\n", dma_chan[ch].dev_id); |
1851 | if (unlikely(status & OMAP2_DMA_TRANS_ERR_IRQ)) | 1851 | if (unlikely(status & OMAP2_DMA_TRANS_ERR_IRQ)) { |
1852 | printk(KERN_INFO "DMA transaction error with device %d\n", | 1852 | printk(KERN_INFO "DMA transaction error with device %d\n", |
1853 | dma_chan[ch].dev_id); | 1853 | dma_chan[ch].dev_id); |
1854 | if (cpu_class_is_omap2()) { | ||
1855 | /* Errata: sDMA Channel is not disabled | ||
1856 | * after a transaction error. So we explicitely | ||
1857 | * disable the channel | ||
1858 | */ | ||
1859 | u32 ccr; | ||
1860 | |||
1861 | ccr = dma_read(CCR(ch)); | ||
1862 | ccr &= ~OMAP_DMA_CCR_EN; | ||
1863 | dma_write(ccr, CCR(ch)); | ||
1864 | dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE; | ||
1865 | } | ||
1866 | } | ||
1854 | if (unlikely(status & OMAP2_DMA_SECURE_ERR_IRQ)) | 1867 | if (unlikely(status & OMAP2_DMA_SECURE_ERR_IRQ)) |
1855 | printk(KERN_INFO "DMA secure error with device %d\n", | 1868 | printk(KERN_INFO "DMA secure error with device %d\n", |
1856 | dma_chan[ch].dev_id); | 1869 | dma_chan[ch].dev_id); |
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 963c31cd1541..e4f0ce04ba92 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c | |||
@@ -539,10 +539,6 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, | |||
539 | omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); | 539 | omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); |
540 | omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); | 540 | omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); |
541 | 541 | ||
542 | /* REVISIT: hw feature, ttgr overtaking tldr? */ | ||
543 | while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))) | ||
544 | cpu_relax(); | ||
545 | |||
546 | omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); | 542 | omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); |
547 | } | 543 | } |
548 | 544 | ||
@@ -553,14 +549,15 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, | |||
553 | u32 l; | 549 | u32 l; |
554 | 550 | ||
555 | l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); | 551 | l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); |
556 | if (autoreload) | 552 | if (autoreload) { |
557 | l |= OMAP_TIMER_CTRL_AR; | 553 | l |= OMAP_TIMER_CTRL_AR; |
558 | else | 554 | omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); |
555 | } else { | ||
559 | l &= ~OMAP_TIMER_CTRL_AR; | 556 | l &= ~OMAP_TIMER_CTRL_AR; |
557 | } | ||
560 | l |= OMAP_TIMER_CTRL_ST; | 558 | l |= OMAP_TIMER_CTRL_ST; |
561 | 559 | ||
562 | omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load); | 560 | omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load); |
563 | omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); | ||
564 | omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); | 561 | omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); |
565 | } | 562 | } |
566 | 563 | ||
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 424049d83fbe..07b6968a7d16 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
@@ -152,6 +152,7 @@ struct gpio_bank { | |||
152 | u32 level_mask; | 152 | u32 level_mask; |
153 | spinlock_t lock; | 153 | spinlock_t lock; |
154 | struct gpio_chip chip; | 154 | struct gpio_chip chip; |
155 | struct clk *dbck; | ||
155 | }; | 156 | }; |
156 | 157 | ||
157 | #define METHOD_MPUIO 0 | 158 | #define METHOD_MPUIO 0 |
@@ -244,6 +245,8 @@ static inline struct gpio_bank *get_gpio_bank(int gpio) | |||
244 | return &gpio_bank[gpio >> 5]; | 245 | return &gpio_bank[gpio >> 5]; |
245 | if (cpu_is_omap34xx()) | 246 | if (cpu_is_omap34xx()) |
246 | return &gpio_bank[gpio >> 5]; | 247 | return &gpio_bank[gpio >> 5]; |
248 | BUG(); | ||
249 | return NULL; | ||
247 | } | 250 | } |
248 | 251 | ||
249 | static inline int get_gpio_index(int gpio) | 252 | static inline int get_gpio_index(int gpio) |
@@ -332,19 +335,6 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input) | |||
332 | __raw_writel(l, reg); | 335 | __raw_writel(l, reg); |
333 | } | 336 | } |
334 | 337 | ||
335 | void omap_set_gpio_direction(int gpio, int is_input) | ||
336 | { | ||
337 | struct gpio_bank *bank; | ||
338 | unsigned long flags; | ||
339 | |||
340 | if (check_gpio(gpio) < 0) | ||
341 | return; | ||
342 | bank = get_gpio_bank(gpio); | ||
343 | spin_lock_irqsave(&bank->lock, flags); | ||
344 | _set_gpio_direction(bank, get_gpio_index(gpio), is_input); | ||
345 | spin_unlock_irqrestore(&bank->lock, flags); | ||
346 | } | ||
347 | |||
348 | static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) | 338 | static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) |
349 | { | 339 | { |
350 | void __iomem *reg = bank->base; | 340 | void __iomem *reg = bank->base; |
@@ -406,20 +396,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) | |||
406 | __raw_writel(l, reg); | 396 | __raw_writel(l, reg); |
407 | } | 397 | } |
408 | 398 | ||
409 | void omap_set_gpio_dataout(int gpio, int enable) | 399 | static int __omap_get_gpio_datain(int gpio) |
410 | { | ||
411 | struct gpio_bank *bank; | ||
412 | unsigned long flags; | ||
413 | |||
414 | if (check_gpio(gpio) < 0) | ||
415 | return; | ||
416 | bank = get_gpio_bank(gpio); | ||
417 | spin_lock_irqsave(&bank->lock, flags); | ||
418 | _set_gpio_dataout(bank, get_gpio_index(gpio), enable); | ||
419 | spin_unlock_irqrestore(&bank->lock, flags); | ||
420 | } | ||
421 | |||
422 | int omap_get_gpio_datain(int gpio) | ||
423 | { | 400 | { |
424 | struct gpio_bank *bank; | 401 | struct gpio_bank *bank; |
425 | void __iomem *reg; | 402 | void __iomem *reg; |
@@ -473,6 +450,7 @@ void omap_set_gpio_debounce(int gpio, int enable) | |||
473 | { | 450 | { |
474 | struct gpio_bank *bank; | 451 | struct gpio_bank *bank; |
475 | void __iomem *reg; | 452 | void __iomem *reg; |
453 | unsigned long flags; | ||
476 | u32 val, l = 1 << get_gpio_index(gpio); | 454 | u32 val, l = 1 << get_gpio_index(gpio); |
477 | 455 | ||
478 | if (cpu_class_is_omap1()) | 456 | if (cpu_class_is_omap1()) |
@@ -480,16 +458,28 @@ void omap_set_gpio_debounce(int gpio, int enable) | |||
480 | 458 | ||
481 | bank = get_gpio_bank(gpio); | 459 | bank = get_gpio_bank(gpio); |
482 | reg = bank->base; | 460 | reg = bank->base; |
483 | |||
484 | reg += OMAP24XX_GPIO_DEBOUNCE_EN; | 461 | reg += OMAP24XX_GPIO_DEBOUNCE_EN; |
462 | |||
463 | spin_lock_irqsave(&bank->lock, flags); | ||
485 | val = __raw_readl(reg); | 464 | val = __raw_readl(reg); |
486 | 465 | ||
487 | if (enable) | 466 | if (enable && !(val & l)) |
488 | val |= l; | 467 | val |= l; |
489 | else | 468 | else if (!enable && (val & l)) |
490 | val &= ~l; | 469 | val &= ~l; |
470 | else | ||
471 | goto done; | ||
472 | |||
473 | if (cpu_is_omap34xx()) { | ||
474 | if (enable) | ||
475 | clk_enable(bank->dbck); | ||
476 | else | ||
477 | clk_disable(bank->dbck); | ||
478 | } | ||
491 | 479 | ||
492 | __raw_writel(val, reg); | 480 | __raw_writel(val, reg); |
481 | done: | ||
482 | spin_unlock_irqrestore(&bank->lock, flags); | ||
493 | } | 483 | } |
494 | EXPORT_SYMBOL(omap_set_gpio_debounce); | 484 | EXPORT_SYMBOL(omap_set_gpio_debounce); |
495 | 485 | ||
@@ -906,26 +896,17 @@ static int gpio_wake_enable(unsigned int irq, unsigned int enable) | |||
906 | return retval; | 896 | return retval; |
907 | } | 897 | } |
908 | 898 | ||
909 | int omap_request_gpio(int gpio) | 899 | static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) |
910 | { | 900 | { |
911 | struct gpio_bank *bank; | 901 | struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); |
912 | unsigned long flags; | 902 | unsigned long flags; |
913 | int status; | ||
914 | |||
915 | if (check_gpio(gpio) < 0) | ||
916 | return -EINVAL; | ||
917 | 903 | ||
918 | status = gpio_request(gpio, NULL); | ||
919 | if (status < 0) | ||
920 | return status; | ||
921 | |||
922 | bank = get_gpio_bank(gpio); | ||
923 | spin_lock_irqsave(&bank->lock, flags); | 904 | spin_lock_irqsave(&bank->lock, flags); |
924 | 905 | ||
925 | /* Set trigger to none. You need to enable the desired trigger with | 906 | /* Set trigger to none. You need to enable the desired trigger with |
926 | * request_irq() or set_irq_type(). | 907 | * request_irq() or set_irq_type(). |
927 | */ | 908 | */ |
928 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); | 909 | _set_gpio_triggering(bank, offset, IRQ_TYPE_NONE); |
929 | 910 | ||
930 | #ifdef CONFIG_ARCH_OMAP15XX | 911 | #ifdef CONFIG_ARCH_OMAP15XX |
931 | if (bank->method == METHOD_GPIO_1510) { | 912 | if (bank->method == METHOD_GPIO_1510) { |
@@ -933,7 +914,7 @@ int omap_request_gpio(int gpio) | |||
933 | 914 | ||
934 | /* Claim the pin for MPU */ | 915 | /* Claim the pin for MPU */ |
935 | reg = bank->base + OMAP1510_GPIO_PIN_CONTROL; | 916 | reg = bank->base + OMAP1510_GPIO_PIN_CONTROL; |
936 | __raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg); | 917 | __raw_writel(__raw_readl(reg) | (1 << offset), reg); |
937 | } | 918 | } |
938 | #endif | 919 | #endif |
939 | spin_unlock_irqrestore(&bank->lock, flags); | 920 | spin_unlock_irqrestore(&bank->lock, flags); |
@@ -941,39 +922,28 @@ int omap_request_gpio(int gpio) | |||
941 | return 0; | 922 | return 0; |
942 | } | 923 | } |
943 | 924 | ||
944 | void omap_free_gpio(int gpio) | 925 | static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) |
945 | { | 926 | { |
946 | struct gpio_bank *bank; | 927 | struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); |
947 | unsigned long flags; | 928 | unsigned long flags; |
948 | 929 | ||
949 | if (check_gpio(gpio) < 0) | ||
950 | return; | ||
951 | bank = get_gpio_bank(gpio); | ||
952 | spin_lock_irqsave(&bank->lock, flags); | 930 | spin_lock_irqsave(&bank->lock, flags); |
953 | if (unlikely(!gpiochip_is_requested(&bank->chip, | ||
954 | get_gpio_index(gpio)))) { | ||
955 | spin_unlock_irqrestore(&bank->lock, flags); | ||
956 | printk(KERN_ERR "omap-gpio: GPIO %d wasn't reserved!\n", gpio); | ||
957 | dump_stack(); | ||
958 | return; | ||
959 | } | ||
960 | #ifdef CONFIG_ARCH_OMAP16XX | 931 | #ifdef CONFIG_ARCH_OMAP16XX |
961 | if (bank->method == METHOD_GPIO_1610) { | 932 | if (bank->method == METHOD_GPIO_1610) { |
962 | /* Disable wake-up during idle for dynamic tick */ | 933 | /* Disable wake-up during idle for dynamic tick */ |
963 | void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; | 934 | void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; |
964 | __raw_writel(1 << get_gpio_index(gpio), reg); | 935 | __raw_writel(1 << offset, reg); |
965 | } | 936 | } |
966 | #endif | 937 | #endif |
967 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | 938 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) |
968 | if (bank->method == METHOD_GPIO_24XX) { | 939 | if (bank->method == METHOD_GPIO_24XX) { |
969 | /* Disable wake-up during idle for dynamic tick */ | 940 | /* Disable wake-up during idle for dynamic tick */ |
970 | void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA; | 941 | void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA; |
971 | __raw_writel(1 << get_gpio_index(gpio), reg); | 942 | __raw_writel(1 << offset, reg); |
972 | } | 943 | } |
973 | #endif | 944 | #endif |
974 | _reset_gpio(bank, gpio); | 945 | _reset_gpio(bank, bank->chip.base + offset); |
975 | spin_unlock_irqrestore(&bank->lock, flags); | 946 | spin_unlock_irqrestore(&bank->lock, flags); |
976 | gpio_free(gpio); | ||
977 | } | 947 | } |
978 | 948 | ||
979 | /* | 949 | /* |
@@ -1252,7 +1222,7 @@ static int gpio_input(struct gpio_chip *chip, unsigned offset) | |||
1252 | 1222 | ||
1253 | static int gpio_get(struct gpio_chip *chip, unsigned offset) | 1223 | static int gpio_get(struct gpio_chip *chip, unsigned offset) |
1254 | { | 1224 | { |
1255 | return omap_get_gpio_datain(chip->base + offset); | 1225 | return __omap_get_gpio_datain(chip->base + offset); |
1256 | } | 1226 | } |
1257 | 1227 | ||
1258 | static int gpio_output(struct gpio_chip *chip, unsigned offset, int value) | 1228 | static int gpio_output(struct gpio_chip *chip, unsigned offset, int value) |
@@ -1279,6 +1249,14 @@ static void gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
1279 | spin_unlock_irqrestore(&bank->lock, flags); | 1249 | spin_unlock_irqrestore(&bank->lock, flags); |
1280 | } | 1250 | } |
1281 | 1251 | ||
1252 | static int gpio_2irq(struct gpio_chip *chip, unsigned offset) | ||
1253 | { | ||
1254 | struct gpio_bank *bank; | ||
1255 | |||
1256 | bank = container_of(chip, struct gpio_bank, chip); | ||
1257 | return bank->virtual_irq_start + offset; | ||
1258 | } | ||
1259 | |||
1282 | /*---------------------------------------------------------------------*/ | 1260 | /*---------------------------------------------------------------------*/ |
1283 | 1261 | ||
1284 | static int initialized; | 1262 | static int initialized; |
@@ -1296,7 +1274,6 @@ static struct clk * gpio5_fck; | |||
1296 | #endif | 1274 | #endif |
1297 | 1275 | ||
1298 | #if defined(CONFIG_ARCH_OMAP3) | 1276 | #if defined(CONFIG_ARCH_OMAP3) |
1299 | static struct clk *gpio_fclks[OMAP34XX_NR_GPIOS]; | ||
1300 | static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; | 1277 | static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; |
1301 | #endif | 1278 | #endif |
1302 | 1279 | ||
@@ -1310,9 +1287,7 @@ static int __init _omap_gpio_init(void) | |||
1310 | int i; | 1287 | int i; |
1311 | int gpio = 0; | 1288 | int gpio = 0; |
1312 | struct gpio_bank *bank; | 1289 | struct gpio_bank *bank; |
1313 | #if defined(CONFIG_ARCH_OMAP3) | ||
1314 | char clk_name[11]; | 1290 | char clk_name[11]; |
1315 | #endif | ||
1316 | 1291 | ||
1317 | initialized = 1; | 1292 | initialized = 1; |
1318 | 1293 | ||
@@ -1367,12 +1342,6 @@ static int __init _omap_gpio_init(void) | |||
1367 | printk(KERN_ERR "Could not get %s\n", clk_name); | 1342 | printk(KERN_ERR "Could not get %s\n", clk_name); |
1368 | else | 1343 | else |
1369 | clk_enable(gpio_iclks[i]); | 1344 | clk_enable(gpio_iclks[i]); |
1370 | sprintf(clk_name, "gpio%d_fck", i + 1); | ||
1371 | gpio_fclks[i] = clk_get(NULL, clk_name); | ||
1372 | if (IS_ERR(gpio_fclks[i])) | ||
1373 | printk(KERN_ERR "Could not get %s\n", clk_name); | ||
1374 | else | ||
1375 | clk_enable(gpio_fclks[i]); | ||
1376 | } | 1345 | } |
1377 | } | 1346 | } |
1378 | #endif | 1347 | #endif |
@@ -1479,10 +1448,13 @@ static int __init _omap_gpio_init(void) | |||
1479 | /* REVISIT eventually switch from OMAP-specific gpio structs | 1448 | /* REVISIT eventually switch from OMAP-specific gpio structs |
1480 | * over to the generic ones | 1449 | * over to the generic ones |
1481 | */ | 1450 | */ |
1451 | bank->chip.request = omap_gpio_request; | ||
1452 | bank->chip.free = omap_gpio_free; | ||
1482 | bank->chip.direction_input = gpio_input; | 1453 | bank->chip.direction_input = gpio_input; |
1483 | bank->chip.get = gpio_get; | 1454 | bank->chip.get = gpio_get; |
1484 | bank->chip.direction_output = gpio_output; | 1455 | bank->chip.direction_output = gpio_output; |
1485 | bank->chip.set = gpio_set; | 1456 | bank->chip.set = gpio_set; |
1457 | bank->chip.to_irq = gpio_2irq; | ||
1486 | if (bank_is_mpuio(bank)) { | 1458 | if (bank_is_mpuio(bank)) { |
1487 | bank->chip.label = "mpuio"; | 1459 | bank->chip.label = "mpuio"; |
1488 | #ifdef CONFIG_ARCH_OMAP16XX | 1460 | #ifdef CONFIG_ARCH_OMAP16XX |
@@ -1511,6 +1483,13 @@ static int __init _omap_gpio_init(void) | |||
1511 | } | 1483 | } |
1512 | set_irq_chained_handler(bank->irq, gpio_irq_handler); | 1484 | set_irq_chained_handler(bank->irq, gpio_irq_handler); |
1513 | set_irq_data(bank->irq, bank); | 1485 | set_irq_data(bank->irq, bank); |
1486 | |||
1487 | if (cpu_is_omap34xx()) { | ||
1488 | sprintf(clk_name, "gpio%d_dbck", i + 1); | ||
1489 | bank->dbck = clk_get(NULL, clk_name); | ||
1490 | if (IS_ERR(bank->dbck)) | ||
1491 | printk(KERN_ERR "Could not get %s\n", clk_name); | ||
1492 | } | ||
1514 | } | 1493 | } |
1515 | 1494 | ||
1516 | /* Enable system clock for GPIO module. | 1495 | /* Enable system clock for GPIO module. |
@@ -1739,12 +1718,6 @@ static int __init omap_gpio_sysinit(void) | |||
1739 | return ret; | 1718 | return ret; |
1740 | } | 1719 | } |
1741 | 1720 | ||
1742 | EXPORT_SYMBOL(omap_request_gpio); | ||
1743 | EXPORT_SYMBOL(omap_free_gpio); | ||
1744 | EXPORT_SYMBOL(omap_set_gpio_direction); | ||
1745 | EXPORT_SYMBOL(omap_set_gpio_dataout); | ||
1746 | EXPORT_SYMBOL(omap_get_gpio_datain); | ||
1747 | |||
1748 | arch_initcall(omap_gpio_sysinit); | 1721 | arch_initcall(omap_gpio_sysinit); |
1749 | 1722 | ||
1750 | 1723 | ||
@@ -1801,14 +1774,14 @@ static int dbg_gpio_show(struct seq_file *s, void *unused) | |||
1801 | continue; | 1774 | continue; |
1802 | 1775 | ||
1803 | irq = bank->virtual_irq_start + j; | 1776 | irq = bank->virtual_irq_start + j; |
1804 | value = omap_get_gpio_datain(gpio); | 1777 | value = gpio_get_value(gpio); |
1805 | is_in = gpio_is_input(bank, mask); | 1778 | is_in = gpio_is_input(bank, mask); |
1806 | 1779 | ||
1807 | if (bank_is_mpuio(bank)) | 1780 | if (bank_is_mpuio(bank)) |
1808 | seq_printf(s, "MPUIO %2d ", j); | 1781 | seq_printf(s, "MPUIO %2d ", j); |
1809 | else | 1782 | else |
1810 | seq_printf(s, "GPIO %3d ", gpio); | 1783 | seq_printf(s, "GPIO %3d ", gpio); |
1811 | seq_printf(s, "(%10s): %s %s", | 1784 | seq_printf(s, "(%-20.20s): %s %s", |
1812 | label, | 1785 | label, |
1813 | is_in ? "in " : "out", | 1786 | is_in ? "in " : "out", |
1814 | value ? "hi" : "lo"); | 1787 | value ? "hi" : "lo"); |
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index 0e6d147ab6f8..89a6ab0b7db8 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c | |||
@@ -79,26 +79,43 @@ static struct platform_device omap_i2c_devices[] = { | |||
79 | #endif | 79 | #endif |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static void __init omap_i2c_mux_pins(int bus_id) | 82 | #if defined(CONFIG_ARCH_OMAP24XX) |
83 | static const int omap24xx_pins[][2] = { | ||
84 | { M19_24XX_I2C1_SCL, L15_24XX_I2C1_SDA }, | ||
85 | { J15_24XX_I2C2_SCL, H19_24XX_I2C2_SDA }, | ||
86 | }; | ||
87 | #else | ||
88 | static const int omap24xx_pins[][2] = {}; | ||
89 | #endif | ||
90 | #if defined(CONFIG_ARCH_OMAP34XX) | ||
91 | static const int omap34xx_pins[][2] = { | ||
92 | { K21_34XX_I2C1_SCL, J21_34XX_I2C1_SDA}, | ||
93 | { AF15_34XX_I2C2_SCL, AE15_34XX_I2C2_SDA}, | ||
94 | { AF14_34XX_I2C3_SCL, AG14_34XX_I2C3_SDA}, | ||
95 | }; | ||
96 | #else | ||
97 | static const int omap34xx_pins[][2] = {}; | ||
98 | #endif | ||
99 | |||
100 | static void __init omap_i2c_mux_pins(int bus) | ||
83 | { | 101 | { |
84 | /* TODO: Muxing for OMAP3 */ | 102 | int scl, sda; |
85 | switch (bus_id) { | 103 | |
86 | case 1: | 104 | if (cpu_class_is_omap1()) { |
87 | if (cpu_class_is_omap1()) { | 105 | scl = I2C_SCL; |
88 | omap_cfg_reg(I2C_SCL); | 106 | sda = I2C_SDA; |
89 | omap_cfg_reg(I2C_SDA); | 107 | } else if (cpu_is_omap24xx()) { |
90 | } else if (cpu_is_omap24xx()) { | 108 | scl = omap24xx_pins[bus][0]; |
91 | omap_cfg_reg(M19_24XX_I2C1_SCL); | 109 | sda = omap24xx_pins[bus][1]; |
92 | omap_cfg_reg(L15_24XX_I2C1_SDA); | 110 | } else if (cpu_is_omap34xx()) { |
93 | } | 111 | scl = omap34xx_pins[bus][0]; |
94 | break; | 112 | sda = omap34xx_pins[bus][1]; |
95 | case 2: | 113 | } else { |
96 | if (cpu_is_omap24xx()) { | 114 | return; |
97 | omap_cfg_reg(J15_24XX_I2C2_SCL); | ||
98 | omap_cfg_reg(H19_24XX_I2C2_SDA); | ||
99 | } | ||
100 | break; | ||
101 | } | 115 | } |
116 | |||
117 | omap_cfg_reg(sda); | ||
118 | omap_cfg_reg(scl); | ||
102 | } | 119 | } |
103 | 120 | ||
104 | int __init omap_register_i2c_bus(int bus_id, u32 clkrate, | 121 | int __init omap_register_i2c_bus(int bus_id, u32 clkrate, |
@@ -142,6 +159,6 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate, | |||
142 | res[1].start = irq; | 159 | res[1].start = irq; |
143 | } | 160 | } |
144 | 161 | ||
145 | omap_i2c_mux_pins(bus_id); | 162 | omap_i2c_mux_pins(bus_id - 1); |
146 | return platform_device_register(pdev); | 163 | return platform_device_register(pdev); |
147 | } | 164 | } |
diff --git a/arch/arm/plat-omap/include/mach/board-apollon.h b/arch/arm/plat-omap/include/mach/board-apollon.h index 731c858cf3fe..61bd5e8f09b1 100644 --- a/arch/arm/plat-omap/include/mach/board-apollon.h +++ b/arch/arm/plat-omap/include/mach/board-apollon.h | |||
@@ -29,12 +29,14 @@ | |||
29 | #ifndef __ASM_ARCH_OMAP_APOLLON_H | 29 | #ifndef __ASM_ARCH_OMAP_APOLLON_H |
30 | #define __ASM_ARCH_OMAP_APOLLON_H | 30 | #define __ASM_ARCH_OMAP_APOLLON_H |
31 | 31 | ||
32 | #include <mach/cpu.h> | ||
33 | |||
32 | extern void apollon_mmc_init(void); | 34 | extern void apollon_mmc_init(void); |
33 | 35 | ||
34 | static inline int apollon_plus(void) | 36 | static inline int apollon_plus(void) |
35 | { | 37 | { |
36 | /* The apollon plus has IDCODE revision 5 */ | 38 | /* The apollon plus has IDCODE revision 5 */ |
37 | return system_rev & 0xc0; | 39 | return omap_rev() & 0xc0; |
38 | } | 40 | } |
39 | 41 | ||
40 | /* Placeholder for APOLLON specific defines */ | 42 | /* Placeholder for APOLLON specific defines */ |
diff --git a/arch/arm/plat-omap/include/mach/board-h2.h b/arch/arm/plat-omap/include/mach/board-h2.h index 2a050e9be65f..15531c8dc0e6 100644 --- a/arch/arm/plat-omap/include/mach/board-h2.h +++ b/arch/arm/plat-omap/include/mach/board-h2.h | |||
@@ -29,13 +29,13 @@ | |||
29 | #ifndef __ASM_ARCH_OMAP_H2_H | 29 | #ifndef __ASM_ARCH_OMAP_H2_H |
30 | #define __ASM_ARCH_OMAP_H2_H | 30 | #define __ASM_ARCH_OMAP_H2_H |
31 | 31 | ||
32 | /* Placeholder for H2 specific defines */ | ||
33 | |||
34 | /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ | 32 | /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ |
35 | #define OMAP1610_ETHR_START 0x04000300 | 33 | #define OMAP1610_ETHR_START 0x04000300 |
36 | 34 | ||
35 | #define H2_TPS_GPIO_BASE (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */) | ||
36 | # define H2_TPS_GPIO_MMC_PWR_EN (H2_TPS_GPIO_BASE + 3) | ||
37 | |||
37 | extern void h2_mmc_init(void); | 38 | extern void h2_mmc_init(void); |
38 | extern void h2_mmc_slot_cover_handler(void *arg, int state); | ||
39 | 39 | ||
40 | #endif /* __ASM_ARCH_OMAP_H2_H */ | 40 | #endif /* __ASM_ARCH_OMAP_H2_H */ |
41 | 41 | ||
diff --git a/arch/arm/plat-omap/include/mach/board-ldp.h b/arch/arm/plat-omap/include/mach/board-ldp.h index 66e2746c04ca..f23399665212 100644 --- a/arch/arm/plat-omap/include/mach/board-ldp.h +++ b/arch/arm/plat-omap/include/mach/board-ldp.h | |||
@@ -32,5 +32,8 @@ | |||
32 | extern void twl4030_bci_battery_init(void); | 32 | extern void twl4030_bci_battery_init(void); |
33 | 33 | ||
34 | #define TWL4030_IRQNUM INT_34XX_SYS_NIRQ | 34 | #define TWL4030_IRQNUM INT_34XX_SYS_NIRQ |
35 | 35 | #define LDP_SMC911X_CS 1 | |
36 | #define LDP_SMC911X_GPIO 152 | ||
37 | #define DEBUG_BASE 0x08000000 | ||
38 | #define OMAP34XX_ETHR_START DEBUG_BASE | ||
36 | #endif /* __ASM_ARCH_OMAP_LDP_H */ | 39 | #endif /* __ASM_ARCH_OMAP_LDP_H */ |
diff --git a/arch/arm/plat-omap/include/mach/board.h b/arch/arm/plat-omap/include/mach/board.h index c23c12ccb353..9466772fc7c8 100644 --- a/arch/arm/plat-omap/include/mach/board.h +++ b/arch/arm/plat-omap/include/mach/board.h | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | /* Different peripheral ids */ | 17 | /* Different peripheral ids */ |
18 | #define OMAP_TAG_CLOCK 0x4f01 | 18 | #define OMAP_TAG_CLOCK 0x4f01 |
19 | #define OMAP_TAG_MMC 0x4f02 | ||
20 | #define OMAP_TAG_SERIAL_CONSOLE 0x4f03 | 19 | #define OMAP_TAG_SERIAL_CONSOLE 0x4f03 |
21 | #define OMAP_TAG_USB 0x4f04 | 20 | #define OMAP_TAG_USB 0x4f04 |
22 | #define OMAP_TAG_LCD 0x4f05 | 21 | #define OMAP_TAG_LCD 0x4f05 |
@@ -35,27 +34,6 @@ struct omap_clock_config { | |||
35 | u8 system_clock_type; | 34 | u8 system_clock_type; |
36 | }; | 35 | }; |
37 | 36 | ||
38 | struct omap_mmc_conf { | ||
39 | unsigned enabled:1; | ||
40 | /* nomux means "standard" muxing is wrong on this board, and that | ||
41 | * board-specific code handled it before common init logic. | ||
42 | */ | ||
43 | unsigned nomux:1; | ||
44 | /* switch pin can be for card detect (default) or card cover */ | ||
45 | unsigned cover:1; | ||
46 | /* 4 wire signaling is optional, and is only used for SD/SDIO */ | ||
47 | unsigned wire4:1; | ||
48 | /* use the internal clock */ | ||
49 | unsigned internal_clock:1; | ||
50 | s16 power_pin; | ||
51 | s16 switch_pin; | ||
52 | s16 wp_pin; | ||
53 | }; | ||
54 | |||
55 | struct omap_mmc_config { | ||
56 | struct omap_mmc_conf mmc[2]; | ||
57 | }; | ||
58 | |||
59 | struct omap_serial_console_config { | 37 | struct omap_serial_console_config { |
60 | u8 console_uart; | 38 | u8 console_uart; |
61 | u32 console_speed; | 39 | u32 console_speed; |
diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h index dc9886760577..269147f3836f 100644 --- a/arch/arm/plat-omap/include/mach/control.h +++ b/arch/arm/plat-omap/include/mach/control.h | |||
@@ -74,6 +74,7 @@ | |||
74 | #define OMAP243X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) | 74 | #define OMAP243X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) |
75 | #define OMAP243X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) | 75 | #define OMAP243X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) |
76 | #define OMAP243X_CONTROL_IVA2_GEMCFG (OMAP2_CONTROL_GENERAL + 0x0198) | 76 | #define OMAP243X_CONTROL_IVA2_GEMCFG (OMAP2_CONTROL_GENERAL + 0x0198) |
77 | #define OMAP243X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x0230) | ||
77 | 78 | ||
78 | /* 24xx-only CONTROL_GENERAL register offsets */ | 79 | /* 24xx-only CONTROL_GENERAL register offsets */ |
79 | #define OMAP24XX_CONTROL_DEBOBS (OMAP2_CONTROL_GENERAL + 0x0000) | 80 | #define OMAP24XX_CONTROL_DEBOBS (OMAP2_CONTROL_GENERAL + 0x0000) |
@@ -140,6 +141,7 @@ | |||
140 | #define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc) | 141 | #define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc) |
141 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) | 142 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) |
142 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) | 143 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) |
144 | #define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02b0) | ||
143 | #define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02b4) | 145 | #define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02b4) |
144 | 146 | ||
145 | /* | 147 | /* |
@@ -154,11 +156,14 @@ | |||
154 | * and the security mode (secure, non-secure, don't care) | 156 | * and the security mode (secure, non-secure, don't care) |
155 | */ | 157 | */ |
156 | /* CONTROL_DEVCONF0 bits */ | 158 | /* CONTROL_DEVCONF0 bits */ |
159 | #define OMAP2_MMCSDIO1ADPCLKISEL (1 << 24) /* MMC1 loop back clock */ | ||
157 | #define OMAP24XX_USBSTANDBYCTRL (1 << 15) | 160 | #define OMAP24XX_USBSTANDBYCTRL (1 << 15) |
158 | #define OMAP2_MCBSP2_CLKS_MASK (1 << 6) | 161 | #define OMAP2_MCBSP2_CLKS_MASK (1 << 6) |
159 | #define OMAP2_MCBSP1_CLKS_MASK (1 << 2) | 162 | #define OMAP2_MCBSP1_CLKS_MASK (1 << 2) |
160 | 163 | ||
161 | /* CONTROL_DEVCONF1 bits */ | 164 | /* CONTROL_DEVCONF1 bits */ |
165 | #define OMAP243X_MMC1_ACTIVE_OVERWRITE (1 << 31) | ||
166 | #define OMAP2_MMCSDIO2ADPCLKISEL (1 << 6) /* MMC2 loop back clock */ | ||
162 | #define OMAP2_MCBSP5_CLKS_MASK (1 << 4) /* > 242x */ | 167 | #define OMAP2_MCBSP5_CLKS_MASK (1 << 4) /* > 242x */ |
163 | #define OMAP2_MCBSP4_CLKS_MASK (1 << 2) /* > 242x */ | 168 | #define OMAP2_MCBSP4_CLKS_MASK (1 << 2) /* > 242x */ |
164 | #define OMAP2_MCBSP3_CLKS_MASK (1 << 0) /* > 242x */ | 169 | #define OMAP2_MCBSP3_CLKS_MASK (1 << 0) /* > 242x */ |
@@ -172,6 +177,18 @@ | |||
172 | #define OMAP2_SYSBOOT_1_MASK (1 << 1) | 177 | #define OMAP2_SYSBOOT_1_MASK (1 << 1) |
173 | #define OMAP2_SYSBOOT_0_MASK (1 << 0) | 178 | #define OMAP2_SYSBOOT_0_MASK (1 << 0) |
174 | 179 | ||
180 | /* CONTROL_PBIAS_LITE bits */ | ||
181 | #define OMAP343X_PBIASLITESUPPLY_HIGH1 (1 << 15) | ||
182 | #define OMAP343X_PBIASLITEVMODEERROR1 (1 << 11) | ||
183 | #define OMAP343X_PBIASSPEEDCTRL1 (1 << 10) | ||
184 | #define OMAP343X_PBIASLITEPWRDNZ1 (1 << 9) | ||
185 | #define OMAP343X_PBIASLITEVMODE1 (1 << 8) | ||
186 | #define OMAP343X_PBIASLITESUPPLY_HIGH0 (1 << 7) | ||
187 | #define OMAP343X_PBIASLITEVMODEERROR0 (1 << 3) | ||
188 | #define OMAP2_PBIASSPEEDCTRL0 (1 << 2) | ||
189 | #define OMAP2_PBIASLITEPWRDNZ0 (1 << 1) | ||
190 | #define OMAP2_PBIASLITEVMODE0 (1 << 0) | ||
191 | |||
175 | #ifndef __ASSEMBLY__ | 192 | #ifndef __ASSEMBLY__ |
176 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 193 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
177 | extern void __iomem *omap_ctrl_base_get(void); | 194 | extern void __iomem *omap_ctrl_base_get(void); |
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h index e0464187209d..b2062f1175de 100644 --- a/arch/arm/plat-omap/include/mach/cpu.h +++ b/arch/arm/plat-omap/include/mach/cpu.h | |||
@@ -28,13 +28,18 @@ | |||
28 | 28 | ||
29 | struct omap_chip_id { | 29 | struct omap_chip_id { |
30 | u8 oc; | 30 | u8 oc; |
31 | u8 type; | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | #define OMAP_CHIP_INIT(x) { .oc = x } | 34 | #define OMAP_CHIP_INIT(x) { .oc = x } |
34 | 35 | ||
35 | extern unsigned int system_rev; | 36 | /* |
36 | 37 | * omap_rev bits: | |
37 | #define omap2_cpu_rev() ((system_rev >> 12) & 0x0f) | 38 | * CPU id bits (0730, 1510, 1710, 2422...) [31:16] |
39 | * CPU revision (See _REV_ defined in cpu.h) [15:08] | ||
40 | * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00] | ||
41 | */ | ||
42 | unsigned int omap_rev(void); | ||
38 | 43 | ||
39 | /* | 44 | /* |
40 | * Test if multicore OMAP support is needed | 45 | * Test if multicore OMAP support is needed |
@@ -108,7 +113,7 @@ extern unsigned int system_rev; | |||
108 | * cpu_is_omap243x(): True for OMAP2430 | 113 | * cpu_is_omap243x(): True for OMAP2430 |
109 | * cpu_is_omap343x(): True for OMAP3430 | 114 | * cpu_is_omap343x(): True for OMAP3430 |
110 | */ | 115 | */ |
111 | #define GET_OMAP_CLASS ((system_rev >> 24) & 0xff) | 116 | #define GET_OMAP_CLASS (omap_rev() & 0xff) |
112 | 117 | ||
113 | #define IS_OMAP_CLASS(class, id) \ | 118 | #define IS_OMAP_CLASS(class, id) \ |
114 | static inline int is_omap ##class (void) \ | 119 | static inline int is_omap ##class (void) \ |
@@ -116,7 +121,7 @@ static inline int is_omap ##class (void) \ | |||
116 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ | 121 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ |
117 | } | 122 | } |
118 | 123 | ||
119 | #define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff) | 124 | #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) |
120 | 125 | ||
121 | #define IS_OMAP_SUBCLASS(subclass, id) \ | 126 | #define IS_OMAP_SUBCLASS(subclass, id) \ |
122 | static inline int is_omap ##subclass (void) \ | 127 | static inline int is_omap ##subclass (void) \ |
@@ -226,7 +231,7 @@ IS_OMAP_SUBCLASS(343x, 0x343) | |||
226 | * cpu_is_omap2430(): True for OMAP2430 | 231 | * cpu_is_omap2430(): True for OMAP2430 |
227 | * cpu_is_omap3430(): True for OMAP3430 | 232 | * cpu_is_omap3430(): True for OMAP3430 |
228 | */ | 233 | */ |
229 | #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) | 234 | #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) |
230 | 235 | ||
231 | #define IS_OMAP_TYPE(type, id) \ | 236 | #define IS_OMAP_TYPE(type, id) \ |
232 | static inline int is_omap ##type (void) \ | 237 | static inline int is_omap ##type (void) \ |
@@ -320,44 +325,20 @@ IS_OMAP_TYPE(3430, 0x3430) | |||
320 | #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) | 325 | #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) |
321 | 326 | ||
322 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 327 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
323 | /* | ||
324 | * Macros to detect silicon revision of OMAP2/3 processors. | ||
325 | * is_sil_rev_greater_than: true if passed cpu type & its rev is greater. | ||
326 | * is_sil_rev_lesser_than: true if passed cpu type & its rev is lesser. | ||
327 | * is_sil_rev_equal_to: true if passed cpu type & its rev is equal. | ||
328 | * get_sil_rev: return the silicon rev value. | ||
329 | */ | ||
330 | #define get_sil_omap_type(rev) ((rev & 0xffff0000) >> 16) | ||
331 | #define get_sil_revision(rev) ((rev & 0x0000f000) >> 12) | ||
332 | 328 | ||
333 | #define is_sil_rev_greater_than(rev) \ | 329 | /* Various silicon revisions for omap2 */ |
334 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ | 330 | #define OMAP242X_CLASS 0x24200024 |
335 | (get_sil_revision(system_rev) > get_sil_revision(rev))) | 331 | #define OMAP2420_REV_ES1_0 0x24200024 |
332 | #define OMAP2420_REV_ES2_0 0x24201024 | ||
336 | 333 | ||
337 | #define is_sil_rev_less_than(rev) \ | 334 | #define OMAP243X_CLASS 0x24300024 |
338 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ | 335 | #define OMAP2430_REV_ES1_0 0x24300024 |
339 | (get_sil_revision(system_rev) < get_sil_revision(rev))) | ||
340 | 336 | ||
341 | #define is_sil_rev_equal_to(rev) \ | 337 | #define OMAP343X_CLASS 0x34300034 |
342 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ | 338 | #define OMAP3430_REV_ES1_0 0x34300034 |
343 | (get_sil_revision(system_rev) == get_sil_revision(rev))) | 339 | #define OMAP3430_REV_ES2_0 0x34301034 |
344 | 340 | #define OMAP3430_REV_ES2_1 0x34302034 | |
345 | #define get_sil_rev() \ | 341 | #define OMAP3430_REV_ES3_0 0x34303034 |
346 | get_sil_revision(system_rev) | ||
347 | |||
348 | /* Various silicon macros defined here */ | ||
349 | #define OMAP242X_CLASS 0x24200000 | ||
350 | #define OMAP2420_REV_ES1_0 0x24200000 | ||
351 | #define OMAP2420_REV_ES2_0 0x24201000 | ||
352 | |||
353 | #define OMAP243X_CLASS 0x24300000 | ||
354 | #define OMAP2430_REV_ES1_0 0x24300000 | ||
355 | |||
356 | #define OMAP343X_CLASS 0x34300000 | ||
357 | #define OMAP3430_REV_ES1_0 0x34300000 | ||
358 | #define OMAP3430_REV_ES2_0 0x34301000 | ||
359 | #define OMAP3430_REV_ES2_1 0x34302000 | ||
360 | #define OMAP3430_REV_ES2_2 0x34303000 | ||
361 | 342 | ||
362 | /* | 343 | /* |
363 | * omap_chip bits | 344 | * omap_chip bits |
@@ -382,23 +363,16 @@ IS_OMAP_TYPE(3430, 0x3430) | |||
382 | #define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) | 363 | #define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) |
383 | 364 | ||
384 | int omap_chip_is(struct omap_chip_id oci); | 365 | int omap_chip_is(struct omap_chip_id oci); |
385 | 366 | int omap_type(void); | |
386 | 367 | ||
387 | /* | 368 | /* |
388 | * Macro to detect device type i.e. EMU/HS/TST/GP/BAD | 369 | * Macro to detect device type i.e. EMU/HS/TST/GP/BAD |
389 | */ | 370 | */ |
390 | #define DEVICE_TYPE_TEST 0 | 371 | #define OMAP2_DEVICE_TYPE_TEST 0 |
391 | #define DEVICE_TYPE_EMU 1 | 372 | #define OMAP2_DEVICE_TYPE_EMU 1 |
392 | #define DEVICE_TYPE_SEC 2 | 373 | #define OMAP2_DEVICE_TYPE_SEC 2 |
393 | #define DEVICE_TYPE_GP 3 | 374 | #define OMAP2_DEVICE_TYPE_GP 3 |
394 | #define DEVICE_TYPE_BAD 4 | 375 | #define OMAP2_DEVICE_TYPE_BAD 4 |
395 | |||
396 | #define get_device_type() ((system_rev & 0x700) >> 8) | ||
397 | #define is_device_type_test() (get_device_type() == DEVICE_TYPE_TEST) | ||
398 | #define is_device_type_emu() (get_device_type() == DEVICE_TYPE_EMU) | ||
399 | #define is_device_type_sec() (get_device_type() == DEVICE_TYPE_SEC) | ||
400 | #define is_device_type_gp() (get_device_type() == DEVICE_TYPE_GP) | ||
401 | #define is_device_type_bad() (get_device_type() == DEVICE_TYPE_BAD) | ||
402 | 376 | ||
403 | void omap2_check_revision(void); | 377 | void omap2_check_revision(void); |
404 | 378 | ||
diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h index 98e9008b7e9d..04e68e88f134 100644 --- a/arch/arm/plat-omap/include/mach/gpio.h +++ b/arch/arm/plat-omap/include/mach/gpio.h | |||
@@ -71,11 +71,6 @@ | |||
71 | IH_GPIO_BASE + (nr)) | 71 | IH_GPIO_BASE + (nr)) |
72 | 72 | ||
73 | extern int omap_gpio_init(void); /* Call from board init only */ | 73 | extern int omap_gpio_init(void); /* Call from board init only */ |
74 | extern int omap_request_gpio(int gpio); | ||
75 | extern void omap_free_gpio(int gpio); | ||
76 | extern void omap_set_gpio_direction(int gpio, int is_input); | ||
77 | extern void omap_set_gpio_dataout(int gpio, int enable); | ||
78 | extern int omap_get_gpio_datain(int gpio); | ||
79 | extern void omap2_gpio_prepare_for_retention(void); | 74 | extern void omap2_gpio_prepare_for_retention(void); |
80 | extern void omap2_gpio_resume_after_retention(void); | 75 | extern void omap2_gpio_resume_after_retention(void); |
81 | extern void omap_set_gpio_debounce(int gpio, int enable); | 76 | extern void omap_set_gpio_debounce(int gpio, int enable); |
@@ -92,6 +87,16 @@ extern void omap_set_gpio_debounce_time(int gpio, int enable); | |||
92 | #include <linux/errno.h> | 87 | #include <linux/errno.h> |
93 | #include <asm-generic/gpio.h> | 88 | #include <asm-generic/gpio.h> |
94 | 89 | ||
90 | static inline int omap_request_gpio(int gpio) | ||
91 | { | ||
92 | return gpio_request(gpio, "FIXME"); | ||
93 | } | ||
94 | |||
95 | static inline void omap_free_gpio(int gpio) | ||
96 | { | ||
97 | gpio_free(gpio); | ||
98 | } | ||
99 | |||
95 | static inline int gpio_get_value(unsigned gpio) | 100 | static inline int gpio_get_value(unsigned gpio) |
96 | { | 101 | { |
97 | return __gpio_get_value(gpio); | 102 | return __gpio_get_value(gpio); |
@@ -109,16 +114,24 @@ static inline int gpio_cansleep(unsigned gpio) | |||
109 | 114 | ||
110 | static inline int gpio_to_irq(unsigned gpio) | 115 | static inline int gpio_to_irq(unsigned gpio) |
111 | { | 116 | { |
112 | if (gpio < (OMAP_MAX_GPIO_LINES + 16)) | 117 | return __gpio_to_irq(gpio); |
113 | return OMAP_GPIO_IRQ(gpio); | ||
114 | return -EINVAL; | ||
115 | } | 118 | } |
116 | 119 | ||
117 | static inline int irq_to_gpio(unsigned irq) | 120 | static inline int irq_to_gpio(unsigned irq) |
118 | { | 121 | { |
122 | int tmp; | ||
123 | |||
124 | /* omap1 SOC mpuio */ | ||
119 | if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16))) | 125 | if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16))) |
120 | return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES; | 126 | return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES; |
121 | return irq - IH_GPIO_BASE; | 127 | |
128 | /* SOC gpio */ | ||
129 | tmp = irq - IH_GPIO_BASE; | ||
130 | if (tmp < OMAP_MAX_GPIO_LINES) | ||
131 | return tmp; | ||
132 | |||
133 | /* we don't supply reverse mappings for non-SOC gpios */ | ||
134 | return -EIO; | ||
122 | } | 135 | } |
123 | 136 | ||
124 | #endif | 137 | #endif |
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h index adc83b7b8205..d92bf7964481 100644 --- a/arch/arm/plat-omap/include/mach/io.h +++ b/arch/arm/plat-omap/include/mach/io.h | |||
@@ -42,8 +42,8 @@ | |||
42 | * We don't actually have real ISA nor PCI buses, but there is so many | 42 | * We don't actually have real ISA nor PCI buses, but there is so many |
43 | * drivers out there that might just work if we fake them... | 43 | * drivers out there that might just work if we fake them... |
44 | */ | 44 | */ |
45 | #define __io(a) ((void __iomem *)(PCIO_BASE + (a))) | 45 | #define __io(a) __typesafe_io(a) |
46 | #define __mem_pci(a) (a) | 46 | #define __mem_pci(a) (a) |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * ---------------------------------------------------------------------------- | 49 | * ---------------------------------------------------------------------------- |
@@ -51,8 +51,6 @@ | |||
51 | * ---------------------------------------------------------------------------- | 51 | * ---------------------------------------------------------------------------- |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #define PCIO_BASE 0 | ||
55 | |||
56 | #if defined(CONFIG_ARCH_OMAP1) | 54 | #if defined(CONFIG_ARCH_OMAP1) |
57 | 55 | ||
58 | #define IO_PHYS 0xFFFB0000 | 56 | #define IO_PHYS 0xFFFB0000 |
diff --git a/arch/arm/plat-omap/include/mach/memory.h b/arch/arm/plat-omap/include/mach/memory.h index d40cac60b959..211c9f6619e9 100644 --- a/arch/arm/plat-omap/include/mach/memory.h +++ b/arch/arm/plat-omap/include/mach/memory.h | |||
@@ -43,18 +43,7 @@ | |||
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Conversion between SDRAM and fake PCI bus, used by USB | ||
47 | * NOTE: Physical address must be converted to Local Bus address | ||
48 | * on OMAP-1510 only | ||
49 | */ | ||
50 | |||
51 | /* | ||
52 | * Bus address is physical address, except for OMAP-1510 Local Bus. | 46 | * Bus address is physical address, except for OMAP-1510 Local Bus. |
53 | */ | ||
54 | #define __virt_to_bus(x) __virt_to_phys(x) | ||
55 | #define __bus_to_virt(x) __phys_to_virt(x) | ||
56 | |||
57 | /* | ||
58 | * OMAP-1510 bus address is translated into a Local Bus address if the | 47 | * OMAP-1510 bus address is translated into a Local Bus address if the |
59 | * OMAP bus type is lbus. We do the address translation based on the | 48 | * OMAP bus type is lbus. We do the address translation based on the |
60 | * device overriding the defaults used in the dma-mapping API. | 49 | * device overriding the defaults used in the dma-mapping API. |
@@ -74,16 +63,16 @@ | |||
74 | 63 | ||
75 | #define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \ | 64 | #define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \ |
76 | (dma_addr_t)virt_to_lbus(page_address(page)) : \ | 65 | (dma_addr_t)virt_to_lbus(page_address(page)) : \ |
77 | (dma_addr_t)__virt_to_bus(page_address(page));}) | 66 | (dma_addr_t)__virt_to_phys(page_address(page));}) |
78 | 67 | ||
79 | #define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \ | 68 | #define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \ |
80 | lbus_to_virt(addr) : \ | 69 | lbus_to_virt(addr) : \ |
81 | __bus_to_virt(addr)); }) | 70 | __phys_to_virt(addr)); }) |
82 | 71 | ||
83 | #define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \ | 72 | #define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \ |
84 | (dma_addr_t) (is_lbus_device(dev) ? \ | 73 | (dma_addr_t) (is_lbus_device(dev) ? \ |
85 | virt_to_lbus(__addr) : \ | 74 | virt_to_lbus(__addr) : \ |
86 | __virt_to_bus(__addr)); }) | 75 | __virt_to_phys(__addr)); }) |
87 | 76 | ||
88 | #endif /* CONFIG_ARCH_OMAP15XX */ | 77 | #endif /* CONFIG_ARCH_OMAP15XX */ |
89 | 78 | ||
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h index fc15d13058fc..031250f02805 100644 --- a/arch/arm/plat-omap/include/mach/mmc.h +++ b/arch/arm/plat-omap/include/mach/mmc.h | |||
@@ -17,12 +17,28 @@ | |||
17 | 17 | ||
18 | #include <mach/board.h> | 18 | #include <mach/board.h> |
19 | 19 | ||
20 | #define OMAP15XX_NR_MMC 1 | ||
21 | #define OMAP16XX_NR_MMC 2 | ||
22 | #define OMAP1_MMC_SIZE 0x080 | ||
23 | #define OMAP1_MMC1_BASE 0xfffb7800 | ||
24 | #define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */ | ||
25 | |||
26 | #define OMAP24XX_NR_MMC 2 | ||
27 | #define OMAP34XX_NR_MMC 3 | ||
28 | #define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE | ||
29 | #define HSMMC_SIZE 0x200 | ||
30 | #define OMAP2_MMC1_BASE 0x4809c000 | ||
31 | #define OMAP2_MMC2_BASE 0x480b4000 | ||
32 | #define OMAP3_MMC3_BASE 0x480ad000 | ||
33 | #define HSMMC3 (1 << 2) | ||
34 | #define HSMMC2 (1 << 1) | ||
35 | #define HSMMC1 (1 << 0) | ||
36 | |||
20 | #define OMAP_MMC_MAX_SLOTS 2 | 37 | #define OMAP_MMC_MAX_SLOTS 2 |
21 | 38 | ||
22 | struct omap_mmc_platform_data { | 39 | struct omap_mmc_platform_data { |
23 | struct omap_mmc_conf conf; | ||
24 | 40 | ||
25 | /* number of slots on board */ | 41 | /* number of slots per controller */ |
26 | unsigned nr_slots:2; | 42 | unsigned nr_slots:2; |
27 | 43 | ||
28 | /* set if your board has components or wiring that limits the | 44 | /* set if your board has components or wiring that limits the |
@@ -41,7 +57,31 @@ struct omap_mmc_platform_data { | |||
41 | int (*suspend)(struct device *dev, int slot); | 57 | int (*suspend)(struct device *dev, int slot); |
42 | int (*resume)(struct device *dev, int slot); | 58 | int (*resume)(struct device *dev, int slot); |
43 | 59 | ||
60 | u64 dma_mask; | ||
61 | |||
44 | struct omap_mmc_slot_data { | 62 | struct omap_mmc_slot_data { |
63 | |||
64 | /* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC; | ||
65 | * 8 wire signaling is also optional, and is used with HSMMC | ||
66 | */ | ||
67 | u8 wires; | ||
68 | |||
69 | /* | ||
70 | * nomux means "standard" muxing is wrong on this board, and | ||
71 | * that board-specific code handled it before common init logic. | ||
72 | */ | ||
73 | unsigned nomux:1; | ||
74 | |||
75 | /* switch pin can be for card detect (default) or card cover */ | ||
76 | unsigned cover:1; | ||
77 | |||
78 | /* use the internal clock */ | ||
79 | unsigned internal_clock:1; | ||
80 | s16 power_pin; | ||
81 | |||
82 | int switch_pin; /* gpio (card detect) */ | ||
83 | int gpio_wp; /* gpio (write protect) */ | ||
84 | |||
45 | int (* set_bus_mode)(struct device *dev, int slot, int bus_mode); | 85 | int (* set_bus_mode)(struct device *dev, int slot, int bus_mode); |
46 | int (* set_power)(struct device *dev, int slot, int power_on, int vdd); | 86 | int (* set_power)(struct device *dev, int slot, int power_on, int vdd); |
47 | int (* get_ro)(struct device *dev, int slot); | 87 | int (* get_ro)(struct device *dev, int slot); |
@@ -49,8 +89,8 @@ struct omap_mmc_platform_data { | |||
49 | /* return MMC cover switch state, can be NULL if not supported. | 89 | /* return MMC cover switch state, can be NULL if not supported. |
50 | * | 90 | * |
51 | * possible return values: | 91 | * possible return values: |
52 | * 0 - open | 92 | * 0 - closed |
53 | * 1 - closed | 93 | * 1 - open |
54 | */ | 94 | */ |
55 | int (* get_cover_state)(struct device *dev, int slot); | 95 | int (* get_cover_state)(struct device *dev, int slot); |
56 | 96 | ||
@@ -66,9 +106,31 @@ struct omap_mmc_platform_data { | |||
66 | } slots[OMAP_MMC_MAX_SLOTS]; | 106 | } slots[OMAP_MMC_MAX_SLOTS]; |
67 | }; | 107 | }; |
68 | 108 | ||
69 | extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info); | ||
70 | |||
71 | /* called from board-specific card detection service routine */ | 109 | /* called from board-specific card detection service routine */ |
72 | extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed); | 110 | extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed); |
73 | 111 | ||
112 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ | ||
113 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) | ||
114 | void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | ||
115 | int nr_controllers); | ||
116 | void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, | ||
117 | int nr_controllers); | ||
118 | int omap_mmc_add(int id, unsigned long base, unsigned long size, | ||
119 | unsigned int irq, struct omap_mmc_platform_data *data); | ||
120 | #else | ||
121 | static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | ||
122 | int nr_controllers) | ||
123 | { | ||
124 | } | ||
125 | static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, | ||
126 | int nr_controllers) | ||
127 | { | ||
128 | } | ||
129 | static inline int omap_mmc_add(int id, unsigned long base, unsigned long size, | ||
130 | unsigned int irq, struct omap_mmc_platform_data *data) | ||
131 | { | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | #endif | ||
74 | #endif | 136 | #endif |
diff --git a/arch/arm/plat-omap/include/mach/mux.h b/arch/arm/plat-omap/include/mach/mux.h index 6bbf1789bed5..f4362b8682c7 100644 --- a/arch/arm/plat-omap/include/mach/mux.h +++ b/arch/arm/plat-omap/include/mach/mux.h | |||
@@ -632,6 +632,15 @@ enum omap24xx_index { | |||
632 | AC7_2430_USB0HS_DATA7, | 632 | AC7_2430_USB0HS_DATA7, |
633 | 633 | ||
634 | /* 2430 McBSP */ | 634 | /* 2430 McBSP */ |
635 | AD6_2430_MCBSP_CLKS, | ||
636 | |||
637 | AB2_2430_MCBSP1_CLKR, | ||
638 | AD5_2430_MCBSP1_FSR, | ||
639 | AA1_2430_MCBSP1_DX, | ||
640 | AF3_2430_MCBSP1_DR, | ||
641 | AB3_2430_MCBSP1_FSX, | ||
642 | Y9_2430_MCBSP1_CLKX, | ||
643 | |||
635 | AC10_2430_MCBSP2_FSX, | 644 | AC10_2430_MCBSP2_FSX, |
636 | AD16_2430_MCBSP2_CLX, | 645 | AD16_2430_MCBSP2_CLX, |
637 | AE13_2430_MCBSP2_DX, | 646 | AE13_2430_MCBSP2_DX, |
@@ -641,6 +650,30 @@ enum omap24xx_index { | |||
641 | AE13_2430_MCBSP2_DX_OFF, | 650 | AE13_2430_MCBSP2_DX_OFF, |
642 | AD13_2430_MCBSP2_DR_OFF, | 651 | AD13_2430_MCBSP2_DR_OFF, |
643 | 652 | ||
653 | AC9_2430_MCBSP3_CLKX, | ||
654 | AE4_2430_MCBSP3_FSX, | ||
655 | AE2_2430_MCBSP3_DR, | ||
656 | AF4_2430_MCBSP3_DX, | ||
657 | |||
658 | N3_2430_MCBSP4_CLKX, | ||
659 | AD23_2430_MCBSP4_DR, | ||
660 | AB25_2430_MCBSP4_DX, | ||
661 | AC25_2430_MCBSP4_FSX, | ||
662 | |||
663 | AE16_2430_MCBSP5_CLKX, | ||
664 | AF12_2430_MCBSP5_FSX, | ||
665 | K7_2430_MCBSP5_DX, | ||
666 | M1_2430_MCBSP5_DR, | ||
667 | |||
668 | /* 2430 McSPI*/ | ||
669 | Y18_2430_MCSPI1_CLK, | ||
670 | AD15_2430_MCSPI1_SIMO, | ||
671 | AE17_2430_MCSPI1_SOMI, | ||
672 | U1_2430_MCSPI1_CS0, | ||
673 | |||
674 | /* Touchscreen GPIO */ | ||
675 | AF19_2430_GPIO_85, | ||
676 | |||
644 | }; | 677 | }; |
645 | 678 | ||
646 | enum omap34xx_index { | 679 | enum omap34xx_index { |
@@ -749,6 +782,14 @@ enum omap34xx_index { | |||
749 | AD2_3430_USB3FS_PHY_MM3_TXDAT, | 782 | AD2_3430_USB3FS_PHY_MM3_TXDAT, |
750 | AC1_3430_USB3FS_PHY_MM3_TXEN_N, | 783 | AC1_3430_USB3FS_PHY_MM3_TXEN_N, |
751 | 784 | ||
785 | /* 34xx GPIO | ||
786 | * - normally these are bidirectional, no internal pullup/pulldown | ||
787 | * - "_UP" suffix (GPIO3_UP) if internal pullup is configured | ||
788 | * - "_DOWN" suffix (GPIO3_DOWN) with internal pulldown | ||
789 | * - "_OUT" suffix (GPIO3_OUT) for output-only pins (unlike 24xx) | ||
790 | */ | ||
791 | AH8_34XX_GPIO29, | ||
792 | J25_34XX_GPIO170, | ||
752 | }; | 793 | }; |
753 | 794 | ||
754 | struct omap_mux_cfg { | 795 | struct omap_mux_cfg { |
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index dcd9d16da2e9..be7bcaf2b832 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <mach/sram.h> | 25 | #include <mach/sram.h> |
26 | #include <mach/board.h> | 26 | #include <mach/board.h> |
27 | #include <mach/cpu.h> | ||
27 | 28 | ||
28 | #include <mach/control.h> | 29 | #include <mach/control.h> |
29 | 30 | ||
@@ -87,7 +88,7 @@ static int is_sram_locked(void) | |||
87 | int type = 0; | 88 | int type = 0; |
88 | 89 | ||
89 | if (cpu_is_omap242x()) | 90 | if (cpu_is_omap242x()) |
90 | type = system_rev & OMAP2_DEVICETYPE_MASK; | 91 | type = omap_rev() & OMAP2_DEVICETYPE_MASK; |
91 | 92 | ||
92 | if (type == GP_DEVICE) { | 93 | if (type == GP_DEVICE) { |
93 | /* RAMFW: R/W access to all initiators for all qualifier sets */ | 94 | /* RAMFW: R/W access to all initiators for all qualifier sets */ |