aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/io.c')
-rw-r--r--arch/arm/mach-omap2/io.c158
1 files changed, 104 insertions, 54 deletions
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 2ce1ce6fb4db..25d20ced03e1 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -16,7 +16,6 @@
16 * it under the terms of the GNU General Public License version 2 as 16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation. 17 * published by the Free Software Foundation.
18 */ 18 */
19
20#include <linux/module.h> 19#include <linux/module.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/init.h> 21#include <linux/init.h>
@@ -35,14 +34,16 @@
35#include "clock2xxx.h" 34#include "clock2xxx.h"
36#include "clock3xxx.h" 35#include "clock3xxx.h"
37#include "clock44xx.h" 36#include "clock44xx.h"
38#include "io.h"
39 37
38#include <plat/common.h>
40#include <plat/omap-pm.h> 39#include <plat/omap-pm.h>
40#include "voltage.h"
41#include "powerdomain.h" 41#include "powerdomain.h"
42 42
43#include "clockdomain.h" 43#include "clockdomain.h"
44#include <plat/omap_hwmod.h> 44#include <plat/omap_hwmod.h>
45#include <plat/multi.h> 45#include <plat/multi.h>
46#include <plat/common.h>
46 47
47/* 48/*
48 * The machine specific code may provide the extra mapping besides the 49 * The machine specific code may provide the extra mapping besides the
@@ -239,25 +240,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
239}; 240};
240#endif 241#endif
241 242
242static void __init _omap2_map_common_io(void)
243{
244 /* Normally devicemaps_init() would flush caches and tlb after
245 * mdesc->map_io(), but we must also do it here because of the CPU
246 * revision check below.
247 */
248 local_flush_tlb_all();
249 flush_cache_all();
250
251 omap2_check_revision();
252 omap_sram_init();
253}
254
255#ifdef CONFIG_SOC_OMAP2420 243#ifdef CONFIG_SOC_OMAP2420
256void __init omap242x_map_common_io(void) 244void __init omap242x_map_common_io(void)
257{ 245{
258 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 246 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
259 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 247 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
260 _omap2_map_common_io();
261} 248}
262#endif 249#endif
263 250
@@ -266,7 +253,6 @@ void __init omap243x_map_common_io(void)
266{ 253{
267 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 254 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
268 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 255 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
269 _omap2_map_common_io();
270} 256}
271#endif 257#endif
272 258
@@ -274,7 +260,6 @@ void __init omap243x_map_common_io(void)
274void __init omap34xx_map_common_io(void) 260void __init omap34xx_map_common_io(void)
275{ 261{
276 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 262 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
277 _omap2_map_common_io();
278} 263}
279#endif 264#endif
280 265
@@ -282,7 +267,6 @@ void __init omap34xx_map_common_io(void)
282void __init omapti816x_map_common_io(void) 267void __init omapti816x_map_common_io(void)
283{ 268{
284 iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc)); 269 iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
285 _omap2_map_common_io();
286} 270}
287#endif 271#endif
288 272
@@ -290,7 +274,6 @@ void __init omapti816x_map_common_io(void)
290void __init omap44xx_map_common_io(void) 274void __init omap44xx_map_common_io(void)
291{ 275{
292 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 276 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
293 _omap2_map_common_io();
294} 277}
295#endif 278#endif
296 279
@@ -336,29 +319,16 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
336/* See irq.c, omap4-common.c and entry-macro.S */ 319/* See irq.c, omap4-common.c and entry-macro.S */
337void __iomem *omap_irq_base; 320void __iomem *omap_irq_base;
338 321
339void __init omap2_init_common_infrastructure(void) 322static void __init omap_common_init_early(void)
340{ 323{
341 u8 postsetup_state; 324 omap2_check_revision();
325 omap_ioremap_init();
326 omap_init_consistent_dma_size();
327}
342 328
343 if (cpu_is_omap242x()) { 329static void __init omap_hwmod_init_postsetup(void)
344 omap2xxx_powerdomains_init(); 330{
345 omap2xxx_clockdomains_init(); 331 u8 postsetup_state;
346 omap2420_hwmod_init();
347 } else if (cpu_is_omap243x()) {
348 omap2xxx_powerdomains_init();
349 omap2xxx_clockdomains_init();
350 omap2430_hwmod_init();
351 } else if (cpu_is_omap34xx()) {
352 omap3xxx_powerdomains_init();
353 omap3xxx_clockdomains_init();
354 omap3xxx_hwmod_init();
355 } else if (cpu_is_omap44xx()) {
356 omap44xx_powerdomains_init();
357 omap44xx_clockdomains_init();
358 omap44xx_hwmod_init();
359 } else {
360 pr_err("Could not init hwmod data - unknown SoC\n");
361 }
362 332
363 /* Set the default postsetup state for all hwmods */ 333 /* Set the default postsetup state for all hwmods */
364#ifdef CONFIG_PM_RUNTIME 334#ifdef CONFIG_PM_RUNTIME
@@ -376,7 +346,7 @@ void __init omap2_init_common_infrastructure(void)
376 * omap_hwmod_late_init(), so boards that desire full watchdog 346 * omap_hwmod_late_init(), so boards that desire full watchdog
377 * coverage of kernel initialization can reprogram the 347 * coverage of kernel initialization can reprogram the
378 * postsetup_state between the calls to 348 * postsetup_state between the calls to
379 * omap2_init_common_infra() and omap2_init_common_devices(). 349 * omap2_init_common_infra() and omap_sdrc_init().
380 * 350 *
381 * XXX ideally we could detect whether the MPU WDT was currently 351 * XXX ideally we could detect whether the MPU WDT was currently
382 * enabled here and make this conditional 352 * enabled here and make this conditional
@@ -387,27 +357,107 @@ void __init omap2_init_common_infrastructure(void)
387 &postsetup_state); 357 &postsetup_state);
388 358
389 omap_pm_if_early_init(); 359 omap_pm_if_early_init();
360}
361
362#ifdef CONFIG_ARCH_OMAP2
363void __init omap2420_init_early(void)
364{
365 omap2_set_globals_242x();
366 omap_common_init_early();
367 omap2xxx_voltagedomains_init();
368 omap242x_powerdomains_init();
369 omap242x_clockdomains_init();
370 omap2420_hwmod_init();
371 omap_hwmod_init_postsetup();
372 omap2420_clk_init();
373}
374
375void __init omap2430_init_early(void)
376{
377 omap2_set_globals_243x();
378 omap_common_init_early();
379 omap2xxx_voltagedomains_init();
380 omap243x_powerdomains_init();
381 omap243x_clockdomains_init();
382 omap2430_hwmod_init();
383 omap_hwmod_init_postsetup();
384 omap2430_clk_init();
385}
386#endif
387
388/*
389 * Currently only board-omap3beagle.c should call this because of the
390 * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
391 */
392#ifdef CONFIG_ARCH_OMAP3
393void __init omap3_init_early(void)
394{
395 omap2_set_globals_3xxx();
396 omap_common_init_early();
397 omap3xxx_voltagedomains_init();
398 omap3xxx_powerdomains_init();
399 omap3xxx_clockdomains_init();
400 omap3xxx_hwmod_init();
401 omap_hwmod_init_postsetup();
402 omap3xxx_clk_init();
403}
390 404
391 if (cpu_is_omap2420()) 405void __init omap3430_init_early(void)
392 omap2420_clk_init(); 406{
393 else if (cpu_is_omap2430()) 407 omap3_init_early();
394 omap2430_clk_init(); 408}
395 else if (cpu_is_omap34xx()) 409
396 omap3xxx_clk_init(); 410void __init omap35xx_init_early(void)
397 else if (cpu_is_omap44xx()) 411{
398 omap4xxx_clk_init(); 412 omap3_init_early();
399 else 413}
400 pr_err("Could not init clock framework - unknown SoC\n"); 414
415void __init omap3630_init_early(void)
416{
417 omap3_init_early();
418}
419
420void __init am35xx_init_early(void)
421{
422 omap3_init_early();
401} 423}
402 424
403void __init omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0, 425void __init ti816x_init_early(void)
426{
427 omap2_set_globals_ti816x();
428 omap_common_init_early();
429 omap3xxx_voltagedomains_init();
430 omap3xxx_powerdomains_init();
431 omap3xxx_clockdomains_init();
432 omap3xxx_hwmod_init();
433 omap_hwmod_init_postsetup();
434 omap3xxx_clk_init();
435}
436#endif
437
438#ifdef CONFIG_ARCH_OMAP4
439void __init omap4430_init_early(void)
440{
441 omap2_set_globals_443x();
442 omap_common_init_early();
443 omap44xx_voltagedomains_init();
444 omap44xx_powerdomains_init();
445 omap44xx_clockdomains_init();
446 omap44xx_hwmod_init();
447 omap_hwmod_init_postsetup();
448 omap4xxx_clk_init();
449}
450#endif
451
452void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
404 struct omap_sdrc_params *sdrc_cs1) 453 struct omap_sdrc_params *sdrc_cs1)
405{ 454{
455 omap_sram_init();
456
406 if (cpu_is_omap24xx() || omap3_has_sdrc()) { 457 if (cpu_is_omap24xx() || omap3_has_sdrc()) {
407 omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 458 omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
408 _omap2_init_reprogram_sdrc(); 459 _omap2_init_reprogram_sdrc();
409 } 460 }
410
411} 461}
412 462
413/* 463/*