From 7b250aff1ce346b6c7bc0329a2350334d1c66525 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Tue, 4 Oct 2011 18:26:28 -0700 Subject: ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done This way we don't need to initialize SoC detection early and can start using generic map_io. Reviewed-by: Santosh Shilimkar Tested-by: Santosh Shilimkar Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/io.c | 95 ++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 47 deletions(-) (limited to 'arch/arm/mach-omap2/io.c') diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 15f91c42be66..e8123d010307 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -248,9 +248,6 @@ static void __init _omap2_map_common_io(void) */ local_flush_tlb_all(); flush_cache_all(); - - omap2_check_revision(); - omap_sram_init(); } #ifdef CONFIG_SOC_OMAP2420 @@ -337,33 +334,15 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data) /* See irq.c, omap4-common.c and entry-macro.S */ void __iomem *omap_irq_base; -void __init omap2_init_common_infrastructure(void) +static void __init omap_common_init_early(void) { - u8 postsetup_state; + omap2_check_revision(); + omap_sram_init(); +} - if (cpu_is_omap242x()) { - omap2xxx_voltagedomains_init(); - omap242x_powerdomains_init(); - omap242x_clockdomains_init(); - omap2420_hwmod_init(); - } else if (cpu_is_omap243x()) { - omap2xxx_voltagedomains_init(); - omap243x_powerdomains_init(); - omap243x_clockdomains_init(); - omap2430_hwmod_init(); - } else if (cpu_is_omap34xx()) { - omap3xxx_voltagedomains_init(); - omap3xxx_powerdomains_init(); - omap3xxx_clockdomains_init(); - omap3xxx_hwmod_init(); - } else if (cpu_is_omap44xx()) { - omap44xx_voltagedomains_init(); - omap44xx_powerdomains_init(); - omap44xx_clockdomains_init(); - omap44xx_hwmod_init(); - } else { - pr_err("Could not init hwmod data - unknown SoC\n"); - } +static void __init omap_hwmod_init_postsetup(void) +{ + u8 postsetup_state; /* Set the default postsetup state for all hwmods */ #ifdef CONFIG_PM_RUNTIME @@ -392,57 +371,79 @@ void __init omap2_init_common_infrastructure(void) &postsetup_state); omap_pm_if_early_init(); - - if (cpu_is_omap2420()) - omap2420_clk_init(); - else if (cpu_is_omap2430()) - omap2430_clk_init(); - else if (cpu_is_omap34xx()) - omap3xxx_clk_init(); - else if (cpu_is_omap44xx()) - omap4xxx_clk_init(); - else - pr_err("Could not init clock framework - unknown SoC\n"); } void __init omap2420_init_early(void) { - omap2_init_common_infrastructure(); + omap_common_init_early(); + omap2xxx_voltagedomains_init(); + omap242x_powerdomains_init(); + omap242x_clockdomains_init(); + omap2420_hwmod_init(); + omap_hwmod_init_postsetup(); + omap2420_clk_init(); } void __init omap2430_init_early(void) { - omap2_init_common_infrastructure(); + omap_common_init_early(); + omap2xxx_voltagedomains_init(); + omap243x_powerdomains_init(); + omap243x_clockdomains_init(); + omap2430_hwmod_init(); + omap_hwmod_init_postsetup(); + omap2430_clk_init(); +} + +/* + * Currently only board-omap3beagle.c should call this because of the + * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT. + */ +void __init omap3_init_early(void) +{ + omap_common_init_early(); + omap3xxx_voltagedomains_init(); + omap3xxx_powerdomains_init(); + omap3xxx_clockdomains_init(); + omap3xxx_hwmod_init(); + omap_hwmod_init_postsetup(); + omap3xxx_clk_init(); } void __init omap3430_init_early(void) { - omap2_init_common_infrastructure(); + omap3_init_early(); } void __init omap35xx_init_early(void) { - omap2_init_common_infrastructure(); + omap3_init_early(); } void __init omap3630_init_early(void) { - omap2_init_common_infrastructure(); + omap3_init_early(); } void __init am35xx_init_early(void) { - omap2_init_common_infrastructure(); + omap3_init_early(); } void __init ti816x_init_early(void) { - omap2_init_common_infrastructure(); + omap3_init_early(); } void __init omap4430_init_early(void) { - omap2_init_common_infrastructure(); + omap_common_init_early(); + omap44xx_voltagedomains_init(); + omap44xx_powerdomains_init(); + omap44xx_clockdomains_init(); + omap44xx_hwmod_init(); + omap_hwmod_init_postsetup(); + omap4xxx_clk_init(); } void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, -- cgit v1.2.3 From a66cb3454f220f49f900646ebdc76cb943319eb7 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Tue, 4 Oct 2011 13:52:57 -0700 Subject: ARM: OMAP: Map SRAM later on with ioremap_exec() This allows us to remove omap hacks for map_io. Acked-by: Nicolas Pitre Reviewed-by: Santosh Shilimkar Tested-by: Santosh Shilimkar Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/io.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'arch/arm/mach-omap2/io.c') diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index e8123d010307..b42bbb8f252d 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -35,8 +35,8 @@ #include "clock2xxx.h" #include "clock3xxx.h" #include "clock44xx.h" -#include "io.h" +#include #include #include "voltage.h" #include "powerdomain.h" @@ -240,22 +240,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = { }; #endif -static void __init _omap2_map_common_io(void) -{ - /* Normally devicemaps_init() would flush caches and tlb after - * mdesc->map_io(), but we must also do it here because of the CPU - * revision check below. - */ - local_flush_tlb_all(); - flush_cache_all(); -} - #ifdef CONFIG_SOC_OMAP2420 void __init omap242x_map_common_io(void) { iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); - _omap2_map_common_io(); } #endif @@ -264,7 +253,6 @@ void __init omap243x_map_common_io(void) { iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); - _omap2_map_common_io(); } #endif @@ -272,7 +260,6 @@ void __init omap243x_map_common_io(void) void __init omap34xx_map_common_io(void) { iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); - _omap2_map_common_io(); } #endif @@ -280,7 +267,6 @@ void __init omap34xx_map_common_io(void) void __init omapti816x_map_common_io(void) { iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc)); - _omap2_map_common_io(); } #endif @@ -288,7 +274,6 @@ void __init omapti816x_map_common_io(void) void __init omap44xx_map_common_io(void) { iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); - _omap2_map_common_io(); } #endif @@ -337,7 +322,6 @@ void __iomem *omap_irq_base; static void __init omap_common_init_early(void) { omap2_check_revision(); - omap_sram_init(); } static void __init omap_hwmod_init_postsetup(void) @@ -449,11 +433,12 @@ void __init omap4430_init_early(void) void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, struct omap_sdrc_params *sdrc_cs1) { + omap_sram_init(); + if (cpu_is_omap24xx() || omap3_has_sdrc()) { omap2_sdrc_init(sdrc_cs0, sdrc_cs1); _omap2_init_reprogram_sdrc(); } - } /* -- cgit v1.2.3 From 4c3cf90117f1f4906d5975aeccc5ffd414807fd2 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Tue, 4 Oct 2011 18:17:41 -0700 Subject: ARM: OMAP: Move set_globals initialization to happen in init_early Otherwise we can't do generic map_io as we currently rely on static mappings that work only because of arch_ioremap. Acked-by: Nicolas Pitre Reviewed-by: Santosh Shilimkar Tested-by: Santosh Shilimkar Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/io.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-omap2/io.c') diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index b42bbb8f252d..d5caac3698dd 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -44,6 +44,7 @@ #include "clockdomain.h" #include #include +#include /* * The machine specific code may provide the extra mapping besides the @@ -359,6 +360,7 @@ static void __init omap_hwmod_init_postsetup(void) void __init omap2420_init_early(void) { + omap2_set_globals_242x(); omap_common_init_early(); omap2xxx_voltagedomains_init(); omap242x_powerdomains_init(); @@ -370,6 +372,7 @@ void __init omap2420_init_early(void) void __init omap2430_init_early(void) { + omap2_set_globals_243x(); omap_common_init_early(); omap2xxx_voltagedomains_init(); omap243x_powerdomains_init(); @@ -385,6 +388,7 @@ void __init omap2430_init_early(void) */ void __init omap3_init_early(void) { + omap2_set_globals_3xxx(); omap_common_init_early(); omap3xxx_voltagedomains_init(); omap3xxx_powerdomains_init(); @@ -416,11 +420,19 @@ void __init am35xx_init_early(void) void __init ti816x_init_early(void) { - omap3_init_early(); + omap2_set_globals_ti816x(); + omap_common_init_early(); + omap3xxx_voltagedomains_init(); + omap3xxx_powerdomains_init(); + omap3xxx_clockdomains_init(); + omap3xxx_hwmod_init(); + omap_hwmod_init_postsetup(); + omap3xxx_clk_init(); } void __init omap4430_init_early(void) { + omap2_set_globals_443x(); omap_common_init_early(); omap44xx_voltagedomains_init(); omap44xx_powerdomains_init(); -- cgit v1.2.3 From 8aca3ab5865f8cfbde841b6daf9442cc2279ced3 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Wed, 5 Oct 2011 17:22:39 -0700 Subject: ARM: OMAP: Warn if omap_ioremap is called before SoC detection We don't have cpu_is_omapxxxx SoC detection initialized until SoC detection is initialized from init_early. Note that with the common map_io we should no longer need cpu_is_omapxxxx for ioremap. Acked-by: Nicolas Pitre Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/io.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/arm/mach-omap2/io.c') diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index d5caac3698dd..aa96538f3fee 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -323,6 +323,7 @@ void __iomem *omap_irq_base; static void __init omap_common_init_early(void) { omap2_check_revision(); + omap_ioremap_init(); } static void __init omap_hwmod_init_postsetup(void) -- cgit v1.2.3