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 #include <linux/module.h> 201dbae815STony Lindgren #include <linux/kernel.h> 211dbae815STony Lindgren #include <linux/init.h> 22fced80c7SRussell King #include <linux/io.h> 232f135eafSPaul Walmsley #include <linux/clk.h> 241dbae815STony Lindgren 25120db2cbSTony Lindgren #include <asm/tlb.h> 26120db2cbSTony Lindgren #include <asm/mach/map.h> 27120db2cbSTony Lindgren 282b6c4e73SLokesh Vutla #include <plat-omap/dma-omap.h> 29646e3ed1STony Lindgren 30622297fdSTony Lindgren #include "../plat-omap/sram.h" 31622297fdSTony Lindgren 32dc843280STony Lindgren #include "omap_hwmod.h" 33dbc04161STony Lindgren #include "soc.h" 34ee0839c2STony Lindgren #include "iomap.h" 35ee0839c2STony Lindgren #include "voltage.h" 36ee0839c2STony Lindgren #include "powerdomain.h" 37ee0839c2STony Lindgren #include "clockdomain.h" 38ee0839c2STony Lindgren #include "common.h" 39e30384abSVaibhav Hiremath #include "clock.h" 40e80a9729SPaul Walmsley #include "clock2xxx.h" 41657ebfadSPaul Walmsley #include "clock3xxx.h" 42e80a9729SPaul Walmsley #include "clock44xx.h" 431d5aef49STony Lindgren #include "omap-pm.h" 443e6ece13SPaul Walmsley #include "sdrc.h" 45b6a4226cSPaul Walmsley #include "control.h" 463d82cbbbSTony Lindgren #include "serial.h" 47c4ceedcbSPaul Walmsley #include "cm2xxx.h" 48c4ceedcbSPaul Walmsley #include "cm3xxx.h" 49d9a16f9aSPaul Walmsley #include "prm.h" 50d9a16f9aSPaul Walmsley #include "cm.h" 51d9a16f9aSPaul Walmsley #include "prcm_mpu44xx.h" 52d9a16f9aSPaul Walmsley #include "prminst44xx.h" 53d9a16f9aSPaul Walmsley #include "cminst44xx.h" 541dbae815STony Lindgren /* 551dbae815STony Lindgren * The machine specific code may provide the extra mapping besides the 561dbae815STony Lindgren * default mapping provided here. 571dbae815STony Lindgren */ 58cc26b3b0SSyed Mohammed, Khasim 59e48f814eSTony Lindgren #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) 60cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = { 611dbae815STony Lindgren { 621dbae815STony Lindgren .virtual = L3_24XX_VIRT, 631dbae815STony Lindgren .pfn = __phys_to_pfn(L3_24XX_PHYS), 641dbae815STony Lindgren .length = L3_24XX_SIZE, 651dbae815STony Lindgren .type = MT_DEVICE 661dbae815STony Lindgren }, 6709f21ed4SKyungmin Park { 6809f21ed4SKyungmin Park .virtual = L4_24XX_VIRT, 6909f21ed4SKyungmin Park .pfn = __phys_to_pfn(L4_24XX_PHYS), 7009f21ed4SKyungmin Park .length = L4_24XX_SIZE, 7109f21ed4SKyungmin Park .type = MT_DEVICE 7209f21ed4SKyungmin Park }, 73cc26b3b0SSyed Mohammed, Khasim }; 74cc26b3b0SSyed Mohammed, Khasim 7559b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420 76cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = { 771dbae815STony Lindgren { 787adb9987SPaul Walmsley .virtual = DSP_MEM_2420_VIRT, 797adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS), 807adb9987SPaul Walmsley .length = DSP_MEM_2420_SIZE, 81c40fae95STony Lindgren .type = MT_DEVICE 82c40fae95STony Lindgren }, 83c40fae95STony Lindgren { 847adb9987SPaul Walmsley .virtual = DSP_IPI_2420_VIRT, 857adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS), 867adb9987SPaul Walmsley .length = DSP_IPI_2420_SIZE, 87c40fae95STony Lindgren .type = MT_DEVICE 88c40fae95STony Lindgren }, 89c40fae95STony Lindgren { 907adb9987SPaul Walmsley .virtual = DSP_MMU_2420_VIRT, 917adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS), 927adb9987SPaul Walmsley .length = DSP_MMU_2420_SIZE, 931dbae815STony Lindgren .type = MT_DEVICE 94cc26b3b0SSyed Mohammed, Khasim }, 951dbae815STony Lindgren }; 961dbae815STony Lindgren 97cc26b3b0SSyed Mohammed, Khasim #endif 98cc26b3b0SSyed Mohammed, Khasim 9959b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430 100cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = { 101cc26b3b0SSyed Mohammed, Khasim { 102cc26b3b0SSyed Mohammed, Khasim .virtual = L4_WK_243X_VIRT, 103cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_WK_243X_PHYS), 104cc26b3b0SSyed Mohammed, Khasim .length = L4_WK_243X_SIZE, 105cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 106cc26b3b0SSyed Mohammed, Khasim }, 107cc26b3b0SSyed Mohammed, Khasim { 108cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_GPMC_VIRT, 109cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS), 110cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_GPMC_SIZE, 111cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 112cc26b3b0SSyed Mohammed, Khasim }, 113cc26b3b0SSyed Mohammed, Khasim { 114cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SDRC_VIRT, 115cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS), 116cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SDRC_SIZE, 117cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 118cc26b3b0SSyed Mohammed, Khasim }, 119cc26b3b0SSyed Mohammed, Khasim { 120cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SMS_VIRT, 121cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS), 122cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SMS_SIZE, 123cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 124cc26b3b0SSyed Mohammed, Khasim }, 125cc26b3b0SSyed Mohammed, Khasim }; 126cc26b3b0SSyed Mohammed, Khasim #endif 127cc26b3b0SSyed Mohammed, Khasim #endif 128cc26b3b0SSyed Mohammed, Khasim 129a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3 130cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = { 131cc26b3b0SSyed Mohammed, Khasim { 132cc26b3b0SSyed Mohammed, Khasim .virtual = L3_34XX_VIRT, 133cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L3_34XX_PHYS), 134cc26b3b0SSyed Mohammed, Khasim .length = L3_34XX_SIZE, 135cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 136cc26b3b0SSyed Mohammed, Khasim }, 137cc26b3b0SSyed Mohammed, Khasim { 138cc26b3b0SSyed Mohammed, Khasim .virtual = L4_34XX_VIRT, 139cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_34XX_PHYS), 140cc26b3b0SSyed Mohammed, Khasim .length = L4_34XX_SIZE, 141cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 142cc26b3b0SSyed Mohammed, Khasim }, 143cc26b3b0SSyed Mohammed, Khasim { 144cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP34XX_GPMC_VIRT, 145cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS), 146cc26b3b0SSyed Mohammed, Khasim .length = OMAP34XX_GPMC_SIZE, 147cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 148cc26b3b0SSyed Mohammed, Khasim }, 149cc26b3b0SSyed Mohammed, Khasim { 150cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SMS_VIRT, 151cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS), 152cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SMS_SIZE, 153cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 154cc26b3b0SSyed Mohammed, Khasim }, 155cc26b3b0SSyed Mohammed, Khasim { 156cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SDRC_VIRT, 157cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS), 158cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SDRC_SIZE, 159cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 160cc26b3b0SSyed Mohammed, Khasim }, 161cc26b3b0SSyed Mohammed, Khasim { 162cc26b3b0SSyed Mohammed, Khasim .virtual = L4_PER_34XX_VIRT, 163cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_PER_34XX_PHYS), 164cc26b3b0SSyed Mohammed, Khasim .length = L4_PER_34XX_SIZE, 165cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 166cc26b3b0SSyed Mohammed, Khasim }, 167cc26b3b0SSyed Mohammed, Khasim { 168cc26b3b0SSyed Mohammed, Khasim .virtual = L4_EMU_34XX_VIRT, 169cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS), 170cc26b3b0SSyed Mohammed, Khasim .length = L4_EMU_34XX_SIZE, 171cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 172cc26b3b0SSyed Mohammed, Khasim }, 173a4f57b81STony Lindgren #if defined(CONFIG_DEBUG_LL) && \ 174a4f57b81STony Lindgren (defined(CONFIG_MACH_OMAP_ZOOM2) || defined(CONFIG_MACH_OMAP_ZOOM3)) 175a4f57b81STony Lindgren { 176a4f57b81STony Lindgren .virtual = ZOOM_UART_VIRT, 177a4f57b81STony Lindgren .pfn = __phys_to_pfn(ZOOM_UART_BASE), 178a4f57b81STony Lindgren .length = SZ_1M, 179a4f57b81STony Lindgren .type = MT_DEVICE 180a4f57b81STony Lindgren }, 181a4f57b81STony Lindgren #endif 182cc26b3b0SSyed Mohammed, Khasim }; 183cc26b3b0SSyed Mohammed, Khasim #endif 18401001712SHemant Pedanekar 18533959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX 186a920360fSHemant Pedanekar static struct map_desc omapti81xx_io_desc[] __initdata = { 18701001712SHemant Pedanekar { 18801001712SHemant Pedanekar .virtual = L4_34XX_VIRT, 18901001712SHemant Pedanekar .pfn = __phys_to_pfn(L4_34XX_PHYS), 19001001712SHemant Pedanekar .length = L4_34XX_SIZE, 19101001712SHemant Pedanekar .type = MT_DEVICE 1921e6cb146SAfzal Mohammed } 1931e6cb146SAfzal Mohammed }; 1941e6cb146SAfzal Mohammed #endif 1951e6cb146SAfzal Mohammed 196bb6abcf4SKevin Hilman #ifdef CONFIG_SOC_AM33XX 1971e6cb146SAfzal Mohammed static struct map_desc omapam33xx_io_desc[] __initdata = { 19801001712SHemant Pedanekar { 19901001712SHemant Pedanekar .virtual = L4_34XX_VIRT, 20001001712SHemant Pedanekar .pfn = __phys_to_pfn(L4_34XX_PHYS), 20101001712SHemant Pedanekar .length = L4_34XX_SIZE, 20201001712SHemant Pedanekar .type = MT_DEVICE 20301001712SHemant Pedanekar }, 2041e6cb146SAfzal Mohammed { 2051e6cb146SAfzal Mohammed .virtual = L4_WK_AM33XX_VIRT, 2061e6cb146SAfzal Mohammed .pfn = __phys_to_pfn(L4_WK_AM33XX_PHYS), 2071e6cb146SAfzal Mohammed .length = L4_WK_AM33XX_SIZE, 2081e6cb146SAfzal Mohammed .type = MT_DEVICE 2091e6cb146SAfzal Mohammed } 21001001712SHemant Pedanekar }; 21101001712SHemant Pedanekar #endif 21201001712SHemant Pedanekar 21344169075SSantosh Shilimkar #ifdef CONFIG_ARCH_OMAP4 21444169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = { 21544169075SSantosh Shilimkar { 21644169075SSantosh Shilimkar .virtual = L3_44XX_VIRT, 21744169075SSantosh Shilimkar .pfn = __phys_to_pfn(L3_44XX_PHYS), 21844169075SSantosh Shilimkar .length = L3_44XX_SIZE, 21944169075SSantosh Shilimkar .type = MT_DEVICE, 22044169075SSantosh Shilimkar }, 22144169075SSantosh Shilimkar { 22244169075SSantosh Shilimkar .virtual = L4_44XX_VIRT, 22344169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_44XX_PHYS), 22444169075SSantosh Shilimkar .length = L4_44XX_SIZE, 22544169075SSantosh Shilimkar .type = MT_DEVICE, 22644169075SSantosh Shilimkar }, 22744169075SSantosh Shilimkar { 22844169075SSantosh Shilimkar .virtual = L4_PER_44XX_VIRT, 22944169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_PER_44XX_PHYS), 23044169075SSantosh Shilimkar .length = L4_PER_44XX_SIZE, 23144169075SSantosh Shilimkar .type = MT_DEVICE, 23244169075SSantosh Shilimkar }, 233137d105dSSantosh Shilimkar #ifdef CONFIG_OMAP4_ERRATA_I688 234137d105dSSantosh Shilimkar { 235137d105dSSantosh Shilimkar .virtual = OMAP4_SRAM_VA, 236137d105dSSantosh Shilimkar .pfn = __phys_to_pfn(OMAP4_SRAM_PA), 237137d105dSSantosh Shilimkar .length = PAGE_SIZE, 238137d105dSSantosh Shilimkar .type = MT_MEMORY_SO, 239137d105dSSantosh Shilimkar }, 240137d105dSSantosh Shilimkar #endif 241137d105dSSantosh Shilimkar 24244169075SSantosh Shilimkar }; 24344169075SSantosh Shilimkar #endif 244cc26b3b0SSyed Mohammed, Khasim 24505e152c7SR Sricharan #ifdef CONFIG_SOC_OMAP5 24605e152c7SR Sricharan static struct map_desc omap54xx_io_desc[] __initdata = { 24705e152c7SR Sricharan { 24805e152c7SR Sricharan .virtual = L3_54XX_VIRT, 24905e152c7SR Sricharan .pfn = __phys_to_pfn(L3_54XX_PHYS), 25005e152c7SR Sricharan .length = L3_54XX_SIZE, 25105e152c7SR Sricharan .type = MT_DEVICE, 25205e152c7SR Sricharan }, 25305e152c7SR Sricharan { 25405e152c7SR Sricharan .virtual = L4_54XX_VIRT, 25505e152c7SR Sricharan .pfn = __phys_to_pfn(L4_54XX_PHYS), 25605e152c7SR Sricharan .length = L4_54XX_SIZE, 25705e152c7SR Sricharan .type = MT_DEVICE, 25805e152c7SR Sricharan }, 25905e152c7SR Sricharan { 26005e152c7SR Sricharan .virtual = L4_WK_54XX_VIRT, 26105e152c7SR Sricharan .pfn = __phys_to_pfn(L4_WK_54XX_PHYS), 26205e152c7SR Sricharan .length = L4_WK_54XX_SIZE, 26305e152c7SR Sricharan .type = MT_DEVICE, 26405e152c7SR Sricharan }, 26505e152c7SR Sricharan { 26605e152c7SR Sricharan .virtual = L4_PER_54XX_VIRT, 26705e152c7SR Sricharan .pfn = __phys_to_pfn(L4_PER_54XX_PHYS), 26805e152c7SR Sricharan .length = L4_PER_54XX_SIZE, 26905e152c7SR Sricharan .type = MT_DEVICE, 27005e152c7SR Sricharan }, 27105e152c7SR Sricharan }; 27205e152c7SR Sricharan #endif 27305e152c7SR Sricharan 27459b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420 275b6a4226cSPaul Walmsley void __init omap242x_map_io(void) 2766fbd55d0STony Lindgren { 2776fbd55d0STony Lindgren iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 2786fbd55d0STony Lindgren iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 2796fbd55d0STony Lindgren } 2806fbd55d0STony Lindgren #endif 2816fbd55d0STony Lindgren 28259b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430 283b6a4226cSPaul Walmsley void __init omap243x_map_io(void) 2846fbd55d0STony Lindgren { 2856fbd55d0STony Lindgren iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 2866fbd55d0STony Lindgren iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 2876fbd55d0STony Lindgren } 2886fbd55d0STony Lindgren #endif 2896fbd55d0STony Lindgren 290a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3 291b6a4226cSPaul Walmsley void __init omap3_map_io(void) 2926fbd55d0STony Lindgren { 2936fbd55d0STony Lindgren iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 2946fbd55d0STony Lindgren } 2956fbd55d0STony Lindgren #endif 2966fbd55d0STony Lindgren 29733959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX 298b6a4226cSPaul Walmsley void __init ti81xx_map_io(void) 29901001712SHemant Pedanekar { 300a920360fSHemant Pedanekar iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc)); 30101001712SHemant Pedanekar } 30201001712SHemant Pedanekar #endif 30301001712SHemant Pedanekar 304bb6abcf4SKevin Hilman #ifdef CONFIG_SOC_AM33XX 305b6a4226cSPaul Walmsley void __init am33xx_map_io(void) 3061e6cb146SAfzal Mohammed { 3071e6cb146SAfzal Mohammed iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); 3086fbd55d0STony Lindgren } 3096fbd55d0STony Lindgren #endif 3106fbd55d0STony Lindgren 3116fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP4 312b6a4226cSPaul Walmsley void __init omap4_map_io(void) 3136fbd55d0STony Lindgren { 3146fbd55d0STony Lindgren iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 3152ec1fc4eSSantosh Shilimkar omap_barriers_init(); 3166fbd55d0STony Lindgren } 3176fbd55d0STony Lindgren #endif 3186fbd55d0STony Lindgren 31905e152c7SR Sricharan #ifdef CONFIG_SOC_OMAP5 320b6a4226cSPaul Walmsley void __init omap5_map_io(void) 32105e152c7SR Sricharan { 32205e152c7SR Sricharan iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); 32305e152c7SR Sricharan } 32405e152c7SR Sricharan #endif 3252f135eafSPaul Walmsley /* 3262f135eafSPaul Walmsley * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters 3272f135eafSPaul Walmsley * 3282f135eafSPaul Walmsley * Sets the CORE DPLL3 M2 divider to the same value that it's at 3292f135eafSPaul Walmsley * currently. This has the effect of setting the SDRC SDRAM AC timing 3302f135eafSPaul Walmsley * registers to the values currently defined by the kernel. Currently 3312f135eafSPaul Walmsley * only defined for OMAP3; will return 0 if called on OMAP2. Returns 3322f135eafSPaul Walmsley * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2, 3332f135eafSPaul Walmsley * or passes along the return value of clk_set_rate(). 3342f135eafSPaul Walmsley */ 3352f135eafSPaul Walmsley static int __init _omap2_init_reprogram_sdrc(void) 3362f135eafSPaul Walmsley { 3372f135eafSPaul Walmsley struct clk *dpll3_m2_ck; 3382f135eafSPaul Walmsley int v = -EINVAL; 3392f135eafSPaul Walmsley long rate; 3402f135eafSPaul Walmsley 3412f135eafSPaul Walmsley if (!cpu_is_omap34xx()) 3422f135eafSPaul Walmsley return 0; 3432f135eafSPaul Walmsley 3442f135eafSPaul Walmsley dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck"); 345e281f7ecSAaro Koskinen if (IS_ERR(dpll3_m2_ck)) 3462f135eafSPaul Walmsley return -EINVAL; 3472f135eafSPaul Walmsley 3482f135eafSPaul Walmsley rate = clk_get_rate(dpll3_m2_ck); 3492f135eafSPaul Walmsley pr_info("Reprogramming SDRC clock to %ld Hz\n", rate); 3502f135eafSPaul Walmsley v = clk_set_rate(dpll3_m2_ck, rate); 3512f135eafSPaul Walmsley if (v) 3522f135eafSPaul Walmsley pr_err("dpll3_m2_clk rate change failed: %d\n", v); 3532f135eafSPaul Walmsley 3542f135eafSPaul Walmsley clk_put(dpll3_m2_ck); 3552f135eafSPaul Walmsley 3562f135eafSPaul Walmsley return v; 3572f135eafSPaul Walmsley } 3582f135eafSPaul Walmsley 3592092e5ccSPaul Walmsley static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data) 3602092e5ccSPaul Walmsley { 3612092e5ccSPaul Walmsley return omap_hwmod_set_postsetup_state(oh, *(u8 *)data); 3622092e5ccSPaul Walmsley } 3632092e5ccSPaul Walmsley 3647b250affSTony Lindgren static void __init omap_common_init_early(void) 3657b250affSTony Lindgren { 366df80442dSArnd Bergmann omap_init_consistent_dma_size(); 3677b250affSTony Lindgren } 3687b250affSTony Lindgren 3697b250affSTony Lindgren static void __init omap_hwmod_init_postsetup(void) 370120db2cbSTony Lindgren { 3712092e5ccSPaul Walmsley u8 postsetup_state; 3722092e5ccSPaul Walmsley 3732092e5ccSPaul Walmsley /* Set the default postsetup state for all hwmods */ 3742092e5ccSPaul Walmsley #ifdef CONFIG_PM_RUNTIME 3752092e5ccSPaul Walmsley postsetup_state = _HWMOD_STATE_IDLE; 3762092e5ccSPaul Walmsley #else 3772092e5ccSPaul Walmsley postsetup_state = _HWMOD_STATE_ENABLED; 3782092e5ccSPaul Walmsley #endif 3792092e5ccSPaul Walmsley omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); 38055d2cb08SBenoit Cousson 38153da4ce2SKevin Hilman omap_pm_if_early_init(); 3824805734bSPaul Walmsley } 3834805734bSPaul Walmsley 38416110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2420 3858f5b5a41STony Lindgren void __init omap2420_init_early(void) 3868f5b5a41STony Lindgren { 387b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000)); 388b6a4226cSPaul Walmsley omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE), 389b6a4226cSPaul Walmsley OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE)); 390b6a4226cSPaul Walmsley omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE), 391b6a4226cSPaul Walmsley NULL); 392d9a16f9aSPaul Walmsley omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE)); 393d9a16f9aSPaul Walmsley omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL); 3944de34f35SVaibhav Hiremath omap2xxx_check_revision(); 395c4ceedcbSPaul Walmsley omap2xxx_cm_init(); 3967b250affSTony Lindgren omap_common_init_early(); 3977b250affSTony Lindgren omap2xxx_voltagedomains_init(); 3987b250affSTony Lindgren omap242x_powerdomains_init(); 3997b250affSTony Lindgren omap242x_clockdomains_init(); 4007b250affSTony Lindgren omap2420_hwmod_init(); 4017b250affSTony Lindgren omap_hwmod_init_postsetup(); 4027b250affSTony Lindgren omap2420_clk_init(); 4038f5b5a41STony Lindgren } 404bbd707acSShawn Guo 405bbd707acSShawn Guo void __init omap2420_init_late(void) 406bbd707acSShawn Guo { 407bbd707acSShawn Guo omap_mux_late_init(); 408bbd707acSShawn Guo omap2_common_pm_late_init(); 409bbd707acSShawn Guo omap2_pm_init(); 410*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 411*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 412*23fb8ba3SRajendra Nayak #endif 413bbd707acSShawn Guo } 41416110798SPaul Walmsley #endif 4158f5b5a41STony Lindgren 41616110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2430 4178f5b5a41STony Lindgren void __init omap2430_init_early(void) 4188f5b5a41STony Lindgren { 419b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000)); 420b6a4226cSPaul Walmsley omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE), 421b6a4226cSPaul Walmsley OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE)); 422b6a4226cSPaul Walmsley omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE), 423b6a4226cSPaul Walmsley NULL); 424d9a16f9aSPaul Walmsley omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE)); 425d9a16f9aSPaul Walmsley omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL); 4264de34f35SVaibhav Hiremath omap2xxx_check_revision(); 427c4ceedcbSPaul Walmsley omap2xxx_cm_init(); 4287b250affSTony Lindgren omap_common_init_early(); 4297b250affSTony Lindgren omap2xxx_voltagedomains_init(); 4307b250affSTony Lindgren omap243x_powerdomains_init(); 4317b250affSTony Lindgren omap243x_clockdomains_init(); 4327b250affSTony Lindgren omap2430_hwmod_init(); 4337b250affSTony Lindgren omap_hwmod_init_postsetup(); 4347b250affSTony Lindgren omap2430_clk_init(); 4357b250affSTony Lindgren } 436bbd707acSShawn Guo 437bbd707acSShawn Guo void __init omap2430_init_late(void) 438bbd707acSShawn Guo { 439bbd707acSShawn Guo omap_mux_late_init(); 440bbd707acSShawn Guo omap2_common_pm_late_init(); 441bbd707acSShawn Guo omap2_pm_init(); 442*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 443*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 444*23fb8ba3SRajendra Nayak #endif 445bbd707acSShawn Guo } 446c4e2d245SSanjeev Premi #endif 4477b250affSTony Lindgren 4487b250affSTony Lindgren /* 4497b250affSTony Lindgren * Currently only board-omap3beagle.c should call this because of the 4507b250affSTony Lindgren * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT. 4517b250affSTony Lindgren */ 452c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP3 4537b250affSTony Lindgren void __init omap3_init_early(void) 4547b250affSTony Lindgren { 455b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000)); 456b6a4226cSPaul Walmsley omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE), 457b6a4226cSPaul Walmsley OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE)); 458b6a4226cSPaul Walmsley omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE), 459b6a4226cSPaul Walmsley NULL); 460d9a16f9aSPaul Walmsley omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE)); 461d9a16f9aSPaul Walmsley omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL); 4624de34f35SVaibhav Hiremath omap3xxx_check_revision(); 4634de34f35SVaibhav Hiremath omap3xxx_check_features(); 464c4ceedcbSPaul Walmsley omap3xxx_cm_init(); 4657b250affSTony Lindgren omap_common_init_early(); 4667b250affSTony Lindgren omap3xxx_voltagedomains_init(); 4677b250affSTony Lindgren omap3xxx_powerdomains_init(); 4687b250affSTony Lindgren omap3xxx_clockdomains_init(); 4697b250affSTony Lindgren omap3xxx_hwmod_init(); 4707b250affSTony Lindgren omap_hwmod_init_postsetup(); 4717b250affSTony Lindgren omap3xxx_clk_init(); 4728f5b5a41STony Lindgren } 4738f5b5a41STony Lindgren 4748f5b5a41STony Lindgren void __init omap3430_init_early(void) 4758f5b5a41STony Lindgren { 4767b250affSTony Lindgren omap3_init_early(); 4778f5b5a41STony Lindgren } 4788f5b5a41STony Lindgren 4798f5b5a41STony Lindgren void __init omap35xx_init_early(void) 4808f5b5a41STony Lindgren { 4817b250affSTony Lindgren omap3_init_early(); 4828f5b5a41STony Lindgren } 4838f5b5a41STony Lindgren 4848f5b5a41STony Lindgren void __init omap3630_init_early(void) 4858f5b5a41STony Lindgren { 4867b250affSTony Lindgren omap3_init_early(); 4878f5b5a41STony Lindgren } 4888f5b5a41STony Lindgren 4898f5b5a41STony Lindgren void __init am35xx_init_early(void) 4908f5b5a41STony Lindgren { 4917b250affSTony Lindgren omap3_init_early(); 4928f5b5a41STony Lindgren } 4938f5b5a41STony Lindgren 494a920360fSHemant Pedanekar void __init ti81xx_init_early(void) 4958f5b5a41STony Lindgren { 496b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP343X_CLASS, 497b6a4226cSPaul Walmsley OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); 498b6a4226cSPaul Walmsley omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE), 499b6a4226cSPaul Walmsley NULL); 500d9a16f9aSPaul Walmsley omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE)); 501d9a16f9aSPaul Walmsley omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL); 5024de34f35SVaibhav Hiremath omap3xxx_check_revision(); 5034de34f35SVaibhav Hiremath ti81xx_check_features(); 5044c3cf901STony Lindgren omap_common_init_early(); 5054c3cf901STony Lindgren omap3xxx_voltagedomains_init(); 5064c3cf901STony Lindgren omap3xxx_powerdomains_init(); 5074c3cf901STony Lindgren omap3xxx_clockdomains_init(); 5084c3cf901STony Lindgren omap3xxx_hwmod_init(); 5094c3cf901STony Lindgren omap_hwmod_init_postsetup(); 5104c3cf901STony Lindgren omap3xxx_clk_init(); 5118f5b5a41STony Lindgren } 512bbd707acSShawn Guo 513bbd707acSShawn Guo void __init omap3_init_late(void) 514bbd707acSShawn Guo { 515bbd707acSShawn Guo omap_mux_late_init(); 516bbd707acSShawn Guo omap2_common_pm_late_init(); 517bbd707acSShawn Guo omap3_pm_init(); 518*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 519*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 520*23fb8ba3SRajendra Nayak #endif 521bbd707acSShawn Guo } 522bbd707acSShawn Guo 523bbd707acSShawn Guo void __init omap3430_init_late(void) 524bbd707acSShawn Guo { 525bbd707acSShawn Guo omap_mux_late_init(); 526bbd707acSShawn Guo omap2_common_pm_late_init(); 527bbd707acSShawn Guo omap3_pm_init(); 528*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 529*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 530*23fb8ba3SRajendra Nayak #endif 531bbd707acSShawn Guo } 532bbd707acSShawn Guo 533bbd707acSShawn Guo void __init omap35xx_init_late(void) 534bbd707acSShawn Guo { 535bbd707acSShawn Guo omap_mux_late_init(); 536bbd707acSShawn Guo omap2_common_pm_late_init(); 537bbd707acSShawn Guo omap3_pm_init(); 538*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 539*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 540*23fb8ba3SRajendra Nayak #endif 541bbd707acSShawn Guo } 542bbd707acSShawn Guo 543bbd707acSShawn Guo void __init omap3630_init_late(void) 544bbd707acSShawn Guo { 545bbd707acSShawn Guo omap_mux_late_init(); 546bbd707acSShawn Guo omap2_common_pm_late_init(); 547bbd707acSShawn Guo omap3_pm_init(); 548*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 549*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 550*23fb8ba3SRajendra Nayak #endif 551bbd707acSShawn Guo } 552bbd707acSShawn Guo 553bbd707acSShawn Guo void __init am35xx_init_late(void) 554bbd707acSShawn Guo { 555bbd707acSShawn Guo omap_mux_late_init(); 556bbd707acSShawn Guo omap2_common_pm_late_init(); 557bbd707acSShawn Guo omap3_pm_init(); 558*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 559*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 560*23fb8ba3SRajendra Nayak #endif 561bbd707acSShawn Guo } 562bbd707acSShawn Guo 563bbd707acSShawn Guo void __init ti81xx_init_late(void) 564bbd707acSShawn Guo { 565bbd707acSShawn Guo omap_mux_late_init(); 566bbd707acSShawn Guo omap2_common_pm_late_init(); 567bbd707acSShawn Guo omap3_pm_init(); 568*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 569*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 570*23fb8ba3SRajendra Nayak #endif 571bbd707acSShawn Guo } 572c4e2d245SSanjeev Premi #endif 5738f5b5a41STony Lindgren 57408f30989SAfzal Mohammed #ifdef CONFIG_SOC_AM33XX 57508f30989SAfzal Mohammed void __init am33xx_init_early(void) 57608f30989SAfzal Mohammed { 577b6a4226cSPaul Walmsley omap2_set_globals_tap(AM335X_CLASS, 578b6a4226cSPaul Walmsley AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); 579b6a4226cSPaul Walmsley omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE), 580b6a4226cSPaul Walmsley NULL); 581d9a16f9aSPaul Walmsley omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE)); 582d9a16f9aSPaul Walmsley omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL); 58308f30989SAfzal Mohammed omap3xxx_check_revision(); 58408f30989SAfzal Mohammed ti81xx_check_features(); 58508f30989SAfzal Mohammed omap_common_init_early(); 586ce3fc89aSVaibhav Hiremath am33xx_voltagedomains_init(); 5873f0ea764SVaibhav Hiremath am33xx_powerdomains_init(); 5889c80f3aaSVaibhav Hiremath am33xx_clockdomains_init(); 589a2cfc509SVaibhav Hiremath am33xx_hwmod_init(); 590a2cfc509SVaibhav Hiremath omap_hwmod_init_postsetup(); 591e30384abSVaibhav Hiremath am33xx_clk_init(); 59208f30989SAfzal Mohammed } 59308f30989SAfzal Mohammed #endif 59408f30989SAfzal Mohammed 595c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP4 5968f5b5a41STony Lindgren void __init omap4430_init_early(void) 5978f5b5a41STony Lindgren { 598b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP443X_CLASS, 599b6a4226cSPaul Walmsley OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE)); 600b6a4226cSPaul Walmsley omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), 601b6a4226cSPaul Walmsley OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE)); 602d9a16f9aSPaul Walmsley omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE)); 603d9a16f9aSPaul Walmsley omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE), 604d9a16f9aSPaul Walmsley OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE)); 605d9a16f9aSPaul Walmsley omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE)); 606d9a16f9aSPaul Walmsley omap_prm_base_init(); 607d9a16f9aSPaul Walmsley omap_cm_base_init(); 6084de34f35SVaibhav Hiremath omap4xxx_check_revision(); 6094de34f35SVaibhav Hiremath omap4xxx_check_features(); 6107b250affSTony Lindgren omap_common_init_early(); 6117b250affSTony Lindgren omap44xx_voltagedomains_init(); 6127b250affSTony Lindgren omap44xx_powerdomains_init(); 6137b250affSTony Lindgren omap44xx_clockdomains_init(); 6147b250affSTony Lindgren omap44xx_hwmod_init(); 6157b250affSTony Lindgren omap_hwmod_init_postsetup(); 6167b250affSTony Lindgren omap4xxx_clk_init(); 6178f5b5a41STony Lindgren } 618bbd707acSShawn Guo 619bbd707acSShawn Guo void __init omap4430_init_late(void) 620bbd707acSShawn Guo { 621bbd707acSShawn Guo omap_mux_late_init(); 622bbd707acSShawn Guo omap2_common_pm_late_init(); 623bbd707acSShawn Guo omap4_pm_init(); 624*23fb8ba3SRajendra Nayak #ifdef CONFIG_COMMON_CLK 625*23fb8ba3SRajendra Nayak omap2_clk_enable_autoidle_all(); 626*23fb8ba3SRajendra Nayak #endif 627bbd707acSShawn Guo } 628c4e2d245SSanjeev Premi #endif 6298f5b5a41STony Lindgren 63005e152c7SR Sricharan #ifdef CONFIG_SOC_OMAP5 63105e152c7SR Sricharan void __init omap5_init_early(void) 63205e152c7SR Sricharan { 633b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP54XX_CLASS, 634b6a4226cSPaul Walmsley OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE)); 635b6a4226cSPaul Walmsley omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE), 636b6a4226cSPaul Walmsley OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE)); 637d9a16f9aSPaul Walmsley omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE)); 638d9a16f9aSPaul Walmsley omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE), 639d9a16f9aSPaul Walmsley OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE)); 640d9a16f9aSPaul Walmsley omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); 641d9a16f9aSPaul Walmsley omap_prm_base_init(); 642d9a16f9aSPaul Walmsley omap_cm_base_init(); 64305e152c7SR Sricharan omap5xxx_check_revision(); 64405e152c7SR Sricharan omap_common_init_early(); 64505e152c7SR Sricharan } 64605e152c7SR Sricharan #endif 64705e152c7SR Sricharan 648a4ca9dbeSTony Lindgren void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, 6494805734bSPaul Walmsley struct omap_sdrc_params *sdrc_cs1) 6504805734bSPaul Walmsley { 651a66cb345STony Lindgren omap_sram_init(); 652a66cb345STony Lindgren 65301001712SHemant Pedanekar if (cpu_is_omap24xx() || omap3_has_sdrc()) { 65458cda884SJean Pihet omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 6552f135eafSPaul Walmsley _omap2_init_reprogram_sdrc(); 656aa4b1f6eSKevin Hilman } 6571dbae815STony Lindgren } 658