All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init
@ 2019-11-15 16:48 Thomas Hebb
  2019-11-15 16:48 ` [U-Boot] [PATCH v2 2/3] rockchip: allow DRAM init in SPL Thomas Hebb
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thomas Hebb @ 2019-11-15 16:48 UTC (permalink / raw)
  To: u-boot

b7abef2ecbcc ("rockchip: rk3399: Migrate to use common spl board file")
removed SoC-specific code for RK3399's SPL and in the process reordered
the DRAM initialization before rockchip_stimer_init(), which as far as I
can tell causes the RK3399 to lock up completely.

Fix this issue in the common code by putting the DRAM init back after
timer init. I have only tested this on the RK3399, but it wouldn't make
any sense for the timer init to require DRAM be set up on any system.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
---
 arch/arm/mach-rockchip/spl.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index 92102b39e7..5570bb1339 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -128,6 +128,13 @@ void board_init_f(ulong dummy)
 		hang();
 	}
 	arch_cpu_init();
+#if !defined(CONFIG_ROCKCHIP_RK3188)
+	rockchip_stimer_init();
+#endif
+#ifdef CONFIG_SYS_ARCH_TIMER
+	/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
+	timer_init();
+#endif
 #if !defined(CONFIG_SUPPORT_TPL) || defined(CONFIG_SPL_OS_BOOT)
 	debug("\nspl:init dram\n");
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
@@ -135,13 +142,6 @@ void board_init_f(ulong dummy)
 		printf("DRAM init failed: %d\n", ret);
 		return;
 	}
-#endif
-#if !defined(CONFIG_ROCKCHIP_RK3188)
-	rockchip_stimer_init();
-#endif
-#ifdef CONFIG_SYS_ARCH_TIMER
-	/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
-	timer_init();
 #endif
 	preloader_console_init();
 }
-- 
2.23.0

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

* [U-Boot] [PATCH v2 2/3] rockchip: allow DRAM init in SPL
  2019-11-15 16:48 [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init Thomas Hebb
@ 2019-11-15 16:48 ` Thomas Hebb
  2019-11-17  8:31   ` Kever Yang
  2019-11-15 16:48 ` [U-Boot] [PATCH v2 3/3] rockchip: imply instead of selecting SPL_SYS_MALLOC_SIMPLE Thomas Hebb
  2019-11-17  8:31 ` [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init Kever Yang
  2 siblings, 1 reply; 6+ messages in thread
From: Thomas Hebb @ 2019-11-15 16:48 UTC (permalink / raw)
  To: u-boot

b7abef2ecbcc ("rockchip: rk3399: Migrate to use common spl board file")
removed SoC-specific code for RK3399's SPL and in the process caused
the previously-unconditional DRAM initialization in board_init_f() to
only happen when compiling a configuration that does not support TPL,
meaning DRAM never gets initialized if TPL is supported but disabled.

Fix this by omitting the DRAM init in SPL only when we are configured to
also build a TPL. This fixes custom configurations that have disabled
TPL, and it should also unbreak the "ficus-rk3399", "rock960-rk3399",
and "chromebook_bob" defconfigs, although since I don't have any of
those devices I can't confirm they're broken now.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
---
 arch/arm/mach-rockchip/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index 5570bb1339..089f0a5258 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -103,7 +103,7 @@ __weak int arch_cpu_init(void)
 void board_init_f(ulong dummy)
 {
 	int ret;
-#if !defined(CONFIG_SUPPORT_TPL) || defined(CONFIG_SPL_OS_BOOT)
+#if !defined(CONFIG_TPL) || defined(CONFIG_SPL_OS_BOOT)
 	struct udevice *dev;
 #endif
 
@@ -135,7 +135,7 @@ void board_init_f(ulong dummy)
 	/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
 	timer_init();
 #endif
-#if !defined(CONFIG_SUPPORT_TPL) || defined(CONFIG_SPL_OS_BOOT)
+#if !defined(CONFIG_TPL) || defined(CONFIG_SPL_OS_BOOT)
 	debug("\nspl:init dram\n");
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret) {
-- 
2.23.0

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

* [U-Boot] [PATCH v2 3/3] rockchip: imply instead of selecting SPL_SYS_MALLOC_SIMPLE
  2019-11-15 16:48 [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init Thomas Hebb
  2019-11-15 16:48 ` [U-Boot] [PATCH v2 2/3] rockchip: allow DRAM init in SPL Thomas Hebb
