This avoids the need to use memblock_virt_alloc in the code. Done in preparation of adding generic PM domains to OMAP platform codebase; generic PM domain registration doesn't work during early_init. Signed-off-by: Tero Kristo <t-kristo@xxxxxx> --- arch/arm/mach-omap2/io.c | 180 ++++++++++++++++++++++++-------------- arch/arm/mach-omap2/omap_hwmod.c | 5 +- drivers/clk/ti/clk.c | 3 +- 3 files changed, 118 insertions(+), 70 deletions(-) diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index fc207ff..282fd96 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -62,6 +62,12 @@ static int (*omap_clk_soc_init)(void); /* + * prcm_data_init: points to a function that does the SoC-specific + * PRCM data (pwrdm/clkdm/hwmod) initializations + */ +static void (*prcm_data_init)(void); + +/* * The machine specific code may provide the extra mapping besides the * default mapping provided here. */ @@ -375,19 +381,24 @@ static void __init __maybe_unused omap_common_late_init(void) } #ifdef CONFIG_SOC_OMAP2420 -void __init omap2420_init_early(void) +static void __init omap2420_prcm_data_init(void) { - omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000)); - omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE), - OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE)); - omap2_control_base_init(); - omap2xxx_check_revision(); omap2_prcm_base_init(); omap2xxx_voltagedomains_init(); omap242x_powerdomains_init(); omap242x_clockdomains_init(); omap2420_hwmod_init(); omap_hwmod_init_postsetup(); +} + +void __init omap2420_init_early(void) +{ + omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000)); + omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE), + OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE)); + omap2_control_base_init(); + omap2xxx_check_revision(); + prcm_data_init = omap2420_prcm_data_init; omap_clk_soc_init = omap2420_dt_clk_init; rate_table = omap2420_rate_table; } @@ -401,19 +412,24 @@ void __init omap2420_init_late(void) #endif #ifdef CONFIG_SOC_OMAP2430 -void __init omap2430_init_early(void) +static void __init omap2430_prcm_data_init(void) { - omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000)); - omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE), - OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE)); - omap2_control_base_init(); - omap2xxx_check_revision(); omap2_prcm_base_init(); omap2xxx_voltagedomains_init(); omap243x_powerdomains_init(); omap243x_clockdomains_init(); omap2430_hwmod_init(); omap_hwmod_init_postsetup(); +} + +void __init omap2430_init_early(void) +{ + omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000)); + omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE), + OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE)); + omap2_control_base_init(); + omap2xxx_check_revision(); + prcm_data_init = omap2430_prcm_data_init; omap_clk_soc_init = omap2430_dt_clk_init; rate_table = omap2430_rate_table; } @@ -431,22 +447,8 @@ void __init omap2430_init_late(void) * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT. */ #ifdef CONFIG_ARCH_OMAP3 -void __init omap3_init_early(void) +static void __init omap3_prcm_data_init(void) { - omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000)); - omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE), - OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE)); - /* XXX: remove these once OMAP3 is DT only */ - if (!of_have_populated_dt()) { - omap2_set_globals_control( - OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE)); - omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE)); - omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), - NULL); - } - omap2_control_base_init(); - omap3xxx_check_revision(); - omap3xxx_check_features(); omap2_prcm_base_init(); /* XXX: remove these once OMAP3 is DT only */ if (!of_have_populated_dt()) { @@ -471,6 +473,25 @@ void __init omap3_init_early(void) } } +void __init omap3_init_early(void) +{ + omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000)); + omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE), + OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE)); + /* XXX: remove these once OMAP3 is DT only */ + if (!of_have_populated_dt()) { + omap2_set_globals_control( + OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE)); + omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE)); + omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), + NULL); + } + omap2_control_base_init(); + omap3xxx_check_revision(); + omap3xxx_check_features(); + prcm_data_init = omap3_prcm_data_init; +} + void __init omap3430_init_early(void) { omap3_init_early(); @@ -542,13 +563,8 @@ void __init ti81xx_init_late(void) #endif #ifdef CONFIG_SOC_TI81XX -void __init ti814x_init_early(void) +void __init ti81xx_prcm_data_init(void) { - omap2_set_globals_tap(TI814X_CLASS, - OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); - omap2_control_base_init(); - omap3xxx_check_revision(); - ti81xx_check_features(); omap2_prcm_base_init(); omap3xxx_voltagedomains_init(); omap3xxx_powerdomains_init(); @@ -559,6 +575,16 @@ void __init ti814x_init_early(void) omap_clk_soc_init = ti81xx_dt_clk_init; } +void __init ti814x_init_early(void) +{ + omap2_set_globals_tap(TI814X_CLASS, + OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); + omap2_control_base_init(); + omap3xxx_check_revision(); + ti81xx_check_features(); + prcm_data_init = ti81xx_prcm_data_init; +} + void __init ti816x_init_early(void) { omap2_set_globals_tap(TI816X_CLASS, @@ -566,18 +592,20 @@ void __init ti816x_init_early(void) omap2_control_base_init(); omap3xxx_check_revision(); ti81xx_check_features(); - omap2_prcm_base_init(); - omap3xxx_voltagedomains_init(); - omap3xxx_powerdomains_init(); - ti81xx_clockdomains_init(); - ti81xx_hwmod_init(); - omap_hwmod_init_postsetup(); - if (of_have_populated_dt()) - omap_clk_soc_init = ti81xx_dt_clk_init; + prcm_data_init = ti81xx_prcm_data_init; } #endif #ifdef CONFIG_SOC_AM33XX +void __init am33xx_prcm_data_init(void) +{ + omap2_prcm_base_init(); + am33xx_powerdomains_init(); + am33xx_clockdomains_init(); + am33xx_hwmod_init(); + omap_hwmod_init_postsetup(); +} + void __init am33xx_init_early(void) { omap2_set_globals_tap(AM335X_CLASS, @@ -585,11 +613,7 @@ void __init am33xx_init_early(void) omap2_control_base_init(); omap3xxx_check_revision(); am33xx_check_features(); - omap2_prcm_base_init(); - am33xx_powerdomains_init(); - am33xx_clockdomains_init(); - am33xx_hwmod_init(); - omap_hwmod_init_postsetup(); + prcm_data_init = am33xx_prcm_data_init; omap_clk_soc_init = am33xx_dt_clk_init; } @@ -600,6 +624,15 @@ void __init am33xx_init_late(void) #endif #ifdef CONFIG_SOC_AM43XX +void __init am43xx_prcm_data_init(void) +{ + omap2_prcm_base_init(); + am43xx_powerdomains_init(); + am43xx_clockdomains_init(); + am43xx_hwmod_init(); + omap_hwmod_init_postsetup(); +} + void __init am43xx_init_early(void) { omap2_set_globals_tap(AM335X_CLASS, @@ -607,12 +640,8 @@ void __init am43xx_init_early(void) omap2_control_base_init(); omap3xxx_check_revision(); am33xx_check_features(); - omap2_prcm_base_init(); - am43xx_powerdomains_init(); - am43xx_clockdomains_init(); - am43xx_hwmod_init(); - omap_hwmod_init_postsetup(); omap_l2_cache_init(); + prcm_data_init = am43xx_prcm_data_init; omap_clk_soc_init = am43xx_dt_clk_init; } @@ -623,13 +652,8 @@ void __init am43xx_init_late(void) #endif #ifdef CONFIG_ARCH_OMAP4 -void __init omap4430_init_early(void) +void __init omap4430_prcm_data_init(void) { - omap2_set_globals_tap(OMAP443X_CLASS, - OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE)); - omap2_control_base_init(); - omap4xxx_check_revision(); - omap4xxx_check_features(); omap2_prcm_base_init(); omap4_pm_init_early(); omap44xx_voltagedomains_init(); @@ -637,7 +661,17 @@ void __init omap4430_init_early(void) omap44xx_clockdomains_init(); omap44xx_hwmod_init(); omap_hwmod_init_postsetup(); +} + +void __init omap4430_init_early(void) +{ + omap2_set_globals_tap(OMAP443X_CLASS, + OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE)); + omap2_control_base_init(); + omap4xxx_check_revision(); + omap4xxx_check_features(); omap_l2_cache_init(); + prcm_data_init = omap4430_prcm_data_init; omap_clk_soc_init = omap4xxx_dt_clk_init; } @@ -650,11 +684,8 @@ void __init omap4430_init_late(void) #endif #ifdef CONFIG_SOC_OMAP5 -void __init omap5_init_early(void) +void __init omap5_prcm_data_init(void) { - omap2_set_globals_tap(OMAP54XX_CLASS, - OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE)); - omap2_control_base_init(); omap4_pm_init_early(); omap2_prcm_base_init(); omap5xxx_check_revision(); @@ -663,6 +694,15 @@ void __init omap5_init_early(void) omap54xx_clockdomains_init(); omap54xx_hwmod_init(); omap_hwmod_init_postsetup(); +} + +void __init omap5_init_early(void) +{ + omap2_set_globals_tap(OMAP54XX_CLASS, + OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE)); + omap2_control_base_init(); + omap5xxx_check_revision(); + prcm_data_init = omap5_prcm_data_init; omap_clk_soc_init = omap5xxx_dt_clk_init; } @@ -675,17 +715,22 @@ void __init omap5_init_late(void) #endif #ifdef CONFIG_SOC_DRA7XX -void __init dra7xx_init_early(void) +void __init dra7xx_prcm_data_init(void) { - omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE)); - omap2_control_base_init(); omap4_pm_init_early(); omap2_prcm_base_init(); - dra7xxx_check_revision(); dra7xx_powerdomains_init(); dra7xx_clockdomains_init(); dra7xx_hwmod_init(); omap_hwmod_init_postsetup(); +} + +void __init dra7xx_init_early(void) +{ + omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE)); + omap2_control_base_init(); + dra7xxx_check_revision(); + prcm_data_init = dra7xx_prcm_data_init; omap_clk_soc_init = dra7xx_dt_clk_init; } @@ -713,6 +758,11 @@ int __init omap_clk_init(void) { int ret = 0; + if (!prcm_data_init) + return 0; + + prcm_data_init(); + if (!omap_clk_soc_init) return 0; diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 355b089..d65f803 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -137,7 +137,6 @@ #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/slab.h> -#include <linux/bootmem.h> #include <linux/cpu.h> #include <linux/of.h> #include <linux/of_address.h> @@ -2738,7 +2737,7 @@ static int __init _alloc_links(struct omap_hwmod_link **ml, sz = sizeof(struct omap_hwmod_link) * LINKS_PER_OCP_IF; *sl = NULL; - *ml = memblock_virt_alloc(sz, 0); + *ml = kmalloc(sz, GFP_KERNEL); *sl = (void *)(*ml) + sizeof(struct omap_hwmod_link); @@ -2855,7 +2854,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois) pr_debug("omap_hwmod: %s: allocating %d byte linkspace (%d links)\n", __func__, sz, max_ls); - linkspace = memblock_virt_alloc(sz, 0); + linkspace = kmalloc(sz, GFP_KERNEL); return 0; } diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index 8091e1e..89c922c 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -22,7 +22,6 @@ #include <linux/of_address.h> #include <linux/list.h> #include <linux/regmap.h> -#include <linux/bootmem.h> #include "clock.h" @@ -247,7 +246,7 @@ void __init omap2_clk_legacy_provider_init(int index, void __iomem *mem) { struct clk_iomap *io; - io = memblock_virt_alloc(sizeof(*io), 0); + io = kzalloc(sizeof(*io), GFP_KERNEL); io->mem = mem; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html