1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-omap1/io.c
5 * OMAP1 I/O mapping code
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/init.h>
12 #include <linux/omap-dma.h>
15 #include <asm/mach/map.h>
22 * The machine specific code may provide the extra mapping besides the
23 * default mapping provided here.
25 static struct map_desc omap_io_desc[] __initdata = {
27 .virtual = OMAP1_IO_VIRT,
28 .pfn = __phys_to_pfn(OMAP1_IO_PHYS),
29 .length = OMAP1_IO_SIZE,
34 #if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
35 static struct map_desc omap7xx_io_desc[] __initdata = {
37 .virtual = OMAP7XX_DSP_BASE,
38 .pfn = __phys_to_pfn(OMAP7XX_DSP_START),
39 .length = OMAP7XX_DSP_SIZE,
42 .virtual = OMAP7XX_DSPREG_BASE,
43 .pfn = __phys_to_pfn(OMAP7XX_DSPREG_START),
44 .length = OMAP7XX_DSPREG_SIZE,
50 #ifdef CONFIG_ARCH_OMAP15XX
51 static struct map_desc omap1510_io_desc[] __initdata = {
53 .virtual = OMAP1510_DSP_BASE,
54 .pfn = __phys_to_pfn(OMAP1510_DSP_START),
55 .length = OMAP1510_DSP_SIZE,
58 .virtual = OMAP1510_DSPREG_BASE,
59 .pfn = __phys_to_pfn(OMAP1510_DSPREG_START),
60 .length = OMAP1510_DSPREG_SIZE,
66 #if defined(CONFIG_ARCH_OMAP16XX)
67 static struct map_desc omap16xx_io_desc[] __initdata = {
69 .virtual = OMAP16XX_DSP_BASE,
70 .pfn = __phys_to_pfn(OMAP16XX_DSP_START),
71 .length = OMAP16XX_DSP_SIZE,
74 .virtual = OMAP16XX_DSPREG_BASE,
75 .pfn = __phys_to_pfn(OMAP16XX_DSPREG_START),
76 .length = OMAP16XX_DSPREG_SIZE,
83 * Maps common IO regions for omap1
85 static void __init omap1_map_common_io(void)
87 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
90 #if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
91 void __init omap7xx_map_io(void)
93 omap1_map_common_io();
94 iotable_init(omap7xx_io_desc, ARRAY_SIZE(omap7xx_io_desc));
98 #ifdef CONFIG_ARCH_OMAP15XX
99 void __init omap15xx_map_io(void)
101 omap1_map_common_io();
102 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
106 #if defined(CONFIG_ARCH_OMAP16XX)
107 void __init omap16xx_map_io(void)
109 omap1_map_common_io();
110 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
115 * Common low-level hardware init for omap1.
117 void __init omap1_init_early(void)
119 omap_check_revision();
121 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
122 * on a Posted Write in the TIPB Bridge".
124 omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
125 omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
128 void __init omap1_init_late(void)
130 omap_serial_wakeup_init();
134 * NOTE: Please use ioremap + __raw_read/write where possible instead of these
137 u8 omap_readb(u32 pa)
139 return __raw_readb(OMAP1_IO_ADDRESS(pa));
141 EXPORT_SYMBOL(omap_readb);
143 u16 omap_readw(u32 pa)
145 return __raw_readw(OMAP1_IO_ADDRESS(pa));
147 EXPORT_SYMBOL(omap_readw);
149 u32 omap_readl(u32 pa)
151 return __raw_readl(OMAP1_IO_ADDRESS(pa));
153 EXPORT_SYMBOL(omap_readl);
155 void omap_writeb(u8 v, u32 pa)
157 __raw_writeb(v, OMAP1_IO_ADDRESS(pa));
159 EXPORT_SYMBOL(omap_writeb);
161 void omap_writew(u16 v, u32 pa)
163 __raw_writew(v, OMAP1_IO_ADDRESS(pa));
165 EXPORT_SYMBOL(omap_writew);
167 void omap_writel(u32 v, u32 pa)
169 __raw_writel(v, OMAP1_IO_ADDRESS(pa));
171 EXPORT_SYMBOL(omap_writel);