diff options
Diffstat (limited to 'arch/arm/plat-omap/include/mach/io.h')
-rw-r--r-- | arch/arm/plat-omap/include/mach/io.h | 97 |
1 files changed, 48 insertions, 49 deletions
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h index 21fb0efdda86..8d32df32b0b1 100644 --- a/arch/arm/plat-omap/include/mach/io.h +++ b/arch/arm/plat-omap/include/mach/io.h | |||
@@ -54,17 +54,33 @@ | |||
54 | * ---------------------------------------------------------------------------- | 54 | * ---------------------------------------------------------------------------- |
55 | */ | 55 | */ |
56 | 56 | ||
57 | #if defined(CONFIG_ARCH_OMAP1) | 57 | #ifdef __ASSEMBLER__ |
58 | #define IOMEM(x) (x) | ||
59 | #else | ||
60 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
61 | #endif | ||
62 | |||
63 | #define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */ | ||
64 | #define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET) | ||
65 | |||
66 | #define OMAP2_IO_OFFSET 0x90000000 | ||
67 | #define OMAP2_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_IO_OFFSET) /* L3 and L4 */ | ||
68 | |||
69 | /* | ||
70 | * ---------------------------------------------------------------------------- | ||
71 | * Omap1 specific IO mapping | ||
72 | * ---------------------------------------------------------------------------- | ||
73 | */ | ||
58 | 74 | ||
59 | #define IO_PHYS 0xFFFB0000 | 75 | #define OMAP1_IO_PHYS 0xFFFB0000 |
60 | #define IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */ | 76 | #define OMAP1_IO_SIZE 0x40000 |
61 | #define IO_SIZE 0x40000 | 77 | #define OMAP1_IO_VIRT (OMAP1_IO_PHYS - OMAP1_IO_OFFSET) |
62 | #define IO_VIRT (IO_PHYS - IO_OFFSET) | ||
63 | #define __IO_ADDRESS(pa) ((pa) - IO_OFFSET) | ||
64 | #define __OMAP1_IO_ADDRESS(pa) ((pa) - IO_OFFSET) | ||
65 | #define io_v2p(va) ((va) + IO_OFFSET) | ||
66 | 78 | ||
67 | #elif defined(CONFIG_ARCH_OMAP2) | 79 | /* |
80 | * ---------------------------------------------------------------------------- | ||
81 | * Omap2 specific IO mapping | ||
82 | * ---------------------------------------------------------------------------- | ||
83 | */ | ||
68 | 84 | ||
69 | /* We map both L3 and L4 on OMAP2 */ | 85 | /* We map both L3 and L4 on OMAP2 */ |
70 | #define L3_24XX_PHYS L3_24XX_BASE /* 0x68000000 */ | 86 | #define L3_24XX_PHYS L3_24XX_BASE /* 0x68000000 */ |
@@ -87,11 +103,6 @@ | |||
87 | #define OMAP243X_SMS_VIRT 0xFC000000 | 103 | #define OMAP243X_SMS_VIRT 0xFC000000 |
88 | #define OMAP243X_SMS_SIZE SZ_1M | 104 | #define OMAP243X_SMS_SIZE SZ_1M |
89 | 105 | ||
90 | #define IO_OFFSET 0x90000000 | ||
91 | #define __IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ | ||
92 | #define __OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ | ||
93 | #define io_v2p(va) ((va) - IO_OFFSET) /* Works for L3 and L4 */ | ||
94 | |||
95 | /* DSP */ | 106 | /* DSP */ |
96 | #define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */ | 107 | #define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */ |
97 | #define DSP_MEM_24XX_VIRT 0xe0000000 | 108 | #define DSP_MEM_24XX_VIRT 0xe0000000 |
@@ -103,7 +114,11 @@ | |||
103 | #define DSP_MMU_24XX_VIRT 0xe2000000 | 114 | #define DSP_MMU_24XX_VIRT 0xe2000000 |
104 | #define DSP_MMU_24XX_SIZE SZ_4K | 115 | #define DSP_MMU_24XX_SIZE SZ_4K |
105 | 116 | ||
106 | #elif defined(CONFIG_ARCH_OMAP3) | 117 | /* |
118 | * ---------------------------------------------------------------------------- | ||
119 | * Omap3 specific IO mapping | ||
120 | * ---------------------------------------------------------------------------- | ||
121 | */ | ||
107 | 122 | ||
108 | /* We map both L3 and L4 on OMAP3 */ | 123 | /* We map both L3 and L4 on OMAP3 */ |
109 | #define L3_34XX_PHYS L3_34XX_BASE /* 0x68000000 */ | 124 | #define L3_34XX_PHYS L3_34XX_BASE /* 0x68000000 */ |
@@ -143,12 +158,6 @@ | |||
143 | #define OMAP343X_SDRC_VIRT 0xFD000000 | 158 | #define OMAP343X_SDRC_VIRT 0xFD000000 |
144 | #define OMAP343X_SDRC_SIZE SZ_1M | 159 | #define OMAP343X_SDRC_SIZE SZ_1M |
145 | 160 | ||
146 | |||
147 | #define IO_OFFSET 0x90000000 | ||
148 | #define __IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ | ||
149 | #define __OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ | ||
150 | #define io_v2p(va) ((va) - IO_OFFSET)/* Works for L3 and L4 */ | ||
151 | |||
152 | /* DSP */ | 161 | /* DSP */ |
153 | #define DSP_MEM_34XX_PHYS OMAP34XX_DSP_MEM_BASE /* 0x58000000 */ | 162 | #define DSP_MEM_34XX_PHYS OMAP34XX_DSP_MEM_BASE /* 0x58000000 */ |
154 | #define DSP_MEM_34XX_VIRT 0xe0000000 | 163 | #define DSP_MEM_34XX_VIRT 0xe0000000 |
@@ -160,8 +169,12 @@ | |||
160 | #define DSP_MMU_34XX_VIRT 0xe2000000 | 169 | #define DSP_MMU_34XX_VIRT 0xe2000000 |
161 | #define DSP_MMU_34XX_SIZE SZ_4K | 170 | #define DSP_MMU_34XX_SIZE SZ_4K |
162 | 171 | ||
172 | /* | ||
173 | * ---------------------------------------------------------------------------- | ||
174 | * Omap4 specific IO mapping | ||
175 | * ---------------------------------------------------------------------------- | ||
176 | */ | ||
163 | 177 | ||
164 | #elif defined(CONFIG_ARCH_OMAP4) | ||
165 | /* We map both L3 and L4 on OMAP4 */ | 178 | /* We map both L3 and L4 on OMAP4 */ |
166 | #define L3_44XX_PHYS L3_44XX_BASE | 179 | #define L3_44XX_PHYS L3_44XX_BASE |
167 | #define L3_44XX_VIRT 0xd4000000 | 180 | #define L3_44XX_VIRT 0xd4000000 |
@@ -189,38 +202,24 @@ | |||
189 | #define OMAP44XX_GPMC_SIZE SZ_1M | 202 | #define OMAP44XX_GPMC_SIZE SZ_1M |
190 | 203 | ||
191 | 204 | ||
192 | #define IO_OFFSET 0x90000000 | 205 | /* |
193 | #define __IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ | 206 | * ---------------------------------------------------------------------------- |
194 | #define __OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ | 207 | * Omap specific register access |
195 | #define io_v2p(va) ((va) - IO_OFFSET)/* Works for L3 and L4 */ | 208 | * ---------------------------------------------------------------------------- |
196 | 209 | */ | |
197 | #endif | ||
198 | |||
199 | #define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa)) | ||
200 | #define OMAP1_IO_ADDRESS(pa) IOMEM(__OMAP1_IO_ADDRESS(pa)) | ||
201 | #define OMAP2_IO_ADDRESS(pa) IOMEM(__OMAP2_IO_ADDRESS(pa)) | ||
202 | 210 | ||
203 | #ifdef __ASSEMBLER__ | 211 | #ifndef __ASSEMBLER__ |
204 | #define IOMEM(x) (x) | ||
205 | #else | ||
206 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
207 | 212 | ||
208 | /* | 213 | /* |
209 | * Functions to access the OMAP IO region | 214 | * NOTE: Please use ioremap + __raw_read/write where possible instead of these |
210 | * | ||
211 | * NOTE: - Use omap_read/write[bwl] for physical register addresses | ||
212 | * - Use __raw_read/write[bwl]() for virtual register addresses | ||
213 | * - Use IO_ADDRESS(phys_addr) to convert registers to virtual addresses | ||
214 | * - DO NOT use hardcoded virtual addresses to allow changing the | ||
215 | * IO address space again if needed | ||
216 | */ | 215 | */ |
217 | #define omap_readb(a) __raw_readb(IO_ADDRESS(a)) | ||
218 | #define omap_readw(a) __raw_readw(IO_ADDRESS(a)) | ||
219 | #define omap_readl(a) __raw_readl(IO_ADDRESS(a)) | ||
220 | 216 | ||
221 | #define omap_writeb(v,a) __raw_writeb(v, IO_ADDRESS(a)) | 217 | extern u8 omap_readb(u32 pa); |
222 | #define omap_writew(v,a) __raw_writew(v, IO_ADDRESS(a)) | 218 | extern u16 omap_readw(u32 pa); |
223 | #define omap_writel(v,a) __raw_writel(v, IO_ADDRESS(a)) | 219 | extern u32 omap_readl(u32 pa); |
220 | extern void omap_writeb(u8 v, u32 pa); | ||
221 | extern void omap_writew(u16 v, u32 pa); | ||
222 | extern void omap_writel(u32 v, u32 pa); | ||
224 | 223 | ||
225 | struct omap_sdrc_params; | 224 | struct omap_sdrc_params; |
226 | 225 | ||