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/gpmc.h> 34ce491cf8STony Lindgren #include <plat/serial.h> 35646e3ed1STony Lindgren 36e80a9729SPaul Walmsley #include "clock2xxx.h" 37657ebfadSPaul Walmsley #include "clock3xxx.h" 38e80a9729SPaul Walmsley #include "clock44xx.h" 39b0a330dcSManjunath Kondaiah G #include "io.h" 401dbae815STony Lindgren 41ce491cf8STony Lindgren #include <plat/omap-pm.h> 42ce491cf8STony Lindgren #include <plat/powerdomain.h> 439717100fSPaul Walmsley 44*1540f214SPaul Walmsley #include "clockdomain.h" 45ce491cf8STony Lindgren #include <plat/omap_hwmod.h> 465d190c40STony Lindgren #include <plat/multi.h> 4702bfc030SPaul Walmsley 481dbae815STony Lindgren /* 491dbae815STony Lindgren * The machine specific code may provide the extra mapping besides the 501dbae815STony Lindgren * default mapping provided here. 511dbae815STony Lindgren */ 52cc26b3b0SSyed Mohammed, Khasim 53088ef950STony Lindgren #ifdef CONFIG_ARCH_OMAP2 54cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = { 551dbae815STony Lindgren { 561dbae815STony Lindgren .virtual = L3_24XX_VIRT, 571dbae815STony Lindgren .pfn = __phys_to_pfn(L3_24XX_PHYS), 581dbae815STony Lindgren .length = L3_24XX_SIZE, 591dbae815STony Lindgren .type = MT_DEVICE 601dbae815STony Lindgren }, 6109f21ed4SKyungmin Park { 6209f21ed4SKyungmin Park .virtual = L4_24XX_VIRT, 6309f21ed4SKyungmin Park .pfn = __phys_to_pfn(L4_24XX_PHYS), 6409f21ed4SKyungmin Park .length = L4_24XX_SIZE, 6509f21ed4SKyungmin Park .type = MT_DEVICE 6609f21ed4SKyungmin Park }, 67cc26b3b0SSyed Mohammed, Khasim }; 68cc26b3b0SSyed Mohammed, Khasim 69cc26b3b0SSyed Mohammed, Khasim #ifdef CONFIG_ARCH_OMAP2420 70cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = { 711dbae815STony Lindgren { 727adb9987SPaul Walmsley .virtual = DSP_MEM_2420_VIRT, 737adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS), 747adb9987SPaul Walmsley .length = DSP_MEM_2420_SIZE, 75c40fae95STony Lindgren .type = MT_DEVICE 76c40fae95STony Lindgren }, 77c40fae95STony Lindgren { 787adb9987SPaul Walmsley .virtual = DSP_IPI_2420_VIRT, 797adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS), 807adb9987SPaul Walmsley .length = DSP_IPI_2420_SIZE, 81c40fae95STony Lindgren .type = MT_DEVICE 82c40fae95STony Lindgren }, 83c40fae95STony Lindgren { 847adb9987SPaul Walmsley .virtual = DSP_MMU_2420_VIRT, 857adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS), 867adb9987SPaul Walmsley .length = DSP_MMU_2420_SIZE, 871dbae815STony Lindgren .type = MT_DEVICE 88cc26b3b0SSyed Mohammed, Khasim }, 891dbae815STony Lindgren }; 901dbae815STony Lindgren 91cc26b3b0SSyed Mohammed, Khasim #endif 92cc26b3b0SSyed Mohammed, Khasim 93cc26b3b0SSyed Mohammed, Khasim #ifdef CONFIG_ARCH_OMAP2430 94cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = { 95cc26b3b0SSyed Mohammed, Khasim { 96cc26b3b0SSyed Mohammed, Khasim .virtual = L4_WK_243X_VIRT, 97cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_WK_243X_PHYS), 98cc26b3b0SSyed Mohammed, Khasim .length = L4_WK_243X_SIZE, 99cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 100cc26b3b0SSyed Mohammed, Khasim }, 101cc26b3b0SSyed Mohammed, Khasim { 102cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_GPMC_VIRT, 103cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS), 104cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_GPMC_SIZE, 105cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 106cc26b3b0SSyed Mohammed, Khasim }, 107cc26b3b0SSyed Mohammed, Khasim { 108cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SDRC_VIRT, 109cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS), 110cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SDRC_SIZE, 111cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 112cc26b3b0SSyed Mohammed, Khasim }, 113cc26b3b0SSyed Mohammed, Khasim { 114cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SMS_VIRT, 115cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS), 116cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SMS_SIZE, 117cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 118cc26b3b0SSyed Mohammed, Khasim }, 119cc26b3b0SSyed Mohammed, Khasim }; 120cc26b3b0SSyed Mohammed, Khasim #endif 121cc26b3b0SSyed Mohammed, Khasim #endif 122cc26b3b0SSyed Mohammed, Khasim 123a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3 124cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = { 125cc26b3b0SSyed Mohammed, Khasim { 126cc26b3b0SSyed Mohammed, Khasim .virtual = L3_34XX_VIRT, 127cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L3_34XX_PHYS), 128cc26b3b0SSyed Mohammed, Khasim .length = L3_34XX_SIZE, 129cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 130cc26b3b0SSyed Mohammed, Khasim }, 131cc26b3b0SSyed Mohammed, Khasim { 132cc26b3b0SSyed Mohammed, Khasim .virtual = L4_34XX_VIRT, 133cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_34XX_PHYS), 134cc26b3b0SSyed Mohammed, Khasim .length = L4_34XX_SIZE, 135cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 136cc26b3b0SSyed Mohammed, Khasim }, 137cc26b3b0SSyed Mohammed, Khasim { 138cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP34XX_GPMC_VIRT, 139cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS), 140cc26b3b0SSyed Mohammed, Khasim .length = OMAP34XX_GPMC_SIZE, 141cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 142cc26b3b0SSyed Mohammed, Khasim }, 143cc26b3b0SSyed Mohammed, Khasim { 144cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SMS_VIRT, 145cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS), 146cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SMS_SIZE, 147cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 148cc26b3b0SSyed Mohammed, Khasim }, 149cc26b3b0SSyed Mohammed, Khasim { 150cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SDRC_VIRT, 151cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS), 152cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SDRC_SIZE, 153cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 154cc26b3b0SSyed Mohammed, Khasim }, 155cc26b3b0SSyed Mohammed, Khasim { 156cc26b3b0SSyed Mohammed, Khasim .virtual = L4_PER_34XX_VIRT, 157cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_PER_34XX_PHYS), 158cc26b3b0SSyed Mohammed, Khasim .length = L4_PER_34XX_SIZE, 159cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 160cc26b3b0SSyed Mohammed, Khasim }, 161cc26b3b0SSyed Mohammed, Khasim { 162cc26b3b0SSyed Mohammed, Khasim .virtual = L4_EMU_34XX_VIRT, 163cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS), 164cc26b3b0SSyed Mohammed, Khasim .length = L4_EMU_34XX_SIZE, 165cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 166cc26b3b0SSyed Mohammed, Khasim }, 167a4f57b81STony Lindgren #if defined(CONFIG_DEBUG_LL) && \ 168a4f57b81STony Lindgren (defined(CONFIG_MACH_OMAP_ZOOM2) || defined(CONFIG_MACH_OMAP_ZOOM3)) 169a4f57b81STony Lindgren { 170a4f57b81STony Lindgren .virtual = ZOOM_UART_VIRT, 171a4f57b81STony Lindgren .pfn = __phys_to_pfn(ZOOM_UART_BASE), 172a4f57b81STony Lindgren .length = SZ_1M, 173a4f57b81STony Lindgren .type = MT_DEVICE 174a4f57b81STony Lindgren }, 175a4f57b81STony Lindgren #endif 176cc26b3b0SSyed Mohammed, Khasim }; 177cc26b3b0SSyed Mohammed, Khasim #endif 17844169075SSantosh Shilimkar #ifdef CONFIG_ARCH_OMAP4 17944169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = { 18044169075SSantosh Shilimkar { 18144169075SSantosh Shilimkar .virtual = L3_44XX_VIRT, 18244169075SSantosh Shilimkar .pfn = __phys_to_pfn(L3_44XX_PHYS), 18344169075SSantosh Shilimkar .length = L3_44XX_SIZE, 18444169075SSantosh Shilimkar .type = MT_DEVICE, 18544169075SSantosh Shilimkar }, 18644169075SSantosh Shilimkar { 18744169075SSantosh Shilimkar .virtual = L4_44XX_VIRT, 18844169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_44XX_PHYS), 18944169075SSantosh Shilimkar .length = L4_44XX_SIZE, 19044169075SSantosh Shilimkar .type = MT_DEVICE, 19144169075SSantosh Shilimkar }, 19244169075SSantosh Shilimkar { 19344169075SSantosh Shilimkar .virtual = OMAP44XX_GPMC_VIRT, 19444169075SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_GPMC_PHYS), 19544169075SSantosh Shilimkar .length = OMAP44XX_GPMC_SIZE, 19644169075SSantosh Shilimkar .type = MT_DEVICE, 19744169075SSantosh Shilimkar }, 19844169075SSantosh Shilimkar { 199f5d2d659SSantosh Shilimkar .virtual = OMAP44XX_EMIF1_VIRT, 200f5d2d659SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_EMIF1_PHYS), 201f5d2d659SSantosh Shilimkar .length = OMAP44XX_EMIF1_SIZE, 202f5d2d659SSantosh Shilimkar .type = MT_DEVICE, 203f5d2d659SSantosh Shilimkar }, 204f5d2d659SSantosh Shilimkar { 205f5d2d659SSantosh Shilimkar .virtual = OMAP44XX_EMIF2_VIRT, 206f5d2d659SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_EMIF2_PHYS), 207f5d2d659SSantosh Shilimkar .length = OMAP44XX_EMIF2_SIZE, 208f5d2d659SSantosh Shilimkar .type = MT_DEVICE, 209f5d2d659SSantosh Shilimkar }, 210f5d2d659SSantosh Shilimkar { 211f5d2d659SSantosh Shilimkar .virtual = OMAP44XX_DMM_VIRT, 212f5d2d659SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_DMM_PHYS), 213f5d2d659SSantosh Shilimkar .length = OMAP44XX_DMM_SIZE, 214f5d2d659SSantosh Shilimkar .type = MT_DEVICE, 215f5d2d659SSantosh Shilimkar }, 216f5d2d659SSantosh Shilimkar { 21744169075SSantosh Shilimkar .virtual = L4_PER_44XX_VIRT, 21844169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_PER_44XX_PHYS), 21944169075SSantosh Shilimkar .length = L4_PER_44XX_SIZE, 22044169075SSantosh Shilimkar .type = MT_DEVICE, 22144169075SSantosh Shilimkar }, 22244169075SSantosh Shilimkar { 22344169075SSantosh Shilimkar .virtual = L4_EMU_44XX_VIRT, 22444169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_EMU_44XX_PHYS), 22544169075SSantosh Shilimkar .length = L4_EMU_44XX_SIZE, 22644169075SSantosh Shilimkar .type = MT_DEVICE, 22744169075SSantosh Shilimkar }, 22844169075SSantosh Shilimkar }; 22944169075SSantosh Shilimkar #endif 230cc26b3b0SSyed Mohammed, Khasim 2316fbd55d0STony Lindgren static void __init _omap2_map_common_io(void) 2321dbae815STony Lindgren { 233120db2cbSTony Lindgren /* Normally devicemaps_init() would flush caches and tlb after 234120db2cbSTony Lindgren * mdesc->map_io(), but we must also do it here because of the CPU 235120db2cbSTony Lindgren * revision check below. 236120db2cbSTony Lindgren */ 237120db2cbSTony Lindgren local_flush_tlb_all(); 238120db2cbSTony Lindgren flush_cache_all(); 239120db2cbSTony Lindgren 2401dbae815STony Lindgren omap2_check_revision(); 2411dbae815STony Lindgren omap_sram_init(); 242120db2cbSTony Lindgren } 243120db2cbSTony Lindgren 2446fbd55d0STony Lindgren #ifdef CONFIG_ARCH_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 _omap2_map_common_io(); 2506fbd55d0STony Lindgren } 2516fbd55d0STony Lindgren #endif 2526fbd55d0STony Lindgren 2536fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP2430 2548185e468SAaro Koskinen void __init omap243x_map_common_io(void) 2556fbd55d0STony Lindgren { 2566fbd55d0STony Lindgren iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 2576fbd55d0STony Lindgren iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 2586fbd55d0STony Lindgren _omap2_map_common_io(); 2596fbd55d0STony Lindgren } 2606fbd55d0STony Lindgren #endif 2616fbd55d0STony Lindgren 262a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3 2638185e468SAaro Koskinen void __init omap34xx_map_common_io(void) 2646fbd55d0STony Lindgren { 2656fbd55d0STony Lindgren iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 2666fbd55d0STony Lindgren _omap2_map_common_io(); 2676fbd55d0STony Lindgren } 2686fbd55d0STony Lindgren #endif 2696fbd55d0STony Lindgren 2706fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP4 2718185e468SAaro Koskinen void __init omap44xx_map_common_io(void) 2726fbd55d0STony Lindgren { 2736fbd55d0STony Lindgren iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 2746fbd55d0STony Lindgren _omap2_map_common_io(); 2756fbd55d0STony Lindgren } 2766fbd55d0STony Lindgren #endif 2776fbd55d0STony Lindgren 2782f135eafSPaul Walmsley /* 2792f135eafSPaul Walmsley * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters 2802f135eafSPaul Walmsley * 2812f135eafSPaul Walmsley * Sets the CORE DPLL3 M2 divider to the same value that it's at 2822f135eafSPaul Walmsley * currently. This has the effect of setting the SDRC SDRAM AC timing 2832f135eafSPaul Walmsley * registers to the values currently defined by the kernel. Currently 2842f135eafSPaul Walmsley * only defined for OMAP3; will return 0 if called on OMAP2. Returns 2852f135eafSPaul Walmsley * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2, 2862f135eafSPaul Walmsley * or passes along the return value of clk_set_rate(). 2872f135eafSPaul Walmsley */ 2882f135eafSPaul Walmsley static int __init _omap2_init_reprogram_sdrc(void) 2892f135eafSPaul Walmsley { 2902f135eafSPaul Walmsley struct clk *dpll3_m2_ck; 2912f135eafSPaul Walmsley int v = -EINVAL; 2922f135eafSPaul Walmsley long rate; 2932f135eafSPaul Walmsley 2942f135eafSPaul Walmsley if (!cpu_is_omap34xx()) 2952f135eafSPaul Walmsley return 0; 2962f135eafSPaul Walmsley 2972f135eafSPaul Walmsley dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck"); 298e281f7ecSAaro Koskinen if (IS_ERR(dpll3_m2_ck)) 2992f135eafSPaul Walmsley return -EINVAL; 3002f135eafSPaul Walmsley 3012f135eafSPaul Walmsley rate = clk_get_rate(dpll3_m2_ck); 3022f135eafSPaul Walmsley pr_info("Reprogramming SDRC clock to %ld Hz\n", rate); 3032f135eafSPaul Walmsley v = clk_set_rate(dpll3_m2_ck, rate); 3042f135eafSPaul Walmsley if (v) 3052f135eafSPaul Walmsley pr_err("dpll3_m2_clk rate change failed: %d\n", v); 3062f135eafSPaul Walmsley 3072f135eafSPaul Walmsley clk_put(dpll3_m2_ck); 3082f135eafSPaul Walmsley 3092f135eafSPaul Walmsley return v; 3102f135eafSPaul Walmsley } 3112f135eafSPaul Walmsley 3122092e5ccSPaul Walmsley static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data) 3132092e5ccSPaul Walmsley { 3142092e5ccSPaul Walmsley return omap_hwmod_set_postsetup_state(oh, *(u8 *)data); 3152092e5ccSPaul Walmsley } 3162092e5ccSPaul Walmsley 3175d190c40STony Lindgren /* 3185d190c40STony Lindgren * Initialize asm_irq_base for entry-macro.S 3195d190c40STony Lindgren */ 3205d190c40STony Lindgren static inline void omap_irq_base_init(void) 3215d190c40STony Lindgren { 3225d190c40STony Lindgren extern void __iomem *omap_irq_base; 3235d190c40STony Lindgren 3245d190c40STony Lindgren #ifdef MULTI_OMAP2 325df127ee3STony Lindgren if (cpu_is_omap24xx()) 3265d190c40STony Lindgren omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE); 3275d190c40STony Lindgren else if (cpu_is_omap34xx()) 3285d190c40STony Lindgren omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE); 3295d190c40STony Lindgren else if (cpu_is_omap44xx()) 3305d190c40STony Lindgren omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE); 3315d190c40STony Lindgren else 3325d190c40STony Lindgren pr_err("Could not initialize omap_irq_base\n"); 3335d190c40STony Lindgren #endif 3345d190c40STony Lindgren } 3355d190c40STony Lindgren 3364805734bSPaul Walmsley void __init omap2_init_common_infrastructure(void) 337120db2cbSTony Lindgren { 3382092e5ccSPaul Walmsley u8 postsetup_state; 3392092e5ccSPaul Walmsley 3406e01478aSPaul Walmsley if (cpu_is_omap242x()) { 3416e01478aSPaul Walmsley omap2xxx_powerdomains_init(); 342dc0b3a70SPaul Walmsley omap2_clockdomains_init(); 3437359154eSPaul Walmsley omap2420_hwmod_init(); 3446e01478aSPaul Walmsley } else if (cpu_is_omap243x()) { 3456e01478aSPaul Walmsley omap2xxx_powerdomains_init(); 346dc0b3a70SPaul Walmsley omap2_clockdomains_init(); 3477359154eSPaul Walmsley omap2430_hwmod_init(); 3486e01478aSPaul Walmsley } else if (cpu_is_omap34xx()) { 3496e01478aSPaul Walmsley omap3xxx_powerdomains_init(); 350dc0b3a70SPaul Walmsley omap2_clockdomains_init(); 3517359154eSPaul Walmsley omap3xxx_hwmod_init(); 3526e01478aSPaul Walmsley } else if (cpu_is_omap44xx()) { 3536e01478aSPaul Walmsley omap44xx_powerdomains_init(); 354dc0b3a70SPaul Walmsley omap44xx_clockdomains_init(); 35555d2cb08SBenoit Cousson omap44xx_hwmod_init(); 3566e01478aSPaul Walmsley } else { 3572092e5ccSPaul Walmsley pr_err("Could not init hwmod data - unknown SoC\n"); 3586e01478aSPaul Walmsley } 3592092e5ccSPaul Walmsley 3602092e5ccSPaul Walmsley /* Set the default postsetup state for all hwmods */ 3612092e5ccSPaul Walmsley #ifdef CONFIG_PM_RUNTIME 3622092e5ccSPaul Walmsley postsetup_state = _HWMOD_STATE_IDLE; 3632092e5ccSPaul Walmsley #else 3642092e5ccSPaul Walmsley postsetup_state = _HWMOD_STATE_ENABLED; 3652092e5ccSPaul Walmsley #endif 3662092e5ccSPaul Walmsley omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); 36755d2cb08SBenoit Cousson 368ff2516fbSPaul Walmsley /* 369ff2516fbSPaul Walmsley * Set the default postsetup state for unusual modules (like 370ff2516fbSPaul Walmsley * MPU WDT). 371ff2516fbSPaul Walmsley * 372ff2516fbSPaul Walmsley * The postsetup_state is not actually used until 373ff2516fbSPaul Walmsley * omap_hwmod_late_init(), so boards that desire full watchdog 374ff2516fbSPaul Walmsley * coverage of kernel initialization can reprogram the 375ff2516fbSPaul Walmsley * postsetup_state between the calls to 376ff2516fbSPaul Walmsley * omap2_init_common_infra() and omap2_init_common_devices(). 377ff2516fbSPaul Walmsley * 378ff2516fbSPaul Walmsley * XXX ideally we could detect whether the MPU WDT was currently 379ff2516fbSPaul Walmsley * enabled here and make this conditional 380ff2516fbSPaul Walmsley */ 381ff2516fbSPaul Walmsley postsetup_state = _HWMOD_STATE_DISABLED; 382ff2516fbSPaul Walmsley omap_hwmod_for_each_by_class("wd_timer", 383ff2516fbSPaul Walmsley _set_hwmod_postsetup_state, 384ff2516fbSPaul Walmsley &postsetup_state); 385ff2516fbSPaul Walmsley 38653da4ce2SKevin Hilman omap_pm_if_early_init(); 387e80a9729SPaul Walmsley 38881b34fbeSPaul Walmsley if (cpu_is_omap2420()) 38981b34fbeSPaul Walmsley omap2420_clk_init(); 39081b34fbeSPaul Walmsley else if (cpu_is_omap2430()) 39181b34fbeSPaul Walmsley omap2430_clk_init(); 392e80a9729SPaul Walmsley else if (cpu_is_omap34xx()) 393e80a9729SPaul Walmsley omap3xxx_clk_init(); 394e80a9729SPaul Walmsley else if (cpu_is_omap44xx()) 395e80a9729SPaul Walmsley omap4xxx_clk_init(); 396e80a9729SPaul Walmsley else 3972092e5ccSPaul Walmsley pr_err("Could not init clock framework - unknown SoC\n"); 3984805734bSPaul Walmsley } 3994805734bSPaul Walmsley 4004805734bSPaul Walmsley void __init omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0, 4014805734bSPaul Walmsley struct omap_sdrc_params *sdrc_cs1) 4024805734bSPaul Walmsley { 403b3c6df3aSPaul Walmsley omap_serial_early_init(); 40497d60162SPaul Walmsley 4052092e5ccSPaul Walmsley omap_hwmod_late_init(); 4062092e5ccSPaul Walmsley 407aa4b1f6eSKevin Hilman if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 40858cda884SJean Pihet omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 4092f135eafSPaul Walmsley _omap2_init_reprogram_sdrc(); 410aa4b1f6eSKevin Hilman } 4114bbbc1adSJuha Yrjola gpmc_init(); 4125d190c40STony Lindgren 4135d190c40STony Lindgren omap_irq_base_init(); 4141dbae815STony Lindgren } 415df1e9d1cSTony Lindgren 416df1e9d1cSTony Lindgren /* 417df1e9d1cSTony Lindgren * NOTE: Please use ioremap + __raw_read/write where possible instead of these 418df1e9d1cSTony Lindgren */ 419df1e9d1cSTony Lindgren 420df1e9d1cSTony Lindgren u8 omap_readb(u32 pa) 421df1e9d1cSTony Lindgren { 422df1e9d1cSTony Lindgren return __raw_readb(OMAP2_L4_IO_ADDRESS(pa)); 423df1e9d1cSTony Lindgren } 424df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_readb); 425df1e9d1cSTony Lindgren 426df1e9d1cSTony Lindgren u16 omap_readw(u32 pa) 427df1e9d1cSTony Lindgren { 428df1e9d1cSTony Lindgren return __raw_readw(OMAP2_L4_IO_ADDRESS(pa)); 429df1e9d1cSTony Lindgren } 430df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_readw); 431df1e9d1cSTony Lindgren 432df1e9d1cSTony Lindgren u32 omap_readl(u32 pa) 433df1e9d1cSTony Lindgren { 434df1e9d1cSTony Lindgren return __raw_readl(OMAP2_L4_IO_ADDRESS(pa)); 435df1e9d1cSTony Lindgren } 436df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_readl); 437df1e9d1cSTony Lindgren 438df1e9d1cSTony Lindgren void omap_writeb(u8 v, u32 pa) 439df1e9d1cSTony Lindgren { 440df1e9d1cSTony Lindgren __raw_writeb(v, OMAP2_L4_IO_ADDRESS(pa)); 441df1e9d1cSTony Lindgren } 442df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_writeb); 443df1e9d1cSTony Lindgren 444df1e9d1cSTony Lindgren void omap_writew(u16 v, u32 pa) 445df1e9d1cSTony Lindgren { 446df1e9d1cSTony Lindgren __raw_writew(v, OMAP2_L4_IO_ADDRESS(pa)); 447df1e9d1cSTony Lindgren } 448df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_writew); 449df1e9d1cSTony Lindgren 450df1e9d1cSTony Lindgren void omap_writel(u32 v, u32 pa) 451df1e9d1cSTony Lindgren { 452df1e9d1cSTony Lindgren __raw_writel(v, OMAP2_L4_IO_ADDRESS(pa)); 453df1e9d1cSTony Lindgren } 454df1e9d1cSTony Lindgren EXPORT_SYMBOL(omap_writel); 455