aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-10-03 06:52:33 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-03 06:52:33 -0400
commit56f68556d7bbb51dd158c74deb09c783345bfbbd (patch)
tree536e6e3c7063b1eee927194dda257602bd3dc66f /arch/arm/plat-omap
parentfd9470ce3ac6fb54d6026e4b1cdab0936e34805e (diff)
parent7c8ad9828e793573877fd60868bb5d2f1e3b64da (diff)
Merge unstable branch 'omap-rmk'
Merge branch 'omap-rmk' into omap-all
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/Makefile2
-rw-r--r--arch/arm/plat-omap/common.c36
-rw-r--r--arch/arm/plat-omap/dma.c8
-rw-r--r--arch/arm/plat-omap/dmtimer.c2
-rw-r--r--arch/arm/plat-omap/gpio.c72
-rw-r--r--arch/arm/plat-omap/include/mach/control.h6
-rw-r--r--arch/arm/plat-omap/include/mach/fpga.h12
-rw-r--r--arch/arm/plat-omap/include/mach/gpio.h2
-rw-r--r--arch/arm/plat-omap/include/mach/hardware.h2
-rw-r--r--arch/arm/plat-omap/include/mach/io.h56
-rw-r--r--arch/arm/plat-omap/include/mach/mcbsp.h5
-rw-r--r--arch/arm/plat-omap/include/mach/pm.h4
-rw-r--r--arch/arm/plat-omap/include/mach/sdrc.h6
-rw-r--r--arch/arm/plat-omap/include/mach/serial.h12
-rw-r--r--arch/arm/plat-omap/io.c83
-rw-r--r--arch/arm/plat-omap/mcbsp.c47
16 files changed, 231 insertions, 124 deletions
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 2c4051cc79a1..deaff58878a2 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support 5# Common support
6obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \ 6obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
7 usb.o fb.o 7 usb.o fb.o io.o
8obj-m := 8obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index f4dff423ae7c..20e8db5fe32a 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -258,12 +258,12 @@ static void __init __omap2_set_globals(void)
258#if defined(CONFIG_ARCH_OMAP2420) 258#if defined(CONFIG_ARCH_OMAP2420)
259 259
260static struct omap_globals omap242x_globals = { 260static struct omap_globals omap242x_globals = {
261 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x48014000), 261 .tap = OMAP2_IO_ADDRESS(0x48014000),
262 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE), 262 .sdrc = OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE),
263 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE), 263 .sms = OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE),
264 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_CTRL_BASE), 264 .ctrl = OMAP2_IO_ADDRESS(OMAP2420_CTRL_BASE),
265 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_PRM_BASE), 265 .prm = OMAP2_IO_ADDRESS(OMAP2420_PRM_BASE),
266 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_CM_BASE), 266 .cm = OMAP2_IO_ADDRESS(OMAP2420_CM_BASE),
267}; 267};
268 268
269void __init omap2_set_globals_242x(void) 269void __init omap2_set_globals_242x(void)
@@ -276,12 +276,12 @@ void __init omap2_set_globals_242x(void)
276#if defined(CONFIG_ARCH_OMAP2430) 276#if defined(CONFIG_ARCH_OMAP2430)
277 277
278static struct omap_globals omap243x_globals = { 278static struct omap_globals omap243x_globals = {
279 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x4900a000), 279 .tap = OMAP2_IO_ADDRESS(0x4900a000),
280 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE), 280 .sdrc = OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE),
281 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE), 281 .sms = OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE),
282 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_CTRL_BASE), 282 .ctrl = OMAP2_IO_ADDRESS(OMAP243X_CTRL_BASE),
283 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2430_PRM_BASE), 283 .prm = OMAP2_IO_ADDRESS(OMAP2430_PRM_BASE),
284 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2430_CM_BASE), 284 .cm = OMAP2_IO_ADDRESS(OMAP2430_CM_BASE),
285}; 285};
286 286
287void __init omap2_set_globals_243x(void) 287void __init omap2_set_globals_243x(void)
@@ -294,12 +294,12 @@ void __init omap2_set_globals_243x(void)
294#if defined(CONFIG_ARCH_OMAP3430) 294#if defined(CONFIG_ARCH_OMAP3430)
295 295
296static struct omap_globals omap343x_globals = { 296static struct omap_globals omap343x_globals = {
297 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x4830A000), 297 .tap = OMAP2_IO_ADDRESS(0x4830A000),
298 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE), 298 .sdrc = OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE),
299 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE), 299 .sms = OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE),
300 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_CTRL_BASE), 300 .ctrl = OMAP2_IO_ADDRESS(OMAP343X_CTRL_BASE),
301 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP3430_PRM_BASE), 301 .prm = OMAP2_IO_ADDRESS(OMAP3430_PRM_BASE),
302 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP3430_CM_BASE), 302 .cm = OMAP2_IO_ADDRESS(OMAP3430_CM_BASE),
303}; 303};
304 304
305void __init omap2_set_globals_343x(void) 305void __init omap2_set_globals_343x(void)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index a63b644ad305..50f8b4ad9a09 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1233,7 +1233,7 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
1233 /* request and reserve DMA channels for the chain */ 1233 /* request and reserve DMA channels for the chain */
1234 for (i = 0; i < no_of_chans; i++) { 1234 for (i = 0; i < no_of_chans; i++) {
1235 err = omap_request_dma(dev_id, dev_name, 1235 err = omap_request_dma(dev_id, dev_name,
1236 callback, 0, &channels[i]); 1236 callback, NULL, &channels[i]);
1237 if (err < 0) { 1237 if (err < 0) {
1238 int j; 1238 int j;
1239 for (j = 0; j < i; j++) 1239 for (j = 0; j < i; j++)
@@ -2297,13 +2297,13 @@ static int __init omap_init_dma(void)
2297 int ch, r; 2297 int ch, r;
2298 2298
2299 if (cpu_class_is_omap1()) { 2299 if (cpu_class_is_omap1()) {
2300 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP1_DMA_BASE); 2300 omap_dma_base = IO_ADDRESS(OMAP1_DMA_BASE);
2301 dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT; 2301 dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT;
2302 } else if (cpu_is_omap24xx()) { 2302 } else if (cpu_is_omap24xx()) {
2303 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP24XX_DMA4_BASE); 2303 omap_dma_base = IO_ADDRESS(OMAP24XX_DMA4_BASE);
2304 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; 2304 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2305 } else if (cpu_is_omap34xx()) { 2305 } else if (cpu_is_omap34xx()) {
2306 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP34XX_DMA4_BASE); 2306 omap_dma_base = IO_ADDRESS(OMAP34XX_DMA4_BASE);
2307 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; 2307 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2308 } else { 2308 } else {
2309 pr_err("DMA init failed for unsupported omap\n"); 2309 pr_err("DMA init failed for unsupported omap\n");
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 743a4abcd85d..df61ad247dc2 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -693,7 +693,7 @@ int __init omap_dm_timer_init(void)
693 693
694 for (i = 0; i < dm_timer_count; i++) { 694 for (i = 0; i < dm_timer_count; i++) {
695 timer = &dm_timers[i]; 695 timer = &dm_timers[i];
696 timer->io_base = (void __iomem *)io_p2v(timer->phys_base); 696 timer->io_base = IO_ADDRESS(timer->phys_base);
697#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 697#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
698 if (cpu_class_is_omap2()) { 698 if (cpu_class_is_omap2()) {
699 char clk_name[16]; 699 char clk_name[16];
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 3e76ee2bc731..5de70d650922 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -29,7 +29,7 @@
29/* 29/*
30 * OMAP1510 GPIO registers 30 * OMAP1510 GPIO registers
31 */ 31 */
32#define OMAP1510_GPIO_BASE (void __iomem *)0xfffce000 32#define OMAP1510_GPIO_BASE IO_ADDRESS(0xfffce000)
33#define OMAP1510_GPIO_DATA_INPUT 0x00 33#define OMAP1510_GPIO_DATA_INPUT 0x00
34#define OMAP1510_GPIO_DATA_OUTPUT 0x04 34#define OMAP1510_GPIO_DATA_OUTPUT 0x04
35#define OMAP1510_GPIO_DIR_CONTROL 0x08 35#define OMAP1510_GPIO_DIR_CONTROL 0x08
@@ -43,10 +43,10 @@
43/* 43/*
44 * OMAP1610 specific GPIO registers 44 * OMAP1610 specific GPIO registers
45 */ 45 */
46#define OMAP1610_GPIO1_BASE (void __iomem *)0xfffbe400 46#define OMAP1610_GPIO1_BASE IO_ADDRESS(0xfffbe400)
47#define OMAP1610_GPIO2_BASE (void __iomem *)0xfffbec00 47#define OMAP1610_GPIO2_BASE IO_ADDRESS(0xfffbec00)
48#define OMAP1610_GPIO3_BASE (void __iomem *)0xfffbb400 48#define OMAP1610_GPIO3_BASE IO_ADDRESS(0xfffbb400)
49#define OMAP1610_GPIO4_BASE (void __iomem *)0xfffbbc00 49#define OMAP1610_GPIO4_BASE IO_ADDRESS(0xfffbbc00)
50#define OMAP1610_GPIO_REVISION 0x0000 50#define OMAP1610_GPIO_REVISION 0x0000
51#define OMAP1610_GPIO_SYSCONFIG 0x0010 51#define OMAP1610_GPIO_SYSCONFIG 0x0010
52#define OMAP1610_GPIO_SYSSTATUS 0x0014 52#define OMAP1610_GPIO_SYSSTATUS 0x0014
@@ -68,12 +68,12 @@
68/* 68/*
69 * OMAP730 specific GPIO registers 69 * OMAP730 specific GPIO registers
70 */ 70 */
71#define OMAP730_GPIO1_BASE (void __iomem *)0xfffbc000 71#define OMAP730_GPIO1_BASE IO_ADDRESS(0xfffbc000)
72#define OMAP730_GPIO2_BASE (void __iomem *)0xfffbc800 72#define OMAP730_GPIO2_BASE IO_ADDRESS(0xfffbc800)
73#define OMAP730_GPIO3_BASE (void __iomem *)0xfffbd000 73#define OMAP730_GPIO3_BASE IO_ADDRESS(0xfffbd000)
74#define OMAP730_GPIO4_BASE (void __iomem *)0xfffbd800 74#define OMAP730_GPIO4_BASE IO_ADDRESS(0xfffbd800)
75#define OMAP730_GPIO5_BASE (void __iomem *)0xfffbe000 75#define OMAP730_GPIO5_BASE IO_ADDRESS(0xfffbe000)
76#define OMAP730_GPIO6_BASE (void __iomem *)0xfffbe800 76#define OMAP730_GPIO6_BASE IO_ADDRESS(0xfffbe800)
77#define OMAP730_GPIO_DATA_INPUT 0x00 77#define OMAP730_GPIO_DATA_INPUT 0x00
78#define OMAP730_GPIO_DATA_OUTPUT 0x04 78#define OMAP730_GPIO_DATA_OUTPUT 0x04
79#define OMAP730_GPIO_DIR_CONTROL 0x08 79#define OMAP730_GPIO_DIR_CONTROL 0x08
@@ -84,16 +84,16 @@
84/* 84/*
85 * omap24xx specific GPIO registers 85 * omap24xx specific GPIO registers
86 */ 86 */
87#define OMAP242X_GPIO1_BASE (void __iomem *)0x48018000 87#define OMAP242X_GPIO1_BASE IO_ADDRESS(0x48018000)
88#define OMAP242X_GPIO2_BASE (void __iomem *)0x4801a000 88#define OMAP242X_GPIO2_BASE IO_ADDRESS(0x4801a000)
89#define OMAP242X_GPIO3_BASE (void __iomem *)0x4801c000 89#define OMAP242X_GPIO3_BASE IO_ADDRESS(0x4801c000)
90#define OMAP242X_GPIO4_BASE (void __iomem *)0x4801e000 90#define OMAP242X_GPIO4_BASE IO_ADDRESS(0x4801e000)
91 91
92#define OMAP243X_GPIO1_BASE (void __iomem *)0x4900C000 92#define OMAP243X_GPIO1_BASE IO_ADDRESS(0x4900C000)
93#define OMAP243X_GPIO2_BASE (void __iomem *)0x4900E000 93#define OMAP243X_GPIO2_BASE IO_ADDRESS(0x4900E000)
94#define OMAP243X_GPIO3_BASE (void __iomem *)0x49010000 94#define OMAP243X_GPIO3_BASE IO_ADDRESS(0x49010000)
95#define OMAP243X_GPIO4_BASE (void __iomem *)0x49012000 95#define OMAP243X_GPIO4_BASE IO_ADDRESS(0x49012000)
96#define OMAP243X_GPIO5_BASE (void __iomem *)0x480B6000 96#define OMAP243X_GPIO5_BASE IO_ADDRESS(0x480B6000)
97 97
98#define OMAP24XX_GPIO_REVISION 0x0000 98#define OMAP24XX_GPIO_REVISION 0x0000
99#define OMAP24XX_GPIO_SYSCONFIG 0x0010 99#define OMAP24XX_GPIO_SYSCONFIG 0x0010
@@ -123,13 +123,14 @@
123 * omap34xx specific GPIO registers 123 * omap34xx specific GPIO registers
124 */ 124 */
125 125
126#define OMAP34XX_GPIO1_BASE (void __iomem *)0x48310000 126#define OMAP34XX_GPIO1_BASE IO_ADDRESS(0x48310000)
127#define OMAP34XX_GPIO2_BASE (void __iomem *)0x49050000 127#define OMAP34XX_GPIO2_BASE IO_ADDRESS(0x49050000)
128#define OMAP34XX_GPIO3_BASE (void __iomem *)0x49052000 128#define OMAP34XX_GPIO3_BASE IO_ADDRESS(0x49052000)
129#define OMAP34XX_GPIO4_BASE (void __iomem *)0x49054000 129#define OMAP34XX_GPIO4_BASE IO_ADDRESS(0x49054000)
130#define OMAP34XX_GPIO5_BASE (void __iomem *)0x49056000 130#define OMAP34XX_GPIO5_BASE IO_ADDRESS(0x49056000)
131#define OMAP34XX_GPIO6_BASE (void __iomem *)0x49058000 131#define OMAP34XX_GPIO6_BASE IO_ADDRESS(0x49058000)
132 132
133#define OMAP_MPUIO_VBASE IO_ADDRESS(OMAP_MPUIO_BASE)
133 134
134struct gpio_bank { 135struct gpio_bank {
135 void __iomem *base; 136 void __iomem *base;
@@ -161,7 +162,7 @@ struct gpio_bank {
161 162
162#ifdef CONFIG_ARCH_OMAP16XX 163#ifdef CONFIG_ARCH_OMAP16XX
163static struct gpio_bank gpio_bank_1610[5] = { 164static struct gpio_bank gpio_bank_1610[5] = {
164 { OMAP_MPUIO_BASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO}, 165 { OMAP_MPUIO_VBASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO},
165 { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 }, 166 { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 },
166 { OMAP1610_GPIO2_BASE, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16, METHOD_GPIO_1610 }, 167 { OMAP1610_GPIO2_BASE, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16, METHOD_GPIO_1610 },
167 { OMAP1610_GPIO3_BASE, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32, METHOD_GPIO_1610 }, 168 { OMAP1610_GPIO3_BASE, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32, METHOD_GPIO_1610 },
@@ -171,14 +172,14 @@ static struct gpio_bank gpio_bank_1610[5] = {
171 172
172#ifdef CONFIG_ARCH_OMAP15XX 173#ifdef CONFIG_ARCH_OMAP15XX
173static struct gpio_bank gpio_bank_1510[2] = { 174static struct gpio_bank gpio_bank_1510[2] = {
174 { OMAP_MPUIO_BASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO }, 175 { OMAP_MPUIO_VBASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO },
175 { OMAP1510_GPIO_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1510 } 176 { OMAP1510_GPIO_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1510 }
176}; 177};
177#endif 178#endif
178 179
179#ifdef CONFIG_ARCH_OMAP730 180#ifdef CONFIG_ARCH_OMAP730
180static struct gpio_bank gpio_bank_730[7] = { 181static struct gpio_bank gpio_bank_730[7] = {
181 { OMAP_MPUIO_BASE, INT_730_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO }, 182 { OMAP_MPUIO_VBASE, INT_730_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO },
182 { OMAP730_GPIO1_BASE, INT_730_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_730 }, 183 { OMAP730_GPIO1_BASE, INT_730_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_730 },
183 { OMAP730_GPIO2_BASE, INT_730_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_730 }, 184 { OMAP730_GPIO2_BASE, INT_730_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_730 },
184 { OMAP730_GPIO3_BASE, INT_730_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_730 }, 185 { OMAP730_GPIO3_BASE, INT_730_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_730 },
@@ -1393,7 +1394,7 @@ static int __init _omap_gpio_init(void)
1393 1394
1394 gpio_bank_count = 5; 1395 gpio_bank_count = 5;
1395 gpio_bank = gpio_bank_1610; 1396 gpio_bank = gpio_bank_1610;
1396 rev = omap_readw(gpio_bank[1].base + OMAP1610_GPIO_REVISION); 1397 rev = __raw_readw(gpio_bank[1].base + OMAP1610_GPIO_REVISION);
1397 printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n", 1398 printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n",
1398 (rev >> 4) & 0x0f, rev & 0x0f); 1399 (rev >> 4) & 0x0f, rev & 0x0f);
1399 } 1400 }
@@ -1412,7 +1413,7 @@ static int __init _omap_gpio_init(void)
1412 1413
1413 gpio_bank_count = 4; 1414 gpio_bank_count = 4;
1414 gpio_bank = gpio_bank_242x; 1415 gpio_bank = gpio_bank_242x;
1415 rev = omap_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); 1416 rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1416 printk(KERN_INFO "OMAP242x GPIO hardware version %d.%d\n", 1417 printk(KERN_INFO "OMAP242x GPIO hardware version %d.%d\n",
1417 (rev >> 4) & 0x0f, rev & 0x0f); 1418 (rev >> 4) & 0x0f, rev & 0x0f);
1418 } 1419 }
@@ -1421,7 +1422,7 @@ static int __init _omap_gpio_init(void)
1421 1422
1422 gpio_bank_count = 5; 1423 gpio_bank_count = 5;
1423 gpio_bank = gpio_bank_243x; 1424 gpio_bank = gpio_bank_243x;
1424 rev = omap_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); 1425 rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1425 printk(KERN_INFO "OMAP243x GPIO hardware version %d.%d\n", 1426 printk(KERN_INFO "OMAP243x GPIO hardware version %d.%d\n",
1426 (rev >> 4) & 0x0f, rev & 0x0f); 1427 (rev >> 4) & 0x0f, rev & 0x0f);
1427 } 1428 }
@@ -1432,7 +1433,7 @@ static int __init _omap_gpio_init(void)
1432 1433
1433 gpio_bank_count = OMAP34XX_NR_GPIOS; 1434 gpio_bank_count = OMAP34XX_NR_GPIOS;
1434 gpio_bank = gpio_bank_34xx; 1435 gpio_bank = gpio_bank_34xx;
1435 rev = omap_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION); 1436 rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
1436 printk(KERN_INFO "OMAP34xx GPIO hardware version %d.%d\n", 1437 printk(KERN_INFO "OMAP34xx GPIO hardware version %d.%d\n",
1437 (rev >> 4) & 0x0f, rev & 0x0f); 1438 (rev >> 4) & 0x0f, rev & 0x0f);
1438 } 1439 }
@@ -1441,10 +1442,9 @@ static int __init _omap_gpio_init(void)
1441 int j, gpio_count = 16; 1442 int j, gpio_count = 16;
1442 1443
1443 bank = &gpio_bank[i]; 1444 bank = &gpio_bank[i];
1444 bank->base = IO_ADDRESS(bank->base);
1445 spin_lock_init(&bank->lock); 1445 spin_lock_init(&bank->lock);
1446 if (bank_is_mpuio(bank)) 1446 if (bank_is_mpuio(bank))
1447 omap_writew(0xFFFF, OMAP_MPUIO_BASE + OMAP_MPUIO_GPIO_MASKIT); 1447 __raw_writew(0xffff, bank->base + OMAP_MPUIO_GPIO_MASKIT);
1448 if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) { 1448 if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) {
1449 __raw_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK); 1449 __raw_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK);
1450 __raw_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS); 1450 __raw_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS);
@@ -1488,7 +1488,7 @@ static int __init _omap_gpio_init(void)
1488 bank->chip.set = gpio_set; 1488 bank->chip.set = gpio_set;
1489 if (bank_is_mpuio(bank)) { 1489 if (bank_is_mpuio(bank)) {
1490 bank->chip.label = "mpuio"; 1490 bank->chip.label = "mpuio";
1491#ifdef CONFIG_ARCH_OMAP1 1491#ifdef CONFIG_ARCH_OMAP16XX
1492 bank->chip.dev = &omap_mpuio_device.dev; 1492 bank->chip.dev = &omap_mpuio_device.dev;
1493#endif 1493#endif
1494 bank->chip.base = OMAP_MPUIO(0); 1494 bank->chip.base = OMAP_MPUIO(0);
diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h
index e3fd62d9a995..ee378d254cbd 100644
--- a/arch/arm/plat-omap/include/mach/control.h
+++ b/arch/arm/plat-omap/include/mach/control.h
@@ -19,11 +19,11 @@
19#include <mach/io.h> 19#include <mach/io.h>
20 20
21#define OMAP242X_CTRL_REGADDR(reg) \ 21#define OMAP242X_CTRL_REGADDR(reg) \
22 (void __iomem *)IO_ADDRESS(OMAP242X_CTRL_BASE + (reg)) 22 IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))
23#define OMAP243X_CTRL_REGADDR(reg) \ 23#define OMAP243X_CTRL_REGADDR(reg) \
24 (void __iomem *)IO_ADDRESS(OMAP243X_CTRL_BASE + (reg)) 24 IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))
25#define OMAP343X_CTRL_REGADDR(reg) \ 25#define OMAP343X_CTRL_REGADDR(reg) \
26 (void __iomem *)IO_ADDRESS(OMAP343X_CTRL_BASE + (reg)) 26 IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))
27 27
28/* 28/*
29 * As elsewhere, the "OMAP2_" prefix indicates that the macro is valid for 29 * As elsewhere, the "OMAP2_" prefix indicates that the macro is valid for
diff --git a/arch/arm/plat-omap/include/mach/fpga.h b/arch/arm/plat-omap/include/mach/fpga.h
index c92e4b42b289..f1864a652f7a 100644
--- a/arch/arm/plat-omap/include/mach/fpga.h
+++ b/arch/arm/plat-omap/include/mach/fpga.h
@@ -34,9 +34,9 @@ extern void omap1510_fpga_init_irq(void);
34 * --------------------------------------------------------------------------- 34 * ---------------------------------------------------------------------------
35 */ 35 */
36/* maps in the FPGA registers and the ETHR registers */ 36/* maps in the FPGA registers and the ETHR registers */
37#define H2P2_DBG_FPGA_BASE 0xE8000000 /* VA */ 37#define H2P2_DBG_FPGA_BASE IOMEM(0xE8000000) /* VA */
38#define H2P2_DBG_FPGA_SIZE SZ_4K /* SIZE */ 38#define H2P2_DBG_FPGA_SIZE SZ_4K /* SIZE */
39#define H2P2_DBG_FPGA_START 0x04000000 /* PA */ 39#define H2P2_DBG_FPGA_START 0x04000000 /* PA */
40 40
41#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300) 41#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300)
42#define H2P2_DBG_FPGA_FPGA_REV (H2P2_DBG_FPGA_BASE + 0x10) /* FPGA Revision */ 42#define H2P2_DBG_FPGA_FPGA_REV (H2P2_DBG_FPGA_BASE + 0x10) /* FPGA Revision */
@@ -85,9 +85,9 @@ struct h2p2_dbg_fpga {
85 * OMAP-1510 FPGA 85 * OMAP-1510 FPGA
86 * --------------------------------------------------------------------------- 86 * ---------------------------------------------------------------------------
87 */ 87 */
88#define OMAP1510_FPGA_BASE 0xE8000000 /* Virtual */ 88#define OMAP1510_FPGA_BASE IOMEM(0xE8000000) /* VA */
89#define OMAP1510_FPGA_SIZE SZ_4K 89#define OMAP1510_FPGA_SIZE SZ_4K
90#define OMAP1510_FPGA_START 0x08000000 /* Physical */ 90#define OMAP1510_FPGA_START 0x08000000 /* PA */
91 91
92/* Revision */ 92/* Revision */
93#define OMAP1510_FPGA_REV_LOW (OMAP1510_FPGA_BASE + 0x0) 93#define OMAP1510_FPGA_REV_LOW (OMAP1510_FPGA_BASE + 0x0)
diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h
index 94ce2780e8ee..4cb818da672c 100644
--- a/arch/arm/plat-omap/include/mach/gpio.h
+++ b/arch/arm/plat-omap/include/mach/gpio.h
@@ -29,7 +29,7 @@
29#include <mach/irqs.h> 29#include <mach/irqs.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#define OMAP_MPUIO_BASE (void __iomem *)0xfffb5000 32#define OMAP_MPUIO_BASE 0xfffb5000
33 33
34#ifdef CONFIG_ARCH_OMAP730 34#ifdef CONFIG_ARCH_OMAP730
35#define OMAP_MPUIO_INPUT_LATCH 0x00 35#define OMAP_MPUIO_INPUT_LATCH 0x00
diff --git a/arch/arm/plat-omap/include/mach/hardware.h b/arch/arm/plat-omap/include/mach/hardware.h
index 07f5d7f21528..abb01e471c4c 100644
--- a/arch/arm/plat-omap/include/mach/hardware.h
+++ b/arch/arm/plat-omap/include/mach/hardware.h
@@ -89,7 +89,7 @@
89#define DPLL_CTL (0xfffecf00) 89#define DPLL_CTL (0xfffecf00)
90 90
91/* DSP clock control. Must use __raw_readw() and __raw_writew() with these */ 91/* DSP clock control. Must use __raw_readw() and __raw_writew() with these */
92#define DSP_CONFIG_REG_BASE (0xe1008000) 92#define DSP_CONFIG_REG_BASE IOMEM(0xe1008000)
93#define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0) 93#define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0)
94#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4) 94#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4)
95#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8) 95#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8)
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h
index 2a30b7d88cde..dd0cf069431d 100644
--- a/arch/arm/plat-omap/include/mach/io.h
+++ b/arch/arm/plat-omap/include/mach/io.h
@@ -55,14 +55,13 @@
55 55
56#if defined(CONFIG_ARCH_OMAP1) 56#if defined(CONFIG_ARCH_OMAP1)
57 57
58#define IO_PHYS 0xFFFB0000 58#define IO_PHYS 0xFFFB0000
59#define IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */ 59#define IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
60#define IO_SIZE 0x40000 60#define IO_SIZE 0x40000
61#define IO_VIRT (IO_PHYS - IO_OFFSET) 61#define IO_VIRT (IO_PHYS - IO_OFFSET)
62#define IO_ADDRESS(pa) ((pa) - IO_OFFSET) 62#define __IO_ADDRESS(pa) ((pa) - IO_OFFSET)
63#define OMAP1_IO_ADDRESS(pa) ((pa) - IO_OFFSET) 63#define __OMAP1_IO_ADDRESS(pa) ((pa) - IO_OFFSET)
64#define io_p2v(pa) ((pa) - IO_OFFSET) 64#define io_v2p(va) ((va) + IO_OFFSET)
65#define io_v2p(va) ((va) + IO_OFFSET)
66 65
67#elif defined(CONFIG_ARCH_OMAP2) 66#elif defined(CONFIG_ARCH_OMAP2)
68 67
@@ -90,11 +89,10 @@
90 89
91#endif 90#endif
92 91
93#define IO_OFFSET 0x90000000 92#define IO_OFFSET 0x90000000
94#define IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ 93#define __IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */
95#define OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ 94#define __OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */
96#define io_p2v(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ 95#define io_v2p(va) ((va) - IO_OFFSET) /* Works for L3 and L4 */
97#define io_v2p(va) ((va) - IO_OFFSET) /* Works for L3 and L4 */
98 96
99/* DSP */ 97/* DSP */
100#define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */ 98#define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */
@@ -149,9 +147,8 @@
149 147
150 148
151#define IO_OFFSET 0x90000000 149#define IO_OFFSET 0x90000000
152#define IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ 150#define __IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
153#define OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ 151#define __OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
154#define io_p2v(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
155#define io_v2p(va) ((va) - IO_OFFSET)/* Works for L3 and L4 */ 152#define io_v2p(va) ((va) - IO_OFFSET)/* Works for L3 and L4 */
156 153
157/* DSP */ 154/* DSP */
@@ -167,7 +164,14 @@
167 164
168#endif 165#endif
169 166
170#ifndef __ASSEMBLER__ 167#define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa))
168#define OMAP1_IO_ADDRESS(pa) IOMEM(__OMAP1_IO_ADDRESS(pa))
169#define OMAP2_IO_ADDRESS(pa) IOMEM(__OMAP2_IO_ADDRESS(pa))
170
171#ifdef __ASSEMBLER__
172#define IOMEM(x) x
173#else
174#define IOMEM(x) ((void __force __iomem *)(x))
171 175
172/* 176/*
173 * Functions to access the OMAP IO region 177 * Functions to access the OMAP IO region
@@ -178,13 +182,13 @@
178 * - DO NOT use hardcoded virtual addresses to allow changing the 182 * - DO NOT use hardcoded virtual addresses to allow changing the
179 * IO address space again if needed 183 * IO address space again if needed
180 */ 184 */
181#define omap_readb(a) (*(volatile unsigned char *)IO_ADDRESS(a)) 185#define omap_readb(a) __raw_readb(IO_ADDRESS(a))
182#define omap_readw(a) (*(volatile unsigned short *)IO_ADDRESS(a)) 186#define omap_readw(a) __raw_readw(IO_ADDRESS(a))
183#define omap_readl(a) (*(volatile unsigned int *)IO_ADDRESS(a)) 187#define omap_readl(a) __raw_readl(IO_ADDRESS(a))
184 188
185#define omap_writeb(v,a) (*(volatile unsigned char *)IO_ADDRESS(a) = (v)) 189#define omap_writeb(v,a) __raw_writeb(v, IO_ADDRESS(a))
186#define omap_writew(v,a) (*(volatile unsigned short *)IO_ADDRESS(a) = (v)) 190#define omap_writew(v,a) __raw_writew(v, IO_ADDRESS(a))
187#define omap_writel(v,a) (*(volatile unsigned int *)IO_ADDRESS(a) = (v)) 191#define omap_writel(v,a) __raw_writel(v, IO_ADDRESS(a))
188 192
189extern void omap1_map_common_io(void); 193extern void omap1_map_common_io(void);
190extern void omap1_init_common_hw(void); 194extern void omap1_init_common_hw(void);
@@ -192,6 +196,12 @@ extern void omap1_init_common_hw(void);
192extern void omap2_map_common_io(void); 196extern void omap2_map_common_io(void);
193extern void omap2_init_common_hw(void); 197extern void omap2_init_common_hw(void);
194 198
199#define __arch_ioremap(p,s,t) omap_ioremap(p,s,t)
200#define __arch_iounmap(v) omap_iounmap(v)
201
202void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type);
203void omap_iounmap(volatile void __iomem *addr);
204
195#endif 205#endif
196 206
197#endif 207#endif
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index 6eb44a92871d..a3074f2fb7ce 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -315,7 +315,7 @@ struct omap_mcbsp_ops {
315}; 315};
316 316
317struct omap_mcbsp_platform_data { 317struct omap_mcbsp_platform_data {
318 u32 virt_base; 318 unsigned long phys_base;
319 u8 dma_rx_sync, dma_tx_sync; 319 u8 dma_rx_sync, dma_tx_sync;
320 u16 rx_irq, tx_irq; 320 u16 rx_irq, tx_irq;
321 struct omap_mcbsp_ops *ops; 321 struct omap_mcbsp_ops *ops;
@@ -324,7 +324,8 @@ struct omap_mcbsp_platform_data {
324 324
325struct omap_mcbsp { 325struct omap_mcbsp {
326 struct device *dev; 326 struct device *dev;
327 u32 io_base; 327 unsigned long phys_base;
328 void __iomem *io_base;
328 u8 id; 329 u8 id;
329 u8 free; 330 u8 free;
330 omap_mcbsp_word_length rx_word_length; 331 omap_mcbsp_word_length rx_word_length;
diff --git a/arch/arm/plat-omap/include/mach/pm.h b/arch/arm/plat-omap/include/mach/pm.h
index bfa09325a5ff..6063e9681de2 100644
--- a/arch/arm/plat-omap/include/mach/pm.h
+++ b/arch/arm/plat-omap/include/mach/pm.h
@@ -39,11 +39,11 @@
39 * Register and offset definitions to be used in PM assembler code 39 * Register and offset definitions to be used in PM assembler code
40 * ---------------------------------------------------------------------------- 40 * ----------------------------------------------------------------------------
41 */ 41 */
42#define CLKGEN_REG_ASM_BASE io_p2v(0xfffece00) 42#define CLKGEN_REG_ASM_BASE IO_ADDRESS(0xfffece00)
43#define ARM_IDLECT1_ASM_OFFSET 0x04 43#define ARM_IDLECT1_ASM_OFFSET 0x04
44#define ARM_IDLECT2_ASM_OFFSET 0x08 44#define ARM_IDLECT2_ASM_OFFSET 0x08
45 45
46#define TCMIF_ASM_BASE io_p2v(0xfffecc00) 46#define TCMIF_ASM_BASE IO_ADDRESS(0xfffecc00)
47#define EMIFS_CONFIG_ASM_OFFSET 0x0c 47#define EMIFS_CONFIG_ASM_OFFSET 0x0c
48#define EMIFF_SDRAM_CONFIG_ASM_OFFSET 0x20 48#define EMIFF_SDRAM_CONFIG_ASM_OFFSET 0x20
49 49
diff --git a/arch/arm/plat-omap/include/mach/sdrc.h b/arch/arm/plat-omap/include/mach/sdrc.h
index 787b7acec546..d908eb527c8d 100644
--- a/arch/arm/plat-omap/include/mach/sdrc.h
+++ b/arch/arm/plat-omap/include/mach/sdrc.h
@@ -63,9 +63,9 @@
63 */ 63 */
64 64
65 65
66#define OMAP242X_SMS_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP2420_SMS_BASE + reg) 66#define OMAP242X_SMS_REGADDR(reg) IO_ADDRESS(OMAP2420_SMS_BASE + reg)
67#define OMAP243X_SMS_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP243X_SMS_BASE + reg) 67#define OMAP243X_SMS_REGADDR(reg) IO_ADDRESS(OMAP243X_SMS_BASE + reg)
68#define OMAP343X_SMS_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP343X_SMS_BASE + reg) 68#define OMAP343X_SMS_REGADDR(reg) IO_ADDRESS(OMAP343X_SMS_BASE + reg)
69 69
70/* SMS register offsets - read/write with sms_{read,write}_reg() */ 70/* SMS register offsets - read/write with sms_{read,write}_reg() */
71 71
diff --git a/arch/arm/plat-omap/include/mach/serial.h b/arch/arm/plat-omap/include/mach/serial.h
index cc6bfa51ccb5..515b89bee966 100644
--- a/arch/arm/plat-omap/include/mach/serial.h
+++ b/arch/arm/plat-omap/include/mach/serial.h
@@ -26,12 +26,12 @@
26#define OMAP1510_BASE_BAUD (12000000/16) 26#define OMAP1510_BASE_BAUD (12000000/16)
27#define OMAP16XX_BASE_BAUD (48000000/16) 27#define OMAP16XX_BASE_BAUD (48000000/16)
28 28
29#define is_omap_port(p) ({int __ret = 0; \ 29#define is_omap_port(pt) ({int __ret = 0; \
30 if (p == IO_ADDRESS(OMAP_UART1_BASE) || \ 30 if ((pt)->port.mapbase == OMAP_UART1_BASE || \
31 p == IO_ADDRESS(OMAP_UART2_BASE) || \ 31 (pt)->port.mapbase == OMAP_UART2_BASE || \
32 p == IO_ADDRESS(OMAP_UART3_BASE)) \ 32 (pt)->port.mapbase == OMAP_UART3_BASE) \
33 __ret = 1; \ 33 __ret = 1; \
34 __ret; \ 34 __ret; \
35 }) 35 })
36 36
37#endif 37#endif
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c
new file mode 100644
index 000000000000..0253c456ed5b
--- /dev/null
+++ b/arch/arm/plat-omap/io.c
@@ -0,0 +1,83 @@
1#include <linux/module.h>
2#include <linux/io.h>
3#include <linux/mm.h>
4
5#include <mach/omap730.h>
6#include <mach/omap1510.h>
7#include <mach/omap16xx.h>
8#include <mach/omap24xx.h>
9#include <mach/omap34xx.h>
10
11#define BETWEEN(p,st,sz) ((p) >= (st) && (p) < ((st) + (sz)))
12#define XLATE(p,pst,vst) ((void __iomem *)((p) - (pst) + (vst)))
13
14/*
15 * Intercept ioremap() requests for addresses in our fixed mapping regions.
16 */
17void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
18{
19#ifdef CONFIG_ARCH_OMAP1
20 if (cpu_class_is_omap1()) {
21 if (BETWEEN(p, IO_PHYS, IO_SIZE))
22 return XLATE(p, IO_PHYS, IO_VIRT);
23 }
24 if (cpu_is_omap730()) {
25 if (BETWEEN(p, OMAP730_DSP_BASE, OMAP730_DSP_SIZE))
26 return XLATE(p, OMAP730_DSP_BASE, OMAP730_DSP_START);
27
28 if (BETWEEN(p, OMAP730_DSPREG_BASE, OMAP730_DSPREG_SIZE))
29 return XLATE(p, OMAP730_DSPREG_BASE,
30 OMAP730_DSPREG_START);
31 }
32 if (cpu_is_omap15xx()) {
33 if (BETWEEN(p, OMAP1510_DSP_BASE, OMAP1510_DSP_SIZE))
34 return XLATE(p, OMAP1510_DSP_BASE, OMAP1510_DSP_START);
35
36 if (BETWEEN(p, OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_SIZE))
37 return XLATE(p, OMAP1510_DSPREG_BASE,
38 OMAP1510_DSPREG_START);
39 }
40 if (cpu_is_omap16xx()) {
41 if (BETWEEN(p, OMAP16XX_DSP_BASE, OMAP16XX_DSP_SIZE))
42 return XLATE(p, OMAP16XX_DSP_BASE, OMAP16XX_DSP_START);
43
44 if (BETWEEN(p, OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_SIZE))
45 return XLATE(p, OMAP16XX_DSPREG_BASE,
46 OMAP16XX_DSPREG_START);
47 }
48#endif
49#ifdef CONFIG_ARCH_OMAP2
50 if (cpu_class_is_omap2()) {
51 if (BETWEEN(p, L3_24XX_PHYS, L3_24XX_SIZE))
52 return XLATE(p, L3_24XX_PHYS, L3_24XX_VIRT);
53 if (BETWEEN(p, L4_24XX_PHYS, L4_24XX_SIZE))
54 return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT);
55 if (BETWEEN(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_SIZE))
56 return XLATE(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_VIRT);
57 if (BETWEEN(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE))
58 return XLATE(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE);
59 if (BETWEEN(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_SIZE))
60 return XLATE(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_VIRT);
61 }
62#ifdef CONFIG_ARCH_OMAP2430
63 if (cpu_is_omap2430()) {
64 if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE))
65 return XLATE(L4_WK_243X_PHYS, L4_WK_243X_VIRT);
66 if (BETWEEN(p, OMAP243X_GPMC_PHYS, OMAP243X_GPMC_SIZE))
67 return XLATE(OMAP243X_GPMC_PHYS, OMAP243X_GPMC_VIRT);
68 }
69#endif
70#endif
71
72 return __arm_ioremap(p, size, type);
73}
74EXPORT_SYMBOL(omap_ioremap);
75
76void omap_iounmap(volatile void __iomem *addr)
77{
78 unsigned long virt = (unsigned long)addr;
79
80 if (virt >= VMALLOC_START && virt < VMALLOC_END)
81 __iounmap(addr);
82}
83EXPORT_SYMBOL(omap_iounmap);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index d0844050f2d2..e63990fd923f 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -126,7 +126,7 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
126 */ 126 */
127void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) 127void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
128{ 128{
129 u32 io_base; 129 void __iomem *io_base;
130 130
131 if (!omap_mcbsp_check_valid_id(id)) { 131 if (!omap_mcbsp_check_valid_id(id)) {
132 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 132 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -134,8 +134,8 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
134 } 134 }
135 135
136 io_base = mcbsp[id].io_base; 136 io_base = mcbsp[id].io_base;
137 dev_dbg(mcbsp[id].dev, "Configuring McBSP%d io_base: 0x%8x\n", 137 dev_dbg(mcbsp[id].dev, "Configuring McBSP%d phys_base: 0x%08lx\n",
138 mcbsp[id].id, io_base); 138 mcbsp[id].id, mcbsp[id].phys_base);
139 139
140 /* We write the given config */ 140 /* We write the given config */
141 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2); 141 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2);
@@ -273,7 +273,7 @@ EXPORT_SYMBOL(omap_mcbsp_free);
273 */ 273 */
274void omap_mcbsp_start(unsigned int id) 274void omap_mcbsp_start(unsigned int id)
275{ 275{
276 u32 io_base; 276 void __iomem *io_base;
277 u16 w; 277 u16 w;
278 278
279 if (!omap_mcbsp_check_valid_id(id)) { 279 if (!omap_mcbsp_check_valid_id(id)) {
@@ -310,7 +310,7 @@ EXPORT_SYMBOL(omap_mcbsp_start);
310 310
311void omap_mcbsp_stop(unsigned int id) 311void omap_mcbsp_stop(unsigned int id)
312{ 312{
313 u32 io_base; 313 void __iomem *io_base;
314 u16 w; 314 u16 w;
315 315
316 if (!omap_mcbsp_check_valid_id(id)) { 316 if (!omap_mcbsp_check_valid_id(id)) {
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(omap_mcbsp_stop);
337/* polled mcbsp i/o operations */ 337/* polled mcbsp i/o operations */
338int omap_mcbsp_pollwrite(unsigned int id, u16 buf) 338int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
339{ 339{
340 u32 base; 340 void __iomem *base;
341 341
342 if (!omap_mcbsp_check_valid_id(id)) { 342 if (!omap_mcbsp_check_valid_id(id)) {
343 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 343 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -379,7 +379,7 @@ EXPORT_SYMBOL(omap_mcbsp_pollwrite);
379 379
380int omap_mcbsp_pollread(unsigned int id, u16 *buf) 380int omap_mcbsp_pollread(unsigned int id, u16 *buf)
381{ 381{
382 u32 base; 382 void __iomem *base;
383 383
384 if (!omap_mcbsp_check_valid_id(id)) { 384 if (!omap_mcbsp_check_valid_id(id)) {
385 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 385 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -424,7 +424,7 @@ EXPORT_SYMBOL(omap_mcbsp_pollread);
424 */ 424 */
425void omap_mcbsp_xmit_word(unsigned int id, u32 word) 425void omap_mcbsp_xmit_word(unsigned int id, u32 word)
426{ 426{
427 u32 io_base; 427 void __iomem *io_base;
428 omap_mcbsp_word_length word_length; 428 omap_mcbsp_word_length word_length;
429 429
430 if (!omap_mcbsp_check_valid_id(id)) { 430 if (!omap_mcbsp_check_valid_id(id)) {
@@ -445,7 +445,7 @@ EXPORT_SYMBOL(omap_mcbsp_xmit_word);
445 445
446u32 omap_mcbsp_recv_word(unsigned int id) 446u32 omap_mcbsp_recv_word(unsigned int id)
447{ 447{
448 u32 io_base; 448 void __iomem *io_base;
449 u16 word_lsb, word_msb = 0; 449 u16 word_lsb, word_msb = 0;
450 omap_mcbsp_word_length word_length; 450 omap_mcbsp_word_length word_length;
451 451
@@ -469,7 +469,7 @@ EXPORT_SYMBOL(omap_mcbsp_recv_word);
469 469
470int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word) 470int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
471{ 471{
472 u32 io_base; 472 void __iomem *io_base;
473 omap_mcbsp_word_length tx_word_length; 473 omap_mcbsp_word_length tx_word_length;
474 omap_mcbsp_word_length rx_word_length; 474 omap_mcbsp_word_length rx_word_length;
475 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 475 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
@@ -534,7 +534,8 @@ EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll);
534 534
535int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word) 535int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
536{ 536{
537 u32 io_base, clock_word = 0; 537 u32 clock_word = 0;
538 void __iomem *io_base;
538 omap_mcbsp_word_length tx_word_length; 539 omap_mcbsp_word_length tx_word_length;
539 omap_mcbsp_word_length rx_word_length; 540 omap_mcbsp_word_length rx_word_length;
540 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 541 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
@@ -651,7 +652,7 @@ int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer,
651 omap_set_dma_dest_params(mcbsp[id].dma_tx_lch, 652 omap_set_dma_dest_params(mcbsp[id].dma_tx_lch,
652 src_port, 653 src_port,
653 OMAP_DMA_AMODE_CONSTANT, 654 OMAP_DMA_AMODE_CONSTANT,
654 mcbsp[id].io_base + OMAP_MCBSP_REG_DXR1, 655 mcbsp[id].phys_base + OMAP_MCBSP_REG_DXR1,
655 0, 0); 656 0, 0);
656 657
657 omap_set_dma_src_params(mcbsp[id].dma_tx_lch, 658 omap_set_dma_src_params(mcbsp[id].dma_tx_lch,
@@ -712,7 +713,7 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer,
712 omap_set_dma_src_params(mcbsp[id].dma_rx_lch, 713 omap_set_dma_src_params(mcbsp[id].dma_rx_lch,
713 src_port, 714 src_port,
714 OMAP_DMA_AMODE_CONSTANT, 715 OMAP_DMA_AMODE_CONSTANT,
715 mcbsp[id].io_base + OMAP_MCBSP_REG_DRR1, 716 mcbsp[id].phys_base + OMAP_MCBSP_REG_DRR1,
716 0, 0); 717 0, 0);
717 718
718 omap_set_dma_dest_params(mcbsp[id].dma_rx_lch, 719 omap_set_dma_dest_params(mcbsp[id].dma_rx_lch,
@@ -830,7 +831,13 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev)
830 mcbsp[id].dma_tx_lch = -1; 831 mcbsp[id].dma_tx_lch = -1;
831 mcbsp[id].dma_rx_lch = -1; 832 mcbsp[id].dma_rx_lch = -1;
832 833
833 mcbsp[id].io_base = pdata->virt_base; 834 mcbsp[id].phys_base = pdata->phys_base;
835 mcbsp[id].io_base = ioremap(pdata->phys_base, SZ_4K);
836 if (!mcbsp[id].io_base) {
837 ret = -ENOMEM;
838 goto err_ioremap;
839 }
840
834 /* Default I/O is IRQ based */ 841 /* Default I/O is IRQ based */
835 mcbsp[id].io_type = OMAP_MCBSP_IRQ_IO; 842 mcbsp[id].io_type = OMAP_MCBSP_IRQ_IO;
836 mcbsp[id].tx_irq = pdata->tx_irq; 843 mcbsp[id].tx_irq = pdata->tx_irq;
@@ -841,18 +848,22 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev)
841 if (pdata->clk_name) 848 if (pdata->clk_name)
842 mcbsp[id].clk = clk_get(&pdev->dev, pdata->clk_name); 849 mcbsp[id].clk = clk_get(&pdev->dev, pdata->clk_name);
843 if (IS_ERR(mcbsp[id].clk)) { 850 if (IS_ERR(mcbsp[id].clk)) {
844 mcbsp[id].free = 0;
845 dev_err(&pdev->dev, 851 dev_err(&pdev->dev,
846 "Invalid clock configuration for McBSP%d.\n", 852 "Invalid clock configuration for McBSP%d.\n",
847 mcbsp[id].id); 853 mcbsp[id].id);
848 ret = -EINVAL; 854 ret = PTR_ERR(mcbsp[id].clk);
849 goto exit; 855 goto err_clk;
850 } 856 }
851 857
852 mcbsp[id].pdata = pdata; 858 mcbsp[id].pdata = pdata;
853 mcbsp[id].dev = &pdev->dev; 859 mcbsp[id].dev = &pdev->dev;
854 platform_set_drvdata(pdev, &mcbsp[id]); 860 platform_set_drvdata(pdev, &mcbsp[id]);
861 return 0;
855 862
863err_clk:
864 iounmap(mcbsp[id].io_base);
865err_ioremap:
866 mcbsp[id].free = 0;
856exit: 867exit:
857 return ret; 868 return ret;
858} 869}
@@ -871,6 +882,8 @@ static int omap_mcbsp_remove(struct platform_device *pdev)
871 clk_disable(mcbsp->clk); 882 clk_disable(mcbsp->clk);
872 clk_put(mcbsp->clk); 883 clk_put(mcbsp->clk);
873 884
885 iounmap(mcbsp->io_base);
886
874 mcbsp->clk = NULL; 887 mcbsp->clk = NULL;
875 mcbsp->free = 0; 888 mcbsp->free = 0;
876 mcbsp->dev = NULL; 889 mcbsp->dev = NULL;