riscv: Remove OF_PRIOR_STAGE from RISC-V boards

At some point back in 2018 prior_stage_fdt_address and OF_PRIOR_STAGE got
introduced,  in order to support a DTB handed over by an earlier stage boo
loader.  However we have another option in the Kconfig (OF_BOARD) which has
identical semantics.

On RISC-V some of the boards pick up the DTB from a1 and copy it in their
private gd_t.  Apart from that they copy it to prior_stage_fdt_address,  if
the Kconfig option is selected, which is unnecessary.

So let's switch the config option for those boards to OF_BOARD and define
the required board_fdt_blob_setup() for them.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
This commit is contained in:
Ilias Apalodimas 2021-10-12 00:00:13 +03:00 committed by Tom Rini
parent d990f7d75d
commit 2e8d2f8843
16 changed files with 28 additions and 23 deletions

View file

@ -17,9 +17,6 @@
* The variables here must be stored in the data section since they are used * The variables here must be stored in the data section since they are used
* before the bss section is available. * before the bss section is available.
*/ */
#ifdef CONFIG_OF_PRIOR_STAGE
phys_addr_t prior_stage_fdt_address __section(".data");
#endif
#ifndef CONFIG_XIP #ifndef CONFIG_XIP
u32 hart_lottery __section(".data") = 0; u32 hart_lottery __section(".data") = 0;

View file

@ -142,11 +142,6 @@ call_harts_early_init:
bnez tp, secondary_hart_loop bnez tp, secondary_hart_loop
#endif #endif
#ifdef CONFIG_OF_PRIOR_STAGE
la t0, prior_stage_fdt_address
SREG s1, 0(t0)
#endif
jal board_init_f_init_reserve jal board_init_f_init_reserve
SREG s1, GD_FIRMWARE_FDT_ADDR(gp) SREG s1, GD_FIRMWARE_FDT_ADDR(gp)

View file

