riscv: do not set default fdt for VisionFive 2

Currently in set_fdtfile() we set the value of environment variable fdtfile
unconditionally. The implies that a value in the environment will be
ignored.

With the patch environment variable fdtfile will only be set if it does not
yet exist. This requires that CONFIG_DEFAULT_FDT_FILE is not set.

Now the user can either set and save fdtfile interactively or in the U-Boot
configuration to overrule the device-tree name chosen based on the
hardware in set_fdtfile().

Reported-by: E Shattow <lucent@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
This commit is contained in:
Heinrich Schuchardt
2024-04-02 10:49:07 +02:00
committed by Leo Yu-Chi Liang
parent 0ba23d3daf
commit 0f6310c7ff
3 changed files with 22 additions and 1 deletions

View File

@@ -49,6 +49,10 @@ static void set_fdtfile(void)
u8 version; u8 version;
const char *fdtfile; const char *fdtfile;
fdtfile = env_get("fdtfile");
if (fdtfile)
return;
version = get_pcb_revision_from_eeprom(); version = get_pcb_revision_from_eeprom();
switch (version) { switch (version) {
case 'a': case 'a':

View File

@@ -40,7 +40,6 @@ CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi" CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi"
CONFIG_USE_PREBOOT=y CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="nvme scan; usb start; setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" CONFIG_PREBOOT="nvme scan; usb start; setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
CONFIG_DEFAULT_FDT_FILE="starfive/jh7110-starfive-visionfive-2.dtb"
CONFIG_SYS_CBSIZE=256 CONFIG_SYS_CBSIZE=256
CONFIG_SYS_PBSIZE=276 CONFIG_SYS_PBSIZE=276
CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_CPUINFO=y

View File

@@ -71,6 +71,24 @@ Now build the U-Boot SPL and U-Boot proper
This will generate the U-Boot SPL image (spl/u-boot-spl.bin.normal.out) as well This will generate the U-Boot SPL image (spl/u-boot-spl.bin.normal.out) as well
as the FIT image (u-boot.itb) with OpenSBI and U-Boot. as the FIT image (u-boot.itb) with OpenSBI and U-Boot.
Device-tree selection
~~~~~~~~~~~~~~~~~~~~~
Depending on the board version U-Boot set variable $fdtfile to either
starfive/jh7110-starfive-visionfive-2-v1.2a.dtb or
starfive/jh7110-starfive-visionfive-2-v1.3b.dtb.
To overrule this selection the variable can be set manually and saved in the
environment
::
setenv fdtfile my_device-tree.dtb
env save
or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to provide
a default value.
Flashing Flashing
~~~~~~~~ ~~~~~~~~