1 /* 2 * linux/arch/arm/mach-omap1/io.c 3 * 4 * OMAP1 I/O mapping code 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. 9 */ 10 11 #include <linux/config.h> 12 #include <linux/module.h> 13 #include <linux/kernel.h> 14 #include <linux/init.h> 15 16 #include <asm/mach/map.h> 17 #include <asm/io.h> 18 #include <asm/arch/tc.h> 19 20 extern int clk_init(void); 21 extern void omap_check_revision(void); 22 extern void omap_sram_init(void); 23 24 /* 25 * The machine specific code may provide the extra mapping besides the 26 * default mapping provided here. 27 */ 28 static struct map_desc omap_io_desc[] __initdata = { 29 { IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE }, 30 }; 31 32 #ifdef CONFIG_ARCH_OMAP730 33 static struct map_desc omap730_io_desc[] __initdata = { 34 { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE }, 35 { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE }, 36 }; 37 #endif 38 39 #ifdef CONFIG_ARCH_OMAP1510 40 static struct map_desc omap1510_io_desc[] __initdata = { 41 { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE }, 42 { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE }, 43 }; 44 #endif 45 46 #if defined(CONFIG_ARCH_OMAP16XX) 47 static struct map_desc omap16xx_io_desc[] __initdata = { 48 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE }, 49 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE }, 50 }; 51 #endif 52 53 static int initialized = 0; 54 55 static void __init _omap_map_io(void) 56 { 57 initialized = 1; 58 59 /* We have to initialize the IO space mapping before we can run 60 * cpu_is_omapxxx() macros. */ 61 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc)); 62 omap_check_revision(); 63 64 #ifdef CONFIG_ARCH_OMAP730 65 if (cpu_is_omap730()) { 66 iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc)); 67 } 68 #endif 69 #ifdef CONFIG_ARCH_OMAP1510 70 if (cpu_is_omap1510()) { 71 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc)); 72 } 73 #endif 74 #if defined(CONFIG_ARCH_OMAP16XX) 75 if (cpu_is_omap16xx()) { 76 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc)); 77 } 78 #endif 79 80 omap_sram_init(); 81 82 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort 83 * on a Posted Write in the TIPB Bridge". 84 */ 85 omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL); 86 omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL); 87 88 /* Must init clocks early to assure that timer interrupt works 89 */ 90 clk_init(); 91 } 92 93 /* 94 * This should only get called from board specific init 95 */ 96 void __init omap_map_common_io(void) 97 { 98 if (!initialized) 99 _omap_map_io(); 100 } 101 102