@ -48,7 +48,7 @@
}; };
}; };
#ifndef CONFIG_OF_PRIOR_STAGE #ifndef CONFIG_OF_BOARD
@fdt-SEQ { @fdt-SEQ {
description = "NAME"; description = "NAME";
type = "flat_dt"; type = "flat_dt";
@ -60,7 +60,7 @@
configurations { configurations {
default = "conf-1"; default = "conf-1";
#ifndef CONFIG_OF_PRIOR_STAGE #ifndef CONFIG_OF_BOARD
@conf-SEQ { @conf-SEQ {
#else #else
conf-1 { conf-1 {
@ -68,7 +68,7 @@
description = "NAME"; description = "NAME";
firmware = "opensbi"; firmware = "opensbi";
loadables = "uboot"; loadables = "uboot";
#ifndef CONFIG_OF_PRIOR_STAGE #ifndef CONFIG_OF_BOARD
fdt = "fdt-SEQ"; fdt = "fdt-SEQ";
#endif #endif
}; };

View file

@ -21,7 +21,6 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
extern phys_addr_t prior_stage_fdt_address;
/* /*
* Miscellaneous platform dependent initializations * Miscellaneous platform dependent initializations
*/ */
@ -57,7 +56,13 @@ ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
void *board_fdt_blob_setup(void) void *board_fdt_blob_setup(void)
{ {
#if CONFIG_IS_ENABLED(OF_BOARD)
return (void *)(ulong)gd->arch.firmware_fdt_addr;
#elif CONFIG_IS_ENABLED(OF_SEPARATE)
return (void *)CONFIG_SYS_FDT_BASE; return (void *)CONFIG_SYS_FDT_BASE;
#else
return NULL;
#endif
} }
int smc_init(void) int smc_init(void)

View file

@ -14,6 +14,8 @@
#include <virtio_types.h> #include <virtio_types.h>
#include <virtio.h> #include <virtio.h>
DECLARE_GLOBAL_DATA_PTR;
int board_init(void) int board_init(void)
{ {
/* /*
@ -69,3 +71,9 @@ int board_fit_config_name_match(const char *name)
return 0; return 0;
} }
#endif #endif
void *board_fdt_blob_setup(void)
{
/* Stored the DTB address there during our init */
return (void *)(ulong)gd->arch.firmware_fdt_addr;
}

View file

@ -17,7 +17,7 @@ CONFIG_CMD_SF_TEST=y
# CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_SETEXPR is not set
CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_BOOTP_PREFER_SERVERIP=y
CONFIG_CMD_CACHE=y CONFIG_CMD_CACHE=y
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_ENV_OVERWRITE=y CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y

View file

@ -21,7 +21,7 @@ CONFIG_CMD_SF_TEST=y
# CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_SETEXPR is not set
CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_BOOTP_PREFER_SERVERIP=y
CONFIG_CMD_CACHE=y CONFIG_CMD_CACHE=y
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_ENV_OVERWRITE=y CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_BOOTP_SEND_HOSTNAME=y

View file

@ -18,7 +18,7 @@ CONFIG_CMD_SF_TEST=y
# CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_SETEXPR is not set
CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_BOOTP_PREFER_SERVERIP=y
CONFIG_CMD_CACHE=y CONFIG_CMD_CACHE=y
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_ENV_OVERWRITE=y CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y

View file

@ -22,7 +22,7 @@ CONFIG_CMD_SF_TEST=y
# CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_SETEXPR is not set
CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_BOOTP_PREFER_SERVERIP=y
CONFIG_CMD_CACHE=y CONFIG_CMD_CACHE=y
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_ENV_OVERWRITE=y CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_BOOTP_SEND_HOSTNAME=y

View file

@ -11,6 +11,6 @@ CONFIG_DISPLAY_BOARDINFO=y
CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_BOOTEFI_SELFTEST=y
CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_EFI=y
# CONFIG_CMD_MII is not set # CONFIG_CMD_MII is not set
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_DM_MTD=y CONFIG_DM_MTD=y

View file

@ -12,7 +12,7 @@ CONFIG_DISPLAY_BOARDINFO=y
CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_BOOTEFI_SELFTEST=y
CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_EFI=y
# CONFIG_CMD_MII is not set # CONFIG_CMD_MII is not set
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_DM_MTD=y CONFIG_DM_MTD=y
CONFIG_SYSRESET_SBI=y CONFIG_SYSRESET_SBI=y

View file

@ -14,7 +14,7 @@ CONFIG_DISPLAY_CPUINFO=y
CONFIG_DISPLAY_BOARDINFO=y CONFIG_DISPLAY_BOARDINFO=y
CONFIG_CMD_SBI=y CONFIG_CMD_SBI=y
# CONFIG_CMD_MII is not set # CONFIG_CMD_MII is not set
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_DM_MTD=y CONFIG_DM_MTD=y
CONFIG_SYSRESET_SBI=y CONFIG_SYSRESET_SBI=y

View file

@ -12,6 +12,6 @@ CONFIG_DISPLAY_BOARDINFO=y
CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_BOOTEFI_SELFTEST=y
CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_EFI=y
# CONFIG_CMD_MII is not set # CONFIG_CMD_MII is not set
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_DM_MTD=y CONFIG_DM_MTD=y

View file

@ -15,7 +15,7 @@ CONFIG_DISPLAY_BOARDINFO=y
CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_BOOTEFI_SELFTEST=y
CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_EFI=y
# CONFIG_CMD_MII is not set # CONFIG_CMD_MII is not set
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_DM_MTD=y CONFIG_DM_MTD=y
CONFIG_SYSRESET_SBI=y CONFIG_SYSRESET_SBI=y

View file

@ -15,7 +15,7 @@ CONFIG_DISPLAY_CPUINFO=y
CONFIG_DISPLAY_BOARDINFO=y CONFIG_DISPLAY_BOARDINFO=y
CONFIG_CMD_SBI=y CONFIG_CMD_SBI=y
# CONFIG_CMD_MII is not set # CONFIG_CMD_MII is not set
CONFIG_OF_PRIOR_STAGE=y CONFIG_OF_BOARD=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_DM_MTD=y CONFIG_DM_MTD=y
CONFIG_SYSRESET_SBI=y CONFIG_SYSRESET_SBI=y

View file

@ -118,7 +118,7 @@ config OF_EMBED
Boards in the mainline U-Boot tree should not use it. Boards in the mainline U-Boot tree should not use it.
config OF_BOARD config OF_BOARD
bool "Provided by the board at runtime" bool "Provided by the board (e.g a previous loader) at runtime"
depends on !SANDBOX depends on !SANDBOX
help help
If this option is enabled, the device tree will be provided by If this option is enabled, the device tree will be provided by