xref: /openbmc/linux/arch/arm/mach-omap2/io.c (revision ea827ad5ffbb78812f6dbdee005e1f364b6bdc58)
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"
487632a02fSTero Kristo #include "cm33xx.h"
49ab6c9bbfSTero Kristo #include "cm44xx.h"
50d9a16f9aSPaul Walmsley #include "prm.h"
51d9a16f9aSPaul Walmsley #include "cm.h"
52d9a16f9aSPaul Walmsley #include "prcm_mpu44xx.h"
53d9a16f9aSPaul Walmsley #include "prminst44xx.h"
5463a293e0SPaul Walmsley #include "prm2xxx.h"
5563a293e0SPaul Walmsley #include "prm3xxx.h"
56d9bbe84fSTero Kristo #include "prm33xx.h"
5763a293e0SPaul Walmsley #include "prm44xx.h"
5869a1e7a1STero Kristo #include "opp2xxx.h"
591dbae815STony Lindgren 
601dbae815STony Lindgren /*
61cfa9667dSTero Kristo  * omap_clk_soc_init: points to a function that does the SoC-specific
62ff931c82SRajendra Nayak  * clock initializations
63ff931c82SRajendra Nayak  */
64cfa9667dSTero Kristo static int (*omap_clk_soc_init)(void);
65ff931c82SRajendra Nayak 
66ff931c82SRajendra Nayak /*
671dbae815STony Lindgren  * The machine specific code may provide the extra mapping besides the
681dbae815STony Lindgren  * default mapping provided here.
691dbae815STony Lindgren  */
70cc26b3b0SSyed Mohammed, Khasim 
71e48f814eSTony Lindgren #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
72cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = {
731dbae815STony Lindgren 	{
741dbae815STony Lindgren 		.virtual	= L3_24XX_VIRT,
751dbae815STony Lindgren 		.pfn		= __phys_to_pfn(L3_24XX_PHYS),
761dbae815STony Lindgren 		.length		= L3_24XX_SIZE,
771dbae815STony Lindgren 		.type		= MT_DEVICE
781dbae815STony Lindgren 	},
7909f21ed4SKyungmin Park 	{
8009f21ed4SKyungmin Park 		.virtual	= L4_24XX_VIRT,
8109f21ed4SKyungmin Park 		.pfn		= __phys_to_pfn(L4_24XX_PHYS),
8209f21ed4SKyungmin Park 		.length		= L4_24XX_SIZE,
8309f21ed4SKyungmin Park 		.type		= MT_DEVICE
8409f21ed4SKyungmin Park 	},
85cc26b3b0SSyed Mohammed, Khasim };
86cc26b3b0SSyed Mohammed, Khasim 
8759b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420
88cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = {
891dbae815STony Lindgren 	{
907adb9987SPaul Walmsley 		.virtual	= DSP_MEM_2420_VIRT,
917adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_MEM_2420_PHYS),
927adb9987SPaul Walmsley 		.length		= DSP_MEM_2420_SIZE,
93c40fae95STony Lindgren 		.type		= MT_DEVICE
94c40fae95STony Lindgren 	},
95c40fae95STony Lindgren 	{
967adb9987SPaul Walmsley 		.virtual	= DSP_IPI_2420_VIRT,
977adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_IPI_2420_PHYS),
987adb9987SPaul Walmsley 		.length		= DSP_IPI_2420_SIZE,
99c40fae95STony Lindgren 		.type		= MT_DEVICE
100c40fae95STony Lindgren 	},
101c40fae95STony Lindgren 	{
1027adb9987SPaul Walmsley 		.virtual	= DSP_MMU_2420_VIRT,
1037adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_MMU_2420_PHYS),
1047adb9987SPaul Walmsley 		.length		= DSP_MMU_2420_SIZE,
1051dbae815STony Lindgren 		.type		= MT_DEVICE
106cc26b3b0SSyed Mohammed, Khasim 	},
1071dbae815STony Lindgren };
1081dbae815STony Lindgren 
109cc26b3b0SSyed Mohammed, Khasim #endif
110cc26b3b0SSyed Mohammed, Khasim 
11159b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430
112cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = {
113cc26b3b0SSyed Mohammed, Khasim 	{
114cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_WK_243X_VIRT,
115cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_WK_243X_PHYS),
116cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_WK_243X_SIZE,
117cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
118cc26b3b0SSyed Mohammed, Khasim 	},
119cc26b3b0SSyed Mohammed, Khasim 	{
120cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_GPMC_VIRT,
121cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_GPMC_PHYS),
122cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_GPMC_SIZE,
123cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
124cc26b3b0SSyed Mohammed, Khasim 	},
125cc26b3b0SSyed Mohammed, Khasim 	{
126cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_SDRC_VIRT,
127cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_SDRC_PHYS),
128cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_SDRC_SIZE,
129cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
130cc26b3b0SSyed Mohammed, Khasim 	},
131cc26b3b0SSyed Mohammed, Khasim 	{
132cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_SMS_VIRT,
133cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_SMS_PHYS),
134cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_SMS_SIZE,
135cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
136cc26b3b0SSyed Mohammed, Khasim 	},
137cc26b3b0SSyed Mohammed, Khasim };
138cc26b3b0SSyed Mohammed, Khasim #endif
139cc26b3b0SSyed Mohammed, Khasim #endif
140cc26b3b0SSyed Mohammed, Khasim 
141a8eb7ca0STony Lindgren #ifdef	CONFIG_ARCH_OMAP3
142cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = {
143cc26b3b0SSyed Mohammed, Khasim 	{
144cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L3_34XX_VIRT,
145cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L3_34XX_PHYS),
146cc26b3b0SSyed Mohammed, Khasim 		.length		= L3_34XX_SIZE,
147cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
148cc26b3b0SSyed Mohammed, Khasim 	},
149cc26b3b0SSyed Mohammed, Khasim 	{
150cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_34XX_VIRT,
151cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
152cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_34XX_SIZE,
153cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
154cc26b3b0SSyed Mohammed, Khasim 	},
155cc26b3b0SSyed Mohammed, Khasim 	{
156cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP34XX_GPMC_VIRT,
157cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP34XX_GPMC_PHYS),
158cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP34XX_GPMC_SIZE,
159cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
160cc26b3b0SSyed Mohammed, Khasim 	},
161cc26b3b0SSyed Mohammed, Khasim 	{
162cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP343X_SMS_VIRT,
163cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP343X_SMS_PHYS),
164cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP343X_SMS_SIZE,
165cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
166cc26b3b0SSyed Mohammed, Khasim 	},
167cc26b3b0SSyed Mohammed, Khasim 	{
168cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP343X_SDRC_VIRT,
169cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP343X_SDRC_PHYS),
170cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP343X_SDRC_SIZE,
171cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
172cc26b3b0SSyed Mohammed, Khasim 	},
173cc26b3b0SSyed Mohammed, Khasim 	{
174cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_PER_34XX_VIRT,
175cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_PER_34XX_PHYS),
176cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_PER_34XX_SIZE,
177cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
178cc26b3b0SSyed Mohammed, Khasim 	},
179cc26b3b0SSyed Mohammed, Khasim 	{
180cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_EMU_34XX_VIRT,
181cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_EMU_34XX_PHYS),
182cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_EMU_34XX_SIZE,
183cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
184cc26b3b0SSyed Mohammed, Khasim 	},
185cc26b3b0SSyed Mohammed, Khasim };
186cc26b3b0SSyed Mohammed, Khasim #endif
18701001712SHemant Pedanekar 
18833959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX
189a920360fSHemant Pedanekar static struct map_desc omapti81xx_io_desc[] __initdata = {
19001001712SHemant Pedanekar 	{
19101001712SHemant Pedanekar 		.virtual	= L4_34XX_VIRT,
19201001712SHemant Pedanekar 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
19301001712SHemant Pedanekar 		.length		= L4_34XX_SIZE,
19401001712SHemant Pedanekar 		.type		= MT_DEVICE
1951e6cb146SAfzal Mohammed 	}
1961e6cb146SAfzal Mohammed };
1971e6cb146SAfzal Mohammed #endif
1981e6cb146SAfzal Mohammed 
199addb154aSAfzal Mohammed #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
2001e6cb146SAfzal Mohammed static struct map_desc omapam33xx_io_desc[] __initdata = {
20101001712SHemant Pedanekar 	{
20201001712SHemant Pedanekar 		.virtual	= L4_34XX_VIRT,
20301001712SHemant Pedanekar 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
20401001712SHemant Pedanekar 		.length		= L4_34XX_SIZE,
20501001712SHemant Pedanekar 		.type		= MT_DEVICE
20601001712SHemant Pedanekar 	},
2071e6cb146SAfzal Mohammed 	{
2081e6cb146SAfzal Mohammed 		.virtual	= L4_WK_AM33XX_VIRT,
2091e6cb146SAfzal Mohammed 		.pfn		= __phys_to_pfn(L4_WK_AM33XX_PHYS),
2101e6cb146SAfzal Mohammed 		.length		= L4_WK_AM33XX_SIZE,
2111e6cb146SAfzal Mohammed 		.type		= MT_DEVICE
2121e6cb146SAfzal Mohammed 	}
21301001712SHemant Pedanekar };
21401001712SHemant Pedanekar #endif
21501001712SHemant Pedanekar 
21644169075SSantosh Shilimkar #ifdef	CONFIG_ARCH_OMAP4
21744169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = {
21844169075SSantosh Shilimkar 	{
21944169075SSantosh Shilimkar 		.virtual	= L3_44XX_VIRT,
22044169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L3_44XX_PHYS),
22144169075SSantosh Shilimkar 		.length		= L3_44XX_SIZE,
22244169075SSantosh Shilimkar 		.type		= MT_DEVICE,
22344169075SSantosh Shilimkar 	},
22444169075SSantosh Shilimkar 	{
22544169075SSantosh Shilimkar 		.virtual	= L4_44XX_VIRT,
22644169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_44XX_PHYS),
22744169075SSantosh Shilimkar 		.length		= L4_44XX_SIZE,
22844169075SSantosh Shilimkar 		.type		= MT_DEVICE,
22944169075SSantosh Shilimkar 	},
23044169075SSantosh Shilimkar 	{
23144169075SSantosh Shilimkar 		.virtual	= L4_PER_44XX_VIRT,
23244169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_PER_44XX_PHYS),
23344169075SSantosh Shilimkar 		.length		= L4_PER_44XX_SIZE,
23444169075SSantosh Shilimkar 		.type		= MT_DEVICE,
23544169075SSantosh Shilimkar 	},
23644169075SSantosh Shilimkar };
23744169075SSantosh Shilimkar #endif
238cc26b3b0SSyed Mohammed, Khasim 
239*ea827ad5SNishanth Menon #ifdef CONFIG_SOC_OMAP5
24005e152c7SR Sricharan static struct map_desc omap54xx_io_desc[] __initdata = {
24105e152c7SR Sricharan 	{
24205e152c7SR Sricharan 		.virtual	= L3_54XX_VIRT,
24305e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L3_54XX_PHYS),
24405e152c7SR Sricharan 		.length		= L3_54XX_SIZE,
24505e152c7SR Sricharan 		.type		= MT_DEVICE,
24605e152c7SR Sricharan 	},
24705e152c7SR Sricharan 	{
24805e152c7SR Sricharan 		.virtual	= L4_54XX_VIRT,
24905e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_54XX_PHYS),
25005e152c7SR Sricharan 		.length		= L4_54XX_SIZE,
25105e152c7SR Sricharan 		.type		= MT_DEVICE,
25205e152c7SR Sricharan 	},
25305e152c7SR Sricharan 	{
25405e152c7SR Sricharan 		.virtual	= L4_WK_54XX_VIRT,
25505e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_WK_54XX_PHYS),
25605e152c7SR Sricharan 		.length		= L4_WK_54XX_SIZE,
25705e152c7SR Sricharan 		.type		= MT_DEVICE,
25805e152c7SR Sricharan 	},
25905e152c7SR Sricharan 	{
26005e152c7SR Sricharan 		.virtual	= L4_PER_54XX_VIRT,
26105e152c7SR Sricharan 		.pfn		= __phys_to_pfn(L4_PER_54XX_PHYS),
26205e152c7SR Sricharan 		.length		= L4_PER_54XX_SIZE,
26305e152c7SR Sricharan 		.type		= MT_DEVICE,
26405e152c7SR Sricharan 	},
26505e152c7SR Sricharan };
26605e152c7SR Sricharan #endif
26705e152c7SR Sricharan 
268*ea827ad5SNishanth Menon #ifdef CONFIG_SOC_DRA7XX
269*ea827ad5SNishanth Menon static struct map_desc dra7xx_io_desc[] __initdata = {
270*ea827ad5SNishanth Menon 	{
271*ea827ad5SNishanth Menon 		.virtual	= L4_CFG_MPU_DRA7XX_VIRT,
272*ea827ad5SNishanth Menon 		.pfn		= __phys_to_pfn(L4_CFG_MPU_DRA7XX_PHYS),
273*ea827ad5SNishanth Menon 		.length		= L4_CFG_MPU_DRA7XX_SIZE,
274*ea827ad5SNishanth Menon 		.type		= MT_DEVICE,
275*ea827ad5SNishanth Menon 	},
276*ea827ad5SNishanth Menon 	{
277*ea827ad5SNishanth Menon 		.virtual	= L3_MAIN_SN_DRA7XX_VIRT,
278*ea827ad5SNishanth Menon 		.pfn		= __phys_to_pfn(L3_MAIN_SN_DRA7XX_PHYS),
279*ea827ad5SNishanth Menon 		.length		= L3_MAIN_SN_DRA7XX_SIZE,
280*ea827ad5SNishanth Menon 		.type		= MT_DEVICE,
281*ea827ad5SNishanth Menon 	},
282*ea827ad5SNishanth Menon 	{
283*ea827ad5SNishanth Menon 		.virtual	= L4_PER1_DRA7XX_VIRT,
284*ea827ad5SNishanth Menon 		.pfn		= __phys_to_pfn(L4_PER1_DRA7XX_PHYS),
285*ea827ad5SNishanth Menon 		.length		= L4_PER1_DRA7XX_SIZE,
286*ea827ad5SNishanth Menon 		.type		= MT_DEVICE,
287*ea827ad5SNishanth Menon 	},
288*ea827ad5SNishanth Menon 	{
289*ea827ad5SNishanth Menon 		.virtual	= L4_PER2_DRA7XX_VIRT,
290*ea827ad5SNishanth Menon 		.pfn		= __phys_to_pfn(L4_PER2_DRA7XX_PHYS),
291*ea827ad5SNishanth Menon 		.length		= L4_PER2_DRA7XX_SIZE,
292*ea827ad5SNishanth Menon 		.type		= MT_DEVICE,
293*ea827ad5SNishanth Menon 	},
294*ea827ad5SNishanth Menon 	{
295*ea827ad5SNishanth Menon 		.virtual	= L4_PER3_DRA7XX_VIRT,
296*ea827ad5SNishanth Menon 		.pfn		= __phys_to_pfn(L4_PER3_DRA7XX_PHYS),
297*ea827ad5SNishanth Menon 		.length		= L4_PER3_DRA7XX_SIZE,
298*ea827ad5SNishanth Menon 		.type		= MT_DEVICE,
299*ea827ad5SNishanth Menon 	},
300*ea827ad5SNishanth Menon 	{
301*ea827ad5SNishanth Menon 		.virtual	= L4_CFG_DRA7XX_VIRT,
302*ea827ad5SNishanth Menon 		.pfn		= __phys_to_pfn(L4_CFG_DRA7XX_PHYS),
303*ea827ad5SNishanth Menon 		.length		= L4_CFG_DRA7XX_SIZE,
304*ea827ad5SNishanth Menon 		.type		= MT_DEVICE,
305*ea827ad5SNishanth Menon 	},
306*ea827ad5SNishanth Menon 	{
307*ea827ad5SNishanth Menon 		.virtual	= L4_WKUP_DRA7XX_VIRT,
308*ea827ad5SNishanth Menon 		.pfn		= __phys_to_pfn(L4_WKUP_DRA7XX_PHYS),
309*ea827ad5SNishanth Menon 		.length		= L4_WKUP_DRA7XX_SIZE,
310*ea827ad5SNishanth Menon 		.type		= MT_DEVICE,
311*ea827ad5SNishanth Menon 	},
312*ea827ad5SNishanth Menon };
313*ea827ad5SNishanth Menon #endif
314*ea827ad5SNishanth Menon 
31559b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2420
316b6a4226cSPaul Walmsley void __init omap242x_map_io(void)
3176fbd55d0STony Lindgren {
3186fbd55d0STony Lindgren 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
3196fbd55d0STony Lindgren 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
3206fbd55d0STony Lindgren }
3216fbd55d0STony Lindgren #endif
3226fbd55d0STony Lindgren 
32359b479e0STony Lindgren #ifdef CONFIG_SOC_OMAP2430
324b6a4226cSPaul Walmsley void __init omap243x_map_io(void)
3256fbd55d0STony Lindgren {
3266fbd55d0STony Lindgren 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
3276fbd55d0STony Lindgren 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
3286fbd55d0STony Lindgren }
3296fbd55d0STony Lindgren #endif
3306fbd55d0STony Lindgren 
331a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3
332b6a4226cSPaul Walmsley void __init omap3_map_io(void)
3336fbd55d0STony Lindgren {
3346fbd55d0STony Lindgren 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
3356fbd55d0STony Lindgren }
3366fbd55d0STony Lindgren #endif
3376fbd55d0STony Lindgren 
33833959553SKevin Hilman #ifdef CONFIG_SOC_TI81XX
339b6a4226cSPaul Walmsley void __init ti81xx_map_io(void)
34001001712SHemant Pedanekar {
341a920360fSHemant Pedanekar 	iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
34201001712SHemant Pedanekar }
34301001712SHemant Pedanekar #endif
34401001712SHemant Pedanekar 
345addb154aSAfzal Mohammed #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
346b6a4226cSPaul Walmsley void __init am33xx_map_io(void)
3471e6cb146SAfzal Mohammed {
3481e6cb146SAfzal Mohammed 	iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
3496fbd55d0STony Lindgren }
3506fbd55d0STony Lindgren #endif
3516fbd55d0STony Lindgren 
3526fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP4
353b6a4226cSPaul Walmsley void __init omap4_map_io(void)
3546fbd55d0STony Lindgren {
3556fbd55d0STony Lindgren 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
3566fbd55d0STony Lindgren }
3576fbd55d0STony Lindgren #endif
3586fbd55d0STony Lindgren 
359*ea827ad5SNishanth Menon #ifdef CONFIG_SOC_OMAP5
360b6a4226cSPaul Walmsley void __init omap5_map_io(void)
36105e152c7SR Sricharan {
36205e152c7SR Sricharan 	iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
36305e152c7SR Sricharan }
36405e152c7SR Sricharan #endif
365*ea827ad5SNishanth Menon 
366*ea827ad5SNishanth Menon #ifdef CONFIG_SOC_DRA7XX
367*ea827ad5SNishanth Menon void __init dra7xx_map_io(void)
368*ea827ad5SNishanth Menon {
369*ea827ad5SNishanth Menon 	iotable_init(dra7xx_io_desc, ARRAY_SIZE(dra7xx_io_desc));
370*ea827ad5SNishanth Menon }
371*ea827ad5SNishanth Menon #endif
3722f135eafSPaul Walmsley /*
3732f135eafSPaul Walmsley  * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
3742f135eafSPaul Walmsley  *
3752f135eafSPaul Walmsley  * Sets the CORE DPLL3 M2 divider to the same value that it's at
3762f135eafSPaul Walmsley  * currently.  This has the effect of setting the SDRC SDRAM AC timing
3772f135eafSPaul Walmsley  * registers to the values currently defined by the kernel.  Currently
3782f135eafSPaul Walmsley  * only defined for OMAP3; will return 0 if called on OMAP2.  Returns
3792f135eafSPaul Walmsley  * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2,
3802f135eafSPaul Walmsley  * or passes along the return value of clk_set_rate().
3812f135eafSPaul Walmsley  */
3822f135eafSPaul Walmsley static int __init _omap2_init_reprogram_sdrc(void)
3832f135eafSPaul Walmsley {
3842f135eafSPaul Walmsley 	struct clk *dpll3_m2_ck;
3852f135eafSPaul Walmsley 	int v = -EINVAL;
3862f135eafSPaul Walmsley 	long rate;
3872f135eafSPaul Walmsley 
3882f135eafSPaul Walmsley 	if (!cpu_is_omap34xx())
3892f135eafSPaul Walmsley 		return 0;
3902f135eafSPaul Walmsley 
3912f135eafSPaul Walmsley 	dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck");
392e281f7ecSAaro Koskinen 	if (IS_ERR(dpll3_m2_ck))
3932f135eafSPaul Walmsley 		return -EINVAL;
3942f135eafSPaul Walmsley 
3952f135eafSPaul Walmsley 	rate = clk_get_rate(dpll3_m2_ck);
3962f135eafSPaul Walmsley 	pr_info("Reprogramming SDRC clock to %ld Hz\n", rate);
3972f135eafSPaul Walmsley 	v = clk_set_rate(dpll3_m2_ck, rate);
3982f135eafSPaul Walmsley 	if (v)
3992f135eafSPaul Walmsley 		pr_err("dpll3_m2_clk rate change failed: %d\n", v);
4002f135eafSPaul Walmsley 
4012f135eafSPaul Walmsley 	clk_put(dpll3_m2_ck);
4022f135eafSPaul Walmsley 
4032f135eafSPaul Walmsley 	return v;
4042f135eafSPaul Walmsley }
4052f135eafSPaul Walmsley 
4062092e5ccSPaul Walmsley static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
4072092e5ccSPaul Walmsley {
4082092e5ccSPaul Walmsley 	return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
4092092e5ccSPaul Walmsley }
4102092e5ccSPaul Walmsley 
4117b250affSTony Lindgren static void __init omap_hwmod_init_postsetup(void)
412120db2cbSTony Lindgren {
4132092e5ccSPaul Walmsley 	u8 postsetup_state;
4142092e5ccSPaul Walmsley 
4152092e5ccSPaul Walmsley 	/* Set the default postsetup state for all hwmods */
416bf7c5449SRafael J. Wysocki #ifdef CONFIG_PM
4172092e5ccSPaul Walmsley 	postsetup_state = _HWMOD_STATE_IDLE;
4182092e5ccSPaul Walmsley #else
4192092e5ccSPaul Walmsley 	postsetup_state = _HWMOD_STATE_ENABLED;
4202092e5ccSPaul Walmsley #endif
4212092e5ccSPaul Walmsley 	omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
42255d2cb08SBenoit Cousson 
42353da4ce2SKevin Hilman 	omap_pm_if_early_init();
4244805734bSPaul Walmsley }
4254805734bSPaul Walmsley 
426069d0a78SArnd Bergmann static void __init __maybe_unused omap_common_late_init(void)
4274ed12be0SRuslan Bilovol {
4284ed12be0SRuslan Bilovol 	omap_mux_late_init();
4294ed12be0SRuslan Bilovol 	omap2_common_pm_late_init();
4306770b211SRuslan Bilovol 	omap_soc_device_init();
4314ed12be0SRuslan Bilovol }
4324ed12be0SRuslan Bilovol 
43316110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2420
4348f5b5a41STony Lindgren void __init omap2420_init_early(void)
4358f5b5a41STony Lindgren {
436b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
437b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
438b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
4392208bf11STero Kristo 	omap2_control_base_init();
4404de34f35SVaibhav Hiremath 	omap2xxx_check_revision();
441ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
4427b250affSTony Lindgren 	omap2xxx_voltagedomains_init();
4437b250affSTony Lindgren 	omap242x_powerdomains_init();
4447b250affSTony Lindgren 	omap242x_clockdomains_init();
4457b250affSTony Lindgren 	omap2420_hwmod_init();
4467b250affSTony Lindgren 	omap_hwmod_init_postsetup();
44769a1e7a1STero Kristo 	omap_clk_soc_init = omap2420_dt_clk_init;
44869a1e7a1STero Kristo 	rate_table = omap2420_rate_table;
4498f5b5a41STony Lindgren }
450bbd707acSShawn Guo 
451bbd707acSShawn Guo void __init omap2420_init_late(void)
452bbd707acSShawn Guo {
4534ed12be0SRuslan Bilovol 	omap_common_late_init();
454bbd707acSShawn Guo 	omap2_pm_init();
45523fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
456bbd707acSShawn Guo }
45716110798SPaul Walmsley #endif
4588f5b5a41STony Lindgren 
45916110798SPaul Walmsley #ifdef CONFIG_SOC_OMAP2430
4608f5b5a41STony Lindgren void __init omap2430_init_early(void)
4618f5b5a41STony Lindgren {
462b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
463b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
464b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
4652208bf11STero Kristo 	omap2_control_base_init();
4664de34f35SVaibhav Hiremath 	omap2xxx_check_revision();
467ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
4687b250affSTony Lindgren 	omap2xxx_voltagedomains_init();
4697b250affSTony Lindgren 	omap243x_powerdomains_init();
4707b250affSTony Lindgren 	omap243x_clockdomains_init();
4717b250affSTony Lindgren 	omap2430_hwmod_init();
4727b250affSTony Lindgren 	omap_hwmod_init_postsetup();
47369a1e7a1STero Kristo 	omap_clk_soc_init = omap2430_dt_clk_init;
47469a1e7a1STero Kristo 	rate_table = omap2430_rate_table;
4757b250affSTony Lindgren }
476bbd707acSShawn Guo 
477bbd707acSShawn Guo void __init omap2430_init_late(void)
478bbd707acSShawn Guo {
4794ed12be0SRuslan Bilovol 	omap_common_late_init();
480bbd707acSShawn Guo 	omap2_pm_init();
48123fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
482bbd707acSShawn Guo }
483c4e2d245SSanjeev Premi #endif
4847b250affSTony Lindgren 
4857b250affSTony Lindgren /*
4867b250affSTony Lindgren  * Currently only board-omap3beagle.c should call this because of the
4877b250affSTony Lindgren  * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
4887b250affSTony Lindgren  */
489c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP3
4907b250affSTony Lindgren void __init omap3_init_early(void)
4917b250affSTony Lindgren {
492b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
493b6a4226cSPaul Walmsley 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
494b6a4226cSPaul Walmsley 			       OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
4952208bf11STero Kristo 	/* XXX: remove these once OMAP3 is DT only */
4962208bf11STero Kristo 	if (!of_have_populated_dt()) {
4972208bf11STero Kristo 		omap2_set_globals_control(
498efde2346STero Kristo 			OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE));
499d9a16f9aSPaul Walmsley 		omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
5002208bf11STero Kristo 		omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
5012208bf11STero Kristo 				     NULL);
5022208bf11STero Kristo 	}
5032208bf11STero Kristo 	omap2_control_base_init();
5044de34f35SVaibhav Hiremath 	omap3xxx_check_revision();
5054de34f35SVaibhav Hiremath 	omap3xxx_check_features();
506ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
507425dc8b2STero Kristo 	/* XXX: remove these once OMAP3 is DT only */
508425dc8b2STero Kristo 	if (!of_have_populated_dt()) {
509ab7b2ffcSTero Kristo 		omap3xxx_prm_init(NULL);
510425dc8b2STero Kristo 		omap3xxx_cm_init(NULL);
511425dc8b2STero Kristo 	}
5127b250affSTony Lindgren 	omap3xxx_voltagedomains_init();
5137b250affSTony Lindgren 	omap3xxx_powerdomains_init();
5147b250affSTony Lindgren 	omap3xxx_clockdomains_init();
5157b250affSTony Lindgren 	omap3xxx_hwmod_init();
5167b250affSTony Lindgren 	omap_hwmod_init_postsetup();
517eded36feSTero Kristo 	if (!of_have_populated_dt()) {
5182208bf11STero Kristo 		omap3_control_legacy_iomap_init();
519eded36feSTero Kristo 		if (soc_is_am35xx())
520eded36feSTero Kristo 			omap_clk_soc_init = am35xx_clk_legacy_init;
521eded36feSTero Kristo 		else if (cpu_is_omap3630())
522eded36feSTero Kristo 			omap_clk_soc_init = omap36xx_clk_legacy_init;
523eded36feSTero Kristo 		else if (omap_rev() == OMAP3430_REV_ES1_0)
524eded36feSTero Kristo 			omap_clk_soc_init = omap3430es1_clk_legacy_init;
525eded36feSTero Kristo 		else
526eded36feSTero Kristo 			omap_clk_soc_init = omap3430_clk_legacy_init;
527eded36feSTero Kristo 	}
5288f5b5a41STony Lindgren }
5298f5b5a41STony Lindgren 
5308f5b5a41STony Lindgren void __init omap3430_init_early(void)
5318f5b5a41STony Lindgren {
5327b250affSTony Lindgren 	omap3_init_early();
5333e049157STero Kristo 	if (of_have_populated_dt())
5343e049157STero Kristo 		omap_clk_soc_init = omap3430_dt_clk_init;
5358f5b5a41STony Lindgren }
5368f5b5a41STony Lindgren 
5378f5b5a41STony Lindgren void __init omap35xx_init_early(void)
5388f5b5a41STony Lindgren {
5397b250affSTony Lindgren 	omap3_init_early();
5403e049157STero Kristo 	if (of_have_populated_dt())
5413e049157STero Kristo 		omap_clk_soc_init = omap3430_dt_clk_init;
5428f5b5a41STony Lindgren }
5438f5b5a41STony Lindgren 
5448f5b5a41STony Lindgren void __init omap3630_init_early(void)
5458f5b5a41STony Lindgren {
5467b250affSTony Lindgren 	omap3_init_early();
5473e049157STero Kristo 	if (of_have_populated_dt())
5483e049157STero Kristo 		omap_clk_soc_init = omap3630_dt_clk_init;
5498f5b5a41STony Lindgren }
5508f5b5a41STony Lindgren 
5518f5b5a41STony Lindgren void __init am35xx_init_early(void)
5528f5b5a41STony Lindgren {
5537b250affSTony Lindgren 	omap3_init_early();
5543e049157STero Kristo 	if (of_have_populated_dt())
5553e049157STero Kristo 		omap_clk_soc_init = am35xx_dt_clk_init;
5568f5b5a41STony Lindgren }
5578f5b5a41STony Lindgren 
558bbd707acSShawn Guo void __init omap3_init_late(void)
559bbd707acSShawn Guo {
5604ed12be0SRuslan Bilovol 	omap_common_late_init();
561bbd707acSShawn Guo 	omap3_pm_init();
56223fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
563bbd707acSShawn Guo }
564bbd707acSShawn Guo 
565bbd707acSShawn Guo void __init omap3430_init_late(void)
566bbd707acSShawn Guo {
5674ed12be0SRuslan Bilovol 	omap_common_late_init();
568bbd707acSShawn Guo 	omap3_pm_init();
56923fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
570bbd707acSShawn Guo }
571bbd707acSShawn Guo 
572bbd707acSShawn Guo void __init omap35xx_init_late(void)
573bbd707acSShawn Guo {
5744ed12be0SRuslan Bilovol 	omap_common_late_init();
575bbd707acSShawn Guo 	omap3_pm_init();
57623fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
577bbd707acSShawn Guo }
578bbd707acSShawn Guo 
579bbd707acSShawn Guo void __init omap3630_init_late(void)
580bbd707acSShawn Guo {
5814ed12be0SRuslan Bilovol 	omap_common_late_init();
582bbd707acSShawn Guo 	omap3_pm_init();
58323fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
584bbd707acSShawn Guo }
585bbd707acSShawn Guo 
586bbd707acSShawn Guo void __init am35xx_init_late(void)
587bbd707acSShawn Guo {
5884ed12be0SRuslan Bilovol 	omap_common_late_init();
589bbd707acSShawn Guo 	omap3_pm_init();
59023fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
591bbd707acSShawn Guo }
592bbd707acSShawn Guo 
593bbd707acSShawn Guo void __init ti81xx_init_late(void)
594bbd707acSShawn Guo {
5954ed12be0SRuslan Bilovol 	omap_common_late_init();
59623fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
597bbd707acSShawn Guo }
598c4e2d245SSanjeev Premi #endif
5998f5b5a41STony Lindgren 
600a64459c4SAida Mynzhasova #ifdef CONFIG_SOC_TI81XX
601a64459c4SAida Mynzhasova void __init ti814x_init_early(void)
602a64459c4SAida Mynzhasova {
603a64459c4SAida Mynzhasova 	omap2_set_globals_tap(TI814X_CLASS,
604a64459c4SAida Mynzhasova 			      OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
6052208bf11STero Kristo 	omap2_control_base_init();
606a64459c4SAida Mynzhasova 	omap3xxx_check_revision();
607a64459c4SAida Mynzhasova 	ti81xx_check_features();
608ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
609a64459c4SAida Mynzhasova 	omap3xxx_voltagedomains_init();
610a64459c4SAida Mynzhasova 	omap3xxx_powerdomains_init();
611a64459c4SAida Mynzhasova 	ti81xx_clockdomains_init();
6124d38bd12STony Lindgren 	ti81xx_hwmod_init();
613a64459c4SAida Mynzhasova 	omap_hwmod_init_postsetup();
614a64459c4SAida Mynzhasova 	if (of_have_populated_dt())
615a64459c4SAida Mynzhasova 		omap_clk_soc_init = ti81xx_dt_clk_init;
616a64459c4SAida Mynzhasova }
617a64459c4SAida Mynzhasova 
618a64459c4SAida Mynzhasova void __init ti816x_init_early(void)
619a64459c4SAida Mynzhasova {
620a64459c4SAida Mynzhasova 	omap2_set_globals_tap(TI816X_CLASS,
621a64459c4SAida Mynzhasova 			      OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
6222208bf11STero Kristo 	omap2_control_base_init();
623a64459c4SAida Mynzhasova 	omap3xxx_check_revision();
624a64459c4SAida Mynzhasova 	ti81xx_check_features();
625ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
626a64459c4SAida Mynzhasova 	omap3xxx_voltagedomains_init();
627a64459c4SAida Mynzhasova 	omap3xxx_powerdomains_init();
628a64459c4SAida Mynzhasova 	ti81xx_clockdomains_init();
6294d38bd12STony Lindgren 	ti81xx_hwmod_init();
630a64459c4SAida Mynzhasova 	omap_hwmod_init_postsetup();
631a64459c4SAida Mynzhasova 	if (of_have_populated_dt())
632a64459c4SAida Mynzhasova 		omap_clk_soc_init = ti81xx_dt_clk_init;
633a64459c4SAida Mynzhasova }
634a64459c4SAida Mynzhasova #endif
635a64459c4SAida Mynzhasova 
63608f30989SAfzal Mohammed #ifdef CONFIG_SOC_AM33XX
63708f30989SAfzal Mohammed void __init am33xx_init_early(void)
63808f30989SAfzal Mohammed {
639b6a4226cSPaul Walmsley 	omap2_set_globals_tap(AM335X_CLASS,
640b6a4226cSPaul Walmsley 			      AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
6412208bf11STero Kristo 	omap2_control_base_init();
64208f30989SAfzal Mohammed 	omap3xxx_check_revision();
6437bcad170SVaibhav Hiremath 	am33xx_check_features();
644ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
6453f0ea764SVaibhav Hiremath 	am33xx_powerdomains_init();
6469c80f3aaSVaibhav Hiremath 	am33xx_clockdomains_init();
647a2cfc509SVaibhav Hiremath 	am33xx_hwmod_init();
648a2cfc509SVaibhav Hiremath 	omap_hwmod_init_postsetup();
649149c09d3STero Kristo 	omap_clk_soc_init = am33xx_dt_clk_init;
65008f30989SAfzal Mohammed }
651765e7a06SNishanth Menon 
652765e7a06SNishanth Menon void __init am33xx_init_late(void)
653765e7a06SNishanth Menon {
654765e7a06SNishanth Menon 	omap_common_late_init();
655765e7a06SNishanth Menon }
65608f30989SAfzal Mohammed #endif
65708f30989SAfzal Mohammed 
658c5107027SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX
659c5107027SAfzal Mohammed void __init am43xx_init_early(void)
660c5107027SAfzal Mohammed {
661c5107027SAfzal Mohammed 	omap2_set_globals_tap(AM335X_CLASS,
662c5107027SAfzal Mohammed 			      AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
6632208bf11STero Kristo 	omap2_control_base_init();
664c5107027SAfzal Mohammed 	omap3xxx_check_revision();
6657a2e0513SAfzal Mohammed 	am33xx_check_features();
666ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
6678835cf6eSAmbresh K 	am43xx_powerdomains_init();
6688835cf6eSAmbresh K 	am43xx_clockdomains_init();
6698835cf6eSAmbresh K 	am43xx_hwmod_init();
6708835cf6eSAmbresh K 	omap_hwmod_init_postsetup();
671d941f86fSSekhar Nori 	omap_l2_cache_init();
672d22031e2STero Kristo 	omap_clk_soc_init = am43xx_dt_clk_init;
673c5107027SAfzal Mohammed }
674765e7a06SNishanth Menon 
675765e7a06SNishanth Menon void __init am43xx_init_late(void)
676765e7a06SNishanth Menon {
677765e7a06SNishanth Menon 	omap_common_late_init();
678765e7a06SNishanth Menon }
679c5107027SAfzal Mohammed #endif
680c5107027SAfzal Mohammed 
681c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP4
6828f5b5a41STony Lindgren void __init omap4430_init_early(void)
6838f5b5a41STony Lindgren {
684b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP443X_CLASS,
685b6a4226cSPaul Walmsley 			      OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
686d9a16f9aSPaul Walmsley 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
687ca125b5eSTero Kristo 	omap2_control_base_init();
6884de34f35SVaibhav Hiremath 	omap4xxx_check_revision();
6894de34f35SVaibhav Hiremath 	omap4xxx_check_features();
690ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
691de70af49SNishanth Menon 	omap4_pm_init_early();
6927b250affSTony Lindgren 	omap44xx_voltagedomains_init();
6937b250affSTony Lindgren 	omap44xx_powerdomains_init();
6947b250affSTony Lindgren 	omap44xx_clockdomains_init();
6957b250affSTony Lindgren 	omap44xx_hwmod_init();
6967b250affSTony Lindgren 	omap_hwmod_init_postsetup();
697b39b14e6SSekhar Nori 	omap_l2_cache_init();
698c8c88d85STero Kristo 	omap_clk_soc_init = omap4xxx_dt_clk_init;
6998f5b5a41STony Lindgren }
700bbd707acSShawn Guo 
701bbd707acSShawn Guo void __init omap4430_init_late(void)
702bbd707acSShawn Guo {
7034ed12be0SRuslan Bilovol 	omap_common_late_init();
704bbd707acSShawn Guo 	omap4_pm_init();
70523fb8ba3SRajendra Nayak 	omap2_clk_enable_autoidle_all();
706bbd707acSShawn Guo }
707c4e2d245SSanjeev Premi #endif
7088f5b5a41STony Lindgren 
70905e152c7SR Sricharan #ifdef CONFIG_SOC_OMAP5
71005e152c7SR Sricharan void __init omap5_init_early(void)
71105e152c7SR Sricharan {
712b6a4226cSPaul Walmsley 	omap2_set_globals_tap(OMAP54XX_CLASS,
713b6a4226cSPaul Walmsley 			      OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
714d9a16f9aSPaul Walmsley 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
715ca125b5eSTero Kristo 	omap2_control_base_init();
716628ed471SSantosh Shilimkar 	omap4_pm_init_early();
717ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
71805e152c7SR Sricharan 	omap5xxx_check_revision();
719e4020aa9SSantosh Shilimkar 	omap54xx_voltagedomains_init();
720e4020aa9SSantosh Shilimkar 	omap54xx_powerdomains_init();
721e4020aa9SSantosh Shilimkar 	omap54xx_clockdomains_init();
722e4020aa9SSantosh Shilimkar 	omap54xx_hwmod_init();
723e4020aa9SSantosh Shilimkar 	omap_hwmod_init_postsetup();
724cfa9667dSTero Kristo 	omap_clk_soc_init = omap5xxx_dt_clk_init;
72505e152c7SR Sricharan }
726765e7a06SNishanth Menon 
727765e7a06SNishanth Menon void __init omap5_init_late(void)
728765e7a06SNishanth Menon {
729765e7a06SNishanth Menon 	omap_common_late_init();
730628ed471SSantosh Shilimkar 	omap4_pm_init();
731628ed471SSantosh Shilimkar 	omap2_clk_enable_autoidle_all();
732765e7a06SNishanth Menon }
73305e152c7SR Sricharan #endif
73405e152c7SR Sricharan 
735a3a9384aSR Sricharan #ifdef CONFIG_SOC_DRA7XX
736a3a9384aSR Sricharan void __init dra7xx_init_early(void)
737a3a9384aSR Sricharan {
738a3a9384aSR Sricharan 	omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
739a3a9384aSR Sricharan 	omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
740ca125b5eSTero Kristo 	omap2_control_base_init();
7416af16a1dSRajendra Nayak 	omap4_pm_init_early();
742ab7b2ffcSTero Kristo 	omap2_prcm_base_init();
743733d20eeSNishanth Menon 	dra7xxx_check_revision();
7447de516a6SAmbresh K 	dra7xx_powerdomains_init();
7457de516a6SAmbresh K 	dra7xx_clockdomains_init();
7467de516a6SAmbresh K 	dra7xx_hwmod_init();
7477de516a6SAmbresh K 	omap_hwmod_init_postsetup();
748f1cf498eSTero Kristo 	omap_clk_soc_init = dra7xx_dt_clk_init;
749a3a9384aSR Sricharan }
750765e7a06SNishanth Menon 
751765e7a06SNishanth Menon void __init dra7xx_init_late(void)
752765e7a06SNishanth Menon {
753765e7a06SNishanth Menon 	omap_common_late_init();
7546af16a1dSRajendra Nayak 	omap4_pm_init();
7556af16a1dSRajendra Nayak 	omap2_clk_enable_autoidle_all();
756765e7a06SNishanth Menon }
757a3a9384aSR Sricharan #endif
758a3a9384aSR Sricharan 
759a3a9384aSR Sricharan 
760a4ca9dbeSTony Lindgren void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
7614805734bSPaul Walmsley 				      struct omap_sdrc_params *sdrc_cs1)
7624805734bSPaul Walmsley {
763a66cb345STony Lindgren 	omap_sram_init();
764a66cb345STony Lindgren 
76501001712SHemant Pedanekar 	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
76658cda884SJean Pihet 		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
7672f135eafSPaul Walmsley 		_omap2_init_reprogram_sdrc();
768aa4b1f6eSKevin Hilman 	}
7691dbae815STony Lindgren }
770cfa9667dSTero Kristo 
771cfa9667dSTero Kristo int __init omap_clk_init(void)
772cfa9667dSTero Kristo {
773cfa9667dSTero Kristo 	int ret = 0;
774cfa9667dSTero Kristo 
775cfa9667dSTero Kristo 	if (!omap_clk_soc_init)
776cfa9667dSTero Kristo 		return 0;
777cfa9667dSTero Kristo 
7788111e010STero Kristo 	ti_clk_init_features();
7798111e010STero Kristo 
780eded36feSTero Kristo 	if (of_have_populated_dt()) {
781fe87414fSTero Kristo 		ret = omap_control_init();
782fe87414fSTero Kristo 		if (ret)
783fe87414fSTero Kristo 			return ret;
784fe87414fSTero Kristo 
7853a1a388eSTero Kristo 		ret = omap_prcm_init();
786c08ee14cSTero Kristo 		if (ret)
787c08ee14cSTero Kristo 			return ret;
788c08ee14cSTero Kristo 
789c08ee14cSTero Kristo 		of_clk_init(NULL);
790c08ee14cSTero Kristo 
791c08ee14cSTero Kristo 		ti_dt_clk_init_retry_clks();
792c08ee14cSTero Kristo 
793c08ee14cSTero Kristo 		ti_dt_clockdomains_setup();
794eded36feSTero Kristo 	}
795c08ee14cSTero Kristo 
796cfa9667dSTero Kristo 	ret = omap_clk_soc_init();
797cfa9667dSTero Kristo 
798cfa9667dSTero Kristo 	return ret;
799cfa9667dSTero Kristo }
800