All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f
@ 2015-02-11  0:07 Tom Rini
  2015-02-11  0:07 ` [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds() Tom Rini
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Tom Rini @ 2015-02-11  0:07 UTC (permalink / raw)
  To: u-boot

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);
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds()
  2015-02-11  0:07 [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f Tom Rini
@ 2015-02-11  0:07 ` Tom Rini
  2015-02-11  0:47   ` Marek Vasut
                     ` (2 more replies)
  2015-03-29 21:59 ` [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f Andreas Bießmann
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 8+ messages in thread
From: Tom Rini @ 2015-02-11  0:07 UTC (permalink / raw)
  To: u-boot

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
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds()
  2015-02-11  0:07 ` [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds() Tom Rini
@ 2015-02-11  0:47   ` Marek Vasut
  2015-02-11  8:04   ` Igor Grinberg
  2015-02-11 11:15   ` Stefano Babic
  2 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2015-02-11  0:47 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds()
  2015-02-11  0:07 ` [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds() Tom Rini
  2015-02-11  0:47   ` Marek Vasut
@ 2015-02-11  8:04   ` Igor Grinberg
  2015-02-11 11:15   ` Stefano Babic
  2 siblings, 0 replies; 8+ messages in thread
From: Igor Grinberg @ 2015-02-11  8:04 UTC (permalink / raw)
  To: u-boot

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>


-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds()
  2015-02-11  0:07 ` [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds() Tom Rini
  2015-02-11  0:47   ` Marek Vasut
  2015-02-11  8:04   ` Igor Grinberg
@ 2015-02-11 11:15   ` Stefano Babic
  2 siblings, 0 replies; 8+ messages in thread
From: Stefano Babic @ 2015-02-11 11:15 UTC (permalink / raw)
  To: u-boot

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

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f
  2015-02-11  0:07 [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f Tom Rini
  2015-02-11  0:07 ` [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds() Tom Rini
@ 2015-03-29 21:59 ` Andreas Bießmann
  2015-03-31 23:05 ` [U-Boot] [PATCH] " Andreas Bießmann
  2015-03-31 23:09 ` Andreas Bießmann
  3 siblings, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2015-03-29 21:59 UTC (permalink / raw)
  To: u-boot

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);
>  }
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] spl_atmel.c: Switch s_init to board_init_f
  2015-02-11  0:07 [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f Tom Rini
  2015-02-11  0:07 ` [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds() Tom Rini
  2015-03-29 21:59 ` [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f Andreas Bießmann
@ 2015-03-31 23:05 ` Andreas Bießmann
  2015-03-31 23:09 ` Andreas Bießmann
  3 siblings, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2015-03-31 23:05 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] spl_atmel.c: Switch s_init to board_init_f
  2015-02-11  0:07 [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f Tom Rini
                   ` (2 preceding siblings ...)
  2015-03-31 23:05 ` [U-Boot] [PATCH] " Andreas Bießmann
@ 2015-03-31 23:09 ` Andreas Bießmann
  3 siblings, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2015-03-31 23:09 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-31 23:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-11  0:07 [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f Tom Rini
2015-02-11  0:07 ` [U-Boot] [PATCH 2/2] mx6: Rework s_init to be spl_board_init() and gate_ungate_all_mx6_pfds() Tom Rini
2015-02-11  0:47   ` Marek Vasut
2015-02-11  8:04   ` Igor Grinberg
2015-02-11 11:15   ` Stefano Babic
2015-03-29 21:59 ` [U-Boot] [PATCH 1/2] spl_atmel.c: Switch s_init to board_init_f Andreas Bießmann
2015-03-31 23:05 ` [U-Boot] [PATCH] " Andreas Bießmann
2015-03-31 23:09 ` Andreas Bießmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.