xref: /openbmc/linux/arch/arm/mach-omap2/io.c (revision 69a1e7a1feb5bac44a5a76380768596a12a33050)
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 
2845c3eb7dSTony Lindgren #include <linux/omap-dma.h>
29646e3ed1STony Lindgren 
30dc843280STony Lindgren #include "omap_hwmod.h"
31dbc04161STony Lindgren #include "soc.h"
32ee0839c2STony Lindgren #include "iomap.h"
33ee0839c2STony Lindgren #include "voltage.h"
34ee0839c2STony Lindgren #include "powerdomain.h"
35ee0839c2STony Lindgren #include "clockdomain.h"
36ee0839c2STony Lindgren #include "common.h"
37e30384abSVaibhav Hiremath #include "clock.h"
38e80a9729SPaul Walmsley #include "clock2xxx.h"
39657ebfadSPaul Walmsley #include "clock3xxx.h"
40e80a9729SPaul Walmsley #include "clock44xx.h"
411d5aef49STony Lindgren #include "omap-pm.h"
423e6ece13SPaul Walmsley #include "sdrc.h"
43b6a4226cSPaul Walmsley #include "control.h"
443d82cbbbSTony Lindgren #include "serial.h"
45bf027ca1STony Lindgren #include "sram.h"
46c4ceedcbSPaul Walmsley #include "cm2xxx.h"
47c4ceedcbSPaul Walmsley #include "cm3xxx.h"
48d9a16f9aSPaul Walmsley #include "prm.h"
49d9a16f9aSPaul Walmsley #include "cm.h"
50d9a16f9aSPaul Walmsley #include "prcm_mpu44xx.h"
51d9a16f9aSPaul Walmsley #include "prminst44xx.h"
52d9a16f9aSPaul Walmsley #include "cminst44xx.h"
5363a293e0SPaul Walmsley #include "prm2xxx.h"
5463a293e0SPaul Walmsley #include "prm3xxx.h"
5563a293e0SPaul Walmsley #include "prm44xx.h"
56*69a1e7a1STero Kristo #include "opp2xxx.h"
571dbae815STony Lindgren 
581dbae815STony Lindgren /*
59cfa9667dSTero Kristo  * omap_clk_soc_init: points to a function that does the SoC-specific
60ff931c82SRajendra Nayak  * clock initializations
61ff931c82SRajendra Nayak  */
62cfa9667dSTero Kristo static int (*omap_clk_soc_init)(void);
63ff931c82SRajendra Nayak 
64ff931c82SRajendra Nayak /*
651dbae815STony Lindgren  * The machine specific code may provide the extra mapping besides the
661dbae815STony Lindgren  * default mapping provided here.
671dbae815STony Lindgren  */
68cc26b3b0SSyed Mohammed, Khasim 
69e48f814eSTony Lindgren #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
70cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = {
711dbae815STony Lindgren 	{
721dbae815STony Lindgren 		.virtual	= L3_24XX_VIRT,
731dbae815STony Lindgren 		.pfn		= __phys_to_pfn(L3_24XX_PHYS),
741dbae815STony Lindgren 		.length		= L3_24XX_SIZE,
751dbae815STony Lindgren 		.type		= MT_DEVICE
761dbae815STony Lindgren 	},
7709f21ed4SKyungmin Park 	{
7809f21ed4SKyungmin Park 		.virtual	= L4_24XX_VIRT,
7909f21ed4SKyungmin Park 		.pfn		= __phys_to_pfn(L4_24XX_PHYS),
8009f21ed4SKyungmin Park 		.length		= L4_24XX_SIZE,
8109f21ed4SKyungmin Park 		.type		= MT_DEVICE
8209f21ed4SKyungmin Park 	},
83cc26b3b0SSyed Mohammed, Khasim };
84cc26b3b0SSyed Mohammed, Khasim 
8559b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420
86cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = {
871dbae815STony Lindgren 	{
887adb9987SPaul Walmsley 		.virtual	= DSP_MEM_2420_VIRT,
897adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_MEM_2420_PHYS),
907adb9987SPaul Walmsley 		.length		= DSP_MEM_2420_SIZE,
91c40fae95STony Lindgren 		.type		= MT_DEVICE
92c40fae95STony Lindgren 	},
93c40fae95STony Lindgren 	{
947adb9987SPaul Walmsley 		.virtual	= DSP_IPI_2420_VIRT,
957adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_IPI_2420_PHYS),
967adb9987SPaul Walmsley 		.length		= DSP_IPI_2420_SIZE,
97c40fae95STony Lindgren 		.type		= MT_DEVICE
98c40fae95STony Lindgren 	},
99c40fae95STony Lindgren 	{
1007adb9987SPaul Walmsley 		.virtual	= DSP_MMU_2420_VIRT,
1017adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_MMU_2420_PHYS),
1027adb9987SPaul Walmsley 		.length		= DSP_MMU_2420_SIZE,
1031dbae815STony Lindgren 		.type		= MT_DEVICE
104cc26b3b0SSyed Mohammed, Khasim 	},
1051dbae815STony Lindgren };
1061dbae815STony Lindgren 
107cc26b3b0SSyed Mohammed, Khasim #endif
108cc26b3b0SSyed Mohammed, Khasim 
10959b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430
110cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = {
111cc26b3b0SSyed Mohammed, Khasim 	{
112cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_WK_243X_VIRT,
113cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_WK_243X_PHYS),
114cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_WK_243X_SIZE,
115cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
116cc26b3b0SSyed Mohammed, Khasim 	},
117cc26b3b0SSyed Mohammed, Khasim 	{
118cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_GPMC_VIRT,
119cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_GPMC_PHYS),
120cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_GPMC_SIZE,
121cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
122cc26b3b0SSyed Mohammed, Khasim 	},
123cc26b3b0SSyed Mohammed, Khasim 	{
124cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_SDRC_VIRT,
125cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_SDRC_PHYS),
126cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_SDRC_SIZE,
127cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
128cc26b3b0SSyed Mohammed, Khasim 	},
129cc26b3b0SSyed Mohammed, Khasim 	{
130cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_SMS_VIRT,
131cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_SMS_PHYS),
132cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_SMS_SIZE,
133cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
134cc26b3b0SSyed Mohammed, Khasim 	},
135cc26b3b0SSyed Mohammed, Khasim };
136cc26b3b0SSyed Mohammed, Khasim #endif
137cc26b3b0SSyed Mohammed, Khasim #endif
138cc26b3b0SSyed Mohammed, Khasim 
139a8eb7ca0STony Lindgren #ifdef	CONFIG_ARCH_OMAP3
140cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = {
141cc26b3b0SSyed Mohammed, Khasim 	{
142cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L3_34XX_VIRT,
143cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L3_34XX_PHYS),
144cc26b3b0SSyed Mohammed, Khasim 		.length		= L3_34XX_SIZE,
145cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
146cc26b3b0SSyed Mohammed, Khasim 	},
147cc26b3b0SSyed Mohammed, Khasim 	{
148cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_34XX_VIRT,
149cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
150cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_34XX_SIZE,
151cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
152cc26b3b0SSyed Mohammed, Khasim 	},
153cc26b3b0SSyed Mohammed, Khasim 	{
154cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP34XX_GPMC_VIRT,
155cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP34XX_GPMC_PHYS),
156cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP34XX_GPMC_SIZE,
157cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
158cc26b3b0SSyed Mohammed, Khasim 	},
159cc26b3b0SSyed Mohammed, Khasim 	{
160cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP343X_SMS_VIRT,
161cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP343X_SMS_PHYS),
162cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP343X_SMS_SIZE,
163cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
164cc26b3b0SSyed Mohammed, Khasim 	},
165cc26b3b0SSyed Mohammed, Khasim 	{
166cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP343X_SDRC_VIRT,
167cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP343X_SDRC_PHYS),
168cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP343X_SDRC_SIZE,
169cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
170cc26b3b0SSyed Mohammed, Khasim 	},
171cc26b3b0SSyed Mohammed, Khasim 	{
172cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_PER_34XX_VIRT,
173cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_PER_34XX_PHYS),
174cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_PER_34XX_SIZE,
175cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
176cc26b3b0SSyed Mohammed, Khasim 	},
177cc26b3b0SSyed Mohammed, Khasim 	{
178cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_EMU_34XX_VIRT,
179cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_EMU_34XX_PHYS),
180cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_EMU_34XX_SIZE,
181cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
182cc26b3b0SSyed Mohammed, Khasim 	},
183cc26b3b0SSyed Mohammed, Khasim };
184cc26b3b0SSyed Mohammed, Khasim #endif
18501001712SHemant Pedanekar 
18633959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX
187a920360fSHemant Pedanekar static struct map_desc omapti81xx_io_desc[] __initdata = {
18801001712SHemant Pedanekar 	{
18901001712SHemant Pedanekar 		.virtual	= L4_34XX_VIRT,
19001001712SHemant Pedanekar 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
19101001712SHemant Pedanekar 		.length		= L4_34XX_SIZE,
19201001712SHemant Pedanekar 		.type		= MT_DEVICE
1931e6cb146SAfzal Mohammed 	}
1941e6cb146SAfzal Mohammed };
1951e6cb146SAfzal Mohammed #endif
1961e6cb146SAfzal Mohammed 
197addb154aSAfzal Mohammed #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
1981e6cb146SAfzal Mohammed static struct map_desc omapam33xx_io_desc[] __initdata = {
19901001712SHemant Pedanekar 	{
20001001712SHemant Pedanekar 		.virtual	= L4_34XX_VIRT,
20101001712SHemant Pedanekar 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
20201001712SHemant Pedanekar 		.length		= L4_34XX_SIZE,
20301001712SHemant Pedanekar 		.type		= MT_DEVICE
20401001712SHemant Pedanekar 	},
2051e6cb146SAfzal Mohammed 	{
2061e6cb146SAfzal Mohammed 		.virtual	= L4_WK_AM33XX_VIRT,
2071e6cb146SAfzal Mohammed 		.pfn		= __phys_to_pfn(L4_WK_AM33XX_PHYS),
2081e6cb146SAfzal Mohammed 		.length		= L4_WK_AM33XX_SIZE,
2091e6cb146SAfzal Mohammed 		.type		= MT_DEVICE
2101e6cb146SAfzal Mohammed 	}
21101001712SHemant Pedanekar };
21201001712SHemant Pedanekar #endif
21301001712SHemant Pedanekar 
21444169075SSantosh Shilimkar #ifdef	CONFIG_ARCH_OMAP4
21544169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = {
21644169075SSantosh Shilimkar 	{
21744169075SSantosh Shilimkar 		.virtual	= L3_44XX_VIRT,
21844169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L3_44XX_PHYS),
21944169075SSantosh Shilimkar 		.length		= L3_44XX_SIZE,
22044169075SSantosh Shilimkar 		.type		= MT_DEVICE,
22144169075SSantosh Shilimkar 	},
22244169075SSantosh Shilimkar 	{
22344169075SSantosh Shilimkar 		.virtual	= L4_44XX_VIRT,
22444169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_44XX_PHYS),
22544169075SSantosh Shilimkar 		.length		= L4_44XX_SIZE,
22644169075SSantosh Shilimkar 		.type		= MT_DEVICE,
22744169075SSantosh Shilimkar 	},
22844169075SSantosh Shilimkar 	{
22944169075SSantosh Shilimkar 		.virtual	= L4_PER_44XX_VIRT,
23044169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_PER_44XX_PHYS),
23144169075SSantosh Shilimkar 		.length		= L4_PER_44XX_SIZE,
23244169075SSantosh Shilimkar 		.type		= MT_DEVICE,
23344169075SSantosh Shilimkar 	},
234137d105dSSantosh Shilimkar #ifdef CONFIG_OMAP4_ERRATA_I688
235137d105dSSantosh Shilimkar 	{
236137d105dSSantosh Shilimkar 		.virtual	= OMAP4_SRAM_VA,
237137d105dSSantosh Shilimkar 		.pfn		= __phys_to_pfn(OMAP4_SRAM_PA),
238137d105dSSantosh Shilimkar 		.length		= PAGE_SIZE,
2392e2c9de2SRussell King 		.type		= MT_MEMORY_RW_SO,
240137d105dSSantosh Shilimkar 	},
241137d105dSSantosh Shilimkar #endif
242137d105dSSantosh Shilimkar 
24344169075SSantosh Shilimkar };
24444169075SSantosh Shilimkar #endif
245cc26b3b0SSyed Mohammed, Khasim 
246a3a9384aSR Sricharan #if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
24705e152c7SR Sricharan static struct map_desc omap54xx_io_desc[] __initdata = {
24805e152c7SR Sricharan 	{
24905e152c7SR Sricharan 		.virtual	= L3_54XX_VIRT,
25005e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L3_54XX_PHYS),
25105e152c7SR Sricharan 		.length		= L3_54XX_SIZE,
25205e152c7SR Sricharan 		.type		= MT_DEVICE,
25305e152c7SR Sricharan 	},
25405e152c7SR Sricharan 	{
25505e152c7SR Sricharan 		.virtual	= L4_54XX_VIRT,
25605e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_54XX_PHYS),
25705e152c7SR Sricharan 		.length		= L4_54XX_SIZE,
25805e152c7SR Sricharan 		.type		= MT_DEVICE,
25905e152c7SR Sricharan 	},
26005e152c7SR Sricharan 	{
26105e152c7SR Sricharan 		.virtual	= L4_WK_54XX_VIRT,
26205e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_WK_54XX_PHYS),
26305e152c7SR Sricharan 		.length		= L4_WK_54XX_SIZE,
26405e152c7SR Sricharan 		.type		= MT_DEVICE,
26505e152c7SR Sricharan 	},
26605e152c7SR Sricharan 	{
26705e152c7SR Sricharan 		.virtual	= L4_PER_54XX_VIRT,
26805e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_PER_54XX_PHYS),
26905e152c7SR Sricharan 		.length		= L4_PER_54XX_SIZE,
27005e152c7SR Sricharan 		.type		= MT_DEVICE,
27105e152c7SR Sricharan 	},
2721348bbf9SSantosh Shilimkar #ifdef CONFIG_OMAP4_ERRATA_I688
2731348bbf9SSantosh Shilimkar 	{
2741348bbf9SSantosh Shilimkar 		.virtual	= OMAP4_SRAM_VA,
2751348bbf9SSantosh Shilimkar 		.pfn		= __phys_to_pfn(OMAP4_SRAM_PA),
2761348bbf9SSantosh Shilimkar 		.length		= PAGE_SIZE,
2772e2c9de2SRussell King 		.type		= MT_MEMORY_RW_SO,
2781348bbf9SSantosh Shilimkar 	},
2791348bbf9SSantosh Shilimkar #endif
28005e152c7SR Sricharan };
28105e152c7SR Sricharan #endif
28205e152c7SR Sricharan 
28359b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420
284b6a4226cSPaul Walmsley void __init omap242x_map_io(void)
2856fbd55d0STony Lindgren {
2866fbd55d0STony Lindgren 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
2876fbd55d0STony Lindgren 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
2886fbd55d0STony Lindgren }
2896fbd55d0STony Lindgren #endif
2906fbd55d0STony Lindgren 
29159b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430
292b6a4226cSPaul Walmsley void __init omap243x_map_io(void)
2936fbd55d0STony Lindgren {
2946fbd55d0STony Lindgren 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
2956fbd55d0STony Lindgren 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
2966fbd55d0STony Lindgren }
2976fbd55d0STony Lindgren #endif
2986fbd55d0STony Lindgren 
299a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3
300b6a4226cSPaul Walmsley void __init omap3_map_io(void)
3016fbd55d0STony Lindgren {
3026fbd55d0STony Lindgren 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
3036fbd55d0STony Lindgren }
3046fbd55d0STony Lindgren #endif
3056fbd55d0STony Lindgren 
30633959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX
307b6a4226cSPaul Walmsley void __init ti81xx_map_io(void)
30801001712SHemant Pedanekar {
309a920360fSHemant Pedanekar 	iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
31001001712SHemant Pedanekar }
31101001712SHemant Pedanekar #endif
31201001712SHemant Pedanekar 
313addb154aSAfzal Mohammed #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
314b6a4226cSPaul Walmsley void __init am33xx_map_io(void)
3151e6cb146SAfzal Mohammed {
3161e6cb146SAfzal Mohammed 	iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
3176fbd55d0STony Lindgren }
3186fbd55d0STony Lindgren #endif
3196fbd55d0STony Lindgren 
3206fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP4
321b6a4226cSPaul Walmsley void __init omap4_map_io(void)
3226fbd55d0STony Lindgren {
3236fbd55d0STony Lindgren 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
3242ec1fc4eSSantosh Shilimkar 	omap_barriers_init();
3256fbd55d0STony Lindgren }
3266fbd55d0STony Lindgren #endif
3276fbd55d0STony Lindgren 
328a3a9384aSR Sricharan #if defined(CONFIG_SOC_OMAP5) ||  defined(CONFIG_SOC_DRA7XX)
329b6a4226cSPaul Walmsley void __init omap5_map_io(void)
33005e152c7SR Sricharan {
33105e152c7SR Sricharan 	iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
3321348bbf9SSantosh Shilimkar 	omap_barriers_init();
33305e152c7SR Sricharan }
33405e152c7SR Sricharan #endif
3352f135eafSPaul Walmsley /*
3362f135eafSPaul Walmsley  * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
3372f135eafSPaul Walmsley  *
3382f135eafSPaul Walmsley  * Sets the CORE DPLL3 M2 divider to the same value that it's at
3392f135eafSPaul Walmsley  * currently.  This has the effect of setting the SDRC SDRAM AC timing
3402f135eafSPaul Walmsley  * registers to the values currently defined by the kernel.  Currently
3412f135eafSPaul Walmsley  * only defined for OMAP3; will return 0 if called on OMAP2.  Returns
3422f135eafSPaul Walmsley  * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2,
3432f135eafSPaul Walmsley  * or passes along the return value of clk_set_rate().
3442f135eafSPaul Walmsley  */
3452f135eafSPaul Walmsley static int __init _omap2_init_reprogram_sdrc(void)
3462f135eafSPaul Walmsley {
3472f135eafSPaul Walmsley 	struct clk *dpll3_m2_ck;
3482f135eafSPaul Walmsley 	int v = -EINVAL;
3492f135eafSPaul Walmsley 	long rate;
3502f135eafSPaul Walmsley 
3512f135eafSPaul Walmsley 	if (!cpu_is_omap34xx())
3522f135eafSPaul Walmsley 		return 0;
3532f135eafSPaul Walmsley 
3542f135eafSPaul Walmsley 	dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck");
355e281f7ecSAaro Koskinen 	if (IS_ERR(dpll3_m2_ck))
3562f135eafSPaul Walmsley 		return -EINVAL;
3572f135eafSPaul Walmsley 
3582f135eafSPaul Walmsley 	rate = clk_get_rate(dpll3_m2_ck);
3592f135eafSPaul Walmsley 	pr_info("Reprogramming SDRC clock to %ld Hz\n", rate);
3602f135eafSPaul Walmsley 	v = clk_set_rate(dpll3_m2_ck, rate);
3612f135eafSPaul Walmsley 	if (v)
3622f135eafSPaul Walmsley 		pr_err("dpll3_m2_clk rate change failed: %d\n", v);
3632f135eafSPaul Walmsley 
3642f135eafSPaul Walmsley 	clk_put(dpll3_m2_ck);
3652f135eafSPaul Walmsley 
3662f135eafSPaul Walmsley 	return v;
3672f135eafSPaul Walmsley }
3682f135eafSPaul Walmsley 
3692092e5ccSPaul Walmsley static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
3702092e5ccSPaul Walmsley {
3712092e5ccSPaul Walmsley 	return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
3722092e5ccSPaul Walmsley }
3732092e5ccSPaul Walmsley 
3747b250affSTony Lindgren static void __init omap_hwmod_init_postsetup(void)
375120db2cbSTony Lindgren {
3762092e5ccSPaul Walmsley 	u8 postsetup_state;
3772092e5ccSPaul Walmsley 
3782092e5ccSPaul Walmsley 	/* Set the default postsetup state for all hwmods */
3792092e5ccSPaul Walmsley #ifdef CONFIG_PM_RUNTIME
3802092e5ccSPaul Walmsley 	postsetup_state = _HWMOD_STATE_IDLE;
3812092e5ccSPaul Walmsley #else
3822092e5ccSPaul Walmsley 	postsetup_state = _HWMOD_STATE_ENABLED;
3832092e5ccSPaul Walmsley #endif
3842092e5ccSPaul Walmsley 	omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
38555d2cb08SBenoit Cousson 
38653da4ce2SKevin Hilman 	omap_pm_if_early_init();
3874805734bSPaul Walmsley }
3884805734bSPaul Walmsley 
389069d0a78SArnd Bergmann static void __init __maybe_unused omap_common_late_init(void)
3904ed12be0SRuslan Bilovol {
3914ed12be0SRuslan Bilovol 	omap_mux_late_init();
3924ed12be0SRuslan Bilovol 	omap2_common_pm_late_init();
3936770b211SRuslan Bilovol 	omap_soc_device_init();
3944ed12be0SRuslan Bilovol }
3954ed12be0SRuslan Bilovol 
39616110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2420
3978f5b5a41STony Lindgren void __init omap2420_init_early(void)
3988f5b5a41STony Lindgren {
399b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
400b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
401b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
402b6a4226cSPaul Walmsley 	omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
403b6a4226cSPaul Walmsley 				  NULL);
404d9a16f9aSPaul Walmsley 	omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
405d9a16f9aSPaul Walmsley 	omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
4064de34f35SVaibhav Hiremath 	omap2xxx_check_revision();
40763a293e0SPaul Walmsley 	omap2xxx_prm_init();
408c4ceedcbSPaul Walmsley 	omap2xxx_cm_init();
4097b250affSTony Lindgren 	omap2xxx_voltagedomains_init();
4107b250affSTony Lindgren 	omap242x_powerdomains_init();
4117b250affSTony Lindgren 	omap242x_clockdomains_init();
4127b250affSTony Lindgren 	omap2420_hwmod_init();
4137b250affSTony Lindgren 	omap_hwmod_init_postsetup();
414*69a1e7a1STero Kristo 	if (of_have_populated_dt()) {
415*69a1e7a1STero Kristo 		omap_clk_soc_init = omap2420_dt_clk_init;
416*69a1e7a1STero Kristo 		rate_table = omap2420_rate_table;
417*69a1e7a1STero Kristo 	} else {
418cfa9667dSTero Kristo 		omap_clk_soc_init = omap2420_clk_init;
4198f5b5a41STony Lindgren 	}
420*69a1e7a1STero Kristo }
421bbd707acSShawn Guo 
422bbd707acSShawn Guo void __init omap2420_init_late(void)
423bbd707acSShawn Guo {
4244ed12be0SRuslan Bilovol 	omap_common_late_init();
425bbd707acSShawn Guo 	omap2_pm_init();
42623fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
427bbd707acSShawn Guo }
42816110798SPaul Walmsley #endif
4298f5b5a41STony Lindgren 
43016110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2430
4318f5b5a41STony Lindgren void __init omap2430_init_early(void)
4328f5b5a41STony Lindgren {
433b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
434b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
435b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
436b6a4226cSPaul Walmsley 	omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
437b6a4226cSPaul Walmsley 				  NULL);
438d9a16f9aSPaul Walmsley 	omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
439d9a16f9aSPaul Walmsley 	omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
4404de34f35SVaibhav Hiremath 	omap2xxx_check_revision();
44163a293e0SPaul Walmsley 	omap2xxx_prm_init();
442c4ceedcbSPaul Walmsley 	omap2xxx_cm_init();
4437b250affSTony Lindgren 	omap2xxx_voltagedomains_init();
4447b250affSTony Lindgren 	omap243x_powerdomains_init();
4457b250affSTony Lindgren 	omap243x_clockdomains_init();
4467b250affSTony Lindgren 	omap2430_hwmod_init();
4477b250affSTony Lindgren 	omap_hwmod_init_postsetup();
448*69a1e7a1STero Kristo 	if (of_have_populated_dt()) {
449*69a1e7a1STero Kristo 		omap_clk_soc_init = omap2430_dt_clk_init;
450*69a1e7a1STero Kristo 		rate_table = omap2430_rate_table;
451*69a1e7a1STero Kristo 	} else {
452cfa9667dSTero Kristo 		omap_clk_soc_init = omap2430_clk_init;
4537b250affSTony Lindgren 	}
454*69a1e7a1STero Kristo }
455bbd707acSShawn Guo 
456bbd707acSShawn Guo void __init omap2430_init_late(void)
457bbd707acSShawn Guo {
4584ed12be0SRuslan Bilovol 	omap_common_late_init();
459bbd707acSShawn Guo 	omap2_pm_init();
46023fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
461bbd707acSShawn Guo }
462c4e2d245SSanjeev Premi #endif
4637b250affSTony Lindgren 
4647b250affSTony Lindgren /*
4657b250affSTony Lindgren  * Currently only board-omap3beagle.c should call this because of the
4667b250affSTony Lindgren  * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
4677b250affSTony Lindgren  */
468c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP3
4697b250affSTony Lindgren void __init omap3_init_early(void)
4707b250affSTony Lindgren {
471b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
472b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
473b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
474b6a4226cSPaul Walmsley 	omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
475b6a4226cSPaul Walmsley 				  NULL);
476d9a16f9aSPaul Walmsley 	omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
477d9a16f9aSPaul Walmsley 	omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
4784de34f35SVaibhav Hiremath 	omap3xxx_check_revision();
4794de34f35SVaibhav Hiremath 	omap3xxx_check_features();
48063a293e0SPaul Walmsley 	omap3xxx_prm_init();
481c4ceedcbSPaul Walmsley 	omap3xxx_cm_init();
4827b250affSTony Lindgren 	omap3xxx_voltagedomains_init();
4837b250affSTony Lindgren 	omap3xxx_powerdomains_init();
4847b250affSTony Lindgren 	omap3xxx_clockdomains_init();
4857b250affSTony Lindgren 	omap3xxx_hwmod_init();
4867b250affSTony Lindgren 	omap_hwmod_init_postsetup();
487cfa9667dSTero Kristo 	omap_clk_soc_init = omap3xxx_clk_init;
4888f5b5a41STony Lindgren }
4898f5b5a41STony Lindgren 
4908f5b5a41STony Lindgren void __init omap3430_init_early(void)
4918f5b5a41STony Lindgren {
4927b250affSTony Lindgren 	omap3_init_early();
4933e049157STero Kristo 	if (of_have_populated_dt())
4943e049157STero Kristo 		omap_clk_soc_init = omap3430_dt_clk_init;
4958f5b5a41STony Lindgren }
4968f5b5a41STony Lindgren 
4978f5b5a41STony Lindgren void __init omap35xx_init_early(void)
4988f5b5a41STony Lindgren {
4997b250affSTony Lindgren 	omap3_init_early();
5003e049157STero Kristo 	if (of_have_populated_dt())
5013e049157STero Kristo 		omap_clk_soc_init = omap3430_dt_clk_init;
5028f5b5a41STony Lindgren }
5038f5b5a41STony Lindgren 
5048f5b5a41STony Lindgren void __init omap3630_init_early(void)
5058f5b5a41STony Lindgren {
5067b250affSTony Lindgren 	omap3_init_early();
5073e049157STero Kristo 	if (of_have_populated_dt())
5083e049157STero Kristo 		omap_clk_soc_init = omap3630_dt_clk_init;
5098f5b5a41STony Lindgren }
5108f5b5a41STony Lindgren 
5118f5b5a41STony Lindgren void __init am35xx_init_early(void)
5128f5b5a41STony Lindgren {
5137b250affSTony Lindgren 	omap3_init_early();
5143e049157STero Kristo 	if (of_have_populated_dt())
5153e049157STero Kristo 		omap_clk_soc_init = am35xx_dt_clk_init;
5168f5b5a41STony Lindgren }
5178f5b5a41STony Lindgren 
518a920360fSHemant Pedanekar void __init ti81xx_init_early(void)
5198f5b5a41STony Lindgren {
520b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP343X_CLASS,
521b6a4226cSPaul Walmsley 			      OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
522b6a4226cSPaul Walmsley 	omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
523b6a4226cSPaul Walmsley 				  NULL);
524d9a16f9aSPaul Walmsley 	omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
525d9a16f9aSPaul Walmsley 	omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
5264de34f35SVaibhav Hiremath 	omap3xxx_check_revision();
5274de34f35SVaibhav Hiremath 	ti81xx_check_features();
5284c3cf901STony Lindgren 	omap3xxx_voltagedomains_init();
5294c3cf901STony Lindgren 	omap3xxx_powerdomains_init();
5304c3cf901STony Lindgren 	omap3xxx_clockdomains_init();
5314c3cf901STony Lindgren 	omap3xxx_hwmod_init();
5324c3cf901STony Lindgren 	omap_hwmod_init_postsetup();
5333e049157STero Kristo 	if (of_have_populated_dt())
5343e049157STero Kristo 		omap_clk_soc_init = ti81xx_dt_clk_init;
5353e049157STero Kristo 	else
536cfa9667dSTero Kristo 		omap_clk_soc_init = omap3xxx_clk_init;
5378f5b5a41STony Lindgren }
538bbd707acSShawn Guo 
539bbd707acSShawn Guo void __init omap3_init_late(void)
540bbd707acSShawn Guo {
5414ed12be0SRuslan Bilovol 	omap_common_late_init();
542bbd707acSShawn Guo 	omap3_pm_init();
54323fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
544bbd707acSShawn Guo }
545bbd707acSShawn Guo 
546bbd707acSShawn Guo void __init omap3430_init_late(void)
547bbd707acSShawn Guo {
5484ed12be0SRuslan Bilovol 	omap_common_late_init();
549bbd707acSShawn Guo 	omap3_pm_init();
55023fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
551bbd707acSShawn Guo }
552bbd707acSShawn Guo 
553bbd707acSShawn Guo void __init omap35xx_init_late(void)
554bbd707acSShawn Guo {
5554ed12be0SRuslan Bilovol 	omap_common_late_init();
556bbd707acSShawn Guo 	omap3_pm_init();
55723fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
558bbd707acSShawn Guo }
559bbd707acSShawn Guo 
560bbd707acSShawn Guo void __init omap3630_init_late(void)
561bbd707acSShawn Guo {
5624ed12be0SRuslan Bilovol 	omap_common_late_init();
563bbd707acSShawn Guo 	omap3_pm_init();
56423fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
565bbd707acSShawn Guo }
566bbd707acSShawn Guo 
567bbd707acSShawn Guo void __init am35xx_init_late(void)
568bbd707acSShawn Guo {
5694ed12be0SRuslan Bilovol 	omap_common_late_init();
570bbd707acSShawn Guo 	omap3_pm_init();
57123fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
572bbd707acSShawn Guo }
573bbd707acSShawn Guo 
574bbd707acSShawn Guo void __init ti81xx_init_late(void)
575bbd707acSShawn Guo {
5764ed12be0SRuslan Bilovol 	omap_common_late_init();
577bbd707acSShawn Guo 	omap3_pm_init();
57823fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
579bbd707acSShawn Guo }
580c4e2d245SSanjeev Premi #endif
5818f5b5a41STony Lindgren 
58208f30989SAfzal Mohammed #ifdef CONFIG_SOC_AM33XX
58308f30989SAfzal Mohammed void __init am33xx_init_early(void)
58408f30989SAfzal Mohammed {
585b6a4226cSPaul Walmsley 	omap2_set_globals_tap(AM335X_CLASS,
586b6a4226cSPaul Walmsley 			      AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
587b6a4226cSPaul Walmsley 	omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
588b6a4226cSPaul Walmsley 				  NULL);
589d9a16f9aSPaul Walmsley 	omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
590d9a16f9aSPaul Walmsley 	omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
59108f30989SAfzal Mohammed 	omap3xxx_check_revision();
5927bcad170SVaibhav Hiremath 	am33xx_check_features();
5933f0ea764SVaibhav Hiremath 	am33xx_powerdomains_init();
5949c80f3aaSVaibhav Hiremath 	am33xx_clockdomains_init();
595a2cfc509SVaibhav Hiremath 	am33xx_hwmod_init();
596a2cfc509SVaibhav Hiremath 	omap_hwmod_init_postsetup();
597149c09d3STero Kristo 	omap_clk_soc_init = am33xx_dt_clk_init;
59808f30989SAfzal Mohammed }
599765e7a06SNishanth Menon 
600765e7a06SNishanth Menon void __init am33xx_init_late(void)
601765e7a06SNishanth Menon {
602765e7a06SNishanth Menon 	omap_common_late_init();
603765e7a06SNishanth Menon }
60408f30989SAfzal Mohammed #endif
60508f30989SAfzal Mohammed 
606c5107027SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX
607c5107027SAfzal Mohammed void __init am43xx_init_early(void)
608c5107027SAfzal Mohammed {
609c5107027SAfzal Mohammed 	omap2_set_globals_tap(AM335X_CLASS,
610c5107027SAfzal Mohammed 			      AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
611c5107027SAfzal Mohammed 	omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
612c5107027SAfzal Mohammed 				  NULL);
613c5107027SAfzal Mohammed 	omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
614c5107027SAfzal Mohammed 	omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
6158835cf6eSAmbresh K 	omap_prm_base_init();
6168835cf6eSAmbresh K 	omap_cm_base_init();
617c5107027SAfzal Mohammed 	omap3xxx_check_revision();
6187a2e0513SAfzal Mohammed 	am33xx_check_features();
6198835cf6eSAmbresh K 	am43xx_powerdomains_init();
6208835cf6eSAmbresh K 	am43xx_clockdomains_init();
6218835cf6eSAmbresh K 	am43xx_hwmod_init();
6228835cf6eSAmbresh K 	omap_hwmod_init_postsetup();
623d941f86fSSekhar Nori 	omap_l2_cache_init();
624d22031e2STero Kristo 	omap_clk_soc_init = am43xx_dt_clk_init;
625c5107027SAfzal Mohammed }
626765e7a06SNishanth Menon 
627765e7a06SNishanth Menon void __init am43xx_init_late(void)
628765e7a06SNishanth Menon {
629765e7a06SNishanth Menon 	omap_common_late_init();
630765e7a06SNishanth Menon }
631c5107027SAfzal Mohammed #endif
632c5107027SAfzal Mohammed 
633c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP4
6348f5b5a41STony Lindgren void __init omap4430_init_early(void)
6358f5b5a41STony Lindgren {
636b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP443X_CLASS,
637b6a4226cSPaul Walmsley 			      OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
638b6a4226cSPaul Walmsley 	omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
639b6a4226cSPaul Walmsley 				  OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
640d9a16f9aSPaul Walmsley 	omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
641d9a16f9aSPaul Walmsley 	omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
642d9a16f9aSPaul Walmsley 			     OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
643d9a16f9aSPaul Walmsley 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
644d9a16f9aSPaul Walmsley 	omap_prm_base_init();
645d9a16f9aSPaul Walmsley 	omap_cm_base_init();
6464de34f35SVaibhav Hiremath 	omap4xxx_check_revision();
6474de34f35SVaibhav Hiremath 	omap4xxx_check_features();
648de70af49SNishanth Menon 	omap4_pm_init_early();
64963a293e0SPaul Walmsley 	omap44xx_prm_init();
6507b250affSTony Lindgren 	omap44xx_voltagedomains_init();
6517b250affSTony Lindgren 	omap44xx_powerdomains_init();
6527b250affSTony Lindgren 	omap44xx_clockdomains_init();
6537b250affSTony Lindgren 	omap44xx_hwmod_init();
6547b250affSTony Lindgren 	omap_hwmod_init_postsetup();
655b39b14e6SSekhar Nori 	omap_l2_cache_init();
656c8c88d85STero Kristo 	omap_clk_soc_init = omap4xxx_dt_clk_init;
6578f5b5a41STony Lindgren }
658bbd707acSShawn Guo 
659bbd707acSShawn Guo void __init omap4430_init_late(void)
660bbd707acSShawn Guo {
6614ed12be0SRuslan Bilovol 	omap_common_late_init();
662bbd707acSShawn Guo 	omap4_pm_init();
66323fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
664bbd707acSShawn Guo }
665c4e2d245SSanjeev Premi #endif
6668f5b5a41STony Lindgren 
66705e152c7SR Sricharan #ifdef CONFIG_SOC_OMAP5
66805e152c7SR Sricharan void __init omap5_init_early(void)
66905e152c7SR Sricharan {
670b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP54XX_CLASS,
671b6a4226cSPaul Walmsley 			      OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
672b6a4226cSPaul Walmsley 	omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
673b6a4226cSPaul Walmsley 				  OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
674d9a16f9aSPaul Walmsley 	omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
675d9a16f9aSPaul Walmsley 	omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
676d9a16f9aSPaul Walmsley 			     OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
677d9a16f9aSPaul Walmsley 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
678d9a16f9aSPaul Walmsley 	omap_prm_base_init();
679d9a16f9aSPaul Walmsley 	omap_cm_base_init();
680e4020aa9SSantosh Shilimkar 	omap44xx_prm_init();
68105e152c7SR Sricharan 	omap5xxx_check_revision();
682e4020aa9SSantosh Shilimkar 	omap54xx_voltagedomains_init();
683e4020aa9SSantosh Shilimkar 	omap54xx_powerdomains_init();
684e4020aa9SSantosh Shilimkar 	omap54xx_clockdomains_init();
685e4020aa9SSantosh Shilimkar 	omap54xx_hwmod_init();
686e4020aa9SSantosh Shilimkar 	omap_hwmod_init_postsetup();
687cfa9667dSTero Kristo 	omap_clk_soc_init = omap5xxx_dt_clk_init;
68805e152c7SR Sricharan }
689765e7a06SNishanth Menon 
690765e7a06SNishanth Menon void __init omap5_init_late(void)
691765e7a06SNishanth Menon {
692765e7a06SNishanth Menon 	omap_common_late_init();
693765e7a06SNishanth Menon }
69405e152c7SR Sricharan #endif
69505e152c7SR Sricharan 
696a3a9384aSR Sricharan #ifdef CONFIG_SOC_DRA7XX
697a3a9384aSR Sricharan void __init dra7xx_init_early(void)
698a3a9384aSR Sricharan {
699a3a9384aSR Sricharan 	omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
700a3a9384aSR Sricharan 	omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
701a3a9384aSR Sricharan 				  OMAP2_L4_IO_ADDRESS(DRA7XX_CTRL_BASE));
702a3a9384aSR Sricharan 	omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
703a3a9384aSR Sricharan 	omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(DRA7XX_CM_CORE_AON_BASE),
704a3a9384aSR Sricharan 			     OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
705a3a9384aSR Sricharan 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
706a3a9384aSR Sricharan 	omap_prm_base_init();
707a3a9384aSR Sricharan 	omap_cm_base_init();
7087de516a6SAmbresh K 	omap44xx_prm_init();
709733d20eeSNishanth Menon 	dra7xxx_check_revision();
7107de516a6SAmbresh K 	dra7xx_powerdomains_init();
7117de516a6SAmbresh K 	dra7xx_clockdomains_init();
7127de516a6SAmbresh K 	dra7xx_hwmod_init();
7137de516a6SAmbresh K 	omap_hwmod_init_postsetup();
714f1cf498eSTero Kristo 	omap_clk_soc_init = dra7xx_dt_clk_init;
715a3a9384aSR Sricharan }
716765e7a06SNishanth Menon 
717765e7a06SNishanth Menon void __init dra7xx_init_late(void)
718765e7a06SNishanth Menon {
719765e7a06SNishanth Menon 	omap_common_late_init();
720765e7a06SNishanth Menon }
721a3a9384aSR Sricharan #endif
722a3a9384aSR Sricharan 
723a3a9384aSR Sricharan 
724a4ca9dbeSTony Lindgren void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
7254805734bSPaul Walmsley 				      struct omap_sdrc_params *sdrc_cs1)
7264805734bSPaul Walmsley {
727a66cb345STony Lindgren 	omap_sram_init();
728a66cb345STony Lindgren 
72901001712SHemant Pedanekar 	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
73058cda884SJean Pihet 		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
7312f135eafSPaul Walmsley 		_omap2_init_reprogram_sdrc();
732aa4b1f6eSKevin Hilman 	}
7331dbae815STony Lindgren }
734cfa9667dSTero Kristo 
735cfa9667dSTero Kristo int __init omap_clk_init(void)
736cfa9667dSTero Kristo {
737cfa9667dSTero Kristo 	int ret = 0;
738cfa9667dSTero Kristo 
739cfa9667dSTero Kristo 	if (!omap_clk_soc_init)
740cfa9667dSTero Kristo 		return 0;
741cfa9667dSTero Kristo 
742cfa9667dSTero Kristo 	ret = of_prcm_init();
743cfa9667dSTero Kristo 	if (!ret)
744cfa9667dSTero Kristo 		ret = omap_clk_soc_init();
745cfa9667dSTero Kristo 
746cfa9667dSTero Kristo 	return ret;
747cfa9667dSTero Kristo }
748