11dbae815STony Lindgren /* 21dbae815STony Lindgren * linux/arch/arm/mach-omap2/io.c 31dbae815STony Lindgren * 41dbae815STony Lindgren * OMAP2 I/O mapping code 51dbae815STony Lindgren * 61dbae815STony Lindgren * Copyright (C) 2005 Nokia Corporation 744169075SSantosh Shilimkar * Copyright (C) 2007-2009 Texas Instruments 8646e3ed1STony Lindgren * 9646e3ed1STony Lindgren * Author: 10646e3ed1STony Lindgren * Juha Yrjola <juha.yrjola@nokia.com> 11646e3ed1STony Lindgren * Syed Khasim <x0khasim@ti.com> 121dbae815STony Lindgren * 1344169075SSantosh Shilimkar * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> 1444169075SSantosh Shilimkar * 151dbae815STony Lindgren * This program is free software; you can redistribute it and/or modify 161dbae815STony Lindgren * it under the terms of the GNU General Public License version 2 as 171dbae815STony Lindgren * published by the Free Software Foundation. 181dbae815STony Lindgren */ 191dbae815STony Lindgren 201dbae815STony Lindgren #include <linux/module.h> 211dbae815STony Lindgren #include <linux/kernel.h> 221dbae815STony Lindgren #include <linux/init.h> 23fced80c7SRussell King #include <linux/io.h> 242f135eafSPaul Walmsley #include <linux/clk.h> 2591773a00STomi Valkeinen #include <linux/omapfb.h> 261dbae815STony Lindgren 27120db2cbSTony Lindgren #include <asm/tlb.h> 28120db2cbSTony Lindgren 29120db2cbSTony Lindgren #include <asm/mach/map.h> 30120db2cbSTony Lindgren 31ce491cf8STony Lindgren #include <plat/sram.h> 32ce491cf8STony Lindgren #include <plat/sdrc.h> 33ce491cf8STony Lindgren #include <plat/serial.h> 34646e3ed1STony Lindgren 35e80a9729SPaul Walmsley #include "clock2xxx.h" 36657ebfadSPaul Walmsley #include "clock3xxx.h" 37e80a9729SPaul Walmsley #include "clock44xx.h" 381dbae815STony Lindgren 39a66cb345STony Lindgren #include <plat/common.h> 40ce491cf8STony Lindgren #include <plat/omap-pm.h> 4181a60482SKevin Hilman #include "voltage.h" 4272e06d08SPaul Walmsley #include "powerdomain.h" 439717100fSPaul Walmsley 441540f214SPaul Walmsley #include "clockdomain.h" 45ce491cf8STony Lindgren #include <plat/omap_hwmod.h> 465d190c40STony Lindgren #include <plat/multi.h> 47*4c3cf901STony Lindgren #include <plat/common.h> 4802bfc030SPaul Walmsley 491dbae815STony Lindgren /* 501dbae815STony Lindgren * The machine specific code may provide the extra mapping besides the 511dbae815STony Lindgren * default mapping provided here. 521dbae815STony Lindgren */ 53cc26b3b0SSyed Mohammed, Khasim 54088ef950STony Lindgren #ifdef CONFIG_ARCH_OMAP2 55cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = { 561dbae815STony Lindgren { 571dbae815STony Lindgren .virtual = L3_24XX_VIRT, 581dbae815STony Lindgren .pfn = __phys_to_pfn(L3_24XX_PHYS), 591dbae815STony Lindgren .length = L3_24XX_SIZE, 601dbae815STony Lindgren .type = MT_DEVICE 611dbae815STony Lindgren }, 6209f21ed4SKyungmin Park { 6309f21ed4SKyungmin Park .virtual = L4_24XX_VIRT, 6409f21ed4SKyungmin Park .pfn = __phys_to_pfn(L4_24XX_PHYS), 6509f21ed4SKyungmin Park .length = L4_24XX_SIZE, 6609f21ed4SKyungmin Park .type = MT_DEVICE 6709f21ed4SKyungmin Park }, 68cc26b3b0SSyed Mohammed, Khasim }; 69cc26b3b0SSyed Mohammed, Khasim 7059b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420 71cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = { 721dbae815STony Lindgren { 737adb9987SPaul Walmsley .virtual = DSP_MEM_2420_VIRT, 747adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS), 757adb9987SPaul Walmsley .length = DSP_MEM_2420_SIZE, 76c40fae95STony Lindgren .type = MT_DEVICE 77c40fae95STony Lindgren }, 78c40fae95STony Lindgren { 797adb9987SPaul Walmsley .virtual = DSP_IPI_2420_VIRT, 807adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS), 817adb9987SPaul Walmsley .length = DSP_IPI_2420_SIZE, 82c40fae95STony Lindgren .type = MT_DEVICE 83c40fae95STony Lindgren }, 84c40fae95STony Lindgren { 857adb9987SPaul Walmsley .virtual = DSP_MMU_2420_VIRT, 867adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS), 877adb9987SPaul Walmsley .length = DSP_MMU_2420_SIZE, 881dbae815STony Lindgren .type = MT_DEVICE 89cc26b3b0SSyed Mohammed, Khasim }, 901dbae815STony Lindgren }; 911dbae815STony Lindgren 92cc26b3b0SSyed Mohammed, Khasim #endif 93cc26b3b0SSyed Mohammed, Khasim 9459b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430 95cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = { 96cc26b3b0SSyed Mohammed, Khasim { 97cc26b3b0SSyed Mohammed, Khasim .virtual = L4_WK_243X_VIRT, 98cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_WK_243X_PHYS), 99cc26b3b0SSyed Mohammed, Khasim .length = L4_WK_243X_SIZE, 100cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 101cc26b3b0SSyed Mohammed, Khasim }, 102cc26b3b0SSyed Mohammed, Khasim { 103cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_GPMC_VIRT, 104cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS), 105cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_GPMC_SIZE, 106cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 107cc26b3b0SSyed Mohammed, Khasim }, 108cc26b3b0SSyed Mohammed, Khasim { 109cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SDRC_VIRT, 110cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS), 111cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SDRC_SIZE, 112cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 113cc26b3b0SSyed Mohammed, Khasim }, 114cc26b3b0SSyed Mohammed, Khasim { 115cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SMS_VIRT, 116cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS), 117cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SMS_SIZE, 118cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 119cc26b3b0SSyed Mohammed, Khasim }, 120cc26b3b0SSyed Mohammed, Khasim }; 121cc26b3b0SSyed Mohammed, Khasim #endif 122cc26b3b0SSyed Mohammed, Khasim #endif 123cc26b3b0SSyed Mohammed, Khasim 124a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3 125cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = { 126cc26b3b0SSyed Mohammed, Khasim { 127cc26b3b0SSyed Mohammed, Khasim .virtual = L3_34XX_VIRT, 128cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L3_34XX_PHYS), 129cc26b3b0SSyed Mohammed, Khasim .length = L3_34XX_SIZE, 130cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 131cc26b3b0SSyed Mohammed, Khasim }, 132cc26b3b0SSyed Mohammed, Khasim { 133cc26b3b0SSyed Mohammed, Khasim .virtual = L4_34XX_VIRT, 134cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_34XX_PHYS), 135cc26b3b0SSyed Mohammed, Khasim .length = L4_34XX_SIZE, 136cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 137cc26b3b0SSyed Mohammed, Khasim }, 138cc26b3b0SSyed Mohammed, Khasim { 139cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP34XX_GPMC_VIRT, 140cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS), 141cc26b3b0SSyed Mohammed, Khasim .length = OMAP34XX_GPMC_SIZE, 142cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 143cc26b3b0SSyed Mohammed, Khasim }, 144cc26b3b0SSyed Mohammed, Khasim { 145cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SMS_VIRT, 146cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS), 147cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SMS_SIZE, 148cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 149cc26b3b0SSyed Mohammed, Khasim }, 150cc26b3b0SSyed Mohammed, Khasim { 151cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SDRC_VIRT, 152cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS), 153cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SDRC_SIZE, 154cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 155cc26b3b0SSyed Mohammed, Khasim }, 156cc26b3b0SSyed Mohammed, Khasim { 157cc26b3b0SSyed Mohammed, Khasim .virtual = L4_PER_34XX_VIRT, 158cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_PER_34XX_PHYS), 159cc26b3b0SSyed Mohammed, Khasim .length = L4_PER_34XX_SIZE, 160cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 161cc26b3b0SSyed Mohammed, Khasim }, 162cc26b3b0SSyed Mohammed, Khasim { 163cc26b3b0SSyed Mohammed, Khasim .virtual = L4_EMU_34XX_VIRT, 164cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS), 165cc26b3b0SSyed Mohammed, Khasim .length = L4_EMU_34XX_SIZE, 166cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 167cc26b3b0SSyed Mohammed, Khasim }, 168a4f57b81STony Lindgren #if defined(CONFIG_DEBUG_LL) && \ 169a4f57b81STony Lindgren (defined(CONFIG_MACH_OMAP_ZOOM2) || defined(CONFIG_MACH_OMAP_ZOOM3)) 170a4f57b81STony Lindgren { 171a4f57b81STony Lindgren .virtual = ZOOM_UART_VIRT, 172a4f57b81STony Lindgren .pfn = __phys_to_pfn(ZOOM_UART_BASE), 173a4f57b81STony Lindgren .length = SZ_1M, 174a4f57b81STony Lindgren .type = MT_DEVICE 175a4f57b81STony Lindgren }, 176a4f57b81STony Lindgren #endif 177cc26b3b0SSyed Mohammed, Khasim }; 178cc26b3b0SSyed Mohammed, Khasim #endif 17901001712SHemant Pedanekar 18001001712SHemant Pedanekar #ifdef CONFIG_SOC_OMAPTI816X 18101001712SHemant Pedanekar static struct map_desc omapti816x_io_desc[] __initdata = { 18201001712SHemant Pedanekar { 18301001712SHemant Pedanekar .virtual = L4_34XX_VIRT, 18401001712SHemant Pedanekar .pfn = __phys_to_pfn(L4_34XX_PHYS), 18501001712SHemant Pedanekar .length = L4_34XX_SIZE, 18601001712SHemant Pedanekar .type = MT_DEVICE 18701001712SHemant Pedanekar }, 18801001712SHemant Pedanekar }; 18901001712SHemant Pedanekar #endif 19001001712SHemant Pedanekar 19144169075SSantosh Shilimkar #ifdef CONFIG_ARCH_OMAP4 19244169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = { 19344169075SSantosh Shilimkar { 19444169075SSantosh Shilimkar .virtual = L3_44XX_VIRT, 19544169075SSantosh Shilimkar .pfn = __phys_to_pfn(L3_44XX_PHYS), 19644169075SSantosh Shilimkar .length = L3_44XX_SIZE, 19744169075SSantosh Shilimkar .type = MT_DEVICE, 19844169075SSantosh Shilimkar }, 19944169075SSantosh Shilimkar { 20044169075SSantosh Shilimkar .virtual = L4_44XX_VIRT, 20144169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_44XX_PHYS), 20244169075SSantosh Shilimkar .length = L4_44XX_SIZE, 20344169075SSantosh Shilimkar .type = MT_DEVICE, 20444169075SSantosh Shilimkar }, 20544169075SSantosh Shilimkar { 20644169075SSantosh Shilimkar .virtual = OMAP44XX_GPMC_VIRT, 20744169075SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_GPMC_PHYS), 20844169075SSantosh Shilimkar .length = OMAP44XX_GPMC_SIZE, 20944169075SSantosh Shilimkar .type = MT_DEVICE, 21044169075SSantosh Shilimkar }, 21144169075SSantosh Shilimkar { 212f5d2d659SSantosh Shilimkar .virtual = OMAP44XX_EMIF1_VIRT, 213f5d2d659SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_EMIF1_PHYS), 214f5d2d659SSantosh Shilimkar .length = OMAP44XX_EMIF1_SIZE, 215f5d2d659SSantosh Shilimkar .type = MT_DEVICE, 216f5d2d659SSantosh Shilimkar }, 217f5d2d659SSantosh Shilimkar { 218f5d2d659SSantosh Shilimkar .virtual = OMAP44XX_EMIF2_VIRT, 219f5d2d659SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_EMIF2_PHYS), 220f5d2d659SSantosh Shilimkar .length = OMAP44XX_EMIF2_SIZE, 221f5d2d659SSantosh Shilimkar .type = MT_DEVICE, 222f5d2d659SSantosh Shilimkar }, 223f5d2d659SSantosh Shilimkar { 224f5d2d659SSantosh Shilimkar .virtual = OMAP44XX_DMM_VIRT, 225f5d2d659SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_DMM_PHYS), 226f5d2d659SSantosh Shilimkar .length = OMAP44XX_DMM_SIZE, 227f5d2d659SSantosh Shilimkar .type = MT_DEVICE, 228f5d2d659SSantosh Shilimkar }, 229f5d2d659SSantosh Shilimkar { 23044169075SSantosh Shilimkar .virtual = L4_PER_44XX_VIRT, 23144169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_PER_44XX_PHYS), 23244169075SSantosh Shilimkar .length = L4_PER_44XX_SIZE, 23344169075SSantosh Shilimkar .type = MT_DEVICE, 23444169075SSantosh Shilimkar }, 23544169075SSantosh Shilimkar { 23644169075SSantosh Shilimkar .virtual = L4_EMU_44XX_VIRT, 23744169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_EMU_44XX_PHYS), 23844169075SSantosh Shilimkar .length = L4_EMU_44XX_SIZE, 23944169075SSantosh Shilimkar .type = MT_DEVICE, 24044169075SSantosh Shilimkar }, 24144169075SSantosh Shilimkar }; 24244169075SSantosh Shilimkar #endif 243cc26b3b0SSyed Mohammed, Khasim 24459b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420 2458185e468SAaro Koskinen void __init omap242x_map_common_io(void) 2466fbd55d0STony Lindgren { 2476fbd55d0STony Lindgren iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 2486fbd55d0STony Lindgren iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 2496fbd55d0STony Lindgren } 2506fbd55d0STony Lindgren #endif 2516fbd55d0STony Lindgren 25259b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430 2538185e468SAaro Koskinen void __init omap243x_map_common_io(void) 2546fbd55d0STony Lindgren { 2556fbd55d0STony Lindgren iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 2566fbd55d0STony Lindgren iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 2576fbd55d0STony Lindgren } 2586fbd55d0STony Lindgren #endif 2596fbd55d0STony Lindgren 260a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3 2618185e468SAaro Koskinen void __init omap34xx_map_common_io(void) 2626fbd55d0STony Lindgren { 2636fbd55d0STony Lindgren iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 2646fbd55d0STony Lindgren } 2656fbd55d0STony Lindgren #endif 2666fbd55d0STony Lindgren 26701001712SHemant Pedanekar #ifdef CONFIG_SOC_OMAPTI816X 26801001712SHemant Pedanekar void __init omapti816x_map_common_io(void) 26901001712SHemant Pedanekar { 27001001712SHemant Pedanekar iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc)); 27101001712SHemant Pedanekar } 27201001712SHemant Pedanekar #endif 27301001712SHemant Pedanekar 2746fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP4 2758185e468SAaro Koskinen void __init omap44xx_map_common_io(void) 2766fbd55d0STony Lindgren { 2776fbd55d0STony Lindgren iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 2786fbd55d0STony Lindgren } 2796fbd55d0STony Lindgren #endif 2806fbd55d0STony Lindgren 2812f135eafSPaul Walmsley /* 2822f135eafSPaul Walmsley * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters 2832f135eafSPaul Walmsley * 2842f135eafSPaul Walmsley * Sets the CORE DPLL3 M2 divider to the same value that it's at 2852f135eafSPaul Walmsley * currently. This has the effect of setting the SDRC SDRAM AC timing 2862f135eafSPaul Walmsley * registers to the values currently defined by the kernel. Currently 2872f135eafSPaul Walmsley * only defined for OMAP3; will return 0 if called on OMAP2. Returns 2882f135eafSPaul Walmsley * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2, 2892f135eafSPaul Walmsley * or passes along the return value of clk_set_rate(). 2902f135eafSPaul Walmsley */ 2912f135eafSPaul Walmsley static int __init _omap2_init_reprogram_sdrc(void) 2922f135eafSPaul Walmsley { 2932f135eafSPaul Walmsley struct clk *dpll3_m2_ck; 2942f135eafSPaul Walmsley int v = -EINVAL; 2952f135eafSPaul Walmsley long rate; 2962f135eafSPaul Walmsley 2972f135eafSPaul Walmsley if (!cpu_is_omap34xx()) 2982f135eafSPaul Walmsley return 0; 2992f135eafSPaul Walmsley 3002f135eafSPaul Walmsley dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck"); 301e281f7ecSAaro Koskinen if (IS_ERR(dpll3_m2_ck)) 3022f135eafSPaul Walmsley return -EINVAL; 3032f135eafSPaul Walmsley 3042f135eafSPaul Walmsley rate = clk_get_rate(dpll3_m2_ck); 3052f135eafSPaul Walmsley pr_info("Reprogramming SDRC clock to %ld Hz\n", rate); 3062f135eafSPaul Walmsley v = clk_set_rate(dpll3_m2_ck, rate); 3072f135eafSPaul Walmsley if (v) 3082f135eafSPaul Walmsley pr_err("dpll3_m2_clk rate change failed: %d\n", v); 3092f135eafSPaul Walmsley 3102f135eafSPaul Walmsley clk_put(dpll3_m2_ck); 3112f135eafSPaul Walmsley 3122f135eafSPaul Walmsley return v; 3132f135eafSPaul Walmsley } 3142f135eafSPaul Walmsley 3152092e5ccSPaul Walmsley static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data) 3162092e5ccSPaul Walmsley { 3172092e5ccSPaul Walmsley return omap_hwmod_set_postsetup_state(oh, *(u8 *)data); 3182092e5ccSPaul Walmsley } 3192092e5ccSPaul Walmsley 320741e3a89STony Lindgren /* See irq.c, omap4-common.c and entry-macro.S */ 3219f9605c2SRussell King void __iomem *omap_irq_base; 3229f9605c2SRussell King 3237b250affSTony Lindgren static void __init omap_common_init_early(void) 3247b250affSTony Lindgren { 3257b250affSTony Lindgren omap2_check_revision(); 3267b250affSTony Lindgren } 3277b250affSTony Lindgren 3287b250affSTony Lindgren static void __init omap_hwmod_init_postsetup(void) 329120db2cbSTony Lindgren { 3302092e5ccSPaul Walmsley u8 postsetup_state; 3312092e5ccSPaul Walmsley 3322092e5ccSPaul Walmsley /* Set the default postsetup state for all hwmods */ 3332092e5ccSPaul Walmsley #ifdef CONFIG_PM_RUNTIME 3342092e5ccSPaul Walmsley postsetup_state = _HWMOD_STATE_IDLE; 3352092e5ccSPaul Walmsley #else 3362092e5ccSPaul Walmsley postsetup_state = _HWMOD_STATE_ENABLED; 3372092e5ccSPaul Walmsley #endif 3382092e5ccSPaul Walmsley omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); 33955d2cb08SBenoit Cousson 340ff2516fbSPaul Walmsley /* 341ff2516fbSPaul Walmsley * Set the default postsetup state for unusual modules (like 342ff2516fbSPaul Walmsley * MPU WDT). 343ff2516fbSPaul Walmsley * 344ff2516fbSPaul Walmsley * The postsetup_state is not actually used until 345ff2516fbSPaul Walmsley * omap_hwmod_late_init(), so boards that desire full watchdog 346ff2516fbSPaul Walmsley * coverage of kernel initialization can reprogram the 347ff2516fbSPaul Walmsley * postsetup_state between the calls to 348a4ca9dbeSTony Lindgren * omap2_init_common_infra() and omap_sdrc_init(). 349ff2516fbSPaul Walmsley * 350ff2516fbSPaul Walmsley * XXX ideally we could detect whether the MPU WDT was currently 351ff2516fbSPaul Walmsley * enabled here and make this conditional 352ff2516fbSPaul Walmsley */ 353ff2516fbSPaul Walmsley postsetup_state = _HWMOD_STATE_DISABLED; 354ff2516fbSPaul Walmsley omap_hwmod_for_each_by_class("wd_timer", 355ff2516fbSPaul Walmsley _set_hwmod_postsetup_state, 356ff2516fbSPaul Walmsley &postsetup_state); 357ff2516fbSPaul Walmsley 35853da4ce2SKevin Hilman omap_pm_if_early_init(); 3594805734bSPaul Walmsley } 3604805734bSPaul Walmsley 3618f5b5a41STony Lindgren void __init omap2420_init_early(void) 3628f5b5a41STony Lindgren { 363*4c3cf901STony Lindgren omap2_set_globals_242x(); 3647b250affSTony Lindgren omap_common_init_early(); 3657b250affSTony Lindgren omap2xxx_voltagedomains_init(); 3667b250affSTony Lindgren omap242x_powerdomains_init(); 3677b250affSTony Lindgren omap242x_clockdomains_init(); 3687b250affSTony Lindgren omap2420_hwmod_init(); 3697b250affSTony Lindgren omap_hwmod_init_postsetup(); 3707b250affSTony Lindgren omap2420_clk_init(); 3718f5b5a41STony Lindgren } 3728f5b5a41STony Lindgren 3738f5b5a41STony Lindgren void __init omap2430_init_early(void) 3748f5b5a41STony Lindgren { 375*4c3cf901STony Lindgren omap2_set_globals_243x(); 3767b250affSTony Lindgren omap_common_init_early(); 3777b250affSTony Lindgren omap2xxx_voltagedomains_init(); 3787b250affSTony Lindgren omap243x_powerdomains_init(); 3797b250affSTony Lindgren omap243x_clockdomains_init(); 3807b250affSTony Lindgren omap2430_hwmod_init(); 3817b250affSTony Lindgren omap_hwmod_init_postsetup(); 3827b250affSTony Lindgren omap2430_clk_init(); 3837b250affSTony Lindgren } 3847b250affSTony Lindgren 3857b250affSTony Lindgren /* 3867b250affSTony Lindgren * Currently only board-omap3beagle.c should call this because of the 3877b250affSTony Lindgren * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT. 3887b250affSTony Lindgren */ 3897b250affSTony Lindgren void __init omap3_init_early(void) 3907b250affSTony Lindgren { 391*4c3cf901STony Lindgren omap2_set_globals_3xxx(); 3927b250affSTony Lindgren omap_common_init_early(); 3937b250affSTony Lindgren omap3xxx_voltagedomains_init(); 3947b250affSTony Lindgren omap3xxx_powerdomains_init(); 3957b250affSTony Lindgren omap3xxx_clockdomains_init(); 3967b250affSTony Lindgren omap3xxx_hwmod_init(); 3977b250affSTony Lindgren omap_hwmod_init_postsetup(); 3987b250affSTony Lindgren omap3xxx_clk_init(); 3998f5b5a41STony Lindgren } 4008f5b5a41STony Lindgren 4018f5b5a41STony Lindgren void __init omap3430_init_early(void) 4028f5b5a41STony Lindgren { 4037b250affSTony Lindgren omap3_init_early(); 4048f5b5a41STony Lindgren } 4058f5b5a41STony Lindgren 4068f5b5a41STony Lindgren void __init omap35xx_init_early(void) 4078f5b5a41STony Lindgren { 4087b250affSTony Lindgren omap3_init_early(); 4098f5b5a41STony Lindgren } 4108f5b5a41STony Lindgren 4118f5b5a41STony Lindgren void __init omap3630_init_early(void) 4128f5b5a41STony Lindgren { 4137b250affSTony Lindgren omap3_init_early(); 4148f5b5a41STony Lindgren } 4158f5b5a41STony Lindgren 4168f5b5a41STony Lindgren void __init am35xx_init_early(void) 4178f5b5a41STony Lindgren { 4187b250affSTony Lindgren omap3_init_early(); 4198f5b5a41STony Lindgren } 4208f5b5a41STony Lindgren 4218f5b5a41STony Lindgren void __init ti816x_init_early(void) 4228f5b5a41STony Lindgren { 423*4c3cf901STony Lindgren omap2_set_globals_ti816x(); 424*4c3cf901STony Lindgren omap_common_init_early(); 425*4c3cf901STony Lindgren omap3xxx_voltagedomains_init(); 426*4c3cf901STony Lindgren omap3xxx_powerdomains_init(); 427*4c3cf901STony Lindgren omap3xxx_clockdomains_init(); 428*4c3cf901STony Lindgren omap3xxx_hwmod_init(); 429*4c3cf901STony Lindgren omap_hwmod_init_postsetup(); 430*4c3cf901STony Lindgren omap3xxx_clk_init(); 4318f5b5a41STony Lindgren } 4328f5b5a41STony Lindgren 4338f5b5a41STony Lindgren void __init omap4430_init_early(void) 4348f5b5a41STony Lindgren { 435*4c3cf901STony Lindgren omap2_set_globals_443x(); 4367b250affSTony Lindgren omap_common_init_early(); 4377b250affSTony Lindgren omap44xx_voltagedomains_init(); 4387b250affSTony Lindgren omap44xx_powerdomains_init(); 4397b250affSTony Lindgren omap44xx_clockdomains_init(); 4407b250affSTony Lindgren omap44xx_hwmod_init(); 4417b250affSTony Lindgren omap_hwmod_init_postsetup(); 4427b250affSTony Lindgren omap4xxx_clk_init(); 4438f5b5a41STony Lindgren } 4448f5b5a41STony Lindgren 445a4ca9dbeSTony Lindgren void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, 4464805734bSPaul Walmsley struct omap_sdrc_params *sdrc_cs1) 4474805734bSPaul Walmsley { 448a66cb345STony Lindgren omap_sram_init(); 449a66cb345STony Lindgren 45001001712SHemant Pedanekar if (cpu_is_omap24xx() || omap3_has_sdrc()) { 45158cda884SJean Pihet omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 4522f135eafSPaul Walmsley _omap2_init_reprogram_sdrc(); 453aa4b1f6eSKevin Hilman } 4541dbae815STony Lindgren } 455df1e9d1cSTony Lindgren 456df1e9d1cSTony Lindgren /* 457df1e9d1cSTony Lindgren * NOTE: Please use ioremap + __raw_read/write where possible instead of these 458df1e9d1cSTony Lindgren */ 459df1e9d1cSTony Lindgren 460df1e9d1cSTony Lindgren u8 omap_readb(u32 pa) 461df1e9d1cSTony Lindgren { 462df1e9d1cSTony Lindgren return __raw_readb(OMAP2_L4_IO_ADDRESS(pa)); 463df1e9d1cSTony Lindgren } 464df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_readb); 465df1e9d1cSTony Lindgren 466df1e9d1cSTony Lindgren u16 omap_readw(u32 pa) 467df1e9d1cSTony Lindgren { 468df1e9d1cSTony Lindgren return __raw_readw(OMAP2_L4_IO_ADDRESS(pa)); 469df1e9d1cSTony Lindgren } 470df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_readw); 471df1e9d1cSTony Lindgren 472df1e9d1cSTony Lindgren u32 omap_readl(u32 pa) 473df1e9d1cSTony Lindgren { 474df1e9d1cSTony Lindgren return __raw_readl(OMAP2_L4_IO_ADDRESS(pa)); 475df1e9d1cSTony Lindgren } 476df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_readl); 477df1e9d1cSTony Lindgren 478df1e9d1cSTony Lindgren void omap_writeb(u8 v, u32 pa) 479df1e9d1cSTony Lindgren { 480df1e9d1cSTony Lindgren __raw_writeb(v, OMAP2_L4_IO_ADDRESS(pa)); 481df1e9d1cSTony Lindgren } 482df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_writeb); 483df1e9d1cSTony Lindgren 484df1e9d1cSTony Lindgren void omap_writew(u16 v, u32 pa) 485df1e9d1cSTony Lindgren { 486df1e9d1cSTony Lindgren __raw_writew(v, OMAP2_L4_IO_ADDRESS(pa)); 487df1e9d1cSTony Lindgren } 488df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_writew); 489df1e9d1cSTony Lindgren 490df1e9d1cSTony Lindgren void omap_writel(u32 v, u32 pa) 491df1e9d1cSTony Lindgren { 492df1e9d1cSTony Lindgren __raw_writel(v, OMAP2_L4_IO_ADDRESS(pa)); 493df1e9d1cSTony Lindgren } 494df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_writel); 495