diff options
Diffstat (limited to 'arch/arm/mach-omap1/io.c')
-rw-r--r-- | arch/arm/mach-omap1/io.c | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c new file mode 100644 index 000000000000..8587b339884f --- /dev/null +++ b/arch/arm/mach-omap1/io.c | |||
@@ -0,0 +1,116 @@ | |||
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 | #include "../clock.h" | ||
21 | |||
22 | extern void omap_check_revision(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 | { OMAP730_SRAM_BASE, OMAP730_SRAM_START, OMAP730_SRAM_SIZE, MT_DEVICE } | ||
37 | }; | ||
38 | #endif | ||
39 | |||
40 | #ifdef CONFIG_ARCH_OMAP1510 | ||
41 | static struct map_desc omap1510_io_desc[] __initdata = { | ||
42 | { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE }, | ||
43 | { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE }, | ||
44 | { OMAP1510_SRAM_BASE, OMAP1510_SRAM_START, OMAP1510_SRAM_SIZE, MT_DEVICE } | ||
45 | }; | ||
46 | #endif | ||
47 | |||
48 | #if defined(CONFIG_ARCH_OMAP16XX) | ||
49 | static struct map_desc omap1610_io_desc[] __initdata = { | ||
50 | { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE }, | ||
51 | { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE }, | ||
52 | { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP1610_SRAM_SIZE, MT_DEVICE } | ||
53 | }; | ||
54 | |||
55 | static struct map_desc omap5912_io_desc[] __initdata = { | ||
56 | { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE }, | ||
57 | { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE }, | ||
58 | /* | ||
59 | * The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page | ||
60 | * size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped. | ||
61 | * Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte | ||
62 | * can be used. | ||
63 | */ | ||
64 | { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP5912_SRAM_SIZE + 0x800, MT_DEVICE } | ||
65 | }; | ||
66 | #endif | ||
67 | |||
68 | static int initialized = 0; | ||
69 | |||
70 | static void __init _omap_map_io(void) | ||
71 | { | ||
72 | initialized = 1; | ||
73 | |||
74 | /* We have to initialize the IO space mapping before we can run | ||
75 | * cpu_is_omapxxx() macros. */ | ||
76 | iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc)); | ||
77 | omap_check_revision(); | ||
78 | |||
79 | #ifdef CONFIG_ARCH_OMAP730 | ||
80 | if (cpu_is_omap730()) { | ||
81 | iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc)); | ||
82 | } | ||
83 | #endif | ||
84 | #ifdef CONFIG_ARCH_OMAP1510 | ||
85 | if (cpu_is_omap1510()) { | ||
86 | iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc)); | ||
87 | } | ||
88 | #endif | ||
89 | #if defined(CONFIG_ARCH_OMAP16XX) | ||
90 | if (cpu_is_omap1610() || cpu_is_omap1710()) { | ||
91 | iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc)); | ||
92 | } | ||
93 | if (cpu_is_omap5912()) { | ||
94 | iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc)); | ||
95 | } | ||
96 | #endif | ||
97 | |||
98 | /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort | ||
99 | * on a Posted Write in the TIPB Bridge". | ||
100 | */ | ||
101 | omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL); | ||
102 | omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL); | ||
103 | |||
104 | /* Must init clocks early to assure that timer interrupt works | ||
105 | */ | ||
106 | clk_init(); | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | * This should only get called from board specific init | ||
111 | */ | ||
112 | void omap_map_common_io(void) | ||
113 | { | ||
114 | if (!initialized) | ||
115 | _omap_map_io(); | ||
116 | } | ||