From 0b1529615a8f932d19cd4200d5bb79e210bc8776 Mon Sep 17 00:00:00 2001 From: Samin Guo Date: Wed, 16 Aug 2023 15:25:38 +0800 Subject: riscv: starfive: evb: remove unused bootenv will be replaced by the new bootenv Signed-off-by: Samin Guo --- include/configs/starfive-evb.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/include/configs/starfive-evb.h b/include/configs/starfive-evb.h index 70eafe5bf9..bc6d9c1da8 100644 --- a/include/configs/starfive-evb.h +++ b/include/configs/starfive-evb.h @@ -134,22 +134,6 @@ "fi; " \ "fi; \0" -#define EVB_BOOTENV_NVME \ - "sdev_cmd=mmc\0" \ - "sdev_blk=mmcblk0p4\0" \ - "scan_nvme_dev=" \ - "if pci enum; then " \ - "nvme scan; " \ - "echo pci enum ...;" \ - "fi; " \ - "if nvme dev; then " \ - "setenv sdev_cmd nvme;" \ - "setenv sdev_blk nvme0n1p4;" \ - "fi; \0" \ - "mmcbootenv=run scan_nvme_dev; " \ - "fatload ${sdev_cmd} 0:3 $kernel_addr_r jh7110_uEnv.txt; " \ - "env import -t $kernel_addr_r $filesize; \0" - #define CHIPA_GMAC_SET \ "chipa_gmac_set=" \ "fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_10 <0x1>;" \ @@ -225,7 +209,6 @@ "loadaddr=0x60000000\0" \ CHIPA_GMAC_SET \ CHIPA_SET \ - EVB_BOOTENV_NVME \ CPU_VOL_1020_SET \ CPU_VOL_1040_SET \ CPU_VOL_1060_SET \ -- cgit v1.2.3 From f4ab04e7c0dc1639cc7d70d9b3f8ad87a473f45d Mon Sep 17 00:00:00 2001 From: Samin Guo Date: Wed, 16 Aug 2023 15:28:58 +0800 Subject: riscv: starfive: jh7110: Add JH7110_XX_BOOTEN Add JH7110_DISTRO_BOOTEN/JH7110_SDK_BOOTEN for debian/sdk boot on JH7110 SOC. Signed-off-by: Samin Guo --- include/configs/starfive-evb.h | 111 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/include/configs/starfive-evb.h b/include/configs/starfive-evb.h index bc6d9c1da8..9894f924aa 100644 --- a/include/configs/starfive-evb.h +++ b/include/configs/starfive-evb.h @@ -193,6 +193,115 @@ "name=loader2,size=4MB,type=${type_guid_gpt_loader2};" \ "name=system,size=-,bootable,type=${type_guid_gpt_system};" +#define JH7110_SDK_BOOTENV \ + "bootdir=/boot\0" \ + "bootpart=3\0" \ + "rootpart=4\0" \ + "load_sdk_uenv=" \ + "fatload ${bootdev} ${devnum}:${bootpart} ${loadaddr} ${bootenv_sdk};" \ + "env import -t ${loadaddr} ${filesize}; \0" \ + "mmc_test_and_boot=" \ + "if mmc dev ${devnum}; then " \ + "echo Try booting from MMC${devnum} ...; " \ + "setenv sdev_blk mmcblk${devnum}p${rootpart};" \ + "run load_sdk_uenv; run boot2;" \ + "fi;\0" \ + "bootenv_mmc=" \ + "setenv bootdev mmc;" \ + "if test ${bootmode} = flash; then " \ + "for mmc_devnum in ${mmc_devnum_l}; do " \ + "setenv devnum ${mmc_devnum}; " \ + "run mmc_test_and_boot;" \ + "done;" \ + "fi; " \ + "if test ${bootmode} = sd; then " \ + "setenv devnum ${sd_devnum};" \ + "run mmc_test_and_boot;" \ + "fi; " \ + "if test ${bootmode} = emmc; then " \ + "setenv devnum ${emmc_devnum};"\ + "run mmc_test_and_boot;" \ + "fi; \0" \ + "bootenv_nvme=" \ + "if test ${bootmode} = flash; then " \ + "for nvme_devnum in ${nvme_devnum_l}; do " \ + "setenv devnum ${nvme_devnum};" \ + "if pci enum; then " \ + "nvme scan; " \ + "fi; " \ + "if nvme dev ${devnum}; then " \ + "echo Try booting from NVME${devnum} ...; " \ + "setenv bootdev nvme;" \ + "setenv sdev_blk nvme${devnum}n1p${rootpart};" \ + "run load_sdk_uenv; run boot2;" \ + "fi; " \ + "done; " \ + "fi; \0" \ + "sdk_boot_env=" \ + "for bootdev_s in ${boot_devs}; do " \ + "run bootenv_${bootdev_s}; " \ + "done;\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" + +#define JH7110_DISTRO_BOOTENV \ + "bootdir=/boot\0" \ + "bootpart=3\0" \ + "rootpart=4\0" \ + "load_distro_uenv=" \ + "fatload ${bootdev} ${devnum}:${bootpart} ${loadaddr} /${bootenv}; " \ + "env import ${loadaddr} ${filesize}; \0" \ + "fdt_loaddtb=" \ + "fatload ${bootdev} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; fdt addr ${fdt_addr_r}; \0" \ + "fdt_sizecheck=" \ + "fatsize ${bootdev} ${devnum}:${bootpart} /dtbs/${fdtfile}; \0" \ + "set_fdt_distro=" \ + "run chipa_set_linux; run cpu_vol_set;" \ + "fatwrite ${bootdev} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile} ${filesize}; \0" \ + "bootcmd_distro=" \ + "run load_distro_uenv; " \ + "run fdt_loaddtb; run fdt_sizecheck; run set_fdt_distro; " \ + "sysboot ${bootdev} ${devnum}:${bootpart} fat ${scriptaddr} /${boot_syslinux_conf}; \0" \ + "distro_mmc_test_and_boot=" \ + "if mmc dev ${devnum}; then " \ + "echo Try booting from MMC${devnum} ...; " \ + "run bootcmd_distro;" \ + "fi;\0" \ + "distro_bootenv_mmc=" \ + "setenv bootdev mmc;" \ + "if test ${bootmode} = flash; then " \ + "for mmc_devnum in ${mmc_devnum_l}; do "\ + "setenv devnum ${mmc_devnum}; " \ + "run distro_mmc_test_and_boot;" \ + "done;" \ + "fi; " \ + "if test ${bootmode} = sd; then " \ + "setenv devnum ${sd_devnum};" \ + "run distro_mmc_test_and_boot;" \ + "fi; " \ + "if test ${bootmode} = emmc; then " \ + "setenv devnum ${emmc_devnum};"\ + "run distro_mmc_test_and_boot;" \ + "fi; \0" \ + "distro_bootenv_nvme=" \ + "if test ${bootmode} = flash; then " \ + "for nvme_devnum in ${nvme_devnum_l}; do " \ + "setenv devnum ${nvme_devnum};" \ + "if pci enum; then " \ + "nvme scan; " \ + "fi; " \ + "if nvme dev ${devnum}; then " \ + "echo Try booting from NVME${devnum} ...; " \ + "setenv bootdev nvme;" \ + "run bootcmd_distro; " \ + "fi; " \ + "done; " \ + "fi; \0" \ + "distro_boot_env=" \ + "echo Tring booting distro ...;" \ + "for bootdev_s in ${boot_devs}; do " \ + "run distro_bootenv_${bootdev_s}; " \ + "done; \0" + #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0xffffffffffffffff\0" \ "initrd_high=0xffffffffffffffff\0" \ @@ -207,6 +316,8 @@ "ramdisk_addr_r=0x46100000\0" \ "fdtoverlay_addr_r=0x4f000000\0" \ "loadaddr=0x60000000\0" \ + JH7110_SDK_BOOTENV \ + JH7110_DISTRO_BOOTENV \ CHIPA_GMAC_SET \ CHIPA_SET \ CPU_VOL_1020_SET \ -- cgit v1.2.3 From c814e8bc9d7b0408aabed9607f2c4bcbc3b0e7c3 Mon Sep 17 00:00:00 2001 From: Samin Guo Date: Wed, 16 Aug 2023 15:37:03 +0800 Subject: riscv: starfive: evb: Add EVB_SDK_BOOTENV Add BOOTENV for jh7110 evb Signed-off-by: Samin Guo --- include/configs/starfive-evb.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/configs/starfive-evb.h b/include/configs/starfive-evb.h index 9894f924aa..9a64635f6d 100644 --- a/include/configs/starfive-evb.h +++ b/include/configs/starfive-evb.h @@ -193,6 +193,15 @@ "name=loader2,size=4MB,type=${type_guid_gpt_loader2};" \ "name=system,size=-,bootable,type=${type_guid_gpt_system};" +#define EVB_SDK_BOOTENV \ + "bootenv=uEnv.txt\0" \ + "bootenv_sdk=jh7110_uEnv.txt\0" \ + "boot_devs=mmc nvme\0" \ + "emmc_devnum=1\0" \ + "sd_devnum=0\0" \ + "mmc_devnum_l=0 1\0" \ + "nvme_devnum_l=0 0\0" + #define JH7110_SDK_BOOTENV \ "bootdir=/boot\0" \ "bootpart=3\0" \ @@ -316,6 +325,7 @@ "ramdisk_addr_r=0x46100000\0" \ "fdtoverlay_addr_r=0x4f000000\0" \ "loadaddr=0x60000000\0" \ + EVB_SDK_BOOTENV \ JH7110_SDK_BOOTENV \ JH7110_DISTRO_BOOTENV \ CHIPA_GMAC_SET \ -- cgit v1.2.3 From b46afd08fd56e2cec9763b9cac62cbd0a82588d0 Mon Sep 17 00:00:00 2001 From: Samin Guo Date: Wed, 16 Aug 2023 15:38:02 +0800 Subject: riscv: starfive: evb: add get_boot_mode add get_boot_mode function to support Multi-device boot Signed-off-by: Samin Guo --- board/starfive/evb/starfive_evb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/board/starfive/evb/starfive_evb.c b/board/starfive/evb/starfive_evb.c index 3fdbb29b6c..6d3ef222b7 100644 --- a/board/starfive/evb/starfive_evb.c +++ b/board/starfive/evb/starfive_evb.c @@ -202,6 +202,12 @@ static u32 get_chip_type(void) return value; } +static void get_boot_mode(void) +{ + /* evb only support flash boot */ + env_set("bootmode", "flash"); +} + #if CONFIG_IS_ENABLED(STARFIVE_OTP) static void get_cpu_voltage_type(struct udevice *dev) { @@ -289,6 +295,8 @@ int board_late_init(void) struct udevice *dev; int ret; + get_boot_mode(); + /* * save the memory info by environment variable in u-boot, * It will used to update the memory configuration in dts, -- cgit v1.2.3 From a5c8183f220f0b40d769ae7b81b0f68554beb35a Mon Sep 17 00:00:00 2001 From: Samin Guo Date: Wed, 16 Aug 2023 15:49:11 +0800 Subject: riscv: starfive: jh7110-evb: Optimize boot commands - Optimize boot commands for jh7110-evb - Add CONFIG_DEFAULT_FDT_FILE for debian boot Signed-off-by: Samin Guo --- configs/starfive_evb_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/starfive_evb_defconfig b/configs/starfive_evb_defconfig index e7ce962c26..1e879dabb3 100644 --- a/configs/starfive_evb_defconfig +++ b/configs/starfive_evb_defconfig @@ -29,9 +29,10 @@ CONFIG_SPI_BOOT=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=tty1 console=ttyS0,115200 debug rootwait earlycon=sbi " CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="run mmcbootenv;run boot2" +CONFIG_BOOTCOMMAND="run sdk_boot_env; run distro_boot_env;" CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="run chipa_set_uboot" +CONFIG_DEFAULT_FDT_FILE="starfive/jh7110-evb.dtb" CONFIG_LOG_MAX_LEVEL=4 CONFIG_SPL_LOG=y CONFIG_DISPLAY_CPUINFO=y -- cgit v1.2.3