[U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f

To facilitate changing lowlevel_init to become s_init, move the current contents of s_init into board_init_f and add the rest of what board_init_f does here.
Cc: Bo Shen voice.shen@atmel.com Cc: Andreas Bießmann andreas.devel@googlemail.com Tested-by: Matt Porter mporter@konsulko.com on sama5d3_xplained Signed-off-by: Tom Rini trini@ti.com --- arch/arm/cpu/at91-common/spl_atmel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/at91-common/spl_atmel.c b/arch/arm/cpu/at91-common/spl_atmel.c index 7297530..d815050 100644 --- a/arch/arm/cpu/at91-common/spl_atmel.c +++ b/arch/arm/cpu/at91-common/spl_atmel.c @@ -58,7 +58,7 @@ static void switch_to_main_crystal_osc(void) writel(tmp, &pmc->mor); }
-void s_init(void) +void board_init_f(ulong dummy) { switch_to_main_crystal_osc();
@@ -77,4 +77,9 @@ void s_init(void) preloader_console_init();
mem_init(); + + /* Clear the BSS. */ + memset(__bss_start, 0, __bss_end - __bss_start); + + board_init_r(NULL, 0); }

To facilitate changing lowlevel_init to become s_init, move the current contents of s_int() to gate_ungate_all_mx6_pfds() (and add extern to arch/arm/include/asm/arch-mx6/crm_regs.h) and add a default weak spl_board_init() that calls this function. The cm_fx6 platform already has a spl_board_init() so make that call the new function as well.
Cc: Marek Vasut marex@denx.de Cc: Stefano Babic sbabic@denx.de Cc: Igor Grinberg grinberg@compulab.co.il Cc: Nikita Kiryanov nikita@compulab.co.il Signed-off-by: Tom Rini trini@ti.com --- arch/arm/cpu/armv7/mx6/soc.c | 7 ++++++- arch/arm/include/asm/arch-mx6/crm_regs.h | 2 ++ board/compulab/cm_fx6/spl.c | 2 ++ include/configs/imx6_spl.h | 1 + 4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c index 5f5f497..ecc4272 100644 --- a/arch/arm/cpu/armv7/mx6/soc.c +++ b/arch/arm/cpu/armv7/mx6/soc.c @@ -385,7 +385,7 @@ const struct boot_mode soc_boot_modes[] = { {NULL, 0}, };
-void s_init(void) +void gate_ungate_all_mx6_pfds(void) { struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR; struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; @@ -429,6 +429,11 @@ void s_init(void) writel(mask528, &anatop->pfd_528_clr); }
+void __weak spl_board_init(void) +{ + gate_ungate_all_mx6_pfds(); +} + #ifdef CONFIG_IMX_HDMI void imx_enable_hdmi_phy(void) { diff --git a/arch/arm/include/asm/arch-mx6/crm_regs.h b/arch/arm/include/asm/arch-mx6/crm_regs.h index 39f3c07..700175e 100644 --- a/arch/arm/include/asm/arch-mx6/crm_regs.h +++ b/arch/arm/include/asm/arch-mx6/crm_regs.h @@ -104,6 +104,8 @@ struct mxc_ccm_reg { u32 analog_pfd_528_clr; u32 analog_pfd_528_tog; }; + +void gate_ungate_all_mx6_pfds(void); #endif
/* Define the bits in register CCR */ diff --git a/board/compulab/cm_fx6/spl.c b/board/compulab/cm_fx6/spl.c index 5b4b76f..83be867 100644 --- a/board/compulab/cm_fx6/spl.c +++ b/board/compulab/cm_fx6/spl.c @@ -341,6 +341,8 @@ void spl_board_init(void) { u32 boot_device = spl_boot_device();
+ gate_ungate_all_mx6_pfds(); + if (boot_device == BOOT_DEVICE_SPI) puts("Booting from SPI flash\n"); else if (boot_device == BOOT_DEVICE_MMC1) diff --git a/include/configs/imx6_spl.h b/include/configs/imx6_spl.h index 1b9c277..d49370d 100644 --- a/include/configs/imx6_spl.h +++ b/include/configs/imx6_spl.h @@ -29,6 +29,7 @@ #define CONFIG_SPL_TEXT_BASE 0x00908000 #define CONFIG_SPL_MAX_SIZE 0x10000 #define CONFIG_SPL_STACK 0x0091FFB8 +#define CONFIG_SPL_BOARD_INIT #define CONFIG_SPL_LIBCOMMON_SUPPORT #define CONFIG_SPL_LIBGENERIC_SUPPORT #define CONFIG_SPL_SERIAL_SUPPORT

On Wednesday, February 11, 2015 at 01:07:23 AM, Tom Rini wrote:
To facilitate changing lowlevel_init to become s_init, move the current contents of s_int() to gate_ungate_all_mx6_pfds() (and add extern to arch/arm/include/asm/arch-mx6/crm_regs.h) and add a default weak spl_board_init() that calls this function. The cm_fx6 platform already has a spl_board_init() so make that call the new function as well.
Cc: Marek Vasut marex@denx.de Cc: Stefano Babic sbabic@denx.de Cc: Igor Grinberg grinberg@compulab.co.il Cc: Nikita Kiryanov nikita@compulab.co.il Signed-off-by: Tom Rini trini@ti.com
Reviewed-by: Marek Vasut marex@denx.de
Best regards, Marek Vasut

On 02/11/15 02:07, Tom Rini wrote:
To facilitate changing lowlevel_init to become s_init, move the current contents of s_int() to gate_ungate_all_mx6_pfds() (and add extern to arch/arm/include/asm/arch-mx6/crm_regs.h) and add a default weak spl_board_init() that calls this function. The cm_fx6 platform already has a spl_board_init() so make that call the new function as well.
Cc: Marek Vasut marex@denx.de Cc: Stefano Babic sbabic@denx.de Cc: Igor Grinberg grinberg@compulab.co.il Cc: Nikita Kiryanov nikita@compulab.co.il Signed-off-by: Tom Rini trini@ti.com
Acked-by: Igor Grinberg grinberg@compulab.co.il

On 11/02/2015 01:07, Tom Rini wrote:
To facilitate changing lowlevel_init to become s_init, move the current contents of s_int() to gate_ungate_all_mx6_pfds() (and add extern to arch/arm/include/asm/arch-mx6/crm_regs.h) and add a default weak spl_board_init() that calls this function. The cm_fx6 platform already has a spl_board_init() so make that call the new function as well.
Cc: Marek Vasut marex@denx.de Cc: Stefano Babic sbabic@denx.de Cc: Igor Grinberg grinberg@compulab.co.il Cc: Nikita Kiryanov nikita@compulab.co.il Signed-off-by: Tom Rini trini@ti.com
arch/arm/cpu/armv7/mx6/soc.c | 7 ++++++- arch/arm/include/asm/arch-mx6/crm_regs.h | 2 ++ board/compulab/cm_fx6/spl.c | 2 ++ include/configs/imx6_spl.h | 1 + 4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c index 5f5f497..ecc4272 100644 --- a/arch/arm/cpu/armv7/mx6/soc.c +++ b/arch/arm/cpu/armv7/mx6/soc.c @@ -385,7 +385,7 @@ const struct boot_mode soc_boot_modes[] = { {NULL, 0}, };
-void s_init(void) +void gate_ungate_all_mx6_pfds(void) { struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR; struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; @@ -429,6 +429,11 @@ void s_init(void) writel(mask528, &anatop->pfd_528_clr); }
+void __weak spl_board_init(void) +{
- gate_ungate_all_mx6_pfds();
+}
#ifdef CONFIG_IMX_HDMI void imx_enable_hdmi_phy(void) { diff --git a/arch/arm/include/asm/arch-mx6/crm_regs.h b/arch/arm/include/asm/arch-mx6/crm_regs.h index 39f3c07..700175e 100644 --- a/arch/arm/include/asm/arch-mx6/crm_regs.h +++ b/arch/arm/include/asm/arch-mx6/crm_regs.h @@ -104,6 +104,8 @@ struct mxc_ccm_reg { u32 analog_pfd_528_clr; u32 analog_pfd_528_tog; };
+void gate_ungate_all_mx6_pfds(void); #endif
/* Define the bits in register CCR */ diff --git a/board/compulab/cm_fx6/spl.c b/board/compulab/cm_fx6/spl.c index 5b4b76f..83be867 100644 --- a/board/compulab/cm_fx6/spl.c +++ b/board/compulab/cm_fx6/spl.c @@ -341,6 +341,8 @@ void spl_board_init(void) { u32 boot_device = spl_boot_device();
- gate_ungate_all_mx6_pfds();
- if (boot_device == BOOT_DEVICE_SPI) puts("Booting from SPI flash\n"); else if (boot_device == BOOT_DEVICE_MMC1)
diff --git a/include/configs/imx6_spl.h b/include/configs/imx6_spl.h index 1b9c277..d49370d 100644 --- a/include/configs/imx6_spl.h +++ b/include/configs/imx6_spl.h @@ -29,6 +29,7 @@ #define CONFIG_SPL_TEXT_BASE 0x00908000 #define CONFIG_SPL_MAX_SIZE 0x10000 #define CONFIG_SPL_STACK 0x0091FFB8 +#define CONFIG_SPL_BOARD_INIT #define CONFIG_SPL_LIBCOMMON_SUPPORT #define CONFIG_SPL_LIBGENERIC_SUPPORT #define CONFIG_SPL_SERIAL_SUPPORT
Acked-by: Stefano Babic sbabic@denx.de
Best regards, Stefano Babic

Hi Tom,
rebased and tried to apply, but unfortuantely this breaks SPL for at91 armv7 boards:
05: spl_atmel.c: Switch s_init to board_init_f arm: + sama5d3xek_mmc sama5d3xek_nandflash sama5d3xek_spiflash sama5d4_xplained_mmc sama5d4ek_nandflash +arch/arm/cpu/armv7/built-in.o: In function `lowlevel_init': +build/../arch/arm/cpu/armv7/lowlevel_init.S:57: undefined reference to `s_init' +make[2]: *** [spl/u-boot-spl] Error 1 +make[1]: *** [spl/u-boot-spl] Error 2 +make: *** [sub-make] Error 2
I have to provide an empty s_init() to compile cleanly. Are you fine with just adopting your patch or would you like to repost?
Andreas
On 11.02.15 01:07, Tom Rini wrote:
To facilitate changing lowlevel_init to become s_init, move the current contents of s_init into board_init_f and add the rest of what board_init_f does here.
Cc: Bo Shen voice.shen@atmel.com Cc: Andreas Bießmann andreas.devel@googlemail.com Tested-by: Matt Porter mporter@konsulko.com on sama5d3_xplained Signed-off-by: Tom Rini trini@ti.com
arch/arm/cpu/at91-common/spl_atmel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/at91-common/spl_atmel.c b/arch/arm/cpu/at91-common/spl_atmel.c index 7297530..d815050 100644 --- a/arch/arm/cpu/at91-common/spl_atmel.c +++ b/arch/arm/cpu/at91-common/spl_atmel.c @@ -58,7 +58,7 @@ static void switch_to_main_crystal_osc(void) writel(tmp, &pmc->mor); }
-void s_init(void) +void board_init_f(ulong dummy) { switch_to_main_crystal_osc();
@@ -77,4 +77,9 @@ void s_init(void) preloader_console_init();
mem_init();
- /* Clear the BSS. */
- memset(__bss_start, 0, __bss_end - __bss_start);
- board_init_r(NULL, 0);
}

Dear Tom Rini,
Tom Rini trini@ti.com writes:
To facilitate changing lowlevel_init to become s_init, move the current contents of s_init into board_init_f and add the rest of what board_init_f does here. In order to compile clean without CONFIG_SKIP_LOWLEVEL_INIT set, leave an empty stub of s_init(). It can be removed when lowlevel_init becomes s_init.
Cc: Bo Shen voice.shen@atmel.com Cc: Andreas Bießmann andreas.devel@googlemail.com Tested-by: Matt Porter mporter@konsulko.com on sama5d3_xplained Signed-off-by: Tom Rini trini@ti.com [rebased on current master, leave s_init() as empty stub] Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
arch/arm/mach-at91/spl_atmel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
applied a rebased and slightly modified version to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Dear Tom Rini,
Tom Rini trini@ti.com writes:
To facilitate changing lowlevel_init to become s_init, move the current contents of s_init into board_init_f and add the rest of what board_init_f does here. In order to compile clean without CONFIG_SKIP_LOWLEVEL_INIT set, leave an empty stub of s_init(). It can be removed when lowlevel_init becomes s_init.
Cc: Bo Shen voice.shen@atmel.com Cc: Andreas Bießmann andreas.devel@googlemail.com Tested-by: Matt Porter mporter@konsulko.com on sama5d3_xplained Signed-off-by: Tom Rini trini@ti.com [rebased on current master, leave s_init() as empty stub] Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
arch/arm/mach-at91/spl_atmel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
applied a rebased and slightly modified version to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann
participants (5)
-
Andreas Bießmann
-
Igor Grinberg
-
Marek Vasut
-
Stefano Babic
-
Tom Rini