]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/io.c
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / io.c
1 /*
2  * linux/arch/arm/mach-omap2/io.c
3  *
4  * OMAP2 I/O mapping code
5  *
6  * Copyright (C) 2005 Nokia Corporation
7  * Copyright (C) 2007 Texas Instruments
8  *
9  * Author:
10  *      Juha Yrjola <juha.yrjola@nokia.com>
11  *      Syed Khasim <x0khasim@ti.com>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2 as
15  * published by the Free Software Foundation.
16  */
17
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21
22 #include <asm/tlb.h>
23 #include <asm/io.h>
24
25 #include <asm/mach/map.h>
26
27 #include <asm/arch/mux.h>
28 #include <asm/arch/omapfb.h>
29
30 extern void omap_sram_init(void);
31 extern int omap2_clk_init(void);
32 extern void omap2_check_revision(void);
33 extern void omap2_init_memory(void);
34 extern void gpmc_init(void);
35 extern void omapfb_reserve_sdram(void);
36
37 /*
38  * The machine specific code may provide the extra mapping besides the
39  * default mapping provided here.
40  */
41
42 #ifdef CONFIG_ARCH_OMAP24XX
43 static struct map_desc omap24xx_io_desc[] __initdata = {
44         {
45                 .virtual        = L3_24XX_VIRT,
46                 .pfn            = __phys_to_pfn(L3_24XX_PHYS),
47                 .length         = L3_24XX_SIZE,
48                 .type           = MT_DEVICE
49         },
50         {
51                 .virtual        = L4_24XX_VIRT,
52                 .pfn            = __phys_to_pfn(L4_24XX_PHYS),
53                 .length         = L4_24XX_SIZE,
54                 .type           = MT_DEVICE
55         },
56 };
57
58 #ifdef CONFIG_ARCH_OMAP2420
59 static struct map_desc omap242x_io_desc[] __initdata = {
60         {
61                 .virtual        = DSP_MEM_24XX_VIRT,
62                 .pfn            = __phys_to_pfn(DSP_MEM_24XX_PHYS),
63                 .length         = DSP_MEM_24XX_SIZE,
64                 .type           = MT_DEVICE
65         },
66         {
67                 .virtual        = DSP_IPI_24XX_VIRT,
68                 .pfn            = __phys_to_pfn(DSP_IPI_24XX_PHYS),
69                 .length         = DSP_IPI_24XX_SIZE,
70                 .type           = MT_DEVICE
71         },
72         {
73                 .virtual        = DSP_MMU_24XX_VIRT,
74                 .pfn            = __phys_to_pfn(DSP_MMU_24XX_PHYS),
75                 .length         = DSP_MMU_24XX_SIZE,
76                 .type           = MT_DEVICE
77         },
78 };
79
80 #endif
81
82 #ifdef CONFIG_ARCH_OMAP2430
83 static struct map_desc omap243x_io_desc[] __initdata = {
84         {
85                 .virtual        = L4_WK_243X_VIRT,
86                 .pfn            = __phys_to_pfn(L4_WK_243X_PHYS),
87                 .length         = L4_WK_243X_SIZE,
88                 .type           = MT_DEVICE
89         },
90         {
91                 .virtual        = OMAP243X_GPMC_VIRT,
92                 .pfn            = __phys_to_pfn(OMAP243X_GPMC_PHYS),
93                 .length         = OMAP243X_GPMC_SIZE,
94                 .type           = MT_DEVICE
95         },
96         {
97                 .virtual        = OMAP243X_SDRC_VIRT,
98                 .pfn            = __phys_to_pfn(OMAP243X_SDRC_PHYS),
99                 .length         = OMAP243X_SDRC_SIZE,
100                 .type           = MT_DEVICE
101         },
102         {
103                 .virtual        = OMAP243X_SMS_VIRT,
104                 .pfn            = __phys_to_pfn(OMAP243X_SMS_PHYS),
105                 .length         = OMAP243X_SMS_SIZE,
106                 .type           = MT_DEVICE
107         },
108 };
109 #endif
110 #endif
111
112 #ifdef  CONFIG_ARCH_OMAP34XX
113 static struct map_desc omap34xx_io_desc[] __initdata = {
114         {
115                 .virtual        = L3_34XX_VIRT,
116                 .pfn            = __phys_to_pfn(L3_34XX_PHYS),
117                 .length         = L3_34XX_SIZE,
118                 .type           = MT_DEVICE
119         },
120         {
121                 .virtual        = L4_34XX_VIRT,
122                 .pfn            = __phys_to_pfn(L4_34XX_PHYS),
123                 .length         = L4_34XX_SIZE,
124                 .type           = MT_DEVICE
125         },
126         {
127                 .virtual        = L4_WK_34XX_VIRT,
128                 .pfn            = __phys_to_pfn(L4_WK_34XX_PHYS),
129                 .length         = L4_WK_34XX_SIZE,
130                 .type           = MT_DEVICE
131         },
132         {
133                 .virtual        = OMAP34XX_GPMC_VIRT,
134                 .pfn            = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
135                 .length         = OMAP34XX_GPMC_SIZE,
136                 .type           = MT_DEVICE
137         },
138         {
139                 .virtual        = OMAP343X_SMS_VIRT,
140                 .pfn            = __phys_to_pfn(OMAP343X_SMS_PHYS),
141                 .length         = OMAP343X_SMS_SIZE,
142                 .type           = MT_DEVICE
143         },
144         {
145                 .virtual        = OMAP343X_SDRC_VIRT,
146                 .pfn            = __phys_to_pfn(OMAP343X_SDRC_PHYS),
147                 .length         = OMAP343X_SDRC_SIZE,
148                 .type           = MT_DEVICE
149         },
150         {
151                 .virtual        = L4_PER_34XX_VIRT,
152                 .pfn            = __phys_to_pfn(L4_PER_34XX_PHYS),
153                 .length         = L4_PER_34XX_SIZE,
154                 .type           = MT_DEVICE
155         },
156         {
157                 .virtual        = L4_EMU_34XX_VIRT,
158                 .pfn            = __phys_to_pfn(L4_EMU_34XX_PHYS),
159                 .length         = L4_EMU_34XX_SIZE,
160                 .type           = MT_DEVICE
161         },
162 };
163 #endif
164
165 void __init omap2_map_common_io(void)
166 {
167 #if defined(CONFIG_ARCH_OMAP2420)
168         iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
169         iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
170 #elif defined(CONFIG_ARCH_OMAP2430)
171         iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
172         iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
173 #elif defined(CONFIG_ARCH_OMAP34XX)
174         iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
175 #endif
176         /* Normally devicemaps_init() would flush caches and tlb after
177          * mdesc->map_io(), but we must also do it here because of the CPU
178          * revision check below.
179          */
180         local_flush_tlb_all();
181         flush_cache_all();
182
183         omap2_check_revision();
184         omap_sram_init();
185         omapfb_reserve_sdram();
186 }
187
188 void __init omap2_init_common_hw(void)
189 {
190         omap2_mux_init();
191         omap2_clk_init();
192         omap2_init_memory();
193         gpmc_init();
194 }