@ 2019-11-15 16:48 ` Thomas Hebb
  2019-11-17  8:32   ` Kever Yang
  2019-11-17  8:31 ` [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init Kever Yang
  2 siblings, 1 reply; 6+ messages in thread
From: Thomas Hebb @ 2019-11-15 16:48 UTC (permalink / raw)
  To: u-boot

We shouldn't force which allocator the SPL uses, since there's no
platform requirement for one over the other: in fact, we currently allow
selection of the TPL allocator but not the SPL one!

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7b80630aa1..f96841c777 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1604,7 +1604,6 @@ config ARCH_ROCKCHIP
 	select OF_CONTROL
 	select SPI
 	select SPL_DM if SPL
-	select SPL_SYS_MALLOC_SIMPLE if SPL
 	select SYS_MALLOC_F
 	select SYS_THUMB_BUILD if !ARM64
 	imply ADC
@@ -1614,6 +1613,7 @@ config ARCH_ROCKCHIP
 	imply FAT_WRITE
 	imply SARADC_ROCKCHIP
 	imply SPL_SYSRESET
+	imply SPL_SYS_MALLOC_SIMPLE
 	imply SYS_NS16550
 	imply TPL_SYSRESET
 	imply USB_FUNCTION_FASTBOOT
-- 
2.23.0

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

* [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init
  2019-11-15 16:48 [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init Thomas Hebb
  2019-11-15 16:48 ` [U-Boot] [PATCH v2 2/3] rockchip: allow DRAM init in SPL Thomas Hebb
  2019-11-15 16:48 ` [U-Boot] [PATCH v2 3/3] rockchip: imply instead of selecting SPL_SYS_MALLOC_SIMPLE Thomas Hebb
@ 2019-11-17  8:31 ` Kever Yang
  2 siblings, 0 replies; 6+ messages in thread
From: Kever Yang @ 2019-11-17  8:31 UTC (permalink / raw)
  To: u-boot


On 2019/11/16 上午12:48, Thomas Hebb wrote:
> b7abef2ecbcc ("rockchip: rk3399: Migrate to use common spl board file")
> removed SoC-specific code for RK3399's SPL and in the process reordered
> the DRAM initialization before rockchip_stimer_init(), which as far as I
> can tell causes the RK3399 to lock up completely.
>
> Fix this issue in the common code by putting the DRAM init back after
> timer init. I have only tested this on the RK3399, but it wouldn't make
> any sense for the timer init to require DRAM be set up on any system.
>
> Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/spl.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
> index 92102b39e7..5570bb1339 100644
> --- a/arch/arm/mach-rockchip/spl.c
> +++ b/arch/arm/mach-rockchip/spl.c
> @@ -128,6 +128,13 @@ void board_init_f(ulong dummy)
>   		hang();
>   	}
>   	arch_cpu_init();
> +#if !defined(CONFIG_ROCKCHIP_RK3188)
> +	rockchip_stimer_init();
> +#endif
> +#ifdef CONFIG_SYS_ARCH_TIMER
> +	/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
> +	timer_init();
> +#endif
>   #if !defined(CONFIG_SUPPORT_TPL) || defined(CONFIG_SPL_OS_BOOT)
>   	debug("\nspl:init dram\n");
>   	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
> @@ -135,13 +142,6 @@ void board_init_f(ulong dummy)
>   		printf("DRAM init failed: %d\n", ret);
>   		return;
>   	}
> -#endif
> -#if !defined(CONFIG_ROCKCHIP_RK3188)
> -	rockchip_stimer_init();
> -#endif
> -#ifdef CONFIG_SYS_ARCH_TIMER
> -	/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
> -	timer_init();
>   #endif
>   	preloader_console_init();
>   }

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

* [U-Boot] [PATCH v2 2/3] rockchip: allow DRAM init in SPL
  2019-11-15 16:48 ` [U-Boot] [PATCH v2 2/3] rockchip: allow DRAM init in SPL Thomas Hebb
@ 2019-11-17  8:31   ` Kever Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Kever Yang @ 2019-11-17  8:31 UTC (permalink / raw)
  To: u-boot


