riscv: sifive: Fix OF_BOARD boot failure
PATCH 1/1 riscv: sifive: Fix OF_BOARD boot failure
When using QEMU to have a quick test of booting U-Boot S-mode payload directly without the needs of preparing the SPI flash or SD card images for SiFive Unleashed board, as per the instructions [1], it currently does not boot any more.
This was caused by the OF_PRIOR_STAGE removal, as gd->fdt_blob no longer points to a valid DTB. OF_BOARD is supposed to replace OF_PRIOR_STAGE, hence we need to add the OF_BOARD logic in board_fdt_blob_setup().
[1] https://qemu.readthedocs.io/en/latest/system/riscv/sifive_u.html#running-u-boot
---
board/sifive/unleashed/unleashed.c | 2 +- board/sifive/unmatched/unmatched.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
board/sifive/unleashed/unleashed.c +1 -1
@@ -117,7 +117,7 @@ int misc_init_r(void)void *board_fdt_blob_setup (int *err) { *err =0 ; -if (IS_ENABLED (CONFIG_OF_SEPARATE )) { +if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) {if (gd->arch.firmware_fdt_addr)return (ulong *)(uintptr_t )gd->arch.firmware_fdt_addr; }
board/sifive/unmatched/unmatched.c +1 -1
@@ -14,7 +14,7 @@void *board_fdt_blob_setup (int *err) { *err =0 ; -if (IS_ENABLED (CONFIG_OF_SEPARATE )) { +if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) {if (gd->arch.firmware_fdt_addr)return (ulong *)(uintptr_t )gd->arch.firmware_fdt_addr; }
Signature · 1 line
2.25.1
Hi Bin,
Quoted 9 lines · Bin Meng
When using QEMU to have a quick test of booting U-Boot S-mode payload directly without the needs of preparing the SPI flash or SD card images for SiFive Unleashed board, as per the instructions [1], it currently does not boot any more.
This was caused by the
OF_PRIOR_STAGEremoval, asgd->fdt_blobno longer points to a valid DTB.OF_BOARDis supposed to replaceOF_PRIOR_STAGE, hence we need to add theOF_BOARDlogic inboard_fdt_blob_setup().
Looking at the patch history I found these It seems that I had something similar on [1] but forgot to add it under the Kconfig after all.
[1] https://lore.kernel.org/u-boot/[email protected]/
I'd prefer if someone with a RISC-V board checked this as well but FWIW
Quoted 41 lines
[1] https://qemu.readthedocs.io/en/latest/system/riscv/sifive_u.html#running-u-boot
Fixes 2e8d2f88439d ("riscv: Remove OF_PRIOR_STAGE from RISC-V boards")Fixes d6f8ab30a2af ("treewide: Remove OF_PRIOR_STAGE")Signed-off-by Bin Meng <[email protected]>---
board/sifive/unleashed/unleashed.c | 2 +- board/sifive/unmatched/unmatched.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)board/sifive/unleashed/unleashed.c +1
-1@@ -117,7 +117,7 @@ int misc_init_r(void)void *board_fdt_blob_setup (int *err) { *err =0 ; -if (IS_ENABLED (CONFIG_OF_SEPARATE )) { +if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) {if (gd->arch.firmware_fdt_addr)return (ulong *)(uintptr_t )gd->arch.firmware_fdt_addr; }board/sifive/unmatched/unmatched.c +1
-2@@ -14,7 +14,7 @@void *board_fdt_blob_setup (int *err) { *err =0 ; -if (IS_ENABLED (CONFIG_OF_SEPARATE )) { +if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) {if (gd->arch.firmware_fdt_addr)return (ulong *)(uintptr_t )gd->arch.firmware_fdt_addr; } --2.25.1
Quoted 12 lines · Bin Meng
When using QEMU to have a quick test of booting U-Boot S-mode payload directly without the needs of preparing the SPI flash or SD card images for SiFive Unleashed board, as per the instructions [1], it currently does not boot any more.
This was caused by the
OF_PRIOR_STAGEremoval, asgd->fdt_blobno longer points to a valid DTB.OF_BOARDis supposed to replaceOF_PRIOR_STAGE, hence we need to add theOF_BOARDlogic inboard_fdt_blob_setup().[1] https://qemu.readthedocs.io/en/latest/system/riscv/sifive_u.html#running-u-boot
Quoted 8 lines
Fixes 2e8d2f88439d ("riscv: Remove OF_PRIOR_STAGE from RISC-V boards")Fixes d6f8ab30a2af ("treewide: Remove OF_PRIOR_STAGE")Signed-off-by Bin Meng <[email protected]>---
board/sifive/unleashed/unleashed.c | 2 +- board/sifive/unmatched/unmatched.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Hi Tom,
Quoted 12 lines · Bin Meng
When using QEMU to have a quick test of booting U-Boot S-mode payload directly without the needs of preparing the SPI flash or SD card images for SiFive Unleashed board, as per the instructions [1], it currently does not boot any more.
This was caused by the
OF_PRIOR_STAGEremoval, asgd->fdt_blobno longer points to a valid DTB.OF_BOARDis supposed to replaceOF_PRIOR_STAGE, hence we need to add theOF_BOARDlogic inboard_fdt_blob_setup().[1] https://qemu.readthedocs.io/en/latest/system/riscv/sifive_u.html#running-u-boot
Quoted 9 lines
Fixes 2e8d2f88439d ("riscv: Remove OF_PRIOR_STAGE from RISC-V boards")Fixes d6f8ab30a2af ("treewide: Remove OF_PRIOR_STAGE")Signed-off-by Bin Meng <[email protected]>---
board/sifive/unleashed/unleashed.c | 2 +- board/sifive/unmatched/unmatched.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Would you pick up this patch directly for v2022.01?
Regards,
Bin
Quoted 9 lines · Bin Meng
When using QEMU to have a quick test of booting U-Boot S-mode payload directly without the needs of preparing the SPI flash or SD card images for SiFive Unleashed board, as per the instructions [1], it currently does not boot any more.
This was caused by the
OF_PRIOR_STAGEremoval, asgd->fdt_blobno longer points to a valid DTB.OF_BOARDis supposed to replaceOF_PRIOR_STAGE, hence we need to add theOF_BOARDlogic inboard_fdt_blob_setup().
Quoted 7 lines
[1] https://qemu.readthedocs.io/en/latest/system/riscv/sifive_u.html#running-u-boot
Fixes 2e8d2f88439d ("riscv: Remove OF_PRIOR_STAGE from RISC-V boards")Fixes d6f8ab30a2af ("treewide: Remove OF_PRIOR_STAGE")Signed-off-by Bin Meng <[email protected]>Reviewed-by Ilias Apalodimas <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom