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