]> 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 #include <asm/arch/powerdomain.h>
31
32 #include "powerdomains.h"
33
34 #include <asm/arch/clockdomain.h>
35 #include "clockdomains.h"
36
37 extern void omap_sram_init(void);
38 extern int omap2_clk_init(void);
39 extern void omap2_check_revision(void);
40 extern void omap2_init_memory(void);
41 extern void gpmc_init(void);
42 extern void omapfb_reserve_sdram(void);
43
44 /*
45  * The machine specific code may provide the extra mapping besides the
46  * default mapping provided here.
47  */
48
49 #ifdef CONFIG_ARCH_OMAP24XX
50 static struct map_desc omap24xx_io_desc[] __initdata = {
51         {
52                 .virtual        = L3_24XX_VIRT,
53                 .pfn            = __phys_to_pfn(L3_24XX_PHYS),
54                 .length         = L3_24XX_SIZE,
55                 .type           = MT_DEVICE
56         },
57         {
58                 .virtual        = L4_24XX_VIRT,
59                 .pfn            = __phys_to_pfn(L4_24XX_PHYS),
60                 .length         = L4_24XX_SIZE,
61                 .type           = MT_DEVICE
62         },
63 };
64
65 #ifdef CONFIG_ARCH_OMAP2420
66 static struct map_desc omap242x_io_desc[] __initdata = {
67         {
68                 .virtual        = DSP_MEM_24XX_VIRT,
69                 .pfn            = __phys_to_pfn(DSP_MEM_24XX_PHYS),
70                 .length         = DSP_MEM_24XX_SIZE,
71                 .type           = MT_DEVICE
72         },
73         {
74                 .virtual        = DSP_IPI_24XX_VIRT,
75                 .pfn            = __phys_to_pfn(DSP_IPI_24XX_PHYS),
76                 .length         = DSP_IPI_24XX_SIZE,
77                 .type           = MT_DEVICE
78         },
79         {
80                 .virtual        = DSP_MMU_24XX_VIRT,
81                 .pfn            = __phys_to_pfn(DSP_MMU_24XX_PHYS),
82                 .length         = DSP_MMU_24XX_SIZE,
83                 .type           = MT_DEVICE
84         },
85 };
86
87 #endif
88
89 #ifdef CONFIG_ARCH_OMAP2430
90 static struct map_desc omap243x_io_desc[] __initdata = {
91         {
92                 .virtual        = L4_WK_243X_VIRT,
93                 .pfn            = __phys_to_pfn(L4_WK_243X_PHYS),
94                 .length         = L4_WK_243X_SIZE,
95                 .type           = MT_DEVICE
96         },
97         {
98                 .virtual        = OMAP243X_GPMC_VIRT,
99                 .pfn            = __phys_to_pfn(OMAP243X_GPMC_PHYS),
100                 .length         = OMAP243X_GPMC_SIZE,
101                 .type           = MT_DEVICE
102         },
103         {
104                 .virtual        = OMAP243X_SDRC_VIRT,
105                 .pfn            = __phys_to_pfn(OMAP243X_SDRC_PHYS),
106                 .length         = OMAP243X_SDRC_SIZE,
107                 .type           = MT_DEVICE
108         },
109         {
110                 .virtual        = OMAP243X_SMS_VIRT,
111                 .pfn            = __phys_to_pfn(OMAP243X_SMS_PHYS),
112                 .length         = OMAP243X_SMS_SIZE,
113                 .type           = MT_DEVICE
114         },
115 };
116 #endif
117 #endif
118
119 #ifdef  CONFIG_ARCH_OMAP34XX
120 static struct map_desc omap34xx_io_desc[] __initdata = {
121         {
122                 .virtual        = L3_34XX_VIRT,
123                 .pfn            = __phys_to_pfn(L3_34XX_PHYS),
124                 .length         = L3_34XX_SIZE,
125                 .type           = MT_DEVICE
126         },
127         {
128                 .virtual        = L4_34XX_VIRT,
129                 .pfn            = __phys_to_pfn(L4_34XX_PHYS),
130                 .length         = L4_34XX_SIZE,
131                 .type           = MT_DEVICE
132         },
133         {
134                 .virtual        = L4_WK_34XX_VIRT,
135                 .pfn            = __phys_to_pfn(L4_WK_34XX_PHYS),
136                 .length         = L4_WK_34XX_SIZE,
137                 .type           = MT_DEVICE
138         },
139         {
140                 .virtual        = OMAP34XX_GPMC_VIRT,
141                 .pfn            = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
142                 .length         = OMAP34XX_GPMC_SIZE,
143                 .type           = MT_DEVICE
144         },
145         {
146                 .virtual        = OMAP343X_SMS_VIRT,
147                 .pfn            = __phys_to_pfn(OMAP343X_SMS_PHYS),
148                 .length         = OMAP343X_SMS_SIZE,
149                 .type           = MT_DEVICE
150         },
151         {
152                 .virtual        = OMAP343X_SDRC_VIRT,
153                 .pfn            = __phys_to_pfn(OMAP343X_SDRC_PHYS),
154                 .length         = OMAP343X_SDRC_SIZE,
155                 .type           = MT_DEVICE
156         },
157         {
158                 .virtual        = L4_PER_34XX_VIRT,
159                 .pfn            = __phys_to_pfn(L4_PER_34XX_PHYS),
160                 .length         = L4_PER_34XX_SIZE,
161                 .type           = MT_DEVICE
162         },
163         {
164                 .virtual        = L4_EMU_34XX_VIRT,
165                 .pfn            = __phys_to_pfn(L4_EMU_34XX_PHYS),
166                 .length         = L4_EMU_34XX_SIZE,
167                 .type           = MT_DEVICE
168         },
169 };
170 #endif
171
172 void __init omap2_map_common_io(void)
173 {
174 #if defined(CONFIG_ARCH_OMAP2420)
175         iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
176         iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
177 #elif defined(CONFIG_ARCH_OMAP2430)
178         iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
179         iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
180 #elif defined(CONFIG_ARCH_OMAP34XX)
181         iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
182 #endif
183         /* Normally devicemaps_init() would flush caches and tlb after
184          * mdesc->map_io(), but we must also do it here because of the CPU
185          * revision check below.
186          */
187         local_flush_tlb_all();
188         flush_cache_all();
189
190         omap2_check_revision();
191         omap_sram_init();
192         omapfb_reserve_sdram();
193 }
194
195 void __init omap2_init_common_hw(void)
196 {
197         omap2_mux_init();
198         pwrdm_init(powerdomains_omap);
199         clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
200         omap2_clk_init();
201         omap2_init_memory();
202         gpmc_init();
203 }