diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/plat-omap/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/io.h | 6 | ||||
-rw-r--r-- | arch/arm/plat-omap/io.c | 83 |
3 files changed, 90 insertions, 1 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 |
6 | obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \ | 6 | obj-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 |
8 | obj-m := | 8 | obj-m := |
9 | obj-n := | 9 | obj-n := |
10 | obj- := | 10 | obj- := |
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h index 2a30b7d88cde..b9f57ce0ac15 100644 --- a/arch/arm/plat-omap/include/mach/io.h +++ b/arch/arm/plat-omap/include/mach/io.h | |||
@@ -192,6 +192,12 @@ extern void omap1_init_common_hw(void); | |||
192 | extern void omap2_map_common_io(void); | 192 | extern void omap2_map_common_io(void); |
193 | extern void omap2_init_common_hw(void); | 193 | extern void omap2_init_common_hw(void); |
194 | 194 | ||
195 | #define __arch_ioremap(p,s,t) omap_ioremap(p,s,t) | ||
196 | #define __arch_iounmap(v) omap_iounmap(v) | ||
197 | |||
198 | void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type); | ||
199 | void omap_iounmap(volatile void __iomem *addr); | ||
200 | |||
195 | #endif | 201 | #endif |
196 | 202 | ||
197 | #endif | 203 | #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 | */ | ||
17 | void __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 | } | ||
74 | EXPORT_SYMBOL(omap_ioremap); | ||
75 | |||
76 | void 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 | } | ||
83 | EXPORT_SYMBOL(omap_iounmap); | ||