On 2019/11/16 上午12:48, Thomas Hebb wrote:
> b7abef2ecbcc ("rockchip: rk3399: Migrate to use common spl board file")
> removed SoC-specific code for RK3399's SPL and in the process caused
> the previously-unconditional DRAM initialization in board_init_f() to
> only happen when compiling a configuration that does not support TPL,
> meaning DRAM never gets initialized if TPL is supported but disabled.
>
> Fix this by omitting the DRAM init in SPL only when we are configured to
> also build a TPL. This fixes custom configurations that have disabled
> TPL, and it should also unbreak the "ficus-rk3399", "rock960-rk3399",
> and "chromebook_bob" defconfigs, although since I don't have any of
> those devices I can't confirm they're broken now.
>
> Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/spl.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
> index 5570bb1339..089f0a5258 100644
> --- a/arch/arm/mach-rockchip/spl.c
> +++ b/arch/arm/mach-rockchip/spl.c
> @@ -103,7 +103,7 @@ __weak int arch_cpu_init(void)
>   void board_init_f(ulong dummy)
>   {
>   	int ret;
> -#if !defined(CONFIG_SUPPORT_TPL) || defined(CONFIG_SPL_OS_BOOT)
> +#if !defined(CONFIG_TPL) || defined(CONFIG_SPL_OS_BOOT)
>   	struct udevice *dev;
>   #endif
>   
> @@ -135,7 +135,7 @@ void board_init_f(ulong dummy)
>   	/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
>   	timer_init();
>   #endif
> -#if !defined(CONFIG_SUPPORT_TPL) || defined(CONFIG_SPL_OS_BOOT)
> +#if !defined(CONFIG_TPL) || defined(CONFIG_SPL_OS_BOOT)
>   	debug("\nspl:init dram\n");
>   	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
>   	if (ret) {

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

* [U-Boot] [PATCH v2 3/3] rockchip: imply instead of selecting SPL_SYS_MALLOC_SIMPLE
  2019-11-15 16:48 ` [U-Boot] [PATCH v2 3/3] rockchip: imply instead of selecting SPL_SYS_MALLOC_SIMPLE Thomas Hebb
@ 2019-11-17  8:32   ` Kever Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Kever Yang @ 2019-11-17  8:32 UTC (permalink / raw)
  To: u-boot


On 2019/11/16 上午12:48, Thomas Hebb wrote:
> We shouldn't force which allocator the SPL uses, since there's no
> platform requirement for one over the other: in fact, we currently allow
> selection of the TPL allocator but not the SPL one!
>
> Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/Kconfig | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 7b80630aa1..f96841c777 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1604,7 +1604,6 @@ config ARCH_ROCKCHIP
>   	select OF_CONTROL
>   	select SPI
>   	select SPL_DM if SPL
> -	select SPL_SYS_MALLOC_SIMPLE if SPL
>   	select SYS_MALLOC_F
>   	select SYS_THUMB_BUILD if !ARM64
>   	imply ADC
> @@ -1614,6 +1613,7 @@ config ARCH_ROCKCHIP
>   	imply FAT_WRITE
>   	imply SARADC_ROCKCHIP
>   	imply SPL_SYSRESET
> +	imply SPL_SYS_MALLOC_SIMPLE
>   	imply SYS_NS16550
>   	imply TPL_SYSRESET
>   	imply USB_FUNCTION_FASTBOOT

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

end of thread, other threads:[~2019-11-17  8:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 16:48 [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init Thomas Hebb
2019-11-15 16:48 ` [U-Boot] [PATCH v2 2/3] rockchip: allow DRAM init in SPL Thomas Hebb
2019-11-17  8:31   ` Kever Yang
2019-11-15 16:48 ` [U-Boot] [PATCH v2 3/3] rockchip: imply instead of selecting SPL_SYS_MALLOC_SIMPLE Thomas Hebb
2019-11-17  8:32   ` Kever Yang
2019-11-17  8:31 ` [U-Boot] [PATCH v2 1/3] rockchip: fix ordering of DRAM init Kever Yang

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.