Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 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> |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 18 | #include <asm/arch/mux.h> |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 19 | #include <asm/arch/tc.h> |
| 20 | |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 21 | extern int omap1_clk_init(void); |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 22 | extern void omap_check_revision(void); |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 23 | extern void omap_sram_init(void); |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 24 | |
| 25 | /* |
| 26 | * The machine specific code may provide the extra mapping besides the |
| 27 | * default mapping provided here. |
| 28 | */ |
| 29 | static struct map_desc omap_io_desc[] __initdata = { |
Deepak Saxena | 9fe133b | 2005-10-28 15:19:00 +0100 | [diff] [blame] | 30 | { |
| 31 | .virtual = IO_VIRT, |
| 32 | .pfn = __phys_to_pfn(IO_PHYS), |
| 33 | .length = IO_SIZE, |
| 34 | .type = MT_DEVICE |
| 35 | } |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | #ifdef CONFIG_ARCH_OMAP730 |
| 39 | static struct map_desc omap730_io_desc[] __initdata = { |
Deepak Saxena | 9fe133b | 2005-10-28 15:19:00 +0100 | [diff] [blame] | 40 | { |
| 41 | .virtual = OMAP730_DSP_BASE, |
| 42 | .pfn = __phys_to_pfn(OMAP730_DSP_START), |
| 43 | .length = OMAP730_DSP_SIZE, |
| 44 | .type = MT_DEVICE |
| 45 | }, { |
| 46 | .virtual = OMAP730_DSPREG_BASE, |
| 47 | .pfn = __phys_to_pfn(OMAP730_DSPREG_START), |
| 48 | .length = OMAP730_DSPREG_SIZE, |
| 49 | .type = MT_DEVICE |
| 50 | } |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 51 | }; |
| 52 | #endif |
| 53 | |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 54 | #ifdef CONFIG_ARCH_OMAP15XX |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 55 | static struct map_desc omap1510_io_desc[] __initdata = { |
Deepak Saxena | 9fe133b | 2005-10-28 15:19:00 +0100 | [diff] [blame] | 56 | { |
| 57 | .virtual = OMAP1510_DSP_BASE, |
| 58 | .pfn = __phys_to_pfn(OMAP1510_DSP_START), |
| 59 | .length = OMAP1510_DSP_SIZE, |
| 60 | .type = MT_DEVICE |
| 61 | }, { |
| 62 | .virtual = OMAP1510_DSPREG_BASE, |
| 63 | .pfn = __phys_to_pfn(OMAP1510_DSPREG_START), |
| 64 | .length = OMAP1510_DSPREG_SIZE, |
| 65 | .type = MT_DEVICE |
| 66 | } |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 67 | }; |
| 68 | #endif |
| 69 | |
| 70 | #if defined(CONFIG_ARCH_OMAP16XX) |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 71 | static struct map_desc omap16xx_io_desc[] __initdata = { |
Deepak Saxena | 9fe133b | 2005-10-28 15:19:00 +0100 | [diff] [blame] | 72 | { |
| 73 | .virtual = OMAP16XX_DSP_BASE, |
| 74 | .pfn = __phys_to_pfn(OMAP16XX_DSP_START), |
| 75 | .length = OMAP16XX_DSP_SIZE, |
| 76 | .type = MT_DEVICE |
| 77 | }, { |
| 78 | .virtual = OMAP16XX_DSPREG_BASE, |
| 79 | .pfn = __phys_to_pfn(OMAP16XX_DSPREG_START), |
| 80 | .length = OMAP16XX_DSPREG_SIZE, |
| 81 | .type = MT_DEVICE |
| 82 | } |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 83 | }; |
| 84 | #endif |
| 85 | |
| 86 | static int initialized = 0; |
| 87 | |
| 88 | static void __init _omap_map_io(void) |
| 89 | { |
| 90 | initialized = 1; |
| 91 | |
| 92 | /* We have to initialize the IO space mapping before we can run |
| 93 | * cpu_is_omapxxx() macros. */ |
| 94 | iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc)); |
| 95 | omap_check_revision(); |
| 96 | |
| 97 | #ifdef CONFIG_ARCH_OMAP730 |
| 98 | if (cpu_is_omap730()) { |
| 99 | iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc)); |
| 100 | } |
| 101 | #endif |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 102 | #ifdef CONFIG_ARCH_OMAP15XX |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 103 | if (cpu_is_omap1510()) { |
| 104 | iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc)); |
| 105 | } |
| 106 | #endif |
| 107 | #if defined(CONFIG_ARCH_OMAP16XX) |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 108 | if (cpu_is_omap16xx()) { |
| 109 | iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc)); |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 110 | } |
| 111 | #endif |
| 112 | |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 113 | omap_sram_init(); |
| 114 | |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 115 | /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort |
| 116 | * on a Posted Write in the TIPB Bridge". |
| 117 | */ |
| 118 | omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL); |
| 119 | omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL); |
| 120 | |
| 121 | /* Must init clocks early to assure that timer interrupt works |
| 122 | */ |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 123 | omap1_clk_init(); |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | /* |
| 127 | * This should only get called from board specific init |
| 128 | */ |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 129 | void __init omap_map_common_io(void) |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 130 | { |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 131 | if (!initialized) { |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 132 | _omap_map_io(); |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 133 | omap1_mux_init(); |
| 134 | } |
Tony Lindgren | f577ffd | 2005-07-10 19:58:12 +0100 | [diff] [blame] | 135 | } |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 136 | |