xref: /openbmc/linux/arch/arm/mach-omap2/io.c (revision e9e63088e4f93cf4ed7999294c09905b7dcb4d32)
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"
401d5aef49STony Lindgren #include "omap-pm.h"
413e6ece13SPaul Walmsley #include "sdrc.h"
42b6a4226cSPaul Walmsley #include "control.h"
433d82cbbbSTony Lindgren #include "serial.h"
44bf027ca1STony Lindgren #include "sram.h"
45c4ceedcbSPaul Walmsley #include "cm2xxx.h"
46c4ceedcbSPaul Walmsley #include "cm3xxx.h"
477632a02fSTero Kristo #include "cm33xx.h"
48ab6c9bbfSTero Kristo #include "cm44xx.h"
49d9a16f9aSPaul Walmsley #include "prm.h"
50d9a16f9aSPaul Walmsley #include "cm.h"
51d9a16f9aSPaul Walmsley #include "prcm_mpu44xx.h"
52d9a16f9aSPaul Walmsley #include "prminst44xx.h"
5363a293e0SPaul Walmsley #include "prm2xxx.h"
5463a293e0SPaul Walmsley #include "prm3xxx.h"
55d9bbe84fSTero Kristo #include "prm33xx.h"
5663a293e0SPaul Walmsley #include "prm44xx.h"
5769a1e7a1STero Kristo #include "opp2xxx.h"
581dbae815STony Lindgren 
591dbae815STony Lindgren /*
60cfa9667dSTero Kristo  * omap_clk_soc_init: points to a function that does the SoC-specific
61ff931c82SRajendra Nayak  * clock initializations
62ff931c82SRajendra Nayak  */
63cfa9667dSTero Kristo static int (*omap_clk_soc_init)(void);
64ff931c82SRajendra Nayak 
65ff931c82SRajendra Nayak /*
661dbae815STony Lindgren  * The machine specific code may provide the extra mapping besides the
671dbae815STony Lindgren  * default mapping provided here.
681dbae815STony Lindgren  */
69cc26b3b0SSyed Mohammed, Khasim 
70e48f814eSTony Lindgren #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
71cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = {
721dbae815STony Lindgren 	{
731dbae815STony Lindgren 		.virtual	= L3_24XX_VIRT,
741dbae815STony Lindgren 		.pfn		= __phys_to_pfn(L3_24XX_PHYS),
751dbae815STony Lindgren 		.length		= L3_24XX_SIZE,
761dbae815STony Lindgren 		.type		= MT_DEVICE
771dbae815STony Lindgren 	},
7809f21ed4SKyungmin Park 	{
7909f21ed4SKyungmin Park 		.virtual	= L4_24XX_VIRT,
8009f21ed4SKyungmin Park 		.pfn		= __phys_to_pfn(L4_24XX_PHYS),
8109f21ed4SKyungmin Park 		.length		= L4_24XX_SIZE,
8209f21ed4SKyungmin Park 		.type		= MT_DEVICE
8309f21ed4SKyungmin Park 	},
84cc26b3b0SSyed Mohammed, Khasim };
85cc26b3b0SSyed Mohammed, Khasim 
8659b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420
87cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = {
881dbae815STony Lindgren 	{
897adb9987SPaul Walmsley 		.virtual	= DSP_MEM_2420_VIRT,
907adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_MEM_2420_PHYS),
917adb9987SPaul Walmsley 		.length		= DSP_MEM_2420_SIZE,
92c40fae95STony Lindgren 		.type		= MT_DEVICE
93c40fae95STony Lindgren 	},
94c40fae95STony Lindgren 	{
957adb9987SPaul Walmsley 		.virtual	= DSP_IPI_2420_VIRT,
967adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_IPI_2420_PHYS),
977adb9987SPaul Walmsley 		.length		= DSP_IPI_2420_SIZE,
98c40fae95STony Lindgren 		.type		= MT_DEVICE
99c40fae95STony Lindgren 	},
100c40fae95STony Lindgren 	{
1017adb9987SPaul Walmsley 		.virtual	= DSP_MMU_2420_VIRT,
1027adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_MMU_2420_PHYS),
1037adb9987SPaul Walmsley 		.length		= DSP_MMU_2420_SIZE,
1041dbae815STony Lindgren 		.type		= MT_DEVICE
105cc26b3b0SSyed Mohammed, Khasim 	},
1061dbae815STony Lindgren };
1071dbae815STony Lindgren 
108cc26b3b0SSyed Mohammed, Khasim #endif
109cc26b3b0SSyed Mohammed, Khasim 
11059b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430
111cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = {
112cc26b3b0SSyed Mohammed, Khasim 	{
113cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_WK_243X_VIRT,
114cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_WK_243X_PHYS),
115cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_WK_243X_SIZE,
116cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
117cc26b3b0SSyed Mohammed, Khasim 	},
118cc26b3b0SSyed Mohammed, Khasim 	{
119cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_GPMC_VIRT,
120cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_GPMC_PHYS),
121cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_GPMC_SIZE,
122cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
123cc26b3b0SSyed Mohammed, Khasim 	},
124cc26b3b0SSyed Mohammed, Khasim 	{
125cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_SDRC_VIRT,
126cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_SDRC_PHYS),
127cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_SDRC_SIZE,
128cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
129cc26b3b0SSyed Mohammed, Khasim 	},
130cc26b3b0SSyed Mohammed, Khasim 	{
131cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_SMS_VIRT,
132cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_SMS_PHYS),
133cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_SMS_SIZE,
134cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
135cc26b3b0SSyed Mohammed, Khasim 	},
136cc26b3b0SSyed Mohammed, Khasim };
137cc26b3b0SSyed Mohammed, Khasim #endif
138cc26b3b0SSyed Mohammed, Khasim #endif
139cc26b3b0SSyed Mohammed, Khasim 
140a8eb7ca0STony Lindgren #ifdef	CONFIG_ARCH_OMAP3
141cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = {
142cc26b3b0SSyed Mohammed, Khasim 	{
143cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L3_34XX_VIRT,
144cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L3_34XX_PHYS),
145cc26b3b0SSyed Mohammed, Khasim 		.length		= L3_34XX_SIZE,
146cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
147cc26b3b0SSyed Mohammed, Khasim 	},
148cc26b3b0SSyed Mohammed, Khasim 	{
149cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_34XX_VIRT,
150cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
151cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_34XX_SIZE,
152cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
153cc26b3b0SSyed Mohammed, Khasim 	},
154cc26b3b0SSyed Mohammed, Khasim 	{
155cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP34XX_GPMC_VIRT,
156cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP34XX_GPMC_PHYS),
157cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP34XX_GPMC_SIZE,
158cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
159cc26b3b0SSyed Mohammed, Khasim 	},
160cc26b3b0SSyed Mohammed, Khasim 	{
161cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP343X_SMS_VIRT,
162cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP343X_SMS_PHYS),
163cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP343X_SMS_SIZE,
164cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
165cc26b3b0SSyed Mohammed, Khasim 	},
166cc26b3b0SSyed Mohammed, Khasim 	{
167cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP343X_SDRC_VIRT,
168cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP343X_SDRC_PHYS),
169cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP343X_SDRC_SIZE,
170cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
171cc26b3b0SSyed Mohammed, Khasim 	},
172cc26b3b0SSyed Mohammed, Khasim 	{
173cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_PER_34XX_VIRT,
174cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_PER_34XX_PHYS),
175cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_PER_34XX_SIZE,
176cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
177cc26b3b0SSyed Mohammed, Khasim 	},
178cc26b3b0SSyed Mohammed, Khasim 	{
179cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_EMU_34XX_VIRT,
180cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_EMU_34XX_PHYS),
181cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_EMU_34XX_SIZE,
182cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
183cc26b3b0SSyed Mohammed, Khasim 	},
184cc26b3b0SSyed Mohammed, Khasim };
185cc26b3b0SSyed Mohammed, Khasim #endif
18601001712SHemant Pedanekar 
18733959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX
188a920360fSHemant Pedanekar static struct map_desc omapti81xx_io_desc[] __initdata = {
18901001712SHemant Pedanekar 	{
19001001712SHemant Pedanekar 		.virtual	= L4_34XX_VIRT,
19101001712SHemant Pedanekar 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
19201001712SHemant Pedanekar 		.length		= L4_34XX_SIZE,
19301001712SHemant Pedanekar 		.type		= MT_DEVICE
1941e6cb146SAfzal Mohammed 	}
1951e6cb146SAfzal Mohammed };
1961e6cb146SAfzal Mohammed #endif
1971e6cb146SAfzal Mohammed 
198addb154aSAfzal Mohammed #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
1991e6cb146SAfzal Mohammed static struct map_desc omapam33xx_io_desc[] __initdata = {
20001001712SHemant Pedanekar 	{
20101001712SHemant Pedanekar 		.virtual	= L4_34XX_VIRT,
20201001712SHemant Pedanekar 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
20301001712SHemant Pedanekar 		.length		= L4_34XX_SIZE,
20401001712SHemant Pedanekar 		.type		= MT_DEVICE
20501001712SHemant Pedanekar 	},
2061e6cb146SAfzal Mohammed 	{
2071e6cb146SAfzal Mohammed 		.virtual	= L4_WK_AM33XX_VIRT,
2081e6cb146SAfzal Mohammed 		.pfn		= __phys_to_pfn(L4_WK_AM33XX_PHYS),
2091e6cb146SAfzal Mohammed 		.length		= L4_WK_AM33XX_SIZE,
2101e6cb146SAfzal Mohammed 		.type		= MT_DEVICE
2111e6cb146SAfzal Mohammed 	}
21201001712SHemant Pedanekar };
21301001712SHemant Pedanekar #endif
21401001712SHemant Pedanekar 
21544169075SSantosh Shilimkar #ifdef	CONFIG_ARCH_OMAP4
21644169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = {
21744169075SSantosh Shilimkar 	{
21844169075SSantosh Shilimkar 		.virtual	= L3_44XX_VIRT,
21944169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L3_44XX_PHYS),
22044169075SSantosh Shilimkar 		.length		= L3_44XX_SIZE,
22144169075SSantosh Shilimkar 		.type		= MT_DEVICE,
22244169075SSantosh Shilimkar 	},
22344169075SSantosh Shilimkar 	{
22444169075SSantosh Shilimkar 		.virtual	= L4_44XX_VIRT,
22544169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_44XX_PHYS),
22644169075SSantosh Shilimkar 		.length		= L4_44XX_SIZE,
22744169075SSantosh Shilimkar 		.type		= MT_DEVICE,
22844169075SSantosh Shilimkar 	},
22944169075SSantosh Shilimkar 	{
23044169075SSantosh Shilimkar 		.virtual	= L4_PER_44XX_VIRT,
23144169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_PER_44XX_PHYS),
23244169075SSantosh Shilimkar 		.length		= L4_PER_44XX_SIZE,
23344169075SSantosh Shilimkar 		.type		= MT_DEVICE,
23444169075SSantosh Shilimkar 	},
23544169075SSantosh Shilimkar };
23644169075SSantosh Shilimkar #endif
237cc26b3b0SSyed Mohammed, Khasim 
238a3a9384aSR Sricharan #if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
23905e152c7SR Sricharan static struct map_desc omap54xx_io_desc[] __initdata = {
24005e152c7SR Sricharan 	{
24105e152c7SR Sricharan 		.virtual	= L3_54XX_VIRT,
24205e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L3_54XX_PHYS),
24305e152c7SR Sricharan 		.length		= L3_54XX_SIZE,
24405e152c7SR Sricharan 		.type		= MT_DEVICE,
24505e152c7SR Sricharan 	},
24605e152c7SR Sricharan 	{
24705e152c7SR Sricharan 		.virtual	= L4_54XX_VIRT,
24805e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_54XX_PHYS),
24905e152c7SR Sricharan 		.length		= L4_54XX_SIZE,
25005e152c7SR Sricharan 		.type		= MT_DEVICE,
25105e152c7SR Sricharan 	},
25205e152c7SR Sricharan 	{
25305e152c7SR Sricharan 		.virtual	= L4_WK_54XX_VIRT,
25405e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_WK_54XX_PHYS),
25505e152c7SR Sricharan 		.length		= L4_WK_54XX_SIZE,
25605e152c7SR Sricharan 		.type		= MT_DEVICE,
25705e152c7SR Sricharan 	},
25805e152c7SR Sricharan 	{
25905e152c7SR Sricharan 		.virtual	= L4_PER_54XX_VIRT,
26005e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_PER_54XX_PHYS),
26105e152c7SR Sricharan 		.length		= L4_PER_54XX_SIZE,
26205e152c7SR Sricharan 		.type		= MT_DEVICE,
26305e152c7SR Sricharan 	},
26405e152c7SR Sricharan };
26505e152c7SR Sricharan #endif
26605e152c7SR Sricharan 
26759b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420
268b6a4226cSPaul Walmsley void __init omap242x_map_io(void)
2696fbd55d0STony Lindgren {
2706fbd55d0STony Lindgren 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
2716fbd55d0STony Lindgren 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
2726fbd55d0STony Lindgren }
2736fbd55d0STony Lindgren #endif
2746fbd55d0STony Lindgren 
27559b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430
276b6a4226cSPaul Walmsley void __init omap243x_map_io(void)
2776fbd55d0STony Lindgren {
2786fbd55d0STony Lindgren 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
2796fbd55d0STony Lindgren 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
2806fbd55d0STony Lindgren }
2816fbd55d0STony Lindgren #endif
2826fbd55d0STony Lindgren 
283a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3
284b6a4226cSPaul Walmsley void __init omap3_map_io(void)
2856fbd55d0STony Lindgren {
2866fbd55d0STony Lindgren 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
2876fbd55d0STony Lindgren }
2886fbd55d0STony Lindgren #endif
2896fbd55d0STony Lindgren 
29033959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX
291b6a4226cSPaul Walmsley void __init ti81xx_map_io(void)
29201001712SHemant Pedanekar {
293a920360fSHemant Pedanekar 	iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
29401001712SHemant Pedanekar }
29501001712SHemant Pedanekar #endif
29601001712SHemant Pedanekar 
297addb154aSAfzal Mohammed #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
298b6a4226cSPaul Walmsley void __init am33xx_map_io(void)
2991e6cb146SAfzal Mohammed {
3001e6cb146SAfzal Mohammed 	iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
3016fbd55d0STony Lindgren }
3026fbd55d0STony Lindgren #endif
3036fbd55d0STony Lindgren 
3046fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP4
305b6a4226cSPaul Walmsley void __init omap4_map_io(void)
3066fbd55d0STony Lindgren {
3076fbd55d0STony Lindgren 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
3086fbd55d0STony Lindgren }
3096fbd55d0STony Lindgren #endif
3106fbd55d0STony Lindgren 
311a3a9384aSR Sricharan #if defined(CONFIG_SOC_OMAP5) ||  defined(CONFIG_SOC_DRA7XX)
312b6a4226cSPaul Walmsley void __init omap5_map_io(void)
31305e152c7SR Sricharan {
31405e152c7SR Sricharan 	iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
31505e152c7SR Sricharan }
31605e152c7SR Sricharan #endif
3172f135eafSPaul Walmsley /*
3182f135eafSPaul Walmsley  * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
3192f135eafSPaul Walmsley  *
3202f135eafSPaul Walmsley  * Sets the CORE DPLL3 M2 divider to the same value that it's at
3212f135eafSPaul Walmsley  * currently.  This has the effect of setting the SDRC SDRAM AC timing
3222f135eafSPaul Walmsley  * registers to the values currently defined by the kernel.  Currently
3232f135eafSPaul Walmsley  * only defined for OMAP3; will return 0 if called on OMAP2.  Returns
3242f135eafSPaul Walmsley  * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2,
3252f135eafSPaul Walmsley  * or passes along the return value of clk_set_rate().
3262f135eafSPaul Walmsley  */
3272f135eafSPaul Walmsley static int __init _omap2_init_reprogram_sdrc(void)
3282f135eafSPaul Walmsley {
3292f135eafSPaul Walmsley 	struct clk *dpll3_m2_ck;
3302f135eafSPaul Walmsley 	int v = -EINVAL;
3312f135eafSPaul Walmsley 	long rate;
3322f135eafSPaul Walmsley 
3332f135eafSPaul Walmsley 	if (!cpu_is_omap34xx())
3342f135eafSPaul Walmsley 		return 0;
3352f135eafSPaul Walmsley 
3362f135eafSPaul Walmsley 	dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck");
337e281f7ecSAaro Koskinen 	if (IS_ERR(dpll3_m2_ck))
3382f135eafSPaul Walmsley 		return -EINVAL;
3392f135eafSPaul Walmsley 
3402f135eafSPaul Walmsley 	rate = clk_get_rate(dpll3_m2_ck);
3412f135eafSPaul Walmsley 	pr_info("Reprogramming SDRC clock to %ld Hz\n", rate);
3422f135eafSPaul Walmsley 	v = clk_set_rate(dpll3_m2_ck, rate);
3432f135eafSPaul Walmsley 	if (v)
3442f135eafSPaul Walmsley 		pr_err("dpll3_m2_clk rate change failed: %d\n", v);
3452f135eafSPaul Walmsley 
3462f135eafSPaul Walmsley 	clk_put(dpll3_m2_ck);
3472f135eafSPaul Walmsley 
3482f135eafSPaul Walmsley 	return v;
3492f135eafSPaul Walmsley }
3502f135eafSPaul Walmsley 
3512092e5ccSPaul Walmsley static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
3522092e5ccSPaul Walmsley {
3532092e5ccSPaul Walmsley 	return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
3542092e5ccSPaul Walmsley }
3552092e5ccSPaul Walmsley 
3567b250affSTony Lindgren static void __init omap_hwmod_init_postsetup(void)
357120db2cbSTony Lindgren {
3582092e5ccSPaul Walmsley 	u8 postsetup_state;
3592092e5ccSPaul Walmsley 
3602092e5ccSPaul Walmsley 	/* Set the default postsetup state for all hwmods */
361bf7c5449SRafael J. Wysocki #ifdef CONFIG_PM
3622092e5ccSPaul Walmsley 	postsetup_state = _HWMOD_STATE_IDLE;
3632092e5ccSPaul Walmsley #else
3642092e5ccSPaul Walmsley 	postsetup_state = _HWMOD_STATE_ENABLED;
3652092e5ccSPaul Walmsley #endif
3662092e5ccSPaul Walmsley 	omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
36755d2cb08SBenoit Cousson 
36853da4ce2SKevin Hilman 	omap_pm_if_early_init();
3694805734bSPaul Walmsley }
3704805734bSPaul Walmsley 
371069d0a78SArnd Bergmann static void __init __maybe_unused omap_common_late_init(void)
3724ed12be0SRuslan Bilovol {
3734ed12be0SRuslan Bilovol 	omap_mux_late_init();
3744ed12be0SRuslan Bilovol 	omap2_common_pm_late_init();
3756770b211SRuslan Bilovol 	omap_soc_device_init();
3764ed12be0SRuslan Bilovol }
3774ed12be0SRuslan Bilovol 
37816110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2420
3798f5b5a41STony Lindgren void __init omap2420_init_early(void)
3808f5b5a41STony Lindgren {
381b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
382b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
383b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
3842208bf11STero Kristo 	omap2_control_base_init();
3854de34f35SVaibhav Hiremath 	omap2xxx_check_revision();
386ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
3877b250affSTony Lindgren 	omap2xxx_voltagedomains_init();
3887b250affSTony Lindgren 	omap242x_powerdomains_init();
3897b250affSTony Lindgren 	omap242x_clockdomains_init();
3907b250affSTony Lindgren 	omap2420_hwmod_init();
3917b250affSTony Lindgren 	omap_hwmod_init_postsetup();
39269a1e7a1STero Kristo 	omap_clk_soc_init = omap2420_dt_clk_init;
39369a1e7a1STero Kristo 	rate_table = omap2420_rate_table;
3948f5b5a41STony Lindgren }
395bbd707acSShawn Guo 
396bbd707acSShawn Guo void __init omap2420_init_late(void)
397bbd707acSShawn Guo {
3984ed12be0SRuslan Bilovol 	omap_common_late_init();
399bbd707acSShawn Guo 	omap2_pm_init();
40023fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
401bbd707acSShawn Guo }
40216110798SPaul Walmsley #endif
4038f5b5a41STony Lindgren 
40416110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2430
4058f5b5a41STony Lindgren void __init omap2430_init_early(void)
4068f5b5a41STony Lindgren {
407b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
408b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
409b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
4102208bf11STero Kristo 	omap2_control_base_init();
4114de34f35SVaibhav Hiremath 	omap2xxx_check_revision();
412ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
4137b250affSTony Lindgren 	omap2xxx_voltagedomains_init();
4147b250affSTony Lindgren 	omap243x_powerdomains_init();
4157b250affSTony Lindgren 	omap243x_clockdomains_init();
4167b250affSTony Lindgren 	omap2430_hwmod_init();
4177b250affSTony Lindgren 	omap_hwmod_init_postsetup();
41869a1e7a1STero Kristo 	omap_clk_soc_init = omap2430_dt_clk_init;
41969a1e7a1STero Kristo 	rate_table = omap2430_rate_table;
4207b250affSTony Lindgren }
421bbd707acSShawn Guo 
422bbd707acSShawn Guo void __init omap2430_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 }
428c4e2d245SSanjeev Premi #endif
4297b250affSTony Lindgren 
4307b250affSTony Lindgren /*
4317b250affSTony Lindgren  * Currently only board-omap3beagle.c should call this because of the
4327b250affSTony Lindgren  * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
4337b250affSTony Lindgren  */
434c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP3
4357b250affSTony Lindgren void __init omap3_init_early(void)
4367b250affSTony Lindgren {
437b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
438b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
439b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
4402208bf11STero Kristo 	/* XXX: remove these once OMAP3 is DT only */
4412208bf11STero Kristo 	if (!of_have_populated_dt()) {
4422208bf11STero Kristo 		omap2_set_globals_control(
443efde2346STero Kristo 			OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE));
444d9a16f9aSPaul Walmsley 		omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
4452208bf11STero Kristo 		omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
4462208bf11STero Kristo 				     NULL);
4472208bf11STero Kristo 	}
4482208bf11STero Kristo 	omap2_control_base_init();
4494de34f35SVaibhav Hiremath 	omap3xxx_check_revision();
4504de34f35SVaibhav Hiremath 	omap3xxx_check_features();
451ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
452425dc8b2STero Kristo 	/* XXX: remove these once OMAP3 is DT only */
453425dc8b2STero Kristo 	if (!of_have_populated_dt()) {
454ab7b2ffcSTero Kristo 		omap3xxx_prm_init(NULL);
455425dc8b2STero Kristo 		omap3xxx_cm_init(NULL);
456425dc8b2STero Kristo 	}
4577b250affSTony Lindgren 	omap3xxx_voltagedomains_init();
4587b250affSTony Lindgren 	omap3xxx_powerdomains_init();
4597b250affSTony Lindgren 	omap3xxx_clockdomains_init();
4607b250affSTony Lindgren 	omap3xxx_hwmod_init();
4617b250affSTony Lindgren 	omap_hwmod_init_postsetup();
462eded36feSTero Kristo 	if (!of_have_populated_dt()) {
4632208bf11STero Kristo 		omap3_control_legacy_iomap_init();
464eded36feSTero Kristo 		if (soc_is_am35xx())
465eded36feSTero Kristo 			omap_clk_soc_init = am35xx_clk_legacy_init;
466eded36feSTero Kristo 		else if (cpu_is_omap3630())
467eded36feSTero Kristo 			omap_clk_soc_init = omap36xx_clk_legacy_init;
468eded36feSTero Kristo 		else if (omap_rev() == OMAP3430_REV_ES1_0)
469eded36feSTero Kristo 			omap_clk_soc_init = omap3430es1_clk_legacy_init;
470eded36feSTero Kristo 		else
471eded36feSTero Kristo 			omap_clk_soc_init = omap3430_clk_legacy_init;
472eded36feSTero Kristo 	}
4738f5b5a41STony Lindgren }
4748f5b5a41STony Lindgren 
4758f5b5a41STony Lindgren void __init omap3430_init_early(void)
4768f5b5a41STony Lindgren {
4777b250affSTony Lindgren 	omap3_init_early();
4783e049157STero Kristo 	if (of_have_populated_dt())
4793e049157STero Kristo 		omap_clk_soc_init = omap3430_dt_clk_init;
4808f5b5a41STony Lindgren }
4818f5b5a41STony Lindgren 
4828f5b5a41STony Lindgren void __init omap35xx_init_early(void)
4838f5b5a41STony Lindgren {
4847b250affSTony Lindgren 	omap3_init_early();
4853e049157STero Kristo 	if (of_have_populated_dt())
4863e049157STero Kristo 		omap_clk_soc_init = omap3430_dt_clk_init;
4878f5b5a41STony Lindgren }
4888f5b5a41STony Lindgren 
4898f5b5a41STony Lindgren void __init omap3630_init_early(void)
4908f5b5a41STony Lindgren {
4917b250affSTony Lindgren 	omap3_init_early();
4923e049157STero Kristo 	if (of_have_populated_dt())
4933e049157STero Kristo 		omap_clk_soc_init = omap3630_dt_clk_init;
4948f5b5a41STony Lindgren }
4958f5b5a41STony Lindgren 
4968f5b5a41STony Lindgren void __init am35xx_init_early(void)
4978f5b5a41STony Lindgren {
4987b250affSTony Lindgren 	omap3_init_early();
4993e049157STero Kristo 	if (of_have_populated_dt())
5003e049157STero Kristo 		omap_clk_soc_init = am35xx_dt_clk_init;
5018f5b5a41STony Lindgren }
5028f5b5a41STony Lindgren 
503bbd707acSShawn Guo void __init omap3_init_late(void)
504bbd707acSShawn Guo {
5054ed12be0SRuslan Bilovol 	omap_common_late_init();
506bbd707acSShawn Guo 	omap3_pm_init();
50723fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
508bbd707acSShawn Guo }
509bbd707acSShawn Guo 
510bbd707acSShawn Guo void __init omap3430_init_late(void)
511bbd707acSShawn Guo {
5124ed12be0SRuslan Bilovol 	omap_common_late_init();
513bbd707acSShawn Guo 	omap3_pm_init();
51423fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
515bbd707acSShawn Guo }
516bbd707acSShawn Guo 
517bbd707acSShawn Guo void __init omap35xx_init_late(void)
518bbd707acSShawn Guo {
5194ed12be0SRuslan Bilovol 	omap_common_late_init();
520bbd707acSShawn Guo 	omap3_pm_init();
52123fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
522bbd707acSShawn Guo }
523bbd707acSShawn Guo 
524bbd707acSShawn Guo void __init omap3630_init_late(void)
525bbd707acSShawn Guo {
5264ed12be0SRuslan Bilovol 	omap_common_late_init();
527bbd707acSShawn Guo 	omap3_pm_init();
52823fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
529bbd707acSShawn Guo }
530bbd707acSShawn Guo 
531bbd707acSShawn Guo void __init am35xx_init_late(void)
532bbd707acSShawn Guo {
5334ed12be0SRuslan Bilovol 	omap_common_late_init();
534bbd707acSShawn Guo 	omap3_pm_init();
53523fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
536bbd707acSShawn Guo }
537bbd707acSShawn Guo 
538bbd707acSShawn Guo void __init ti81xx_init_late(void)
539bbd707acSShawn Guo {
5404ed12be0SRuslan Bilovol 	omap_common_late_init();
54123fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
542bbd707acSShawn Guo }
543c4e2d245SSanjeev Premi #endif
5448f5b5a41STony Lindgren 
545a64459c4SAida Mynzhasova #ifdef CONFIG_SOC_TI81XX
546a64459c4SAida Mynzhasova void __init ti814x_init_early(void)
547a64459c4SAida Mynzhasova {
548a64459c4SAida Mynzhasova 	omap2_set_globals_tap(TI814X_CLASS,
549a64459c4SAida Mynzhasova 			      OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
5502208bf11STero Kristo 	omap2_control_base_init();
551a64459c4SAida Mynzhasova 	omap3xxx_check_revision();
552a64459c4SAida Mynzhasova 	ti81xx_check_features();
553ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
554a64459c4SAida Mynzhasova 	omap3xxx_voltagedomains_init();
555a64459c4SAida Mynzhasova 	omap3xxx_powerdomains_init();
556a64459c4SAida Mynzhasova 	ti81xx_clockdomains_init();
5574d38bd12STony Lindgren 	ti81xx_hwmod_init();
558a64459c4SAida Mynzhasova 	omap_hwmod_init_postsetup();
559a64459c4SAida Mynzhasova 	if (of_have_populated_dt())
560a64459c4SAida Mynzhasova 		omap_clk_soc_init = ti81xx_dt_clk_init;
561a64459c4SAida Mynzhasova }
562a64459c4SAida Mynzhasova 
563a64459c4SAida Mynzhasova void __init ti816x_init_early(void)
564a64459c4SAida Mynzhasova {
565a64459c4SAida Mynzhasova 	omap2_set_globals_tap(TI816X_CLASS,
566a64459c4SAida Mynzhasova 			      OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
5672208bf11STero Kristo 	omap2_control_base_init();
568a64459c4SAida Mynzhasova 	omap3xxx_check_revision();
569a64459c4SAida Mynzhasova 	ti81xx_check_features();
570ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
571a64459c4SAida Mynzhasova 	omap3xxx_voltagedomains_init();
572a64459c4SAida Mynzhasova 	omap3xxx_powerdomains_init();
573a64459c4SAida Mynzhasova 	ti81xx_clockdomains_init();
5744d38bd12STony Lindgren 	ti81xx_hwmod_init();
575a64459c4SAida Mynzhasova 	omap_hwmod_init_postsetup();
576a64459c4SAida Mynzhasova 	if (of_have_populated_dt())
577a64459c4SAida Mynzhasova 		omap_clk_soc_init = ti81xx_dt_clk_init;
578a64459c4SAida Mynzhasova }
579a64459c4SAida Mynzhasova #endif
580a64459c4SAida Mynzhasova 
58108f30989SAfzal Mohammed #ifdef CONFIG_SOC_AM33XX
58208f30989SAfzal Mohammed void __init am33xx_init_early(void)
58308f30989SAfzal Mohammed {
584b6a4226cSPaul Walmsley 	omap2_set_globals_tap(AM335X_CLASS,
585b6a4226cSPaul Walmsley 			      AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
5862208bf11STero Kristo 	omap2_control_base_init();
58708f30989SAfzal Mohammed 	omap3xxx_check_revision();
5887bcad170SVaibhav Hiremath 	am33xx_check_features();
589ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
5903f0ea764SVaibhav Hiremath 	am33xx_powerdomains_init();
5919c80f3aaSVaibhav Hiremath 	am33xx_clockdomains_init();
592a2cfc509SVaibhav Hiremath 	am33xx_hwmod_init();
593a2cfc509SVaibhav Hiremath 	omap_hwmod_init_postsetup();
594149c09d3STero Kristo 	omap_clk_soc_init = am33xx_dt_clk_init;
59508f30989SAfzal Mohammed }
596765e7a06SNishanth Menon 
597765e7a06SNishanth Menon void __init am33xx_init_late(void)
598765e7a06SNishanth Menon {
599765e7a06SNishanth Menon 	omap_common_late_init();
600765e7a06SNishanth Menon }
60108f30989SAfzal Mohammed #endif
60208f30989SAfzal Mohammed 
603c5107027SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX
604c5107027SAfzal Mohammed void __init am43xx_init_early(void)
605c5107027SAfzal Mohammed {
606c5107027SAfzal Mohammed 	omap2_set_globals_tap(AM335X_CLASS,
607c5107027SAfzal Mohammed 			      AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
6082208bf11STero Kristo 	omap2_control_base_init();
609c5107027SAfzal Mohammed 	omap3xxx_check_revision();
6107a2e0513SAfzal Mohammed 	am33xx_check_features();
611ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
6128835cf6eSAmbresh K 	am43xx_powerdomains_init();
6138835cf6eSAmbresh K 	am43xx_clockdomains_init();
6148835cf6eSAmbresh K 	am43xx_hwmod_init();
6158835cf6eSAmbresh K 	omap_hwmod_init_postsetup();
616d941f86fSSekhar Nori 	omap_l2_cache_init();
617d22031e2STero Kristo 	omap_clk_soc_init = am43xx_dt_clk_init;
618c5107027SAfzal Mohammed }
619765e7a06SNishanth Menon 
620765e7a06SNishanth Menon void __init am43xx_init_late(void)
621765e7a06SNishanth Menon {
622765e7a06SNishanth Menon 	omap_common_late_init();
623765e7a06SNishanth Menon }
624c5107027SAfzal Mohammed #endif
625c5107027SAfzal Mohammed 
626c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP4
6278f5b5a41STony Lindgren void __init omap4430_init_early(void)
6288f5b5a41STony Lindgren {
629b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP443X_CLASS,
630b6a4226cSPaul Walmsley 			      OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
631d9a16f9aSPaul Walmsley 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
632ca125b5eSTero Kristo 	omap2_control_base_init();
6334de34f35SVaibhav Hiremath 	omap4xxx_check_revision();
6344de34f35SVaibhav Hiremath 	omap4xxx_check_features();
635ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
636de70af49SNishanth Menon 	omap4_pm_init_early();
6377b250affSTony Lindgren 	omap44xx_voltagedomains_init();
6387b250affSTony Lindgren 	omap44xx_powerdomains_init();
6397b250affSTony Lindgren 	omap44xx_clockdomains_init();
6407b250affSTony Lindgren 	omap44xx_hwmod_init();
6417b250affSTony Lindgren 	omap_hwmod_init_postsetup();
642b39b14e6SSekhar Nori 	omap_l2_cache_init();
643c8c88d85STero Kristo 	omap_clk_soc_init = omap4xxx_dt_clk_init;
6448f5b5a41STony Lindgren }
645bbd707acSShawn Guo 
646bbd707acSShawn Guo void __init omap4430_init_late(void)
647bbd707acSShawn Guo {
6484ed12be0SRuslan Bilovol 	omap_common_late_init();
649bbd707acSShawn Guo 	omap4_pm_init();
65023fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
651bbd707acSShawn Guo }
652c4e2d245SSanjeev Premi #endif
6538f5b5a41STony Lindgren 
65405e152c7SR Sricharan #ifdef CONFIG_SOC_OMAP5
65505e152c7SR Sricharan void __init omap5_init_early(void)
65605e152c7SR Sricharan {
657b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP54XX_CLASS,
658b6a4226cSPaul Walmsley 			      OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
659d9a16f9aSPaul Walmsley 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
660ca125b5eSTero Kristo 	omap2_control_base_init();
661628ed471SSantosh Shilimkar 	omap4_pm_init_early();
662ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
66305e152c7SR Sricharan 	omap5xxx_check_revision();
664e4020aa9SSantosh Shilimkar 	omap54xx_voltagedomains_init();
665e4020aa9SSantosh Shilimkar 	omap54xx_powerdomains_init();
666e4020aa9SSantosh Shilimkar 	omap54xx_clockdomains_init();
667e4020aa9SSantosh Shilimkar 	omap54xx_hwmod_init();
668e4020aa9SSantosh Shilimkar 	omap_hwmod_init_postsetup();
669cfa9667dSTero Kristo 	omap_clk_soc_init = omap5xxx_dt_clk_init;
67005e152c7SR Sricharan }
671765e7a06SNishanth Menon 
672765e7a06SNishanth Menon void __init omap5_init_late(void)
673765e7a06SNishanth Menon {
674765e7a06SNishanth Menon 	omap_common_late_init();
675628ed471SSantosh Shilimkar 	omap4_pm_init();
676628ed471SSantosh Shilimkar 	omap2_clk_enable_autoidle_all();
677765e7a06SNishanth Menon }
67805e152c7SR Sricharan #endif
67905e152c7SR Sricharan 
680a3a9384aSR Sricharan #ifdef CONFIG_SOC_DRA7XX
681a3a9384aSR Sricharan void __init dra7xx_init_early(void)
682a3a9384aSR Sricharan {
683a3a9384aSR Sricharan 	omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
684a3a9384aSR Sricharan 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
685ca125b5eSTero Kristo 	omap2_control_base_init();
6866af16a1dSRajendra Nayak 	omap4_pm_init_early();
687ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
688733d20eeSNishanth Menon 	dra7xxx_check_revision();
6897de516a6SAmbresh K 	dra7xx_powerdomains_init();
6907de516a6SAmbresh K 	dra7xx_clockdomains_init();
6917de516a6SAmbresh K 	dra7xx_hwmod_init();
6927de516a6SAmbresh K 	omap_hwmod_init_postsetup();
693f1cf498eSTero Kristo 	omap_clk_soc_init = dra7xx_dt_clk_init;
694a3a9384aSR Sricharan }
695765e7a06SNishanth Menon 
696765e7a06SNishanth Menon void __init dra7xx_init_late(void)
697765e7a06SNishanth Menon {
698765e7a06SNishanth Menon 	omap_common_late_init();
6996af16a1dSRajendra Nayak 	omap4_pm_init();
7006af16a1dSRajendra Nayak 	omap2_clk_enable_autoidle_all();
701765e7a06SNishanth Menon }
702a3a9384aSR Sricharan #endif
703a3a9384aSR Sricharan 
704a3a9384aSR Sricharan 
705a4ca9dbeSTony Lindgren void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
7064805734bSPaul Walmsley 				      struct omap_sdrc_params *sdrc_cs1)
7074805734bSPaul Walmsley {
708a66cb345STony Lindgren 	omap_sram_init();
709a66cb345STony Lindgren 
71001001712SHemant Pedanekar 	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
71158cda884SJean Pihet 		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
7122f135eafSPaul Walmsley 		_omap2_init_reprogram_sdrc();
713aa4b1f6eSKevin Hilman 	}
7141dbae815STony Lindgren }
715cfa9667dSTero Kristo 
716cfa9667dSTero Kristo int __init omap_clk_init(void)
717cfa9667dSTero Kristo {
718cfa9667dSTero Kristo 	int ret = 0;
719cfa9667dSTero Kristo 
720cfa9667dSTero Kristo 	if (!omap_clk_soc_init)
721cfa9667dSTero Kristo 		return 0;
722cfa9667dSTero Kristo 
7238111e010STero Kristo 	ti_clk_init_features();
7248111e010STero Kristo 
725*e9e63088STero Kristo 	omap2_clk_setup_ll_ops();
726*e9e63088STero Kristo 
727eded36feSTero Kristo 	if (of_have_populated_dt()) {
728fe87414fSTero Kristo 		ret = omap_control_init();
729fe87414fSTero Kristo 		if (ret)
730fe87414fSTero Kristo 			return ret;
731fe87414fSTero Kristo 
7323a1a388eSTero Kristo 		ret = omap_prcm_init();
733c08ee14cSTero Kristo 		if (ret)
734c08ee14cSTero Kristo 			return ret;
735c08ee14cSTero Kristo 
736c08ee14cSTero Kristo 		of_clk_init(NULL);
737c08ee14cSTero Kristo 
738c08ee14cSTero Kristo 		ti_dt_clk_init_retry_clks();
739c08ee14cSTero Kristo 
740c08ee14cSTero Kristo 		ti_dt_clockdomains_setup();
741eded36feSTero Kristo 	}
742c08ee14cSTero Kristo 
743cfa9667dSTero Kristo 	ret = omap_clk_soc_init();
744cfa9667dSTero Kristo 
745cfa9667dSTero Kristo 	return ret;
746cfa9667dSTero Kristo }
747