1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 21dbae815STony Lindgren /* 31dbae815STony Lindgren * linux/arch/arm/mach-omap2/io.c 41dbae815STony Lindgren * 51dbae815STony Lindgren * OMAP2 I/O mapping code 61dbae815STony Lindgren * 71dbae815STony Lindgren * Copyright (C) 2005 Nokia Corporation 844169075SSantosh Shilimkar * Copyright (C) 2007-2009 Texas Instruments 9646e3ed1STony Lindgren * 10646e3ed1STony Lindgren * Author: 11646e3ed1STony Lindgren * Juha Yrjola <juha.yrjola@nokia.com> 12646e3ed1STony Lindgren * Syed Khasim <x0khasim@ti.com> 131dbae815STony Lindgren * 1444169075SSantosh Shilimkar * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> 151dbae815STony Lindgren */ 161dbae815STony Lindgren #include <linux/module.h> 171dbae815STony Lindgren #include <linux/kernel.h> 181dbae815STony Lindgren #include <linux/init.h> 19fced80c7SRussell King #include <linux/io.h> 202f135eafSPaul Walmsley #include <linux/clk.h> 211dbae815STony Lindgren 22120db2cbSTony Lindgren #include <asm/tlb.h> 23120db2cbSTony Lindgren #include <asm/mach/map.h> 24120db2cbSTony Lindgren 2545c3eb7dSTony Lindgren #include <linux/omap-dma.h> 26646e3ed1STony Lindgren 27dc843280STony Lindgren #include "omap_hwmod.h" 28dbc04161STony Lindgren #include "soc.h" 29ee0839c2STony Lindgren #include "iomap.h" 30ee0839c2STony Lindgren #include "voltage.h" 31ee0839c2STony Lindgren #include "powerdomain.h" 32ee0839c2STony Lindgren #include "clockdomain.h" 33ee0839c2STony Lindgren #include "common.h" 34e30384abSVaibhav Hiremath #include "clock.h" 353e6ece13SPaul Walmsley #include "sdrc.h" 36b6a4226cSPaul Walmsley #include "control.h" 37bf027ca1STony Lindgren #include "sram.h" 38c4ceedcbSPaul Walmsley #include "cm2xxx.h" 39c4ceedcbSPaul Walmsley #include "cm3xxx.h" 407632a02fSTero Kristo #include "cm33xx.h" 41ab6c9bbfSTero Kristo #include "cm44xx.h" 42d9a16f9aSPaul Walmsley #include "prm.h" 43d9a16f9aSPaul Walmsley #include "cm.h" 44d9a16f9aSPaul Walmsley #include "prcm_mpu44xx.h" 45d9a16f9aSPaul Walmsley #include "prminst44xx.h" 4663a293e0SPaul Walmsley #include "prm2xxx.h" 4763a293e0SPaul Walmsley #include "prm3xxx.h" 48d9bbe84fSTero Kristo #include "prm33xx.h" 4963a293e0SPaul Walmsley #include "prm44xx.h" 5069a1e7a1STero Kristo #include "opp2xxx.h" 51db711893SAndrew F. Davis #include "omap-secure.h" 521dbae815STony Lindgren 531dbae815STony Lindgren /* 54cfa9667dSTero Kristo * omap_clk_soc_init: points to a function that does the SoC-specific 55ff931c82SRajendra Nayak * clock initializations 56ff931c82SRajendra Nayak */ 57cfa9667dSTero Kristo static int (*omap_clk_soc_init)(void); 58ff931c82SRajendra Nayak 59ff931c82SRajendra Nayak /* 601dbae815STony Lindgren * The machine specific code may provide the extra mapping besides the 611dbae815STony Lindgren * default mapping provided here. 621dbae815STony Lindgren */ 63cc26b3b0SSyed Mohammed, Khasim 64e48f814eSTony Lindgren #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) 65cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = { 661dbae815STony Lindgren { 671dbae815STony Lindgren .virtual = L3_24XX_VIRT, 681dbae815STony Lindgren .pfn = __phys_to_pfn(L3_24XX_PHYS), 691dbae815STony Lindgren .length = L3_24XX_SIZE, 701dbae815STony Lindgren .type = MT_DEVICE 711dbae815STony Lindgren }, 7209f21ed4SKyungmin Park { 7309f21ed4SKyungmin Park .virtual = L4_24XX_VIRT, 7409f21ed4SKyungmin Park .pfn = __phys_to_pfn(L4_24XX_PHYS), 7509f21ed4SKyungmin Park .length = L4_24XX_SIZE, 7609f21ed4SKyungmin Park .type = MT_DEVICE 7709f21ed4SKyungmin Park }, 78cc26b3b0SSyed Mohammed, Khasim }; 79cc26b3b0SSyed Mohammed, Khasim 8059b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420 81cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = { 821dbae815STony Lindgren { 837adb9987SPaul Walmsley .virtual = DSP_MEM_2420_VIRT, 847adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS), 857adb9987SPaul Walmsley .length = DSP_MEM_2420_SIZE, 86c40fae95STony Lindgren .type = MT_DEVICE 87c40fae95STony Lindgren }, 88c40fae95STony Lindgren { 897adb9987SPaul Walmsley .virtual = DSP_IPI_2420_VIRT, 907adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS), 917adb9987SPaul Walmsley .length = DSP_IPI_2420_SIZE, 92c40fae95STony Lindgren .type = MT_DEVICE 93c40fae95STony Lindgren }, 94c40fae95STony Lindgren { 957adb9987SPaul Walmsley .virtual = DSP_MMU_2420_VIRT, 967adb9987SPaul Walmsley .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS), 977adb9987SPaul Walmsley .length = DSP_MMU_2420_SIZE, 981dbae815STony Lindgren .type = MT_DEVICE 99cc26b3b0SSyed Mohammed, Khasim }, 1001dbae815STony Lindgren }; 1011dbae815STony Lindgren 102cc26b3b0SSyed Mohammed, Khasim #endif 103cc26b3b0SSyed Mohammed, Khasim 10459b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430 105cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = { 106cc26b3b0SSyed Mohammed, Khasim { 107cc26b3b0SSyed Mohammed, Khasim .virtual = L4_WK_243X_VIRT, 108cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_WK_243X_PHYS), 109cc26b3b0SSyed Mohammed, Khasim .length = L4_WK_243X_SIZE, 110cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 111cc26b3b0SSyed Mohammed, Khasim }, 112cc26b3b0SSyed Mohammed, Khasim { 113cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_GPMC_VIRT, 114cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS), 115cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_GPMC_SIZE, 116cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 117cc26b3b0SSyed Mohammed, Khasim }, 118cc26b3b0SSyed Mohammed, Khasim { 119cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SDRC_VIRT, 120cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS), 121cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SDRC_SIZE, 122cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 123cc26b3b0SSyed Mohammed, Khasim }, 124cc26b3b0SSyed Mohammed, Khasim { 125cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SMS_VIRT, 126cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS), 127cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SMS_SIZE, 128cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 129cc26b3b0SSyed Mohammed, Khasim }, 130cc26b3b0SSyed Mohammed, Khasim }; 131cc26b3b0SSyed Mohammed, Khasim #endif 132cc26b3b0SSyed Mohammed, Khasim #endif 133cc26b3b0SSyed Mohammed, Khasim 134a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3 135cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = { 136cc26b3b0SSyed Mohammed, Khasim { 137cc26b3b0SSyed Mohammed, Khasim .virtual = L3_34XX_VIRT, 138cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L3_34XX_PHYS), 139cc26b3b0SSyed Mohammed, Khasim .length = L3_34XX_SIZE, 140cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 141cc26b3b0SSyed Mohammed, Khasim }, 142cc26b3b0SSyed Mohammed, Khasim { 143cc26b3b0SSyed Mohammed, Khasim .virtual = L4_34XX_VIRT, 144cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_34XX_PHYS), 145cc26b3b0SSyed Mohammed, Khasim .length = L4_34XX_SIZE, 146cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 147cc26b3b0SSyed Mohammed, Khasim }, 148cc26b3b0SSyed Mohammed, Khasim { 149cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP34XX_GPMC_VIRT, 150cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS), 151cc26b3b0SSyed Mohammed, Khasim .length = OMAP34XX_GPMC_SIZE, 152cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 153cc26b3b0SSyed Mohammed, Khasim }, 154cc26b3b0SSyed Mohammed, Khasim { 155cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SMS_VIRT, 156cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS), 157cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SMS_SIZE, 158cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 159cc26b3b0SSyed Mohammed, Khasim }, 160cc26b3b0SSyed Mohammed, Khasim { 161cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SDRC_VIRT, 162cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS), 163cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SDRC_SIZE, 164cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 165cc26b3b0SSyed Mohammed, Khasim }, 166cc26b3b0SSyed Mohammed, Khasim { 167cc26b3b0SSyed Mohammed, Khasim .virtual = L4_PER_34XX_VIRT, 168cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_PER_34XX_PHYS), 169cc26b3b0SSyed Mohammed, Khasim .length = L4_PER_34XX_SIZE, 170cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 171cc26b3b0SSyed Mohammed, Khasim }, 172cc26b3b0SSyed Mohammed, Khasim { 173cc26b3b0SSyed Mohammed, Khasim .virtual = L4_EMU_34XX_VIRT, 174cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS), 175cc26b3b0SSyed Mohammed, Khasim .length = L4_EMU_34XX_SIZE, 176cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 177cc26b3b0SSyed Mohammed, Khasim }, 178cc26b3b0SSyed Mohammed, Khasim }; 179cc26b3b0SSyed Mohammed, Khasim #endif 18001001712SHemant Pedanekar 18133959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX 182a920360fSHemant Pedanekar static struct map_desc omapti81xx_io_desc[] __initdata = { 18301001712SHemant Pedanekar { 18401001712SHemant Pedanekar .virtual = L4_34XX_VIRT, 18501001712SHemant Pedanekar .pfn = __phys_to_pfn(L4_34XX_PHYS), 18601001712SHemant Pedanekar .length = L4_34XX_SIZE, 18701001712SHemant Pedanekar .type = MT_DEVICE 1881e6cb146SAfzal Mohammed } 1891e6cb146SAfzal Mohammed }; 1901e6cb146SAfzal Mohammed #endif 1911e6cb146SAfzal Mohammed 192addb154aSAfzal Mohammed #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) 1931e6cb146SAfzal Mohammed static struct map_desc omapam33xx_io_desc[] __initdata = { 19401001712SHemant Pedanekar { 19501001712SHemant Pedanekar .virtual = L4_34XX_VIRT, 19601001712SHemant Pedanekar .pfn = __phys_to_pfn(L4_34XX_PHYS), 19701001712SHemant Pedanekar .length = L4_34XX_SIZE, 19801001712SHemant Pedanekar .type = MT_DEVICE 19901001712SHemant Pedanekar }, 2001e6cb146SAfzal Mohammed { 2011e6cb146SAfzal Mohammed .virtual = L4_WK_AM33XX_VIRT, 2021e6cb146SAfzal Mohammed .pfn = __phys_to_pfn(L4_WK_AM33XX_PHYS), 2031e6cb146SAfzal Mohammed .length = L4_WK_AM33XX_SIZE, 2041e6cb146SAfzal Mohammed .type = MT_DEVICE 2051e6cb146SAfzal Mohammed } 20601001712SHemant Pedanekar }; 20701001712SHemant Pedanekar #endif 20801001712SHemant Pedanekar 20944169075SSantosh Shilimkar #ifdef CONFIG_ARCH_OMAP4 21044169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = { 21144169075SSantosh Shilimkar { 21244169075SSantosh Shilimkar .virtual = L3_44XX_VIRT, 21344169075SSantosh Shilimkar .pfn = __phys_to_pfn(L3_44XX_PHYS), 21444169075SSantosh Shilimkar .length = L3_44XX_SIZE, 21544169075SSantosh Shilimkar .type = MT_DEVICE, 21644169075SSantosh Shilimkar }, 21744169075SSantosh Shilimkar { 21844169075SSantosh Shilimkar .virtual = L4_44XX_VIRT, 21944169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_44XX_PHYS), 22044169075SSantosh Shilimkar .length = L4_44XX_SIZE, 22144169075SSantosh Shilimkar .type = MT_DEVICE, 22244169075SSantosh Shilimkar }, 22344169075SSantosh Shilimkar { 22444169075SSantosh Shilimkar .virtual = L4_PER_44XX_VIRT, 22544169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_PER_44XX_PHYS), 22644169075SSantosh Shilimkar .length = L4_PER_44XX_SIZE, 22744169075SSantosh Shilimkar .type = MT_DEVICE, 22844169075SSantosh Shilimkar }, 22944169075SSantosh Shilimkar }; 23044169075SSantosh Shilimkar #endif 231cc26b3b0SSyed Mohammed, Khasim 232ea827ad5SNishanth Menon #ifdef CONFIG_SOC_OMAP5 23305e152c7SR Sricharan static struct map_desc omap54xx_io_desc[] __initdata = { 23405e152c7SR Sricharan { 23505e152c7SR Sricharan .virtual = L3_54XX_VIRT, 23605e152c7SR Sricharan .pfn = __phys_to_pfn(L3_54XX_PHYS), 23705e152c7SR Sricharan .length = L3_54XX_SIZE, 23805e152c7SR Sricharan .type = MT_DEVICE, 23905e152c7SR Sricharan }, 24005e152c7SR Sricharan { 24105e152c7SR Sricharan .virtual = L4_54XX_VIRT, 24205e152c7SR Sricharan .pfn = __phys_to_pfn(L4_54XX_PHYS), 24305e152c7SR Sricharan .length = L4_54XX_SIZE, 24405e152c7SR Sricharan .type = MT_DEVICE, 24505e152c7SR Sricharan }, 24605e152c7SR Sricharan { 24705e152c7SR Sricharan .virtual = L4_WK_54XX_VIRT, 24805e152c7SR Sricharan .pfn = __phys_to_pfn(L4_WK_54XX_PHYS), 24905e152c7SR Sricharan .length = L4_WK_54XX_SIZE, 25005e152c7SR Sricharan .type = MT_DEVICE, 25105e152c7SR Sricharan }, 25205e152c7SR Sricharan { 25305e152c7SR Sricharan .virtual = L4_PER_54XX_VIRT, 25405e152c7SR Sricharan .pfn = __phys_to_pfn(L4_PER_54XX_PHYS), 25505e152c7SR Sricharan .length = L4_PER_54XX_SIZE, 25605e152c7SR Sricharan .type = MT_DEVICE, 25705e152c7SR Sricharan }, 25805e152c7SR Sricharan }; 25905e152c7SR Sricharan #endif 26005e152c7SR Sricharan 261ea827ad5SNishanth Menon #ifdef CONFIG_SOC_DRA7XX 262ea827ad5SNishanth Menon static struct map_desc dra7xx_io_desc[] __initdata = { 263ea827ad5SNishanth Menon { 264ea827ad5SNishanth Menon .virtual = L4_CFG_MPU_DRA7XX_VIRT, 265ea827ad5SNishanth Menon .pfn = __phys_to_pfn(L4_CFG_MPU_DRA7XX_PHYS), 266ea827ad5SNishanth Menon .length = L4_CFG_MPU_DRA7XX_SIZE, 267ea827ad5SNishanth Menon .type = MT_DEVICE, 268ea827ad5SNishanth Menon }, 269ea827ad5SNishanth Menon { 270ea827ad5SNishanth Menon .virtual = L3_MAIN_SN_DRA7XX_VIRT, 271ea827ad5SNishanth Menon .pfn = __phys_to_pfn(L3_MAIN_SN_DRA7XX_PHYS), 272ea827ad5SNishanth Menon .length = L3_MAIN_SN_DRA7XX_SIZE, 273ea827ad5SNishanth Menon .type = MT_DEVICE, 274ea827ad5SNishanth Menon }, 275ea827ad5SNishanth Menon { 276ea827ad5SNishanth Menon .virtual = L4_PER1_DRA7XX_VIRT, 277ea827ad5SNishanth Menon .pfn = __phys_to_pfn(L4_PER1_DRA7XX_PHYS), 278ea827ad5SNishanth Menon .length = L4_PER1_DRA7XX_SIZE, 279ea827ad5SNishanth Menon .type = MT_DEVICE, 280ea827ad5SNishanth Menon }, 281ea827ad5SNishanth Menon { 282ea827ad5SNishanth Menon .virtual = L4_PER2_DRA7XX_VIRT, 283ea827ad5SNishanth Menon .pfn = __phys_to_pfn(L4_PER2_DRA7XX_PHYS), 284ea827ad5SNishanth Menon .length = L4_PER2_DRA7XX_SIZE, 285ea827ad5SNishanth Menon .type = MT_DEVICE, 286ea827ad5SNishanth Menon }, 287ea827ad5SNishanth Menon { 288ea827ad5SNishanth Menon .virtual = L4_PER3_DRA7XX_VIRT, 289ea827ad5SNishanth Menon .pfn = __phys_to_pfn(L4_PER3_DRA7XX_PHYS), 290ea827ad5SNishanth Menon .length = L4_PER3_DRA7XX_SIZE, 291ea827ad5SNishanth Menon .type = MT_DEVICE, 292ea827ad5SNishanth Menon }, 293ea827ad5SNishanth Menon { 294ea827ad5SNishanth Menon .virtual = L4_CFG_DRA7XX_VIRT, 295ea827ad5SNishanth Menon .pfn = __phys_to_pfn(L4_CFG_DRA7XX_PHYS), 296ea827ad5SNishanth Menon .length = L4_CFG_DRA7XX_SIZE, 297ea827ad5SNishanth Menon .type = MT_DEVICE, 298ea827ad5SNishanth Menon }, 299ea827ad5SNishanth Menon { 300ea827ad5SNishanth Menon .virtual = L4_WKUP_DRA7XX_VIRT, 301ea827ad5SNishanth Menon .pfn = __phys_to_pfn(L4_WKUP_DRA7XX_PHYS), 302ea827ad5SNishanth Menon .length = L4_WKUP_DRA7XX_SIZE, 303ea827ad5SNishanth Menon .type = MT_DEVICE, 304ea827ad5SNishanth Menon }, 305ea827ad5SNishanth Menon }; 306ea827ad5SNishanth Menon #endif 307ea827ad5SNishanth Menon 30859b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420 309b6a4226cSPaul Walmsley void __init omap242x_map_io(void) 3106fbd55d0STony Lindgren { 3116fbd55d0STony Lindgren iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 3126fbd55d0STony Lindgren iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 3136fbd55d0STony Lindgren } 3146fbd55d0STony Lindgren #endif 3156fbd55d0STony Lindgren 31659b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430 317b6a4226cSPaul Walmsley void __init omap243x_map_io(void) 3186fbd55d0STony Lindgren { 3196fbd55d0STony Lindgren iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 3206fbd55d0STony Lindgren iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 3216fbd55d0STony Lindgren } 3226fbd55d0STony Lindgren #endif 3236fbd55d0STony Lindgren 324a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3 325b6a4226cSPaul Walmsley void __init omap3_map_io(void) 3266fbd55d0STony Lindgren { 3276fbd55d0STony Lindgren iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 3286fbd55d0STony Lindgren } 3296fbd55d0STony Lindgren #endif 3306fbd55d0STony Lindgren 33133959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX 332b6a4226cSPaul Walmsley void __init ti81xx_map_io(void) 33301001712SHemant Pedanekar { 334a920360fSHemant Pedanekar iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc)); 33501001712SHemant Pedanekar } 33601001712SHemant Pedanekar #endif 33701001712SHemant Pedanekar 338addb154aSAfzal Mohammed #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) 339b6a4226cSPaul Walmsley void __init am33xx_map_io(void) 3401e6cb146SAfzal Mohammed { 3411e6cb146SAfzal Mohammed iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); 3426fbd55d0STony Lindgren } 3436fbd55d0STony Lindgren #endif 3446fbd55d0STony Lindgren 3456fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP4 346b6a4226cSPaul Walmsley void __init omap4_map_io(void) 3476fbd55d0STony Lindgren { 3486fbd55d0STony Lindgren iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 349f746929fSRussell King omap_barriers_init(); 3506fbd55d0STony Lindgren } 3516fbd55d0STony Lindgren #endif 3526fbd55d0STony Lindgren 353ea827ad5SNishanth Menon #ifdef CONFIG_SOC_OMAP5 354b6a4226cSPaul Walmsley void __init omap5_map_io(void) 35505e152c7SR Sricharan { 35605e152c7SR Sricharan iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); 357f746929fSRussell King omap_barriers_init(); 35805e152c7SR Sricharan } 35905e152c7SR Sricharan #endif 360ea827ad5SNishanth Menon 361ea827ad5SNishanth Menon #ifdef CONFIG_SOC_DRA7XX 362ea827ad5SNishanth Menon void __init dra7xx_map_io(void) 363ea827ad5SNishanth Menon { 364ea827ad5SNishanth Menon iotable_init(dra7xx_io_desc, ARRAY_SIZE(dra7xx_io_desc)); 365456e8d53SNishanth Menon omap_barriers_init(); 366ea827ad5SNishanth Menon } 367ea827ad5SNishanth Menon #endif 3682f135eafSPaul Walmsley /* 3692f135eafSPaul Walmsley * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters 3702f135eafSPaul Walmsley * 3712f135eafSPaul Walmsley * Sets the CORE DPLL3 M2 divider to the same value that it's at 3722f135eafSPaul Walmsley * currently. This has the effect of setting the SDRC SDRAM AC timing 3732f135eafSPaul Walmsley * registers to the values currently defined by the kernel. Currently 3742f135eafSPaul Walmsley * only defined for OMAP3; will return 0 if called on OMAP2. Returns 3752f135eafSPaul Walmsley * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2, 3762f135eafSPaul Walmsley * or passes along the return value of clk_set_rate(). 3772f135eafSPaul Walmsley */ 3782f135eafSPaul Walmsley static int __init _omap2_init_reprogram_sdrc(void) 3792f135eafSPaul Walmsley { 3802f135eafSPaul Walmsley struct clk *dpll3_m2_ck; 3812f135eafSPaul Walmsley int v = -EINVAL; 3822f135eafSPaul Walmsley long rate; 3832f135eafSPaul Walmsley 3842f135eafSPaul Walmsley if (!cpu_is_omap34xx()) 3852f135eafSPaul Walmsley return 0; 3862f135eafSPaul Walmsley 3872f135eafSPaul Walmsley dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck"); 388e281f7ecSAaro Koskinen if (IS_ERR(dpll3_m2_ck)) 3892f135eafSPaul Walmsley return -EINVAL; 3902f135eafSPaul Walmsley 3912f135eafSPaul Walmsley rate = clk_get_rate(dpll3_m2_ck); 3922f135eafSPaul Walmsley pr_info("Reprogramming SDRC clock to %ld Hz\n", rate); 3932f135eafSPaul Walmsley v = clk_set_rate(dpll3_m2_ck, rate); 3942f135eafSPaul Walmsley if (v) 3952f135eafSPaul Walmsley pr_err("dpll3_m2_clk rate change failed: %d\n", v); 3962f135eafSPaul Walmsley 3972f135eafSPaul Walmsley clk_put(dpll3_m2_ck); 3982f135eafSPaul Walmsley 3992f135eafSPaul Walmsley return v; 4002f135eafSPaul Walmsley } 4012f135eafSPaul Walmsley 402f21af425STony Lindgren #ifdef CONFIG_OMAP_HWMOD 4032092e5ccSPaul Walmsley static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data) 4042092e5ccSPaul Walmsley { 4052092e5ccSPaul Walmsley return omap_hwmod_set_postsetup_state(oh, *(u8 *)data); 4062092e5ccSPaul Walmsley } 4072092e5ccSPaul Walmsley 408293ea3d0SArnd Bergmann static void __init __maybe_unused omap_hwmod_init_postsetup(void) 409120db2cbSTony Lindgren { 4106d63b12dSTony Lindgren u8 postsetup_state = _HWMOD_STATE_DEFAULT; 4112092e5ccSPaul Walmsley 4122092e5ccSPaul Walmsley /* Set the default postsetup state for all hwmods */ 4132092e5ccSPaul Walmsley omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); 4144805734bSPaul Walmsley } 415f21af425STony Lindgren #else 416f21af425STony Lindgren static inline void omap_hwmod_init_postsetup(void) 417f21af425STony Lindgren { 418f21af425STony Lindgren } 419f21af425STony Lindgren #endif 4204805734bSPaul Walmsley 42116110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2420 4228f5b5a41STony Lindgren void __init omap2420_init_early(void) 4238f5b5a41STony Lindgren { 424b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000)); 425b6a4226cSPaul Walmsley omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE), 426b6a4226cSPaul Walmsley OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE)); 4272208bf11STero Kristo omap2_control_base_init(); 4284de34f35SVaibhav Hiremath omap2xxx_check_revision(); 429ab7b2ffcSTero Kristo omap2_prcm_base_init(); 4307b250affSTony Lindgren omap2xxx_voltagedomains_init(); 4317b250affSTony Lindgren omap242x_powerdomains_init(); 4327b250affSTony Lindgren omap242x_clockdomains_init(); 4337b250affSTony Lindgren omap2420_hwmod_init(); 4347b250affSTony Lindgren omap_hwmod_init_postsetup(); 43569a1e7a1STero Kristo omap_clk_soc_init = omap2420_dt_clk_init; 43669a1e7a1STero Kristo rate_table = omap2420_rate_table; 4378f5b5a41STony Lindgren } 43816110798SPaul Walmsley #endif 4398f5b5a41STony Lindgren 44016110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2430 4418f5b5a41STony Lindgren void __init omap2430_init_early(void) 4428f5b5a41STony Lindgren { 443b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000)); 444b6a4226cSPaul Walmsley omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE), 445b6a4226cSPaul Walmsley OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE)); 4462208bf11STero Kristo omap2_control_base_init(); 4474de34f35SVaibhav Hiremath omap2xxx_check_revision(); 448ab7b2ffcSTero Kristo omap2_prcm_base_init(); 4497b250affSTony Lindgren omap2xxx_voltagedomains_init(); 4507b250affSTony Lindgren omap243x_powerdomains_init(); 4517b250affSTony Lindgren omap243x_clockdomains_init(); 4527b250affSTony Lindgren omap2430_hwmod_init(); 4537b250affSTony Lindgren omap_hwmod_init_postsetup(); 45469a1e7a1STero Kristo omap_clk_soc_init = omap2430_dt_clk_init; 45569a1e7a1STero Kristo rate_table = omap2430_rate_table; 4567b250affSTony Lindgren } 457c4e2d245SSanjeev Premi #endif 4587b250affSTony Lindgren 4597b250affSTony Lindgren /* 4607b250affSTony Lindgren * Currently only board-omap3beagle.c should call this because of the 4617b250affSTony Lindgren * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT. 4627b250affSTony Lindgren */ 463c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP3 464*6aeb51c1SArnd Bergmann static void __init omap3_init_early(void) 4657b250affSTony Lindgren { 466b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000)); 467b6a4226cSPaul Walmsley omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE), 468b6a4226cSPaul Walmsley OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE)); 4692208bf11STero Kristo omap2_control_base_init(); 4704de34f35SVaibhav Hiremath omap3xxx_check_revision(); 4714de34f35SVaibhav Hiremath omap3xxx_check_features(); 472ab7b2ffcSTero Kristo omap2_prcm_base_init(); 4737b250affSTony Lindgren omap3xxx_voltagedomains_init(); 4747b250affSTony Lindgren omap3xxx_powerdomains_init(); 4757b250affSTony Lindgren omap3xxx_clockdomains_init(); 4767b250affSTony Lindgren omap3xxx_hwmod_init(); 4777b250affSTony Lindgren omap_hwmod_init_postsetup(); 478db711893SAndrew F. Davis omap_secure_init(); 4798f5b5a41STony Lindgren } 4808f5b5a41STony Lindgren 4818f5b5a41STony Lindgren void __init omap3430_init_early(void) 4828f5b5a41STony Lindgren { 4837b250affSTony Lindgren omap3_init_early(); 4843e049157STero Kristo omap_clk_soc_init = omap3430_dt_clk_init; 4858f5b5a41STony Lindgren } 4868f5b5a41STony Lindgren 4878f5b5a41STony Lindgren void __init omap3630_init_early(void) 4888f5b5a41STony Lindgren { 4897b250affSTony Lindgren omap3_init_early(); 4903e049157STero Kristo omap_clk_soc_init = omap3630_dt_clk_init; 4918f5b5a41STony Lindgren } 4928f5b5a41STony Lindgren 4938f5b5a41STony Lindgren void __init am35xx_init_early(void) 4948f5b5a41STony Lindgren { 4957b250affSTony Lindgren omap3_init_early(); 4963e049157STero Kristo omap_clk_soc_init = am35xx_dt_clk_init; 4978f5b5a41STony Lindgren } 4988f5b5a41STony Lindgren 499bbd707acSShawn Guo void __init omap3_init_late(void) 500bbd707acSShawn Guo { 50102b83dcbSTony Lindgren omap_pm_soc_init = omap3_pm_init; 502bbd707acSShawn Guo } 503bbd707acSShawn Guo 504bbd707acSShawn Guo void __init ti81xx_init_late(void) 505bbd707acSShawn Guo { 50602b83dcbSTony Lindgren omap_pm_soc_init = omap_pm_nop_init; 507bbd707acSShawn Guo } 508c4e2d245SSanjeev Premi #endif 5098f5b5a41STony Lindgren 510a64459c4SAida Mynzhasova #ifdef CONFIG_SOC_TI81XX 511a64459c4SAida Mynzhasova void __init ti814x_init_early(void) 512a64459c4SAida Mynzhasova { 513a64459c4SAida Mynzhasova omap2_set_globals_tap(TI814X_CLASS, 514a64459c4SAida Mynzhasova OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); 5152208bf11STero Kristo omap2_control_base_init(); 516a64459c4SAida Mynzhasova omap3xxx_check_revision(); 517a64459c4SAida Mynzhasova ti81xx_check_features(); 518ab7b2ffcSTero Kristo omap2_prcm_base_init(); 519a64459c4SAida Mynzhasova omap3xxx_voltagedomains_init(); 520a64459c4SAida Mynzhasova omap3xxx_powerdomains_init(); 521185fde6dSTony Lindgren ti814x_clockdomains_init(); 5220f3ccb24STony Lindgren dm814x_hwmod_init(); 523a64459c4SAida Mynzhasova omap_hwmod_init_postsetup(); 5249cf705deSTony Lindgren omap_clk_soc_init = dm814x_dt_clk_init; 525db711893SAndrew F. Davis omap_secure_init(); 526a64459c4SAida Mynzhasova } 527a64459c4SAida Mynzhasova 528a64459c4SAida Mynzhasova void __init ti816x_init_early(void) 529a64459c4SAida Mynzhasova { 530a64459c4SAida Mynzhasova omap2_set_globals_tap(TI816X_CLASS, 531a64459c4SAida Mynzhasova OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); 5322208bf11STero Kristo omap2_control_base_init(); 533a64459c4SAida Mynzhasova omap3xxx_check_revision(); 534a64459c4SAida Mynzhasova ti81xx_check_features(); 535ab7b2ffcSTero Kristo omap2_prcm_base_init(); 536a64459c4SAida Mynzhasova omap3xxx_voltagedomains_init(); 537a64459c4SAida Mynzhasova omap3xxx_powerdomains_init(); 538185fde6dSTony Lindgren ti816x_clockdomains_init(); 5390f3ccb24STony Lindgren dm816x_hwmod_init(); 540a64459c4SAida Mynzhasova omap_hwmod_init_postsetup(); 5419cf705deSTony Lindgren omap_clk_soc_init = dm816x_dt_clk_init; 542db711893SAndrew F. Davis omap_secure_init(); 543a64459c4SAida Mynzhasova } 544a64459c4SAida Mynzhasova #endif 545a64459c4SAida Mynzhasova 54608f30989SAfzal Mohammed #ifdef CONFIG_SOC_AM33XX 54708f30989SAfzal Mohammed void __init am33xx_init_early(void) 54808f30989SAfzal Mohammed { 549b6a4226cSPaul Walmsley omap2_set_globals_tap(AM335X_CLASS, 550b6a4226cSPaul Walmsley AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); 5512208bf11STero Kristo omap2_control_base_init(); 55208f30989SAfzal Mohammed omap3xxx_check_revision(); 5537bcad170SVaibhav Hiremath am33xx_check_features(); 554ab7b2ffcSTero Kristo omap2_prcm_base_init(); 5553f0ea764SVaibhav Hiremath am33xx_powerdomains_init(); 5569c80f3aaSVaibhav Hiremath am33xx_clockdomains_init(); 557149c09d3STero Kristo omap_clk_soc_init = am33xx_dt_clk_init; 558db711893SAndrew F. Davis omap_secure_init(); 55908f30989SAfzal Mohammed } 560765e7a06SNishanth Menon 561765e7a06SNishanth Menon void __init am33xx_init_late(void) 562765e7a06SNishanth Menon { 56302b83dcbSTony Lindgren omap_pm_soc_init = amx3_common_pm_init; 564765e7a06SNishanth Menon } 56508f30989SAfzal Mohammed #endif 56608f30989SAfzal Mohammed 567c5107027SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX 568c5107027SAfzal Mohammed void __init am43xx_init_early(void) 569c5107027SAfzal Mohammed { 570c5107027SAfzal Mohammed omap2_set_globals_tap(AM335X_CLASS, 571c5107027SAfzal Mohammed AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); 5722208bf11STero Kristo omap2_control_base_init(); 573c5107027SAfzal Mohammed omap3xxx_check_revision(); 5747a2e0513SAfzal Mohammed am33xx_check_features(); 575ab7b2ffcSTero Kristo omap2_prcm_base_init(); 5768835cf6eSAmbresh K am43xx_powerdomains_init(); 5778835cf6eSAmbresh K am43xx_clockdomains_init(); 578d941f86fSSekhar Nori omap_l2_cache_init(); 579d22031e2STero Kristo omap_clk_soc_init = am43xx_dt_clk_init; 580db711893SAndrew F. Davis omap_secure_init(); 581c5107027SAfzal Mohammed } 582765e7a06SNishanth Menon 583765e7a06SNishanth Menon void __init am43xx_init_late(void) 584765e7a06SNishanth Menon { 58502b83dcbSTony Lindgren omap_pm_soc_init = amx3_common_pm_init; 586765e7a06SNishanth Menon } 587c5107027SAfzal Mohammed #endif 588c5107027SAfzal Mohammed 589c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP4 5908f5b5a41STony Lindgren void __init omap4430_init_early(void) 5918f5b5a41STony Lindgren { 592b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP443X_CLASS, 593b6a4226cSPaul Walmsley OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE)); 594d9a16f9aSPaul Walmsley omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE)); 595ca125b5eSTero Kristo omap2_control_base_init(); 5964de34f35SVaibhav Hiremath omap4xxx_check_revision(); 5974de34f35SVaibhav Hiremath omap4xxx_check_features(); 598ab7b2ffcSTero Kristo omap2_prcm_base_init(); 599f4b9f40aSTony Lindgren omap4_sar_ram_init(); 6000573b957STony Lindgren omap4_mpuss_early_init(); 601de70af49SNishanth Menon omap4_pm_init_early(); 6027b250affSTony Lindgren omap44xx_voltagedomains_init(); 6037b250affSTony Lindgren omap44xx_powerdomains_init(); 6047b250affSTony Lindgren omap44xx_clockdomains_init(); 605b39b14e6SSekhar Nori omap_l2_cache_init(); 606c8c88d85STero Kristo omap_clk_soc_init = omap4xxx_dt_clk_init; 607db711893SAndrew F. Davis omap_secure_init(); 6088f5b5a41STony Lindgren } 609bbd707acSShawn Guo 610bbd707acSShawn Guo void __init omap4430_init_late(void) 611bbd707acSShawn Guo { 61202b83dcbSTony Lindgren omap_pm_soc_init = omap4_pm_init; 613bbd707acSShawn Guo } 614c4e2d245SSanjeev Premi #endif 6158f5b5a41STony Lindgren 61605e152c7SR Sricharan #ifdef CONFIG_SOC_OMAP5 61705e152c7SR Sricharan void __init omap5_init_early(void) 61805e152c7SR Sricharan { 619b6a4226cSPaul Walmsley omap2_set_globals_tap(OMAP54XX_CLASS, 620b6a4226cSPaul Walmsley OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE)); 621d9a16f9aSPaul Walmsley omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); 622ca125b5eSTero Kristo omap2_control_base_init(); 623ab7b2ffcSTero Kristo omap2_prcm_base_init(); 62405e152c7SR Sricharan omap5xxx_check_revision(); 625f4b9f40aSTony Lindgren omap4_sar_ram_init(); 6268a8be46aSTony Lindgren omap4_mpuss_early_init(); 6278a8be46aSTony Lindgren omap4_pm_init_early(); 628e4020aa9SSantosh Shilimkar omap54xx_voltagedomains_init(); 629e4020aa9SSantosh Shilimkar omap54xx_powerdomains_init(); 630e4020aa9SSantosh Shilimkar omap54xx_clockdomains_init(); 631cfa9667dSTero Kristo omap_clk_soc_init = omap5xxx_dt_clk_init; 632db711893SAndrew F. Davis omap_secure_init(); 63305e152c7SR Sricharan } 634765e7a06SNishanth Menon 635765e7a06SNishanth Menon void __init omap5_init_late(void) 636765e7a06SNishanth Menon { 63702b83dcbSTony Lindgren omap_pm_soc_init = omap4_pm_init; 638765e7a06SNishanth Menon } 63905e152c7SR Sricharan #endif 64005e152c7SR Sricharan 641a3a9384aSR Sricharan #ifdef CONFIG_SOC_DRA7XX 642a3a9384aSR Sricharan void __init dra7xx_init_early(void) 643a3a9384aSR Sricharan { 644ec490f6fSNishanth Menon omap2_set_globals_tap(DRA7XX_CLASS, 645ec490f6fSNishanth Menon OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE)); 646a3a9384aSR Sricharan omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); 647ca125b5eSTero Kristo omap2_control_base_init(); 6486af16a1dSRajendra Nayak omap4_pm_init_early(); 649ab7b2ffcSTero Kristo omap2_prcm_base_init(); 650733d20eeSNishanth Menon dra7xxx_check_revision(); 6517de516a6SAmbresh K dra7xx_powerdomains_init(); 6527de516a6SAmbresh K dra7xx_clockdomains_init(); 653f1cf498eSTero Kristo omap_clk_soc_init = dra7xx_dt_clk_init; 654db711893SAndrew F. Davis omap_secure_init(); 655a3a9384aSR Sricharan } 656765e7a06SNishanth Menon 657765e7a06SNishanth Menon void __init dra7xx_init_late(void) 658765e7a06SNishanth Menon { 65902b83dcbSTony Lindgren omap_pm_soc_init = omap4_pm_init; 660765e7a06SNishanth Menon } 661a3a9384aSR Sricharan #endif 662a3a9384aSR Sricharan 663a3a9384aSR Sricharan 664a4ca9dbeSTony Lindgren void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, 6654805734bSPaul Walmsley struct omap_sdrc_params *sdrc_cs1) 6664805734bSPaul Walmsley { 667a66cb345STony Lindgren omap_sram_init(); 668a66cb345STony Lindgren 66901001712SHemant Pedanekar if (cpu_is_omap24xx() || omap3_has_sdrc()) { 67058cda884SJean Pihet omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 6712f135eafSPaul Walmsley _omap2_init_reprogram_sdrc(); 672aa4b1f6eSKevin Hilman } 6731dbae815STony Lindgren } 674cfa9667dSTero Kristo 675cfa9667dSTero Kristo int __init omap_clk_init(void) 676cfa9667dSTero Kristo { 677cfa9667dSTero Kristo int ret = 0; 678cfa9667dSTero Kristo 679cfa9667dSTero Kristo if (!omap_clk_soc_init) 680cfa9667dSTero Kristo return 0; 681cfa9667dSTero Kristo 6828111e010STero Kristo ti_clk_init_features(); 6838111e010STero Kristo 684e9e63088STero Kristo omap2_clk_setup_ll_ops(); 685e9e63088STero Kristo 686fe87414fSTero Kristo ret = omap_control_init(); 687fe87414fSTero Kristo if (ret) 688fe87414fSTero Kristo return ret; 689fe87414fSTero Kristo 6903a1a388eSTero Kristo ret = omap_prcm_init(); 691c08ee14cSTero Kristo if (ret) 692c08ee14cSTero Kristo return ret; 693c08ee14cSTero Kristo 694c08ee14cSTero Kristo of_clk_init(NULL); 695c08ee14cSTero Kristo 696c08ee14cSTero Kristo ti_dt_clk_init_retry_clks(); 697c08ee14cSTero Kristo 698c08ee14cSTero Kristo ti_dt_clockdomains_setup(); 699c08ee14cSTero Kristo 700cfa9667dSTero Kristo ret = omap_clk_soc_init(); 701cfa9667dSTero Kristo 702cfa9667dSTero Kristo return ret; 703cfa9667dSTero Kristo } 704