blob: c3472bd8e5a4aca6e7ad9096faa69f9d76881ed1 [file] [log] [blame]
Tony Lindgren1dbae812005-11-10 14:26:51 +00001/*
2 * linux/arch/arm/mach-omap2/io.c
3 *
4 * OMAP2 I/O mapping code
5 *
6 * Copyright (C) 2005 Nokia Corporation
Santosh Shilimkar44169072009-05-28 14:16:04 -07007 * Copyright (C) 2007-2009 Texas Instruments
Tony Lindgren646e3ed2008-10-06 15:49:36 +03008 *
9 * Author:
10 * Juha Yrjola <juha.yrjola@nokia.com>
11 * Syed Khasim <x0khasim@ti.com>
Tony Lindgren1dbae812005-11-10 14:26:51 +000012 *
Santosh Shilimkar44169072009-05-28 14:16:04 -070013 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
14 *
Tony Lindgren1dbae812005-11-10 14:26:51 +000015 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
Tony Lindgren1dbae812005-11-10 14:26:51 +000019#include <linux/module.h>
20#include <linux/kernel.h>
21#include <linux/init.h>
Russell Kingfced80c2008-09-06 12:10:45 +010022#include <linux/io.h>
Paul Walmsley2f135ea2009-06-19 19:08:25 -060023#include <linux/clk.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000024
Tony Lindgren120db2c2006-04-02 17:46:27 +010025#include <asm/tlb.h>
Tony Lindgren120db2c2006-04-02 17:46:27 +010026#include <asm/mach/map.h>
27
Lokesh Vutla2b6c4e72012-10-15 14:04:53 -070028#include <plat-omap/dma-omap.h>
Tony Lindgren646e3ed2008-10-06 15:49:36 +030029
Tony Lindgren622297f2012-10-02 14:19:52 -070030#include "../plat-omap/sram.h"
31
Tony Lindgrendc843282012-10-03 11:23:43 -070032#include "omap_hwmod.h"
Tony Lindgrendbc04162012-08-31 10:59:07 -070033#include "soc.h"
Tony Lindgrenee0839c2012-02-24 10:34:35 -080034#include "iomap.h"
35#include "voltage.h"
36#include "powerdomain.h"
37#include "clockdomain.h"
38#include "common.h"
Vaibhav Hiremathe30384a2012-05-29 15:26:41 +053039#include "clock.h"
Paul Walmsleye80a9722010-01-26 20:13:12 -070040#include "clock2xxx.h"
Paul Walmsley657ebfa2010-02-22 22:09:20 -070041#include "clock3xxx.h"
Paul Walmsleye80a9722010-01-26 20:13:12 -070042#include "clock44xx.h"
Tony Lindgren1d5aef42012-10-03 16:36:40 -070043#include "omap-pm.h"
Paul Walmsley3e6ece12012-10-17 00:46:45 +000044#include "sdrc.h"
Paul Walmsleyb6a42262012-10-29 20:50:21 -060045#include "control.h"
Tony Lindgren3d82cbb2012-10-15 12:50:46 -070046#include "serial.h"
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060047#include "cm2xxx.h"
48#include "cm3xxx.h"
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060049#include "prm.h"
50#include "cm.h"
51#include "prcm_mpu44xx.h"
52#include "prminst44xx.h"
53#include "cminst44xx.h"
Tony Lindgren1dbae812005-11-10 14:26:51 +000054/*
55 * The machine specific code may provide the extra mapping besides the
56 * default mapping provided here.
57 */
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030058
Tony Lindgrene48f8142012-03-06 11:49:22 -080059#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030060static struct map_desc omap24xx_io_desc[] __initdata = {
Tony Lindgren1dbae812005-11-10 14:26:51 +000061 {
62 .virtual = L3_24XX_VIRT,
63 .pfn = __phys_to_pfn(L3_24XX_PHYS),
64 .length = L3_24XX_SIZE,
65 .type = MT_DEVICE
66 },
Kyungmin Park09f21ed2008-02-20 15:30:06 -080067 {
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030068 .virtual = L4_24XX_VIRT,
69 .pfn = __phys_to_pfn(L4_24XX_PHYS),
70 .length = L4_24XX_SIZE,
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080071 .type = MT_DEVICE
72 },
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030073};
74
Tony Lindgren59b479e2011-01-27 16:39:40 -080075#ifdef CONFIG_SOC_OMAP2420
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030076static struct map_desc omap242x_io_desc[] __initdata = {
Tony Lindgren1dbae812005-11-10 14:26:51 +000077 {
Paul Walmsley7adb9982010-01-08 15:23:05 -070078 .virtual = DSP_MEM_2420_VIRT,
79 .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS),
80 .length = DSP_MEM_2420_SIZE,
Tony Lindgrenc40fae952006-12-07 13:58:10 -080081 .type = MT_DEVICE
82 },
83 {
Paul Walmsley7adb9982010-01-08 15:23:05 -070084 .virtual = DSP_IPI_2420_VIRT,
85 .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS),
86 .length = DSP_IPI_2420_SIZE,
Tony Lindgrenc40fae952006-12-07 13:58:10 -080087 .type = MT_DEVICE
88 },
89 {
Paul Walmsley7adb9982010-01-08 15:23:05 -070090 .virtual = DSP_MMU_2420_VIRT,
91 .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS),
92 .length = DSP_MMU_2420_SIZE,
Tony Lindgren1dbae812005-11-10 14:26:51 +000093 .type = MT_DEVICE
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030094 },
Tony Lindgren1dbae812005-11-10 14:26:51 +000095};
96
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030097#endif
98
Tony Lindgren59b479e2011-01-27 16:39:40 -080099#ifdef CONFIG_SOC_OMAP2430
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +0300100static struct map_desc omap243x_io_desc[] __initdata = {
101 {
102 .virtual = L4_WK_243X_VIRT,
103 .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
104 .length = L4_WK_243X_SIZE,
105 .type = MT_DEVICE
106 },
107 {
108 .virtual = OMAP243X_GPMC_VIRT,
109 .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
110 .length = OMAP243X_GPMC_SIZE,
111 .type = MT_DEVICE
112 },
113 {
114 .virtual = OMAP243X_SDRC_VIRT,
115 .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS),
116 .length = OMAP243X_SDRC_SIZE,
117 .type = MT_DEVICE
118 },
119 {
120 .virtual = OMAP243X_SMS_VIRT,
121 .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS),
122 .length = OMAP243X_SMS_SIZE,
123 .type = MT_DEVICE
124 },
125};
126#endif
127#endif
128
Tony Lindgrena8eb7ca2010-02-12 12:26:48 -0800129#ifdef CONFIG_ARCH_OMAP3
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +0300130static struct map_desc omap34xx_io_desc[] __initdata = {
131 {
132 .virtual = L3_34XX_VIRT,
133 .pfn = __phys_to_pfn(L3_34XX_PHYS),
134 .length = L3_34XX_SIZE,
135 .type = MT_DEVICE
136 },
137 {
138 .virtual = L4_34XX_VIRT,
139 .pfn = __phys_to_pfn(L4_34XX_PHYS),
140 .length = L4_34XX_SIZE,
141 .type = MT_DEVICE
142 },
143 {
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +0300144 .virtual = OMAP34XX_GPMC_VIRT,
145 .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
146 .length = OMAP34XX_GPMC_SIZE,
147 .type = MT_DEVICE
148 },
149 {
150 .virtual = OMAP343X_SMS_VIRT,
151 .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS),
152 .length = OMAP343X_SMS_SIZE,
153 .type = MT_DEVICE
154 },
155 {
156 .virtual = OMAP343X_SDRC_VIRT,
157 .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS),
158 .length = OMAP343X_SDRC_SIZE,
159 .type = MT_DEVICE
160 },
161 {
162 .virtual = L4_PER_34XX_VIRT,
163 .pfn = __phys_to_pfn(L4_PER_34XX_PHYS),
164 .length = L4_PER_34XX_SIZE,
165 .type = MT_DEVICE
166 },
167 {
168 .virtual = L4_EMU_34XX_VIRT,
169 .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS),
170 .length = L4_EMU_34XX_SIZE,
171 .type = MT_DEVICE
172 },
Tony Lindgrena4f57b82010-04-30 12:57:14 -0700173#if defined(CONFIG_DEBUG_LL) && \
174 (defined(CONFIG_MACH_OMAP_ZOOM2) || defined(CONFIG_MACH_OMAP_ZOOM3))
175 {
176 .virtual = ZOOM_UART_VIRT,
177 .pfn = __phys_to_pfn(ZOOM_UART_BASE),
178 .length = SZ_1M,
179 .type = MT_DEVICE
180 },
181#endif
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +0300182};
183#endif
Hemant Pedanekar01001712011-02-16 08:31:39 -0800184
Kevin Hilman33959552012-05-10 11:10:07 -0700185#ifdef CONFIG_SOC_TI81XX
Hemant Pedanekara9203602011-12-13 10:46:44 -0800186static struct map_desc omapti81xx_io_desc[] __initdata = {
Hemant Pedanekar01001712011-02-16 08:31:39 -0800187 {
188 .virtual = L4_34XX_VIRT,
189 .pfn = __phys_to_pfn(L4_34XX_PHYS),
190 .length = L4_34XX_SIZE,
191 .type = MT_DEVICE
Afzal Mohammed1e6cb142011-12-13 10:46:43 -0800192 }
193};
194#endif
195
Kevin Hilmanbb6abcf2012-05-10 11:10:07 -0700196#ifdef CONFIG_SOC_AM33XX
Afzal Mohammed1e6cb142011-12-13 10:46:43 -0800197static struct map_desc omapam33xx_io_desc[] __initdata = {
Hemant Pedanekar01001712011-02-16 08:31:39 -0800198 {
199 .virtual = L4_34XX_VIRT,
200 .pfn = __phys_to_pfn(L4_34XX_PHYS),
201 .length = L4_34XX_SIZE,
202 .type = MT_DEVICE
203 },
Afzal Mohammed1e6cb142011-12-13 10:46:43 -0800204 {
205 .virtual = L4_WK_AM33XX_VIRT,
206 .pfn = __phys_to_pfn(L4_WK_AM33XX_PHYS),
207 .length = L4_WK_AM33XX_SIZE,
208 .type = MT_DEVICE
209 }
Hemant Pedanekar01001712011-02-16 08:31:39 -0800210};
211#endif
212
Santosh Shilimkar44169072009-05-28 14:16:04 -0700213#ifdef CONFIG_ARCH_OMAP4
214static struct map_desc omap44xx_io_desc[] __initdata = {
215 {
216 .virtual = L3_44XX_VIRT,
217 .pfn = __phys_to_pfn(L3_44XX_PHYS),
218 .length = L3_44XX_SIZE,
219 .type = MT_DEVICE,
220 },
221 {
222 .virtual = L4_44XX_VIRT,
223 .pfn = __phys_to_pfn(L4_44XX_PHYS),
224 .length = L4_44XX_SIZE,
225 .type = MT_DEVICE,
226 },
227 {
Santosh Shilimkar44169072009-05-28 14:16:04 -0700228 .virtual = L4_PER_44XX_VIRT,
229 .pfn = __phys_to_pfn(L4_PER_44XX_PHYS),
230 .length = L4_PER_44XX_SIZE,
231 .type = MT_DEVICE,
232 },
Santosh Shilimkar137d1052011-06-25 18:04:31 -0700233#ifdef CONFIG_OMAP4_ERRATA_I688
234 {
235 .virtual = OMAP4_SRAM_VA,
236 .pfn = __phys_to_pfn(OMAP4_SRAM_PA),
237 .length = PAGE_SIZE,
238 .type = MT_MEMORY_SO,
239 },
240#endif
241
Santosh Shilimkar44169072009-05-28 14:16:04 -0700242};
243#endif
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +0300244
R Sricharan05e152c2012-06-05 16:21:32 +0530245#ifdef CONFIG_SOC_OMAP5
246static struct map_desc omap54xx_io_desc[] __initdata = {
247 {
248 .virtual = L3_54XX_VIRT,
249 .pfn = __phys_to_pfn(L3_54XX_PHYS),
250 .length = L3_54XX_SIZE,
251 .type = MT_DEVICE,
252 },
253 {
254 .virtual = L4_54XX_VIRT,
255 .pfn = __phys_to_pfn(L4_54XX_PHYS),
256 .length = L4_54XX_SIZE,
257 .type = MT_DEVICE,
258 },
259 {
260 .virtual = L4_WK_54XX_VIRT,
261 .pfn = __phys_to_pfn(L4_WK_54XX_PHYS),
262 .length = L4_WK_54XX_SIZE,
263 .type = MT_DEVICE,
264 },
265 {
266 .virtual = L4_PER_54XX_VIRT,
267 .pfn = __phys_to_pfn(L4_PER_54XX_PHYS),
268 .length = L4_PER_54XX_SIZE,
269 .type = MT_DEVICE,
270 },
271};
272#endif
273
Tony Lindgren59b479e2011-01-27 16:39:40 -0800274#ifdef CONFIG_SOC_OMAP2420
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600275void __init omap242x_map_io(void)
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800276{
277 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
278 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800279}
280#endif
281
Tony Lindgren59b479e2011-01-27 16:39:40 -0800282#ifdef CONFIG_SOC_OMAP2430
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600283void __init omap243x_map_io(void)
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800284{
285 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
286 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800287}
288#endif
289
Tony Lindgrena8eb7ca2010-02-12 12:26:48 -0800290#ifdef CONFIG_ARCH_OMAP3
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600291void __init omap3_map_io(void)
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800292{
293 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800294}
295#endif
296
Kevin Hilman33959552012-05-10 11:10:07 -0700297#ifdef CONFIG_SOC_TI81XX
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600298void __init ti81xx_map_io(void)
Hemant Pedanekar01001712011-02-16 08:31:39 -0800299{
Hemant Pedanekara9203602011-12-13 10:46:44 -0800300 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
Hemant Pedanekar01001712011-02-16 08:31:39 -0800301}
302#endif
303
Kevin Hilmanbb6abcf2012-05-10 11:10:07 -0700304#ifdef CONFIG_SOC_AM33XX
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600305void __init am33xx_map_io(void)
Afzal Mohammed1e6cb142011-12-13 10:46:43 -0800306{
307 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800308}
309#endif
310
311#ifdef CONFIG_ARCH_OMAP4
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600312void __init omap4_map_io(void)
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800313{
314 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
Santosh Shilimkar2ec1fc42012-02-02 19:33:55 +0530315 omap_barriers_init();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800316}
317#endif
318
R Sricharan05e152c2012-06-05 16:21:32 +0530319#ifdef CONFIG_SOC_OMAP5
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600320void __init omap5_map_io(void)
R Sricharan05e152c2012-06-05 16:21:32 +0530321{
322 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
323}
324#endif
Paul Walmsley2f135ea2009-06-19 19:08:25 -0600325/*
326 * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
327 *
328 * Sets the CORE DPLL3 M2 divider to the same value that it's at
329 * currently. This has the effect of setting the SDRC SDRAM AC timing
330 * registers to the values currently defined by the kernel. Currently
331 * only defined for OMAP3; will return 0 if called on OMAP2. Returns
332 * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2,
333 * or passes along the return value of clk_set_rate().
334 */
335static int __init _omap2_init_reprogram_sdrc(void)
336{
337 struct clk *dpll3_m2_ck;
338 int v = -EINVAL;
339 long rate;
340
341 if (!cpu_is_omap34xx())
342 return 0;
343
344 dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck");
Aaro Koskinene281f7e2010-11-30 14:17:58 +0000345 if (IS_ERR(dpll3_m2_ck))
Paul Walmsley2f135ea2009-06-19 19:08:25 -0600346 return -EINVAL;
347
348 rate = clk_get_rate(dpll3_m2_ck);
349 pr_info("Reprogramming SDRC clock to %ld Hz\n", rate);
350 v = clk_set_rate(dpll3_m2_ck, rate);
351 if (v)
352 pr_err("dpll3_m2_clk rate change failed: %d\n", v);
353
354 clk_put(dpll3_m2_ck);
355
356 return v;
357}
358
Paul Walmsley2092e5c2010-12-14 12:42:35 -0700359static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
360{
361 return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
362}
363
Tony Lindgren7b250af2011-10-04 18:26:28 -0700364static void __init omap_common_init_early(void)
365{
Arnd Bergmanndf804422011-11-01 13:47:27 +0100366 omap_init_consistent_dma_size();
Tony Lindgren7b250af2011-10-04 18:26:28 -0700367}
368
369static void __init omap_hwmod_init_postsetup(void)
Tony Lindgren120db2c2006-04-02 17:46:27 +0100370{
Paul Walmsley2092e5c2010-12-14 12:42:35 -0700371 u8 postsetup_state;
372
Paul Walmsley2092e5c2010-12-14 12:42:35 -0700373 /* Set the default postsetup state for all hwmods */
374#ifdef CONFIG_PM_RUNTIME
375 postsetup_state = _HWMOD_STATE_IDLE;
376#else
377 postsetup_state = _HWMOD_STATE_ENABLED;
378#endif
379 omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
Benoit Cousson55d2cb02010-05-12 17:54:36 +0200380
Kevin Hilman53da4ce2010-12-09 09:13:48 -0600381 omap_pm_if_early_init();
Paul Walmsley48057342010-12-21 15:25:10 -0700382}
383
Paul Walmsley161107982012-01-25 12:57:46 -0700384#ifdef CONFIG_SOC_OMAP2420
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700385void __init omap2420_init_early(void)
386{
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600387 omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
388 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
389 OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
390 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
391 NULL);
Paul Walmsleyd9a16f92012-10-29 20:57:39 -0600392 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
393 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
Vaibhav Hiremath4de34f32011-12-19 15:50:15 +0530394 omap2xxx_check_revision();
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -0600395 omap2xxx_cm_init();
Tony Lindgren7b250af2011-10-04 18:26:28 -0700396 omap_common_init_early();
397 omap2xxx_voltagedomains_init();
398 omap242x_powerdomains_init();
399 omap242x_clockdomains_init();
400 omap2420_hwmod_init();
401 omap_hwmod_init_postsetup();
402 omap2420_clk_init();
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700403}
Shawn Guobbd707a2012-04-26 16:06:50 +0800404
405void __init omap2420_init_late(void)
406{
407 omap_mux_late_init();
408 omap2_common_pm_late_init();
409 omap2_pm_init();
410}
Paul Walmsley161107982012-01-25 12:57:46 -0700411#endif
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700412
Paul Walmsley161107982012-01-25 12:57:46 -0700413#ifdef CONFIG_SOC_OMAP2430
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700414void __init omap2430_init_early(void)
415{
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600416 omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
417 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
418 OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
419 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
420 NULL);
Paul Walmsleyd9a16f92012-10-29 20:57:39 -0600421 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
422 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
Vaibhav Hiremath4de34f32011-12-19 15:50:15 +0530423 omap2xxx_check_revision();
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -0600424 omap2xxx_cm_init();
Tony Lindgren7b250af2011-10-04 18:26:28 -0700425 omap_common_init_early();
426 omap2xxx_voltagedomains_init();
427 omap243x_powerdomains_init();
428 omap243x_clockdomains_init();
429 omap2430_hwmod_init();
430 omap_hwmod_init_postsetup();
431 omap2430_clk_init();
432}
Shawn Guobbd707a2012-04-26 16:06:50 +0800433
434void __init omap2430_init_late(void)
435{
436 omap_mux_late_init();
437 omap2_common_pm_late_init();
438 omap2_pm_init();
439}
Sanjeev Premic4e2d242011-10-13 21:44:10 +0530440#endif
Tony Lindgren7b250af2011-10-04 18:26:28 -0700441
442/*
443 * Currently only board-omap3beagle.c should call this because of the
444 * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
445 */
Sanjeev Premic4e2d242011-10-13 21:44:10 +0530446#ifdef CONFIG_ARCH_OMAP3
Tony Lindgren7b250af2011-10-04 18:26:28 -0700447void __init omap3_init_early(void)
448{
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600449 omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
450 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
451 OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
452 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
453 NULL);
Paul Walmsleyd9a16f92012-10-29 20:57:39 -0600454 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
455 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
Vaibhav Hiremath4de34f32011-12-19 15:50:15 +0530456 omap3xxx_check_revision();
457 omap3xxx_check_features();
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -0600458 omap3xxx_cm_init();
Tony Lindgren7b250af2011-10-04 18:26:28 -0700459 omap_common_init_early();
460 omap3xxx_voltagedomains_init();
461 omap3xxx_powerdomains_init();
462 omap3xxx_clockdomains_init();
463 omap3xxx_hwmod_init();
464 omap_hwmod_init_postsetup();
465 omap3xxx_clk_init();
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700466}
467
468void __init omap3430_init_early(void)
469{
Tony Lindgren7b250af2011-10-04 18:26:28 -0700470 omap3_init_early();
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700471}
472
473void __init omap35xx_init_early(void)
474{
Tony Lindgren7b250af2011-10-04 18:26:28 -0700475 omap3_init_early();
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700476}
477
478void __init omap3630_init_early(void)
479{
Tony Lindgren7b250af2011-10-04 18:26:28 -0700480 omap3_init_early();
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700481}
482
483void __init am35xx_init_early(void)
484{
Tony Lindgren7b250af2011-10-04 18:26:28 -0700485 omap3_init_early();
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700486}
487
Hemant Pedanekara9203602011-12-13 10:46:44 -0800488void __init ti81xx_init_early(void)
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700489{
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600490 omap2_set_globals_tap(OMAP343X_CLASS,
491 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
492 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
493 NULL);
Paul Walmsleyd9a16f92012-10-29 20:57:39 -0600494 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
495 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
Vaibhav Hiremath4de34f32011-12-19 15:50:15 +0530496 omap3xxx_check_revision();
497 ti81xx_check_features();
Tony Lindgren4c3cf902011-10-04 18:17:41 -0700498 omap_common_init_early();
499 omap3xxx_voltagedomains_init();
500 omap3xxx_powerdomains_init();
501 omap3xxx_clockdomains_init();
502 omap3xxx_hwmod_init();
503 omap_hwmod_init_postsetup();
504 omap3xxx_clk_init();
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700505}
Shawn Guobbd707a2012-04-26 16:06:50 +0800506
507void __init omap3_init_late(void)
508{
509 omap_mux_late_init();
510 omap2_common_pm_late_init();
511 omap3_pm_init();
512}
513
514void __init omap3430_init_late(void)
515{
516 omap_mux_late_init();
517 omap2_common_pm_late_init();
518 omap3_pm_init();
519}
520
521void __init omap35xx_init_late(void)
522{
523 omap_mux_late_init();
524 omap2_common_pm_late_init();
525 omap3_pm_init();
526}
527
528void __init omap3630_init_late(void)
529{
530 omap_mux_late_init();
531 omap2_common_pm_late_init();
532 omap3_pm_init();
533}
534
535void __init am35xx_init_late(void)
536{
537 omap_mux_late_init();
538 omap2_common_pm_late_init();
539 omap3_pm_init();
540}
541
542void __init ti81xx_init_late(void)
543{
544 omap_mux_late_init();
545 omap2_common_pm_late_init();
546 omap3_pm_init();
547}
Sanjeev Premic4e2d242011-10-13 21:44:10 +0530548#endif
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700549
Afzal Mohammed08f30982012-05-11 00:38:49 +0530550#ifdef CONFIG_SOC_AM33XX
551void __init am33xx_init_early(void)
552{
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600553 omap2_set_globals_tap(AM335X_CLASS,
554 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
555 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
556 NULL);
Paul Walmsleyd9a16f92012-10-29 20:57:39 -0600557 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
558 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
Afzal Mohammed08f30982012-05-11 00:38:49 +0530559 omap3xxx_check_revision();
560 ti81xx_check_features();
561 omap_common_init_early();
Vaibhav Hiremathce3fc892012-06-18 00:47:26 -0600562 am33xx_voltagedomains_init();
Vaibhav Hiremath3f0ea762012-06-18 00:47:27 -0600563 am33xx_powerdomains_init();
Vaibhav Hiremath9c80f3a2012-06-18 00:47:27 -0600564 am33xx_clockdomains_init();
Vaibhav Hirematha2cfc502012-07-25 13:51:13 -0600565 am33xx_hwmod_init();
566 omap_hwmod_init_postsetup();
Vaibhav Hiremathe30384a2012-05-29 15:26:41 +0530567 am33xx_clk_init();
Afzal Mohammed08f30982012-05-11 00:38:49 +0530568}
569#endif
570
Sanjeev Premic4e2d242011-10-13 21:44:10 +0530571#ifdef CONFIG_ARCH_OMAP4
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700572void __init omap4430_init_early(void)
573{
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600574 omap2_set_globals_tap(OMAP443X_CLASS,
575 OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
576 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
577 OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
Paul Walmsleyd9a16f92012-10-29 20:57:39 -0600578 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
579 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
580 OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
581 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
582 omap_prm_base_init();
583 omap_cm_base_init();
Vaibhav Hiremath4de34f32011-12-19 15:50:15 +0530584 omap4xxx_check_revision();
585 omap4xxx_check_features();
Tony Lindgren7b250af2011-10-04 18:26:28 -0700586 omap_common_init_early();
587 omap44xx_voltagedomains_init();
588 omap44xx_powerdomains_init();
589 omap44xx_clockdomains_init();
590 omap44xx_hwmod_init();
591 omap_hwmod_init_postsetup();
592 omap4xxx_clk_init();
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700593}
Shawn Guobbd707a2012-04-26 16:06:50 +0800594
595void __init omap4430_init_late(void)
596{
597 omap_mux_late_init();
598 omap2_common_pm_late_init();
599 omap4_pm_init();
600}
Sanjeev Premic4e2d242011-10-13 21:44:10 +0530601#endif
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700602
R Sricharan05e152c2012-06-05 16:21:32 +0530603#ifdef CONFIG_SOC_OMAP5
604void __init omap5_init_early(void)
605{
Paul Walmsleyb6a42262012-10-29 20:50:21 -0600606 omap2_set_globals_tap(OMAP54XX_CLASS,
607 OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
608 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
609 OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
Paul Walmsleyd9a16f92012-10-29 20:57:39 -0600610 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
611 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
612 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
613 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
614 omap_prm_base_init();
615 omap_cm_base_init();
R Sricharan05e152c2012-06-05 16:21:32 +0530616 omap5xxx_check_revision();
617 omap_common_init_early();
618}
619#endif
620
Tony Lindgrena4ca9db2011-08-22 23:57:23 -0700621void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
Paul Walmsley48057342010-12-21 15:25:10 -0700622 struct omap_sdrc_params *sdrc_cs1)
623{
Tony Lindgrena66cb342011-10-04 13:52:57 -0700624 omap_sram_init();
625
Hemant Pedanekar01001712011-02-16 08:31:39 -0800626 if (cpu_is_omap24xx() || omap3_has_sdrc()) {
Kevin Hilmanaa4b1f62010-03-10 17:16:31 +0000627 omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
628 _omap2_init_reprogram_sdrc();
629 }
Tony Lindgren1dbae812005-11-10 14:26:51 +0000630}