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.c141
1 files changed, 120 insertions, 21 deletions
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index a1939b1e6f82..e66687b0b9de 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -39,13 +39,11 @@
39#include "io.h" 39#include "io.h"
40 40
41#include <plat/omap-pm.h> 41#include <plat/omap-pm.h>
42#include <plat/powerdomain.h> 42#include "powerdomain.h"
43#include "powerdomains.h"
44
45#include <plat/clockdomain.h>
46#include "clockdomains.h"
47 43
44#include "clockdomain.h"
48#include <plat/omap_hwmod.h> 45#include <plat/omap_hwmod.h>
46#include <plat/multi.h>
49 47
50/* 48/*
51 * The machine specific code may provide the extra mapping besides the 49 * The machine specific code may provide the extra mapping besides the
@@ -311,24 +309,81 @@ static int __init _omap2_init_reprogram_sdrc(void)
311 return v; 309 return v;
312} 310}
313 311
314void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0, 312static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
315 struct omap_sdrc_params *sdrc_cs1) 313{
314 return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
315}
316
317/*
318 * Initialize asm_irq_base for entry-macro.S
319 */
320static inline void omap_irq_base_init(void)
321{
322 extern void __iomem *omap_irq_base;
323
324#ifdef MULTI_OMAP2
325 if (cpu_is_omap24xx())
326 omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE);
327 else if (cpu_is_omap34xx())
328 omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE);
329 else if (cpu_is_omap44xx())
330 omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE);
331 else
332 pr_err("Could not initialize omap_irq_base\n");
333#endif
334}
335
336void __init omap2_init_common_infrastructure(void)
316{ 337{
317 u8 skip_setup_idle = 0; 338 u8 postsetup_state;
318 339
319 pwrdm_init(powerdomains_omap); 340 if (cpu_is_omap242x()) {
320 clkdm_init(clockdomains_omap, clkdm_autodeps); 341 omap2xxx_powerdomains_init();
321 if (cpu_is_omap242x()) 342 omap2_clockdomains_init();
322 omap2420_hwmod_init(); 343 omap2420_hwmod_init();
323 else if (cpu_is_omap243x()) 344 } else if (cpu_is_omap243x()) {
345 omap2xxx_powerdomains_init();
346 omap2_clockdomains_init();
324 omap2430_hwmod_init(); 347 omap2430_hwmod_init();
325 else if (cpu_is_omap34xx()) 348 } else if (cpu_is_omap34xx()) {
349 omap3xxx_powerdomains_init();
350 omap2_clockdomains_init();
326 omap3xxx_hwmod_init(); 351 omap3xxx_hwmod_init();
327 else if (cpu_is_omap44xx()) 352 } else if (cpu_is_omap44xx()) {
353 omap44xx_powerdomains_init();
354 omap44xx_clockdomains_init();
328 omap44xx_hwmod_init(); 355 omap44xx_hwmod_init();
356 } else {
357 pr_err("Could not init hwmod data - unknown SoC\n");
358 }
359
360 /* Set the default postsetup state for all hwmods */
361#ifdef CONFIG_PM_RUNTIME
362 postsetup_state = _HWMOD_STATE_IDLE;
363#else
364 postsetup_state = _HWMOD_STATE_ENABLED;
365#endif
366 omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
367
368 /*
369 * Set the default postsetup state for unusual modules (like
370 * MPU WDT).
371 *
372 * The postsetup_state is not actually used until
373 * omap_hwmod_late_init(), so boards that desire full watchdog
374 * coverage of kernel initialization can reprogram the
375 * postsetup_state between the calls to
376 * omap2_init_common_infra() and omap2_init_common_devices().
377 *
378 * XXX ideally we could detect whether the MPU WDT was currently
379 * enabled here and make this conditional
380 */
381 postsetup_state = _HWMOD_STATE_DISABLED;
382 omap_hwmod_for_each_by_class("wd_timer",
383 _set_hwmod_postsetup_state,
384 &postsetup_state);
329 385
330 /* The OPP tables have to be registered before a clk init */ 386 omap_pm_if_early_init();
331 omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
332 387
333 if (cpu_is_omap2420()) 388 if (cpu_is_omap2420())
334 omap2420_clk_init(); 389 omap2420_clk_init();
@@ -339,17 +394,61 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
339 else if (cpu_is_omap44xx()) 394 else if (cpu_is_omap44xx())
340 omap4xxx_clk_init(); 395 omap4xxx_clk_init();
341 else 396 else
342 pr_err("Could not init clock framework - unknown CPU\n"); 397 pr_err("Could not init clock framework - unknown SoC\n");
398}
343 399
400void __init omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,
401 struct omap_sdrc_params *sdrc_cs1)
402{
344 omap_serial_early_init(); 403 omap_serial_early_init();
345 404
346#ifndef CONFIG_PM_RUNTIME 405 omap_hwmod_late_init();
347 skip_setup_idle = 1; 406
348#endif
349 omap_hwmod_late_init(skip_setup_idle);
350 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 407 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
351 omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 408 omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
352 _omap2_init_reprogram_sdrc(); 409 _omap2_init_reprogram_sdrc();
353 } 410 }
354 gpmc_init(); 411 gpmc_init();
412
413 omap_irq_base_init();
414}
415
416/*
417 * NOTE: Please use ioremap + __raw_read/write where possible instead of these
418 */
419
420u8 omap_readb(u32 pa)
421{
422 return __raw_readb(OMAP2_L4_IO_ADDRESS(pa));
423}
424EXPORT_SYMBOL(omap_readb);
425
426u16 omap_readw(u32 pa)
427{
428 return __raw_readw(OMAP2_L4_IO_ADDRESS(pa));
429}
430EXPORT_SYMBOL(omap_readw);
431
432u32 omap_readl(u32 pa)
433{
434 return __raw_readl(OMAP2_L4_IO_ADDRESS(pa));
435}
436EXPORT_SYMBOL(omap_readl);
437
438void omap_writeb(u8 v, u32 pa)
439{
440 __raw_writeb(v, OMAP2_L4_IO_ADDRESS(pa));
441}
442EXPORT_SYMBOL(omap_writeb);
443
444void omap_writew(u16 v, u32 pa)
445{
446 __raw_writew(v, OMAP2_L4_IO_ADDRESS(pa));
447}
448EXPORT_SYMBOL(omap_writew);
449
450void omap_writel(u32 v, u32 pa)
451{
452 __raw_writel(v, OMAP2_L4_IO_ADDRESS(pa));
355} 453}
454EXPORT_SYMBOL(omap_writel);