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 7*44169075SSantosh 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 * 13*44169075SSantosh Shilimkar * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> 14*44169075SSantosh 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> 241dbae815STony Lindgren 25120db2cbSTony Lindgren #include <asm/tlb.h> 26120db2cbSTony Lindgren 27120db2cbSTony Lindgren #include <asm/mach/map.h> 28120db2cbSTony Lindgren 29a09e64fbSRussell King #include <mach/mux.h> 30a09e64fbSRussell King #include <mach/omapfb.h> 31646e3ed1STony Lindgren #include <mach/sram.h> 32f8de9b2cSPaul Walmsley #include <mach/sdrc.h> 33f8de9b2cSPaul Walmsley #include <mach/gpmc.h> 34646e3ed1STony Lindgren 35*44169075SSantosh Shilimkar #ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdev is ready */ 36646e3ed1STony Lindgren #include "clock.h" 371dbae815STony Lindgren 389717100fSPaul Walmsley #include <mach/powerdomain.h> 399717100fSPaul Walmsley 409717100fSPaul Walmsley #include "powerdomains.h" 419717100fSPaul Walmsley 42801954d3SPaul Walmsley #include <mach/clockdomain.h> 43801954d3SPaul Walmsley #include "clockdomains.h" 44*44169075SSantosh Shilimkar #endif 451dbae815STony Lindgren /* 461dbae815STony Lindgren * The machine specific code may provide the extra mapping besides the 471dbae815STony Lindgren * default mapping provided here. 481dbae815STony Lindgren */ 49cc26b3b0SSyed Mohammed, Khasim 50cc26b3b0SSyed Mohammed, Khasim #ifdef CONFIG_ARCH_OMAP24XX 51cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = { 521dbae815STony Lindgren { 531dbae815STony Lindgren .virtual = L3_24XX_VIRT, 541dbae815STony Lindgren .pfn = __phys_to_pfn(L3_24XX_PHYS), 551dbae815STony Lindgren .length = L3_24XX_SIZE, 561dbae815STony Lindgren .type = MT_DEVICE 571dbae815STony Lindgren }, 5809f21ed4SKyungmin Park { 5909f21ed4SKyungmin Park .virtual = L4_24XX_VIRT, 6009f21ed4SKyungmin Park .pfn = __phys_to_pfn(L4_24XX_PHYS), 6109f21ed4SKyungmin Park .length = L4_24XX_SIZE, 6209f21ed4SKyungmin Park .type = MT_DEVICE 6309f21ed4SKyungmin Park }, 64cc26b3b0SSyed Mohammed, Khasim }; 65cc26b3b0SSyed Mohammed, Khasim 66cc26b3b0SSyed Mohammed, Khasim #ifdef CONFIG_ARCH_OMAP2420 67cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = { 681dbae815STony Lindgren { 69c40fae95STony Lindgren .virtual = DSP_MEM_24XX_VIRT, 70c40fae95STony Lindgren .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS), 71c40fae95STony Lindgren .length = DSP_MEM_24XX_SIZE, 72c40fae95STony Lindgren .type = MT_DEVICE 73c40fae95STony Lindgren }, 74c40fae95STony Lindgren { 75c40fae95STony Lindgren .virtual = DSP_IPI_24XX_VIRT, 76c40fae95STony Lindgren .pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS), 77c40fae95STony Lindgren .length = DSP_IPI_24XX_SIZE, 78c40fae95STony Lindgren .type = MT_DEVICE 79c40fae95STony Lindgren }, 80c40fae95STony Lindgren { 81c40fae95STony Lindgren .virtual = DSP_MMU_24XX_VIRT, 82c40fae95STony Lindgren .pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS), 83c40fae95STony Lindgren .length = DSP_MMU_24XX_SIZE, 841dbae815STony Lindgren .type = MT_DEVICE 85cc26b3b0SSyed Mohammed, Khasim }, 861dbae815STony Lindgren }; 871dbae815STony Lindgren 88cc26b3b0SSyed Mohammed, Khasim #endif 89cc26b3b0SSyed Mohammed, Khasim 90cc26b3b0SSyed Mohammed, Khasim #ifdef CONFIG_ARCH_OMAP2430 91cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = { 92cc26b3b0SSyed Mohammed, Khasim { 93cc26b3b0SSyed Mohammed, Khasim .virtual = L4_WK_243X_VIRT, 94cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_WK_243X_PHYS), 95cc26b3b0SSyed Mohammed, Khasim .length = L4_WK_243X_SIZE, 96cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 97cc26b3b0SSyed Mohammed, Khasim }, 98cc26b3b0SSyed Mohammed, Khasim { 99cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_GPMC_VIRT, 100cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS), 101cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_GPMC_SIZE, 102cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 103cc26b3b0SSyed Mohammed, Khasim }, 104cc26b3b0SSyed Mohammed, Khasim { 105cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SDRC_VIRT, 106cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS), 107cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SDRC_SIZE, 108cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 109cc26b3b0SSyed Mohammed, Khasim }, 110cc26b3b0SSyed Mohammed, Khasim { 111cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP243X_SMS_VIRT, 112cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS), 113cc26b3b0SSyed Mohammed, Khasim .length = OMAP243X_SMS_SIZE, 114cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 115cc26b3b0SSyed Mohammed, Khasim }, 116cc26b3b0SSyed Mohammed, Khasim }; 117cc26b3b0SSyed Mohammed, Khasim #endif 118cc26b3b0SSyed Mohammed, Khasim #endif 119cc26b3b0SSyed Mohammed, Khasim 120cc26b3b0SSyed Mohammed, Khasim #ifdef CONFIG_ARCH_OMAP34XX 121cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = { 122cc26b3b0SSyed Mohammed, Khasim { 123cc26b3b0SSyed Mohammed, Khasim .virtual = L3_34XX_VIRT, 124cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L3_34XX_PHYS), 125cc26b3b0SSyed Mohammed, Khasim .length = L3_34XX_SIZE, 126cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 127cc26b3b0SSyed Mohammed, Khasim }, 128cc26b3b0SSyed Mohammed, Khasim { 129cc26b3b0SSyed Mohammed, Khasim .virtual = L4_34XX_VIRT, 130cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_34XX_PHYS), 131cc26b3b0SSyed Mohammed, Khasim .length = L4_34XX_SIZE, 132cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 133cc26b3b0SSyed Mohammed, Khasim }, 134cc26b3b0SSyed Mohammed, Khasim { 135cc26b3b0SSyed Mohammed, Khasim .virtual = L4_WK_34XX_VIRT, 136cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_WK_34XX_PHYS), 137cc26b3b0SSyed Mohammed, Khasim .length = L4_WK_34XX_SIZE, 138cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 139cc26b3b0SSyed Mohammed, Khasim }, 140cc26b3b0SSyed Mohammed, Khasim { 141cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP34XX_GPMC_VIRT, 142cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS), 143cc26b3b0SSyed Mohammed, Khasim .length = OMAP34XX_GPMC_SIZE, 144cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 145cc26b3b0SSyed Mohammed, Khasim }, 146cc26b3b0SSyed Mohammed, Khasim { 147cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SMS_VIRT, 148cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS), 149cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SMS_SIZE, 150cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 151cc26b3b0SSyed Mohammed, Khasim }, 152cc26b3b0SSyed Mohammed, Khasim { 153cc26b3b0SSyed Mohammed, Khasim .virtual = OMAP343X_SDRC_VIRT, 154cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS), 155cc26b3b0SSyed Mohammed, Khasim .length = OMAP343X_SDRC_SIZE, 156cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 157cc26b3b0SSyed Mohammed, Khasim }, 158cc26b3b0SSyed Mohammed, Khasim { 159cc26b3b0SSyed Mohammed, Khasim .virtual = L4_PER_34XX_VIRT, 160cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_PER_34XX_PHYS), 161cc26b3b0SSyed Mohammed, Khasim .length = L4_PER_34XX_SIZE, 162cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 163cc26b3b0SSyed Mohammed, Khasim }, 164cc26b3b0SSyed Mohammed, Khasim { 165cc26b3b0SSyed Mohammed, Khasim .virtual = L4_EMU_34XX_VIRT, 166cc26b3b0SSyed Mohammed, Khasim .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS), 167cc26b3b0SSyed Mohammed, Khasim .length = L4_EMU_34XX_SIZE, 168cc26b3b0SSyed Mohammed, Khasim .type = MT_DEVICE 169cc26b3b0SSyed Mohammed, Khasim }, 170cc26b3b0SSyed Mohammed, Khasim }; 171cc26b3b0SSyed Mohammed, Khasim #endif 172*44169075SSantosh Shilimkar #ifdef CONFIG_ARCH_OMAP4 173*44169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = { 174*44169075SSantosh Shilimkar { 175*44169075SSantosh Shilimkar .virtual = L3_44XX_VIRT, 176*44169075SSantosh Shilimkar .pfn = __phys_to_pfn(L3_44XX_PHYS), 177*44169075SSantosh Shilimkar .length = L3_44XX_SIZE, 178*44169075SSantosh Shilimkar .type = MT_DEVICE, 179*44169075SSantosh Shilimkar }, 180*44169075SSantosh Shilimkar { 181*44169075SSantosh Shilimkar .virtual = L4_44XX_VIRT, 182*44169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_44XX_PHYS), 183*44169075SSantosh Shilimkar .length = L4_44XX_SIZE, 184*44169075SSantosh Shilimkar .type = MT_DEVICE, 185*44169075SSantosh Shilimkar }, 186*44169075SSantosh Shilimkar { 187*44169075SSantosh Shilimkar .virtual = L4_WK_44XX_VIRT, 188*44169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_WK_44XX_PHYS), 189*44169075SSantosh Shilimkar .length = L4_WK_44XX_SIZE, 190*44169075SSantosh Shilimkar .type = MT_DEVICE, 191*44169075SSantosh Shilimkar }, 192*44169075SSantosh Shilimkar { 193*44169075SSantosh Shilimkar .virtual = OMAP44XX_GPMC_VIRT, 194*44169075SSantosh Shilimkar .pfn = __phys_to_pfn(OMAP44XX_GPMC_PHYS), 195*44169075SSantosh Shilimkar .length = OMAP44XX_GPMC_SIZE, 196*44169075SSantosh Shilimkar .type = MT_DEVICE, 197*44169075SSantosh Shilimkar }, 198*44169075SSantosh Shilimkar { 199*44169075SSantosh Shilimkar .virtual = L4_PER_44XX_VIRT, 200*44169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_PER_44XX_PHYS), 201*44169075SSantosh Shilimkar .length = L4_PER_44XX_SIZE, 202*44169075SSantosh Shilimkar .type = MT_DEVICE, 203*44169075SSantosh Shilimkar }, 204*44169075SSantosh Shilimkar { 205*44169075SSantosh Shilimkar .virtual = L4_EMU_44XX_VIRT, 206*44169075SSantosh Shilimkar .pfn = __phys_to_pfn(L4_EMU_44XX_PHYS), 207*44169075SSantosh Shilimkar .length = L4_EMU_44XX_SIZE, 208*44169075SSantosh Shilimkar .type = MT_DEVICE, 209*44169075SSantosh Shilimkar }, 210*44169075SSantosh Shilimkar }; 211*44169075SSantosh Shilimkar #endif 212cc26b3b0SSyed Mohammed, Khasim 213120db2cbSTony Lindgren void __init omap2_map_common_io(void) 2141dbae815STony Lindgren { 215cc26b3b0SSyed Mohammed, Khasim #if defined(CONFIG_ARCH_OMAP2420) 216cc26b3b0SSyed Mohammed, Khasim iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 217cc26b3b0SSyed Mohammed, Khasim iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 218cc26b3b0SSyed Mohammed, Khasim #endif 219cc26b3b0SSyed Mohammed, Khasim 220cc26b3b0SSyed Mohammed, Khasim #if defined(CONFIG_ARCH_OMAP2430) 221cc26b3b0SSyed Mohammed, Khasim iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 222cc26b3b0SSyed Mohammed, Khasim iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 223cc26b3b0SSyed Mohammed, Khasim #endif 224cc26b3b0SSyed Mohammed, Khasim 225cc26b3b0SSyed Mohammed, Khasim #if defined(CONFIG_ARCH_OMAP34XX) 226cc26b3b0SSyed Mohammed, Khasim iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 227cc26b3b0SSyed Mohammed, Khasim #endif 228120db2cbSTony Lindgren 229*44169075SSantosh Shilimkar #if defined(CONFIG_ARCH_OMAP4) 230*44169075SSantosh Shilimkar iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 231*44169075SSantosh Shilimkar #endif 232120db2cbSTony Lindgren /* Normally devicemaps_init() would flush caches and tlb after 233120db2cbSTony Lindgren * mdesc->map_io(), but we must also do it here because of the CPU 234120db2cbSTony Lindgren * revision check below. 235120db2cbSTony Lindgren */ 236120db2cbSTony Lindgren local_flush_tlb_all(); 237120db2cbSTony Lindgren flush_cache_all(); 238120db2cbSTony Lindgren 2391dbae815STony Lindgren omap2_check_revision(); 2401dbae815STony Lindgren omap_sram_init(); 241b7cc6d46SImre Deak omapfb_reserve_sdram(); 242120db2cbSTony Lindgren } 243120db2cbSTony Lindgren 24487246b75SPaul Walmsley void __init omap2_init_common_hw(struct omap_sdrc_params *sp) 245120db2cbSTony Lindgren { 2461dbae815STony Lindgren omap2_mux_init(); 247*44169075SSantosh Shilimkar #ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once the clkdev is ready */ 2489717100fSPaul Walmsley pwrdm_init(powerdomains_omap); 249801954d3SPaul Walmsley clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); 2501dbae815STony Lindgren omap2_clk_init(); 25187246b75SPaul Walmsley omap2_sdrc_init(sp); 252*44169075SSantosh Shilimkar #endif 2534bbbc1adSJuha Yrjola gpmc_init(); 2541dbae815STony Lindgren } 255