diff mbox series

[3/4] rockchip: spl-boot-order: do not attempt to access fdt if OF_PLATDATA

Message ID 20200513191523.3141-4-urjaman@gmail.com
State Accepted
Commit e68a84360173f90fa37df875e6aa2c83f2858b80
Headers show
Series Making veyrons boot, 2020 edition | expand

Commit Message

Urja Rannikko May 13, 2020, 7:15 p.m. UTC
gd->fdt_blob is null if using OF_PLATDATA in SPL, which causes a hang
after f0921f5098 ("fdt: Sync up to the latest libfdt").
We use the same test that is used in spl_common_init on whether to call
fdtdec_setup to unconditionally avoid linking in the fdt-using code
when not necessary and thus reduce SPL size.

Signed-off-by: Urja Rannikko <urjaman at gmail.com>
---
 arch/arm/mach-rockchip/spl-boot-order.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Kever Yang May 15, 2020, 1:57 a.m. UTC | #1
On 2020/5/14 ??3:15, Urja Rannikko wrote:
> gd->fdt_blob is null if using OF_PLATDATA in SPL, which causes a hang
> after f0921f5098 ("fdt: Sync up to the latest libfdt").
> We use the same test that is used in spl_common_init on whether to call
> fdtdec_setup to unconditionally avoid linking in the fdt-using code
> when not necessary and thus reduce SPL size.
>
> Signed-off-by: Urja Rannikko <urjaman at gmail.com>

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

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/spl-boot-order.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c
> index c147d5821e..d23829a789 100644
> --- a/arch/arm/mach-rockchip/spl-boot-order.c
> +++ b/arch/arm/mach-rockchip/spl-boot-order.c
> @@ -98,6 +98,12 @@ __weak const char *board_spl_was_booted_from(void)
>   
>   void board_boot_order(u32 *spl_boot_list)
>   {
> +	/* In case of no fdt (or only platdata), use spl_boot_device() */
> +	if (!CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)) {
> +		spl_boot_list[0] = spl_boot_device();
> +		return;
> +	}
> +
>   	const void *blob = gd->fdt_blob;
>   	int chosen_node = fdt_path_offset(blob, "/chosen");
>   	int idx = 0;
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c
index c147d5821e..d23829a789 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -98,6 +98,12 @@  __weak const char *board_spl_was_booted_from(void)
 
 void board_boot_order(u32 *spl_boot_list)
 {
+	/* In case of no fdt (or only platdata), use spl_boot_device() */
+	if (!CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)) {
+		spl_boot_list[0] = spl_boot_device();
+		return;
+	}
+
 	const void *blob = gd->fdt_blob;
 	int chosen_node = fdt_path_offset(blob, "/chosen");
 	int idx = 0;