aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/include/mach/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/include/mach/io.h')
-rw-r--r--arch/arm/plat-omap/include/mach/io.h64
1 files changed, 21 insertions, 43 deletions
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h
index 21fb0efdda86..55659809478e 100644
--- a/arch/arm/plat-omap/include/mach/io.h
+++ b/arch/arm/plat-omap/include/mach/io.h
@@ -54,15 +54,23 @@
54 * ---------------------------------------------------------------------------- 54 * ----------------------------------------------------------------------------
55 */ 55 */
56 56
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
57#if defined(CONFIG_ARCH_OMAP1) 69#if defined(CONFIG_ARCH_OMAP1)
58 70
59#define IO_PHYS 0xFFFB0000 71#define IO_PHYS 0xFFFB0000
60#define IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
61#define IO_SIZE 0x40000 72#define IO_SIZE 0x40000
62#define IO_VIRT (IO_PHYS - IO_OFFSET) 73#define IO_VIRT (IO_PHYS - OMAP1_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 74
67#elif defined(CONFIG_ARCH_OMAP2) 75#elif defined(CONFIG_ARCH_OMAP2)
68 76
@@ -87,11 +95,6 @@
87#define OMAP243X_SMS_VIRT 0xFC000000 95#define OMAP243X_SMS_VIRT 0xFC000000
88#define OMAP243X_SMS_SIZE SZ_1M 96#define OMAP243X_SMS_SIZE SZ_1M
89 97
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 */ 98/* DSP */
96#define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */ 99#define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */
97#define DSP_MEM_24XX_VIRT 0xe0000000 100#define DSP_MEM_24XX_VIRT 0xe0000000
@@ -143,12 +146,6 @@
143#define OMAP343X_SDRC_VIRT 0xFD000000 146#define OMAP343X_SDRC_VIRT 0xFD000000
144#define OMAP343X_SDRC_SIZE SZ_1M 147#define OMAP343X_SDRC_SIZE SZ_1M
145 148
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 */ 149/* DSP */
153#define DSP_MEM_34XX_PHYS OMAP34XX_DSP_MEM_BASE /* 0x58000000 */ 150#define DSP_MEM_34XX_PHYS OMAP34XX_DSP_MEM_BASE /* 0x58000000 */
154#define DSP_MEM_34XX_VIRT 0xe0000000 151#define DSP_MEM_34XX_VIRT 0xe0000000
@@ -188,39 +185,20 @@
188#define OMAP44XX_GPMC_VIRT 0xe0000000 185#define OMAP44XX_GPMC_VIRT 0xe0000000
189#define OMAP44XX_GPMC_SIZE SZ_1M 186#define OMAP44XX_GPMC_SIZE SZ_1M
190 187
191
192#define IO_OFFSET 0x90000000
193#define __IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
194#define __OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
195#define io_v2p(va) ((va) - IO_OFFSET)/* Works for L3 and L4 */
196
197#endif 188#endif
198 189
199#define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa)) 190#ifndef __ASSEMBLER__
200#define OMAP1_IO_ADDRESS(pa) IOMEM(__OMAP1_IO_ADDRESS(pa))
201#define OMAP2_IO_ADDRESS(pa) IOMEM(__OMAP2_IO_ADDRESS(pa))
202
203#ifdef __ASSEMBLER__
204#define IOMEM(x) (x)
205#else
206#define IOMEM(x) ((void __force __iomem *)(x))
207 191
208/* 192/*
209 * Functions to access the OMAP IO region 193 * 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 */ 194 */
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 195
221#define omap_writeb(v,a) __raw_writeb(v, IO_ADDRESS(a)) 196extern u8 omap_readb(u32 pa);
222#define omap_writew(v,a) __raw_writew(v, IO_ADDRESS(a)) 197extern u16 omap_readw(u32 pa);
223#define omap_writel(v,a) __raw_writel(v, IO_ADDRESS(a)) 198extern u32 omap_readl(u32 pa);
199extern void omap_writeb(u8 v, u32 pa);
200extern void omap_writew(u16 v, u32 pa);
201extern void omap_writel(u32 v, u32 pa);
224 202
225struct omap_sdrc_params; 203struct omap_sdrc_params;
226 204