xref: /openbmc/linux/arch/arm/mach-omap2/io.c (revision a8eb7ca0cbb41c9cd379b8d2a2a5efb503aa65e9)
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 
201dbae815STony Lindgren #include <linux/module.h>
211dbae815STony Lindgren #include <linux/kernel.h>
221dbae815STony Lindgren #include <linux/init.h>
23fced80c7SRussell King #include <linux/io.h>
242f135eafSPaul Walmsley #include <linux/clk.h>
2591773a00STomi Valkeinen #include <linux/omapfb.h>
261dbae815STony Lindgren 
27120db2cbSTony Lindgren #include <asm/tlb.h>
28120db2cbSTony Lindgren 
29120db2cbSTony Lindgren #include <asm/mach/map.h>
30120db2cbSTony Lindgren 
31ce491cf8STony Lindgren #include <plat/mux.h>
32ce491cf8STony Lindgren #include <plat/sram.h>
33ce491cf8STony Lindgren #include <plat/sdrc.h>
34ce491cf8STony Lindgren #include <plat/gpmc.h>
35ce491cf8STony Lindgren #include <plat/serial.h>
36afedec18STomi Valkeinen #include <plat/vram.h>
37646e3ed1STony Lindgren 
38e80a9729SPaul Walmsley #include "clock2xxx.h"
39e80a9729SPaul Walmsley #include "clock34xx.h"
40e80a9729SPaul Walmsley #include "clock44xx.h"
411dbae815STony Lindgren 
42ce491cf8STony Lindgren #include <plat/omap-pm.h>
43ce491cf8STony Lindgren #include <plat/powerdomain.h>
449717100fSPaul Walmsley #include "powerdomains.h"
459717100fSPaul Walmsley 
46ce491cf8STony Lindgren #include <plat/clockdomain.h>
47801954d3SPaul Walmsley #include "clockdomains.h"
48ce491cf8STony Lindgren #include <plat/omap_hwmod.h>
4902bfc030SPaul Walmsley #include "omap_hwmod_2420.h"
5002bfc030SPaul Walmsley #include "omap_hwmod_2430.h"
5102bfc030SPaul Walmsley #include "omap_hwmod_34xx.h"
5202bfc030SPaul Walmsley 
531dbae815STony Lindgren /*
541dbae815STony Lindgren  * The machine specific code may provide the extra mapping besides the
551dbae815STony Lindgren  * default mapping provided here.
561dbae815STony Lindgren  */
57cc26b3b0SSyed Mohammed, Khasim 
58088ef950STony Lindgren #ifdef CONFIG_ARCH_OMAP2
59cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap24xx_io_desc[] __initdata = {
601dbae815STony Lindgren 	{
611dbae815STony Lindgren 		.virtual	= L3_24XX_VIRT,
621dbae815STony Lindgren 		.pfn		= __phys_to_pfn(L3_24XX_PHYS),
631dbae815STony Lindgren 		.length		= L3_24XX_SIZE,
641dbae815STony Lindgren 		.type		= MT_DEVICE
651dbae815STony Lindgren 	},
6609f21ed4SKyungmin Park 	{
6709f21ed4SKyungmin Park 		.virtual	= L4_24XX_VIRT,
6809f21ed4SKyungmin Park 		.pfn		= __phys_to_pfn(L4_24XX_PHYS),
6909f21ed4SKyungmin Park 		.length		= L4_24XX_SIZE,
7009f21ed4SKyungmin Park 		.type		= MT_DEVICE
7109f21ed4SKyungmin Park 	},
72cc26b3b0SSyed Mohammed, Khasim };
73cc26b3b0SSyed Mohammed, Khasim 
74cc26b3b0SSyed Mohammed, Khasim #ifdef CONFIG_ARCH_OMAP2420
75cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap242x_io_desc[] __initdata = {
761dbae815STony Lindgren 	{
777adb9987SPaul Walmsley 		.virtual	= DSP_MEM_2420_VIRT,
787adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_MEM_2420_PHYS),
797adb9987SPaul Walmsley 		.length		= DSP_MEM_2420_SIZE,
80c40fae95STony Lindgren 		.type		= MT_DEVICE
81c40fae95STony Lindgren 	},
82c40fae95STony Lindgren 	{
837adb9987SPaul Walmsley 		.virtual	= DSP_IPI_2420_VIRT,
847adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_IPI_2420_PHYS),
857adb9987SPaul Walmsley 		.length		= DSP_IPI_2420_SIZE,
86c40fae95STony Lindgren 		.type		= MT_DEVICE
87c40fae95STony Lindgren 	},
88c40fae95STony Lindgren 	{
897adb9987SPaul Walmsley 		.virtual	= DSP_MMU_2420_VIRT,
907adb9987SPaul Walmsley 		.pfn		= __phys_to_pfn(DSP_MMU_2420_PHYS),
917adb9987SPaul Walmsley 		.length		= DSP_MMU_2420_SIZE,
921dbae815STony Lindgren 		.type		= MT_DEVICE
93cc26b3b0SSyed Mohammed, Khasim 	},
941dbae815STony Lindgren };
951dbae815STony Lindgren 
96cc26b3b0SSyed Mohammed, Khasim #endif
97cc26b3b0SSyed Mohammed, Khasim 
98cc26b3b0SSyed Mohammed, Khasim #ifdef CONFIG_ARCH_OMAP2430
99cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap243x_io_desc[] __initdata = {
100cc26b3b0SSyed Mohammed, Khasim 	{
101cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_WK_243X_VIRT,
102cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_WK_243X_PHYS),
103cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_WK_243X_SIZE,
104cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
105cc26b3b0SSyed Mohammed, Khasim 	},
106cc26b3b0SSyed Mohammed, Khasim 	{
107cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_GPMC_VIRT,
108cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_GPMC_PHYS),
109cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_GPMC_SIZE,
110cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
111cc26b3b0SSyed Mohammed, Khasim 	},
112cc26b3b0SSyed Mohammed, Khasim 	{
113cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_SDRC_VIRT,
114cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_SDRC_PHYS),
115cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_SDRC_SIZE,
116cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
117cc26b3b0SSyed Mohammed, Khasim 	},
118cc26b3b0SSyed Mohammed, Khasim 	{
119cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP243X_SMS_VIRT,
120cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP243X_SMS_PHYS),
121cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP243X_SMS_SIZE,
122cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
123cc26b3b0SSyed Mohammed, Khasim 	},
124cc26b3b0SSyed Mohammed, Khasim };
125cc26b3b0SSyed Mohammed, Khasim #endif
126cc26b3b0SSyed Mohammed, Khasim #endif
127cc26b3b0SSyed Mohammed, Khasim 
128*a8eb7ca0STony Lindgren #ifdef	CONFIG_ARCH_OMAP3
129cc26b3b0SSyed Mohammed, Khasim static struct map_desc omap34xx_io_desc[] __initdata = {
130cc26b3b0SSyed Mohammed, Khasim 	{
131cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L3_34XX_VIRT,
132cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L3_34XX_PHYS),
133cc26b3b0SSyed Mohammed, Khasim 		.length		= L3_34XX_SIZE,
134cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
135cc26b3b0SSyed Mohammed, Khasim 	},
136cc26b3b0SSyed Mohammed, Khasim 	{
137cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_34XX_VIRT,
138cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_34XX_PHYS),
139cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_34XX_SIZE,
140cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
141cc26b3b0SSyed Mohammed, Khasim 	},
142cc26b3b0SSyed Mohammed, Khasim 	{
143cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_WK_34XX_VIRT,
144cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_WK_34XX_PHYS),
145cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_WK_34XX_SIZE,
146cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
147cc26b3b0SSyed Mohammed, Khasim 	},
148cc26b3b0SSyed Mohammed, Khasim 	{
149cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP34XX_GPMC_VIRT,
150cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP34XX_GPMC_PHYS),
151cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP34XX_GPMC_SIZE,
152cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
153cc26b3b0SSyed Mohammed, Khasim 	},
154cc26b3b0SSyed Mohammed, Khasim 	{
155cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP343X_SMS_VIRT,
156cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP343X_SMS_PHYS),
157cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP343X_SMS_SIZE,
158cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
159cc26b3b0SSyed Mohammed, Khasim 	},
160cc26b3b0SSyed Mohammed, Khasim 	{
161cc26b3b0SSyed Mohammed, Khasim 		.virtual	= OMAP343X_SDRC_VIRT,
162cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(OMAP343X_SDRC_PHYS),
163cc26b3b0SSyed Mohammed, Khasim 		.length		= OMAP343X_SDRC_SIZE,
164cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
165cc26b3b0SSyed Mohammed, Khasim 	},
166cc26b3b0SSyed Mohammed, Khasim 	{
167cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_PER_34XX_VIRT,
168cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_PER_34XX_PHYS),
169cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_PER_34XX_SIZE,
170cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
171cc26b3b0SSyed Mohammed, Khasim 	},
172cc26b3b0SSyed Mohammed, Khasim 	{
173cc26b3b0SSyed Mohammed, Khasim 		.virtual	= L4_EMU_34XX_VIRT,
174cc26b3b0SSyed Mohammed, Khasim 		.pfn		= __phys_to_pfn(L4_EMU_34XX_PHYS),
175cc26b3b0SSyed Mohammed, Khasim 		.length		= L4_EMU_34XX_SIZE,
176cc26b3b0SSyed Mohammed, Khasim 		.type		= MT_DEVICE
177cc26b3b0SSyed Mohammed, Khasim 	},
178cc26b3b0SSyed Mohammed, Khasim };
179cc26b3b0SSyed Mohammed, Khasim #endif
18044169075SSantosh Shilimkar #ifdef	CONFIG_ARCH_OMAP4
18144169075SSantosh Shilimkar static struct map_desc omap44xx_io_desc[] __initdata = {
18244169075SSantosh Shilimkar 	{
18344169075SSantosh Shilimkar 		.virtual	= L3_44XX_VIRT,
18444169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L3_44XX_PHYS),
18544169075SSantosh Shilimkar 		.length		= L3_44XX_SIZE,
18644169075SSantosh Shilimkar 		.type		= MT_DEVICE,
18744169075SSantosh Shilimkar 	},
18844169075SSantosh Shilimkar 	{
18944169075SSantosh Shilimkar 		.virtual	= L4_44XX_VIRT,
19044169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_44XX_PHYS),
19144169075SSantosh Shilimkar 		.length		= L4_44XX_SIZE,
19244169075SSantosh Shilimkar 		.type		= MT_DEVICE,
19344169075SSantosh Shilimkar 	},
19444169075SSantosh Shilimkar 	{
19544169075SSantosh Shilimkar 		.virtual	= L4_WK_44XX_VIRT,
19644169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_WK_44XX_PHYS),
19744169075SSantosh Shilimkar 		.length		= L4_WK_44XX_SIZE,
19844169075SSantosh Shilimkar 		.type		= MT_DEVICE,
19944169075SSantosh Shilimkar 	},
20044169075SSantosh Shilimkar 	{
20144169075SSantosh Shilimkar 		.virtual	= OMAP44XX_GPMC_VIRT,
20244169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(OMAP44XX_GPMC_PHYS),
20344169075SSantosh Shilimkar 		.length		= OMAP44XX_GPMC_SIZE,
20444169075SSantosh Shilimkar 		.type		= MT_DEVICE,
20544169075SSantosh Shilimkar 	},
20644169075SSantosh Shilimkar 	{
207f5d2d659SSantosh Shilimkar 		.virtual	= OMAP44XX_EMIF1_VIRT,
208f5d2d659SSantosh Shilimkar 		.pfn		= __phys_to_pfn(OMAP44XX_EMIF1_PHYS),
209f5d2d659SSantosh Shilimkar 		.length		= OMAP44XX_EMIF1_SIZE,
210f5d2d659SSantosh Shilimkar 		.type		= MT_DEVICE,
211f5d2d659SSantosh Shilimkar 	},
212f5d2d659SSantosh Shilimkar 	{
213f5d2d659SSantosh Shilimkar 		.virtual	= OMAP44XX_EMIF2_VIRT,
214f5d2d659SSantosh Shilimkar 		.pfn		= __phys_to_pfn(OMAP44XX_EMIF2_PHYS),
215f5d2d659SSantosh Shilimkar 		.length		= OMAP44XX_EMIF2_SIZE,
216f5d2d659SSantosh Shilimkar 		.type		= MT_DEVICE,
217f5d2d659SSantosh Shilimkar 	},
218f5d2d659SSantosh Shilimkar 	{
219f5d2d659SSantosh Shilimkar 		.virtual	= OMAP44XX_DMM_VIRT,
220f5d2d659SSantosh Shilimkar 		.pfn		= __phys_to_pfn(OMAP44XX_DMM_PHYS),
221f5d2d659SSantosh Shilimkar 		.length		= OMAP44XX_DMM_SIZE,
222f5d2d659SSantosh Shilimkar 		.type		= MT_DEVICE,
223f5d2d659SSantosh Shilimkar 	},
224f5d2d659SSantosh Shilimkar 	{
22544169075SSantosh Shilimkar 		.virtual	= L4_PER_44XX_VIRT,
22644169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_PER_44XX_PHYS),
22744169075SSantosh Shilimkar 		.length		= L4_PER_44XX_SIZE,
22844169075SSantosh Shilimkar 		.type		= MT_DEVICE,
22944169075SSantosh Shilimkar 	},
23044169075SSantosh Shilimkar 	{
23144169075SSantosh Shilimkar 		.virtual	= L4_EMU_44XX_VIRT,
23244169075SSantosh Shilimkar 		.pfn		= __phys_to_pfn(L4_EMU_44XX_PHYS),
23344169075SSantosh Shilimkar 		.length		= L4_EMU_44XX_SIZE,
23444169075SSantosh Shilimkar 		.type		= MT_DEVICE,
23544169075SSantosh Shilimkar 	},
23644169075SSantosh Shilimkar };
23744169075SSantosh Shilimkar #endif
238cc26b3b0SSyed Mohammed, Khasim 
2396fbd55d0STony Lindgren static void __init _omap2_map_common_io(void)
2401dbae815STony Lindgren {
241120db2cbSTony Lindgren 	/* Normally devicemaps_init() would flush caches and tlb after
242120db2cbSTony Lindgren 	 * mdesc->map_io(), but we must also do it here because of the CPU
243120db2cbSTony Lindgren 	 * revision check below.
244120db2cbSTony Lindgren 	 */
245120db2cbSTony Lindgren 	local_flush_tlb_all();
246120db2cbSTony Lindgren 	flush_cache_all();
247120db2cbSTony Lindgren 
2481dbae815STony Lindgren 	omap2_check_revision();
2491dbae815STony Lindgren 	omap_sram_init();
250b7cc6d46SImre Deak 	omapfb_reserve_sdram();
251afedec18STomi Valkeinen 	omap_vram_reserve_sdram();
252120db2cbSTony Lindgren }
253120db2cbSTony Lindgren 
2546fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP2420
2556fbd55d0STony Lindgren void __init omap242x_map_common_io()
2566fbd55d0STony Lindgren {
2576fbd55d0STony Lindgren 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
2586fbd55d0STony Lindgren 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
2596fbd55d0STony Lindgren 	_omap2_map_common_io();
2606fbd55d0STony Lindgren }
2616fbd55d0STony Lindgren #endif
2626fbd55d0STony Lindgren 
2636fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP2430
2646fbd55d0STony Lindgren void __init omap243x_map_common_io()
2656fbd55d0STony Lindgren {
2666fbd55d0STony Lindgren 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
2676fbd55d0STony Lindgren 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
2686fbd55d0STony Lindgren 	_omap2_map_common_io();
2696fbd55d0STony Lindgren }
2706fbd55d0STony Lindgren #endif
2716fbd55d0STony Lindgren 
272*a8eb7ca0STony Lindgren #ifdef CONFIG_ARCH_OMAP3
2736fbd55d0STony Lindgren void __init omap34xx_map_common_io()
2746fbd55d0STony Lindgren {
2756fbd55d0STony Lindgren 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
2766fbd55d0STony Lindgren 	_omap2_map_common_io();
2776fbd55d0STony Lindgren }
2786fbd55d0STony Lindgren #endif
2796fbd55d0STony Lindgren 
2806fbd55d0STony Lindgren #ifdef CONFIG_ARCH_OMAP4
2816fbd55d0STony Lindgren void __init omap44xx_map_common_io()
2826fbd55d0STony Lindgren {
2836fbd55d0STony Lindgren 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
2846fbd55d0STony Lindgren 	_omap2_map_common_io();
2856fbd55d0STony Lindgren }
2866fbd55d0STony Lindgren #endif
2876fbd55d0STony Lindgren 
2882f135eafSPaul Walmsley /*
2892f135eafSPaul Walmsley  * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
2902f135eafSPaul Walmsley  *
2912f135eafSPaul Walmsley  * Sets the CORE DPLL3 M2 divider to the same value that it's at
2922f135eafSPaul Walmsley  * currently.  This has the effect of setting the SDRC SDRAM AC timing
2932f135eafSPaul Walmsley  * registers to the values currently defined by the kernel.  Currently
2942f135eafSPaul Walmsley  * only defined for OMAP3; will return 0 if called on OMAP2.  Returns
2952f135eafSPaul Walmsley  * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2,
2962f135eafSPaul Walmsley  * or passes along the return value of clk_set_rate().
2972f135eafSPaul Walmsley  */
2982f135eafSPaul Walmsley static int __init _omap2_init_reprogram_sdrc(void)
2992f135eafSPaul Walmsley {
3002f135eafSPaul Walmsley 	struct clk *dpll3_m2_ck;
3012f135eafSPaul Walmsley 	int v = -EINVAL;
3022f135eafSPaul Walmsley 	long rate;
3032f135eafSPaul Walmsley 
3042f135eafSPaul Walmsley 	if (!cpu_is_omap34xx())
3052f135eafSPaul Walmsley 		return 0;
3062f135eafSPaul Walmsley 
3072f135eafSPaul Walmsley 	dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck");
3082f135eafSPaul Walmsley 	if (!dpll3_m2_ck)
3092f135eafSPaul Walmsley 		return -EINVAL;
3102f135eafSPaul Walmsley 
3112f135eafSPaul Walmsley 	rate = clk_get_rate(dpll3_m2_ck);
3122f135eafSPaul Walmsley 	pr_info("Reprogramming SDRC clock to %ld Hz\n", rate);
3132f135eafSPaul Walmsley 	v = clk_set_rate(dpll3_m2_ck, rate);
3142f135eafSPaul Walmsley 	if (v)
3152f135eafSPaul Walmsley 		pr_err("dpll3_m2_clk rate change failed: %d\n", v);
3162f135eafSPaul Walmsley 
3172f135eafSPaul Walmsley 	clk_put(dpll3_m2_ck);
3182f135eafSPaul Walmsley 
3192f135eafSPaul Walmsley 	return v;
3202f135eafSPaul Walmsley }
3212f135eafSPaul Walmsley 
32258cda884SJean Pihet void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
32358cda884SJean Pihet 				 struct omap_sdrc_params *sdrc_cs1)
324120db2cbSTony Lindgren {
32502bfc030SPaul Walmsley 	struct omap_hwmod **hwmods = NULL;
32602bfc030SPaul Walmsley 
32702bfc030SPaul Walmsley 	if (cpu_is_omap2420())
32802bfc030SPaul Walmsley 		hwmods = omap2420_hwmods;
32902bfc030SPaul Walmsley 	else if (cpu_is_omap2430())
33002bfc030SPaul Walmsley 		hwmods = omap2430_hwmods;
33102bfc030SPaul Walmsley 	else if (cpu_is_omap34xx())
33202bfc030SPaul Walmsley 		hwmods = omap34xx_hwmods;
33302bfc030SPaul Walmsley 
3343a759f09SAbhijit Pagare 	pwrdm_init(powerdomains_omap);
33555ed9694SPaul Walmsley 	clkdm_init(clockdomains_omap, clkdm_autodeps);
33644169075SSantosh Shilimkar #ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once the clkdev is ready */
337c0407a96SPaul Walmsley 	/* The OPP tables have to be registered before a clk init */
33861f04ee8STony Lindgren 	omap_hwmod_init(hwmods);
33961f04ee8STony Lindgren 	omap2_mux_init();
340c0407a96SPaul Walmsley 	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
3415b7815b5SSantosh Shilimkar #endif
342e80a9729SPaul Walmsley 
343e80a9729SPaul Walmsley 	if (cpu_is_omap24xx())
344e80a9729SPaul Walmsley 		omap2xxx_clk_init();
345e80a9729SPaul Walmsley 	else if (cpu_is_omap34xx())
346e80a9729SPaul Walmsley 		omap3xxx_clk_init();
347e80a9729SPaul Walmsley 	else if (cpu_is_omap44xx())
348e80a9729SPaul Walmsley 		omap4xxx_clk_init();
349e80a9729SPaul Walmsley 	else
350e80a9729SPaul Walmsley 		pr_err("Could not init clock framework - unknown CPU\n");
351e80a9729SPaul Walmsley 
352b3c6df3aSPaul Walmsley 	omap_serial_early_init();
3535b7815b5SSantosh Shilimkar #ifndef CONFIG_ARCH_OMAP4
35402bfc030SPaul Walmsley 	omap_hwmod_late_init();
355c0407a96SPaul Walmsley 	omap_pm_if_init();
35658cda884SJean Pihet 	omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
3572f135eafSPaul Walmsley 	_omap2_init_reprogram_sdrc();
35844169075SSantosh Shilimkar #endif
3594bbbc1adSJuha Yrjola 	gpmc_init();
3601dbae815STony Lindgren }
361