From d0969a6b64edca8f1bf85ef14c186ff7a4db3f8d Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Fri, 7 Mar 2025 13:13:41 +0000 Subject: [PATCH 01/21] riscv: lib: Add a default implementation of board_fdt_blob_setup It's common for S-Mode proper U-Boot to retrieve a FDT blob along with taking control from SBI firmware. Add a weak version of board_fdt_blob_setup to make use of it by default, avoiding copy-pasting similar functions among boards. Signed-off-by: Yao Zi Reviewed-by: Leo Yu-Chi Liang --- arch/riscv/lib/Makefile | 1 + arch/riscv/lib/board.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 arch/riscv/lib/board.c diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile index 22b675ffe82..189b35c24d3 100644 --- a/arch/riscv/lib/Makefile +++ b/arch/riscv/lib/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_$(PHASE_)SMP) += smp.o obj-$(CONFIG_XPL_BUILD) += spl.o obj-y += fdt_fixup.o obj-$(CONFIG_$(SPL)CMD_BDI) += bdinfo.o +obj-$(CONFIG_OF_BOARD) += board.o # For building EFI apps CFLAGS_NON_EFI := -fstack-protector-strong diff --git a/arch/riscv/lib/board.c b/arch/riscv/lib/board.c new file mode 100644 index 00000000000..624c4eaaf4d --- /dev/null +++ b/arch/riscv/lib/board.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * RISC-V-specific handling of firmware FDT + */ + +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +__weak int board_fdt_blob_setup(void **fdtp) +{ + if (!gd->arch.firmware_fdt_addr) + return -EEXIST; + + *fdtp = (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr; + + return 0; +} From 1ec65b26cf430c01df773f2532ec142d767edb5b Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Fri, 7 Mar 2025 13:13:42 +0000 Subject: [PATCH 02/21] board: qemu: riscv: Remove duplicated board_fdt_blob_setup The default version should work for RISC-V QEMU. Signed-off-by: Yao Zi Reviewed-by: Leo Yu-Chi Liang --- board/emulation/qemu-riscv/qemu-riscv.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c index a90222ea6a4..70190ebe8fc 100644 --- a/board/emulation/qemu-riscv/qemu-riscv.c +++ b/board/emulation/qemu-riscv/qemu-riscv.c @@ -63,11 +63,3 @@ int board_fit_config_name_match(const char *name) return 0; } #endif - -int board_fdt_blob_setup(void **fdtp) -{ - /* Stored the DTB address there during our init */ - *fdtp = (void *)(ulong)gd->arch.firmware_fdt_addr; - - return 0; -} From 41cb90a27a7ccd31fbfe2c8e5a0ba19144865d28 Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Fri, 7 Mar 2025 13:13:43 +0000 Subject: [PATCH 03/21] board: starfive: Remove duplicated board_fdt_blob_setup The default version should work for Starfive VisionFive 2. Signed-off-by: Yao Zi Reviewed-by: Leo Yu-Chi Liang --- board/starfive/visionfive2/starfive_visionfive2.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index b8cd509bc89..db9ff378ae1 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -106,16 +106,6 @@ int board_late_init(void) return 0; } -int board_fdt_blob_setup(void **fdtp) -{ - if (gd->arch.firmware_fdt_addr) { - *fdtp = (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr; - return 0; - } - - return -EEXIST; -} - int ft_board_setup(void *blob, struct bd_info *bd) { return fdt_fixup_memory(blob, 0x40000000, gd->ram_size); From a7bc58409f509acda631b558f87f93470ac90a94 Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Fri, 7 Mar 2025 13:13:44 +0000 Subject: [PATCH 04/21] board: sifive: Remove dead board_fdt_blob_setup CONFIG_OF_BOARD isn't enabled on SiFive Unleashed and Unmatched, thus board_fdt_blob_setup is actually dead code on these platforms. Let's remove it. Signed-off-by: Yao Zi Reviewed-by: Leo Yu-Chi Liang --- board/sifive/unleashed/unleashed.c | 11 ----------- board/sifive/unmatched/unmatched.c | 10 ---------- 2 files changed, 21 deletions(-) diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c index c1c374610c3..f5da289b836 100644 --- a/board/sifive/unleashed/unleashed.c +++ b/board/sifive/unleashed/unleashed.c @@ -114,17 +114,6 @@ int misc_init_r(void) #endif -int board_fdt_blob_setup(void **fdtp) -{ - if (gd->arch.firmware_fdt_addr) { - *fdtp = (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr; - - return 0; - } - - return -EEXIST; -} - int board_init(void) { /* enable all cache ways */ diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c index 23e03e145ee..a57ce1f10fe 100644 --- a/board/sifive/unmatched/unmatched.c +++ b/board/sifive/unmatched/unmatched.c @@ -10,16 +10,6 @@ #include #include -int board_fdt_blob_setup(void **fdtp) -{ - if (gd->arch.firmware_fdt_addr) { - *fdtp = (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr; - return 0; - } - - return -EEXIST; -} - int board_init(void) { /* enable all cache ways */ From d1cea78af41c1d86c6aebdbe98b050f311d7724e Mon Sep 17 00:00:00 2001 From: Huan Zhou Date: Sat, 29 Mar 2025 20:47:59 +0800 Subject: [PATCH 05/21] riscv: dts: k1: add pinctrl property in dts. Add pinctrl node in device tree and update in bananapi f3 dts. Signed-off-by: Huan Zhou Reviewed-by: Leo Yu-Chi Liang --- arch/riscv/dts/k1-bananapi-f3.dts | 3 +++ arch/riscv/dts/k1-pinctrl.dtsi | 19 +++++++++++++++++++ arch/riscv/dts/k1.dtsi | 8 +++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/dts/k1-pinctrl.dtsi diff --git a/arch/riscv/dts/k1-bananapi-f3.dts b/arch/riscv/dts/k1-bananapi-f3.dts index d2486f70906..6b5b83bcdb9 100644 --- a/arch/riscv/dts/k1-bananapi-f3.dts +++ b/arch/riscv/dts/k1-bananapi-f3.dts @@ -5,6 +5,7 @@ #include "k1.dtsi" #include "binman.dtsi" +#include "k1-pinctrl.dtsi" / { model = "Banana Pi BPI-F3"; @@ -21,5 +22,7 @@ }; &uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_2_cfg>; status = "okay"; }; diff --git a/arch/riscv/dts/k1-pinctrl.dtsi b/arch/riscv/dts/k1-pinctrl.dtsi new file mode 100644 index 00000000000..14e7096fbcf --- /dev/null +++ b/arch/riscv/dts/k1-pinctrl.dtsi @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 Spacemit Inc. + * Copyright (C) 2025 Yixun Lan + */ + +#define K1_PADCONF(pin, func) (((pin) << 16) | (func)) + +&pinctrl { + uart0_2_cfg: uart0-2-cfg { + uart0-2-pins { + pinmux = , + ; + + bias-pull-up = <0>; + drive-strength = <32>; + }; + }; +}; diff --git a/arch/riscv/dts/k1.dtsi b/arch/riscv/dts/k1.dtsi index 7c0f1b928e2..a633e43da32 100644 --- a/arch/riscv/dts/k1.dtsi +++ b/arch/riscv/dts/k1.dtsi @@ -470,5 +470,11 @@ #reset-cells = <1>; status = "disabled"; }; + + pinctrl: pinctrl@d401e000 { + compatible = "spacemit,k1-pinctrl", "pinctrl-single"; + reg = <0x0 0xd401e000 0x0 0x400>; + pinctrl-single,register-width = <32>; + }; }; -}; \ No newline at end of file +}; From cffe38b7b3c094c06e18e25d450397530e10dfce Mon Sep 17 00:00:00 2001 From: Huan Zhou Date: Sat, 29 Mar 2025 20:48:00 +0800 Subject: [PATCH 06/21] config: Enable pinctrl in bananapi-f3 Add pinctrl support in bananapi-f3 platform Signed-off-by: Huan Zhou Reviewed-by: Leo Yu-Chi Liang --- configs/bananapi-f3_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/bananapi-f3_defconfig b/configs/bananapi-f3_defconfig index 7483f128bae..30c4f8af62f 100644 --- a/configs/bananapi-f3_defconfig +++ b/configs/bananapi-f3_defconfig @@ -19,3 +19,5 @@ CONFIG_ENV_OVERWRITE=y CONFIG_SYS_NS16550=y CONFIG_SYS_NS16550_MEM32=y CONFIG_RESET_SPACEMIT_K1=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_SINGLE=y From 107df8b3b16f22f7ef86eeda4a5fa37d514308e7 Mon Sep 17 00:00:00 2001 From: Minda Chen Date: Thu, 3 Apr 2025 18:28:37 +0800 Subject: [PATCH 07/21] MAINTAINERS: visionfive2: Add match N: starfive pattern Add match N:starfive pattern to visionfive2 board. Now starfive pattern just related to JH7110 IC. Signed-off-by: Minda Chen Reviewed-by: Leo Yu-Chi Liang Reviewed-by: Marek Vasut --- board/starfive/visionfive2/MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/starfive/visionfive2/MAINTAINERS b/board/starfive/visionfive2/MAINTAINERS index 898e284ce2c..9d348c4b067 100644 --- a/board/starfive/visionfive2/MAINTAINERS +++ b/board/starfive/visionfive2/MAINTAINERS @@ -2,6 +2,6 @@ STARFIVE JH7110 VISIONFIVE2 BOARD M: Minda Chen M: Hal Feng S: Maintained -F: drivers/ram/starfive/ +N: starfive N: jh7110 N: visionfive2 From 5c8e1c46b16a92c1a0eb93d26d7c6aacda007d9e Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 3 Apr 2025 16:28:16 +0200 Subject: [PATCH 08/21] configs: qemu-riscv raise CONFIG_NR_DRAM_BANKS The number of memory banks in QEMU is not bounded by 1. In this example we have two banks: qemu-system-riscv64 \ -machine virt \ -nographic \ -m 8192 \ -smp 8,sockets=2,cores=4,threads=1 \ -numa node,cpus=0-3,mem=4096 \ -numa node,cpus=4-7,mem=4096 \ -kernel u-boot As we will see RISC-V NUMA systems using U-Boot we should be able to emulate these. Use the default value defined in /Kconfig as 4. Signed-off-by: Heinrich Schuchardt Reviewed-by: Leo Yu-Chi Liang --- configs/qemu-riscv32_defconfig | 1 - configs/qemu-riscv32_smode_defconfig | 1 - configs/qemu-riscv32_spl_defconfig | 1 - configs/qemu-riscv64_defconfig | 1 - configs/qemu-riscv64_smode_defconfig | 1 - configs/qemu-riscv64_spl_defconfig | 1 - 6 files changed, 6 deletions(-) diff --git a/configs/qemu-riscv32_defconfig b/configs/qemu-riscv32_defconfig index b9f28873c15..b9cb780200e 100644 --- a/configs/qemu-riscv32_defconfig +++ b/configs/qemu-riscv32_defconfig @@ -1,6 +1,5 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 -CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000 CONFIG_ENV_SIZE=0x20000 diff --git a/configs/qemu-riscv32_smode_defconfig b/configs/qemu-riscv32_smode_defconfig index cd89571e40c..8a09d80da11 100644 --- a/configs/qemu-riscv32_smode_defconfig +++ b/configs/qemu-riscv32_smode_defconfig @@ -1,6 +1,5 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 -CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000 CONFIG_ENV_SIZE=0x20000 diff --git a/configs/qemu-riscv32_spl_defconfig b/configs/qemu-riscv32_spl_defconfig index 8d5f9d9f5cc..c4b6d57020b 100644 --- a/configs/qemu-riscv32_spl_defconfig +++ b/configs/qemu-riscv32_spl_defconfig @@ -1,6 +1,5 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 -CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000 CONFIG_ENV_SIZE=0x20000 diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig index c67fb9a3352..6b2fed4ad16 100644 --- a/configs/qemu-riscv64_defconfig +++ b/configs/qemu-riscv64_defconfig @@ -1,6 +1,5 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 -CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000 CONFIG_ENV_SIZE=0x20000 diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig index d28e9fbeceb..95f24ac3d55 100644 --- a/configs/qemu-riscv64_smode_defconfig +++ b/configs/qemu-riscv64_smode_defconfig @@ -1,6 +1,5 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 -CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000 CONFIG_ENV_SIZE=0x20000 diff --git a/configs/qemu-riscv64_spl_defconfig b/configs/qemu-riscv64_spl_defconfig index 18b7e049d86..d2b0aec8d3c 100644 --- a/configs/qemu-riscv64_spl_defconfig +++ b/configs/qemu-riscv64_spl_defconfig @@ -1,6 +1,5 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 -CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000 CONFIG_ENV_SIZE=0x20000 From efe9c12322b92c49257d3dd86e40de8c26209e16 Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Wed, 16 Apr 2025 16:25:31 +0000 Subject: [PATCH 09/21] riscv: dts: binman.dtsi: Switch to u-boot-nodtb entry for proper U-Boot Switch to u-boot-nodtb entry which precisely represents a proper U-Boot and could be matched with u_boot_any. This allows RISC-V ports that make use of binman to be built without disabling SPL_BINMAN_UBOOT_SYMBOLS explicitly, which is set to y by default. Fixes: 0784510f741 ("riscv: sifive: unleashed: Switch to use binman to generate u-boot.itb") Suggested-by: Jonas Karlman Signed-off-by: Yao Zi Reviewed-by: Simon Glass --- arch/riscv/dts/binman.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/dts/binman.dtsi b/arch/riscv/dts/binman.dtsi index ceb916b74a7..5aeeeddb59f 100644 --- a/arch/riscv/dts/binman.dtsi +++ b/arch/riscv/dts/binman.dtsi @@ -35,7 +35,7 @@ compression = "none"; load = /bits/ 64 ; - uboot_blob: blob-ext { + uboot_blob: u-boot-nodtb { filename = "u-boot-nodtb.bin"; }; }; From 97b433b4e301fa8847e3d394a025d98fd814b3a5 Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Wed, 16 Apr 2025 16:25:32 +0000 Subject: [PATCH 10/21] riscv: dts: starfive: Prevent binman from relocating symbols in SPL SPL and proper U-Boot are split into two images with default binman configuration of StarFive VisionFive 2, thus proper U-Boot symbols cannot be found in the SPL image. This fixes errors like Section '/binman/spl-img': Symbol '_binman_u_boot_any_prop_size' in entry '/binman/spl-img/mkimage/u-boot-spl/u-boot-spl-nodtb': Entry 'u-boot-any' not found in list (u-boot-spl-nodtb, u-boot-spl-dtb,u-boot-spl,mkimage,spl-img) Fixes: 90602e779d3 ("riscv: dts: starfive: generate u-boot-spl.bin.normal.out") Suggested-by: Jonas Karlman Signed-off-by: Yao Zi --- arch/riscv/dts/starfive-visionfive2-binman.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/dts/starfive-visionfive2-binman.dtsi b/arch/riscv/dts/starfive-visionfive2-binman.dtsi index 05787bdb92d..6e083bf0537 100644 --- a/arch/riscv/dts/starfive-visionfive2-binman.dtsi +++ b/arch/riscv/dts/starfive-visionfive2-binman.dtsi @@ -20,6 +20,7 @@ args = "-T sfspl"; u-boot-spl { + no-write-symbols; }; }; }; From d3c597f08a5d04ae13eb523db11db8baf490037e Mon Sep 17 00:00:00 2001 From: Yao Zi Date: Wed, 16 Apr 2025 16:25:33 +0000 Subject: [PATCH 11/21] riscv: Provide __image_copy_{start_end} symbols in linkerscript Binman looks for __image_copy_start to determine the base address of an entry if elf-base-sym isn't specified, which is missing in RISC-V port. This causes binman skips RISC-V SPL entries without filling addresses into its .binman_sym_table section. This patch defines __image_copy_start in linkerscript of both SPL and proper U-Boot to ensure binman_sym functions correctly with the default binman.dtsi. The paired symbol, __image_copy_end, is introduced as well for completeness. Signed-off-by: Yao Zi Reviewed-by: Simon Glass --- arch/riscv/cpu/u-boot-spl.lds | 2 ++ arch/riscv/cpu/u-boot.lds | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/riscv/cpu/u-boot-spl.lds b/arch/riscv/cpu/u-boot-spl.lds index 907094620bd..0717833df55 100644 --- a/arch/riscv/cpu/u-boot-spl.lds +++ b/arch/riscv/cpu/u-boot-spl.lds @@ -16,6 +16,7 @@ ENTRY(_start) SECTIONS { . = ALIGN(4); + __image_copy_start = ADDR(.text); .text : { arch/riscv/cpu/start.o (.text) *(.text*) @@ -46,6 +47,7 @@ SECTIONS _end = .; _image_binary_end = .; + __image_copy_end = .; .bss : { __bss_start = .; diff --git a/arch/riscv/cpu/u-boot.lds b/arch/riscv/cpu/u-boot.lds index 2ffe6ba3c8f..b11ea8b56d2 100644 --- a/arch/riscv/cpu/u-boot.lds +++ b/arch/riscv/cpu/u-boot.lds @@ -10,6 +10,7 @@ ENTRY(_start) SECTIONS { . = ALIGN(4); + __image_copy_start = ADDR(.text); .text : { arch/riscv/cpu/start.o (.text) } @@ -57,6 +58,8 @@ SECTIONS __efi_runtime_rel_stop = .; } + __image_copy_end = .; + /DISCARD/ : { *(.rela.plt*) } .rela.dyn : { __rel_dyn_start = .; From ccb1769e854188ff059dab5b95ba9d2e6bb605d0 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Apr 2025 14:13:08 +0200 Subject: [PATCH 12/21] configs: add jh7110-deepcomputing-fml13v01 to VF2 defconfig The DeepComputing Framework motherboard is a JH7110 device support by the upstream kernel. Add its device-tree to the list of device-trees to be included into the starfive_visionfive_defconfig. Reviewed-by: Sumit Garg Reviewed-by: Hal Feng Reviewed-by: Matthias Brugger Signed-off-by: Heinrich Schuchardt Reviewed-by: E Shattow --- configs/starfive_visionfive2_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index 6a5b247c4b5..e145ced8db8 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -80,7 +80,7 @@ CONFIG_CMD_WDT=y CONFIG_CMD_WGET=y CONFIG_CMD_BOOTSTAGE=y CONFIG_OF_BOARD=y -CONFIG_OF_LIST="starfive/jh7110-milkv-mars starfive/jh7110-pine64-star64 starfive/jh7110-starfive-visionfive-2-v1.2a starfive/jh7110-starfive-visionfive-2-v1.3b" +CONFIG_OF_LIST="starfive/jh7110-deepcomputing-fml13v01 starfive/jh7110-milkv-mars starfive/jh7110-pine64-star64 starfive/jh7110-starfive-visionfive-2-v1.2a starfive/jh7110-starfive-visionfive-2-v1.3b" CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y From d4bcf3b417fc4d43583d11555a8cf29a87628b46 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Apr 2025 14:13:09 +0200 Subject: [PATCH 13/21] riscv: dts: jh7110: add DeepComputing FML13V01 device-tree Add the u-boot device-tree include needed to support the DeepComputing Framework motherboard (FML13V01). Reviewed-by: Sumit Garg Reviewed-by: Hal Feng Reviewed-by: Matthias Brugger Signed-off-by: Heinrich Schuchardt Reviewed-by: E Shattow --- arch/riscv/dts/jh7110-deepcomputing-fml13v01-u-boot.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 arch/riscv/dts/jh7110-deepcomputing-fml13v01-u-boot.dtsi diff --git a/arch/riscv/dts/jh7110-deepcomputing-fml13v01-u-boot.dtsi b/arch/riscv/dts/jh7110-deepcomputing-fml13v01-u-boot.dtsi new file mode 100644 index 00000000000..ab882d07f6f --- /dev/null +++ b/arch/riscv/dts/jh7110-deepcomputing-fml13v01-u-boot.dtsi @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2024 StarFive Technology Co., Ltd. + */ + +#include "jh7110-common-u-boot.dtsi" +#include "starfive-visionfive2-binman.dtsi" From 3de6e675ed082986574e2c6960642fde7d8139aa Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Apr 2025 14:13:10 +0200 Subject: [PATCH 14/21] board: starfive: DeepComputing FML13V01 fdt selection We support all JH7110 boards with starfive_visionfive2_defconfig. The relevant device-tree is selected at runtime based on EEPROM data. Support setting $fdtfile to the file name of the DeepComputing Framework motherboard (FML13V01) device-tree. Reviewed-by: Hal Feng Reviewed-by: Matthias Brugger Signed-off-by: Heinrich Schuchardt Reviewed-by: E Shattow --- board/starfive/visionfive2/starfive_visionfive2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index db9ff378ae1..4b273e52e9a 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -17,6 +17,8 @@ DECLARE_GLOBAL_DATA_PTR; #define JH7110_L2_PREFETCHER_BASE_ADDR 0x2030000 #define JH7110_L2_PREFETCHER_HART_OFFSET 0x2000 +#define FDTFILE_FML13V01 \ + "starfive/jh7110-deepcomputing-fml13v01.dtb" #define FDTFILE_MILK_V_MARS \ "starfive/jh7110-milkv-mars.dtb" #define FDTFILE_VISIONFIVE2_1_2A \ @@ -63,7 +65,9 @@ static void set_fdtfile(void) log_err("Can't read EEPROM\n"); return; } - if (!strncmp(product_id, "MARS", 4)) { + if (!strncmp(product_id, "FML13V01", 8)) { + fdtfile = FDTFILE_FML13V01; + } else if (!strncmp(product_id, "MARS", 4)) { fdtfile = FDTFILE_MILK_V_MARS; } else if (!strncmp(product_id, "VF7110", 6)) { version = get_pcb_revision_from_eeprom(); From 26cd7afcce2865a6640278dbec9a643868b6c411 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Apr 2025 14:13:11 +0200 Subject: [PATCH 15/21] board: starfive: spl: support DeepComputing FML13V01 On the DeepComputing Framework motherboard (FML13V01) choose the matching FIT configuration. Reviewed-by: Hal Feng Reviewed-by: Matthias Brugger Signed-off-by: Heinrich Schuchardt Reviewed-by: E Shattow --- board/starfive/visionfive2/spl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index 3e4d3e21988..9a3081ef06f 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -125,7 +125,10 @@ int board_fit_config_name_match(const char *name) if (strncmp(name, "starfive/", 9)) return -EINVAL; name += 9; - if (!strncmp(product_id, "VF7110", 6)) { + if (!strncmp(product_id, "FML13V01", 8) && + !strcmp(name, "jh7110-deepcomputing-fml13v01")) { + return 0; + } else if (!strncmp(product_id, "VF7110", 6)) { version = get_pcb_revision_from_eeprom(); if ((version == 'b' || version == 'B') && !strcmp(name, "jh7110-starfive-visionfive-2-v1.3b")) From 9b0a451b9e18152ef3d0fa6028b5eaae97ee94e5 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Apr 2025 14:13:12 +0200 Subject: [PATCH 16/21] doc: add DeepComputing FML13V01 documentation Describe building U-Boot for the board and booting. Carve out common information for JH7110 boards into an include. Signed-off-by: Heinrich Schuchardt Reviewed-by: E Shattow --- doc/board/starfive/deepcomputing_fml13v01.rst | 80 +++++++++++++++++ doc/board/starfive/index.rst | 1 + doc/board/starfive/jh7110_common.rst | 89 +++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 doc/board/starfive/deepcomputing_fml13v01.rst create mode 100644 doc/board/starfive/jh7110_common.rst diff --git a/doc/board/starfive/deepcomputing_fml13v01.rst b/doc/board/starfive/deepcomputing_fml13v01.rst new file mode 100644 index 00000000000..5d9612483b4 --- /dev/null +++ b/doc/board/starfive/deepcomputing_fml13v01.rst @@ -0,0 +1,80 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +DeepComputing Framework Motherboard (FLM13V01) +============================================== + +The DeepComputing Framework motherboard (FLM13V01) can be combined with a +13 inch Framework laptop chassis to provide a complete laptop. + +U-Boot for the board uses the same binaries as the VisionFive 2 board. +Currently only serial console output is supported by mainline U-Boot. + +Building +-------- + +Setup the cross compilation environment variable: + +.. code-block:: bash + + export CROSS_COMPILE=riscv64-linux-gnu- + +The M-mode software OpenSBI provides the supervisor binary interface (SBI) and +is responsible for the switch to S-Mode. It is a prerequisite for building +U-Boot. Support for the JH7110 was introduced in OpenSBI 1.2. It is recommended +to use a current release. + +.. code-block:: bash + + git clone https://github.com/riscv/opensbi.git + cd opensbi + make PLATFORM=generic FW_TEXT_START=0x40000000 FW_OPTIONS=0 + export OPENSBI="$(pwd)/build/platform/generic/firmware/fw_dynamic.bin" + +Now build U-Boot SPL and main U-Boot. + +.. code-block:: bash + + cd + make starfive_visionfive2_defconfig + make + +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, U-Boot, and device-trees. + +Device-tree selection +--------------------- + +The product ID stored in the board EEPROM is used by U-Boot SPL to select the +right configuration and device-tree from the u-boot.itb FIT image. + +Furthermore if variable $fdtfile has not been saved in the environment it is +set based on the product ID to *starfive/jh7110-deepcomputing-fml13v01.dtb*. + +To overrule this default the variable can be set manually and saved in the +environment + +.. code-block:: console + + setenv fdtfile my_device-tree.dtb + env save + +Power switch +------------ + +A tiny power switch is located in right upper corner of the board. + +Open case detection +------------------- + +The board has an open case detection switch. Red lights will flash and the +board will not boot if the switch is not held down. + +UART +---- + +UART 0 is exposed via the side channel contacts SBU1 and SBU2 of the lower, +right USB C connector. A USB C cable and a breakout board are needed for +physical access. It depends on the cable orientation on which of SBU1 and SBU2 +you will find RX and TX. The signal voltage is 3.3 V. The baud rate is 115200. + +.. include:: jh7110_common.rst diff --git a/doc/board/starfive/index.rst b/doc/board/starfive/index.rst index 2cba1b6dc56..66abc6f9d98 100644 --- a/doc/board/starfive/index.rst +++ b/doc/board/starfive/index.rst @@ -6,6 +6,7 @@ StarFive .. toctree:: :maxdepth: 1 + deepcomputing_fml13v01 milk-v_mars pine64_star64 visionfive2 diff --git a/doc/board/starfive/jh7110_common.rst b/doc/board/starfive/jh7110_common.rst new file mode 100644 index 00000000000..fb8d87a1551 --- /dev/null +++ b/doc/board/starfive/jh7110_common.rst @@ -0,0 +1,89 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Boot source selection +--------------------- + +The board provides DIP switches to select the device for loading the boot +firmware. + +=========== === === +Boot source SW1 SW2 +=========== === === +UART OFF OFF +SD-card ON OFF +eMMC OFF ON +SPI flash ON ON +=========== === === + +Flashing a new U-Boot version +----------------------------- + +U-Boot SPL is provided as file spl/u-boot-spl.bin.normal.out. Main U-Boot is +in file u-boot.itb. + +Assuming your new U-Boot version is on partition 1 of an SD-card you could +install it to the SPI flash with: + +.. code-block:: console + + sf probe + load mmc 1:1 $kernel_addr_r u-boot-spl.bin.normal.out + sf update $kernel_addr_r 0 $filesize + load mmc 1:1 $kernel_addr_r u-boot.itb + sf update $kernel_addr_r 0x100000 $filesize + +For loading the files from a TFTP server refer to the dhcp and tftpboot +commands. + +After updating U-Boot you may want to erase a saved environment and reboot. + +.. code-block:: console + + env erase + reset + +Booting from SD-Card +-------------------- + +The device boot ROM loads U-Boot SPL (u-boot-spl.bin.normal.out) from the +partition with type GUID 2E54B353-1271-4842-806F-E436D6AF6985. You are free +to choose any partition number. + +With the default configuration U-Boot SPL loads the U-Boot FIT image +(u-boot.itb) from partition 2 (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x2). +When formatting it is recommended to use GUID +BC13C2FF-59E6-4262-A352-B275FD6F7172 for this partition. + +Booting from eMMC +----------------- + +The device boot ROM tries to load U-Boot SPL (u-boot-spl.bin.normal.out) from +sector 0 of the eMMC's main hardware partition. But this conflicts with GPT +partitioning. Fortunately eMMC can alternatively load U-Boot SPL from a backup +position. + +For U-Boot SPL (u-boot-spl.bin.normal.out) starting at sector 2048 (position +0x100000) write the following bytes to the eMMC device after GPT partitioning: + +======= ======================== +Address Bytes +======= ======================== +0x0000 40 02 00 00 00 00 10 00 +0x0290 40 02 00 00 00 00 10 00 +======= ======================== + +With the default configuration U-Boot SPL loads the U-Boot FIT image +(u-boot.itb) from partition 2 (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x2). +When formatting it is recommended to use GUID +BC13C2FF-59E6-4262-A352-B275FD6F7172 for this partition. + +Booting from UART +----------------- + +The boot ROM supports the X-modem protocol to upload +spl/u-boot-spl.bin.normal.out. U-Boot SPL support loading the FIT image +u-boot.itb via the Y-modem protocol. + +Due to restrictions of the boot ROM not all X-modem implementations are +compatible. The package tio (https://github.com/tio/tio) has been found to be +usable. From 39b558c4164b8ea4d2e97b4941a6c369a4021914 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Apr 2025 14:13:13 +0200 Subject: [PATCH 17/21] doc: starfive: use consistent formatting Always use ---- for the H2 level. Signed-off-by: Heinrich Schuchardt Reviewed-by: E Shattow --- doc/board/starfive/milk-v_mars.rst | 10 +++++----- doc/board/starfive/pine64_star64.rst | 12 ++++++------ doc/board/starfive/visionfive2.rst | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/board/starfive/milk-v_mars.rst b/doc/board/starfive/milk-v_mars.rst index 554932ecfd4..aba9c9c53d4 100644 --- a/doc/board/starfive/milk-v_mars.rst +++ b/doc/board/starfive/milk-v_mars.rst @@ -8,7 +8,7 @@ board. In U-Boot SPL the actual board is detected and the device-tree patched accordingly. Building -~~~~~~~~ +-------- 1. Add the RISC-V toolchain to your PATH. 2. Setup ARCH & cross compilation environment variable: @@ -40,7 +40,7 @@ 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. Device-tree selection -~~~~~~~~~~~~~~~~~~~~~ +--------------------- Depending on the board version U-Boot set variable $fdtfile to either starfive/jh7110-starfive-visionfive-2-v1.2a.dtb or @@ -58,14 +58,14 @@ or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to set to provide a default value. Boot source selection -~~~~~~~~~~~~~~~~~~~~~ +--------------------- The board provides the DIP switches MSEL[1:0] to select the boot device out of SPI flash, eMMC, SD-card, UART. To select booting from SD-card set the DIP switches MSEL[1:0] to 10. Preparing the SD-Card -~~~~~~~~~~~~~~~~~~~~~ +--------------------- The device firmware loads U-Boot SPL (u-boot-spl.bin.normal.out) from the partition with type GUID 2E54B353-1271-4842-806F-E436D6AF6985. You are free @@ -106,6 +106,6 @@ Copy U-Boot to the SD card sudo umount /mnt Booting -~~~~~~~ +------- Once you plugin the sdcard and power up, you should see the U-Boot prompt. diff --git a/doc/board/starfive/pine64_star64.rst b/doc/board/starfive/pine64_star64.rst index 52e9a907917..1df4b68e4a0 100644 --- a/doc/board/starfive/pine64_star64.rst +++ b/doc/board/starfive/pine64_star64.rst @@ -8,7 +8,7 @@ In U-Boot SPL the actual board is detected and the device-tree patched accordingly. Building -~~~~~~~~ +-------- 1. Add the RISC-V toolchain to your PATH. 2. Setup ARCH & cross compilation environment variable: @@ -40,7 +40,7 @@ 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. Device-tree selection -~~~~~~~~~~~~~~~~~~~~~ +--------------------- U-Boot will set variable $fdtfile to starfive/jh7110-pine64-star64.dtb. @@ -56,7 +56,7 @@ or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to set to provide a default value. Boot source selection -~~~~~~~~~~~~~~~~~~~~~ +--------------------- Boot mode is selected by an MSEL-DIP marked S1804 and GPIO_0 position adjacent to the 40pin GPIO header. ON/ONKE and number markings of the MSEL-DIP are @@ -69,7 +69,7 @@ accurate selection. + UART: 11 Preparing the SD-Card -~~~~~~~~~~~~~~~~~~~~~ +--------------------- The device firmware loads U-Boot SPL (u-boot-spl.bin.normal.out) from the partition with type GUID 2E54B353-1271-4842-806F-E436D6AF6985. You are free @@ -110,12 +110,12 @@ Copy U-Boot to the SD card sudo umount /mnt Booting -~~~~~~~ +------- Once you plugin the sdcard and power up, you should see the U-Boot prompt. Serial Number and MAC address issues -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------------------ U-Boot requires valid EEPROM data to determine which board-specific fix-up to apply at runtime. This affects the size of memory initialized, network mac diff --git a/doc/board/starfive/visionfive2.rst b/doc/board/starfive/visionfive2.rst index 2c68df3ce4d..44e7fcb3a48 100644 --- a/doc/board/starfive/visionfive2.rst +++ b/doc/board/starfive/visionfive2.rst @@ -36,7 +36,7 @@ Currently, the u-boot.itb is used as a dynamic of the OpenSBI FW_DYNAMIC firmware with the latest. Building -~~~~~~~~ +-------- 1. Add the RISC-V toolchain to your PATH. 2. Setup ARCH & cross compilation environment variable: @@ -72,7 +72,7 @@ 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. Device-tree selection -~~~~~~~~~~~~~~~~~~~~~ +--------------------- Depending on the board version U-Boot set variable $fdtfile to either starfive/jh7110-starfive-visionfive-2-v1.2a.dtb or @@ -90,7 +90,7 @@ or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to provide a default value. Flashing -~~~~~~~~ +-------- The device firmware loads U-Boot SPL (u-boot-spl.bin.normal.out) from the partition with type GUID 2E54B353-1271-4842-806F-E436D6AF6985. You are free @@ -133,7 +133,7 @@ Program the SD card sudo umount /mnt Booting -~~~~~~~ +------- The board provides the DIP switches MSEL[1:0] to select the boot device. To select booting from SD-card set the DIP switches MSEL[1:0] to 10. @@ -141,7 +141,7 @@ To select booting from SD-card set the DIP switches MSEL[1:0] to 10. Once you plugin the sdcard and power up, you should see the U-Boot prompt. Sample boot log from StarFive VisionFive2 board -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +----------------------------------------------- .. code-block:: none From f0b86c4dd14a94422b69b440554e050e89dd7a72 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Apr 2025 14:13:14 +0200 Subject: [PATCH 18/21] doc: starfive: use jh7110_common.rst To avoid duplicate maintenance just include jh7110_common.rst to describe the usage of the different boot sources. Signed-off-by: Heinrich Schuchardt Reviewed-by: E Shattow --- doc/board/starfive/milk-v_mars.rst | 12 +-------- doc/board/starfive/pine64_star64.rst | 18 +------------ doc/board/starfive/visionfive2.rst | 39 +--------------------------- 3 files changed, 3 insertions(+), 66 deletions(-) diff --git a/doc/board/starfive/milk-v_mars.rst b/doc/board/starfive/milk-v_mars.rst index aba9c9c53d4..ce4539a46f1 100644 --- a/doc/board/starfive/milk-v_mars.rst +++ b/doc/board/starfive/milk-v_mars.rst @@ -57,13 +57,6 @@ environment or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to set to provide a default value. -Boot source selection ---------------------- - -The board provides the DIP switches MSEL[1:0] to select the boot device out of -SPI flash, eMMC, SD-card, UART. To select booting from SD-card set the DIP -switches MSEL[1:0] to 10. - Preparing the SD-Card --------------------- @@ -105,7 +98,4 @@ Copy U-Boot to the SD card sudo cp jh7110-starfive-visionfive-2.dtb /mnt/ sudo umount /mnt -Booting -------- - -Once you plugin the sdcard and power up, you should see the U-Boot prompt. +.. include:: jh7110_common.rst diff --git a/doc/board/starfive/pine64_star64.rst b/doc/board/starfive/pine64_star64.rst index 1df4b68e4a0..d1752c452da 100644 --- a/doc/board/starfive/pine64_star64.rst +++ b/doc/board/starfive/pine64_star64.rst @@ -55,19 +55,6 @@ environment or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to set to provide a default value. -Boot source selection ---------------------- - -Boot mode is selected by an MSEL-DIP marked S1804 and GPIO_0 position adjacent -to the 40pin GPIO header. ON/ONKE and number markings of the MSEL-DIP are -misleading; Instead refer to the ``L`` (0) and ``H`` (1) silkscreen for -accurate selection. - -+ (QSPI) Flash: 00 -+ SD: 01 -+ EMMC: 10 -+ UART: 11 - Preparing the SD-Card --------------------- @@ -109,10 +96,7 @@ Copy U-Boot to the SD card sudo cp jh7110-starfive-visionfive-2.dtb /mnt/ sudo umount /mnt -Booting -------- - -Once you plugin the sdcard and power up, you should see the U-Boot prompt. +.. include:: jh7110_common.rst Serial Number and MAC address issues ------------------------------------ diff --git a/doc/board/starfive/visionfive2.rst b/doc/board/starfive/visionfive2.rst index 44e7fcb3a48..6f3c572f1f8 100644 --- a/doc/board/starfive/visionfive2.rst +++ b/doc/board/starfive/visionfive2.rst @@ -132,13 +132,7 @@ Program the SD card sudo cp jh7110-starfive-visionfive-2.dtb /mnt/ sudo umount /mnt -Booting -------- - -The board provides the DIP switches MSEL[1:0] to select the boot device. -To select booting from SD-card set the DIP switches MSEL[1:0] to 10. - -Once you plugin the sdcard and power up, you should see the U-Boot prompt. +.. include:: jh7110_common.rst Sample boot log from StarFive VisionFive2 board ----------------------------------------------- @@ -479,34 +473,3 @@ Sample boot log from StarFive VisionFive2 board Welcome to Buildroot buildroot login: - -Booting from SPI ----------------- - -Use Building steps from "Booting from MMC using U-Boot SPL" section. - -Partition the SPI in Linux via mtdblock. (Require to boot the board in -SD boot mode by enabling MTD block in Linux) - -Use prebuilt image from here [1], which support to partition the SPI flash. - - -Program the SPI (Require to boot the board in SD boot mode) - -Execute below steps on U-Boot proper, - -.. code-block:: none - - sf probe - fatload mmc 1:3 $kernel_addr_r u-boot.itb - sf update $kernel_addr_r 0x100000 $filesize - - fatload mmc 1:3 $kernel_addr_r u-boot-spl.bin.normal.out - sf update $kernel_addr_r 0x0 $filesize - - -Power off the board - -Change DIP switches MSEL[1:0] are set to 00, select the boot mode to flash - -Power up the board. From 95c1bb5f55dc9ce7fe922cc2ee36b191a25236c8 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Apr 2025 14:13:15 +0200 Subject: [PATCH 19/21] doc: jh7110: describe debug UART Provide the settings for using the debug UART in SPL. Signed-off-by: Heinrich Schuchardt Reviewed-by: E Shattow --- doc/board/starfive/jh7110_common.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/board/starfive/jh7110_common.rst b/doc/board/starfive/jh7110_common.rst index fb8d87a1551..4a8058ee5da 100644 --- a/doc/board/starfive/jh7110_common.rst +++ b/doc/board/starfive/jh7110_common.rst @@ -87,3 +87,17 @@ u-boot.itb via the Y-modem protocol. Due to restrictions of the boot ROM not all X-modem implementations are compatible. The package tio (https://github.com/tio/tio) has been found to be usable. + +Debug UART +---------- + +By default the SBI interface is used for the debug UART. But this only works +in main U-Boot. To enable the debug UART in SPL, too, use the following +settings:: + + CONFIG_DEBUG_UART=y + CONFIG_DEBUG_UART_NS16550=y + CONFIG_DEBUG_UART_BASE=0x10000000 + CONFIG_SPL_DEBUG_UART_BASE=0x10000000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_DEBUG_UART_SHIFT=2 From 84028132afffdb1ef31b9ece8da0790782164fa2 Mon Sep 17 00:00:00 2001 From: E Shattow Date: Wed, 23 Apr 2025 14:28:51 -0700 Subject: [PATCH 20/21] doc: board: starfive: visionfive2: add missing format command to Flashing Signed-off-by: E Shattow Reviewed-by: Leo Yu-Chi Liang --- doc/board/starfive/visionfive2.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/board/starfive/visionfive2.rst b/doc/board/starfive/visionfive2.rst index 6f3c572f1f8..11121a1751a 100644 --- a/doc/board/starfive/visionfive2.rst +++ b/doc/board/starfive/visionfive2.rst @@ -116,6 +116,7 @@ Format the SD card (make sure the disk has GPT, otherwise use gdisk to switch) --new=2:8192:16383 --change-name=2:uboot --typecode=2:BC13C2FF-59E6-4262-A352-B275FD6F7172 \ --new=3:16384:1654784 --change-name=3:system --typecode=3:EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 \ /dev/sdb + sudo mkfs.vfat -F32 /dev/sdb3 Program the SD card From 5ac699efe94f24df561d33e420d3c73f5fb797e8 Mon Sep 17 00:00:00 2001 From: E Shattow Date: Mon, 21 Apr 2025 23:49:17 -0700 Subject: [PATCH 21/21] board: starfive: visionfive2: Order board detection logic to match config Refactor inside-out EEPROM-checking logic to better match the board-seeking callback and ordered list of targets from starfive_visionfive2_config since the JH7110 OF_UPSTREAM migration. Signed-off-by: E Shattow Reviewed-by: Leo Yu-Chi Liang --- board/starfive/visionfive2/spl.c | 44 +++++++++++++++----------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index 9a3081ef06f..0d4d5cccabd 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -116,33 +116,29 @@ void board_init_f(ulong dummy) #if CONFIG_IS_ENABLED(LOAD_FIT) int board_fit_config_name_match(const char *name) { - const char *product_id; - u8 version; - - product_id = get_product_id_from_eeprom(); - - /* Strip off prefix */ - if (strncmp(name, "starfive/", 9)) - return -EINVAL; - name += 9; - if (!strncmp(product_id, "FML13V01", 8) && - !strcmp(name, "jh7110-deepcomputing-fml13v01")) { + if (!strcmp(name, "starfive/jh7110-deepcomputing-fml13v01") && + !strncmp(get_product_id_from_eeprom(), "FML13V01", 8)) { return 0; - } else if (!strncmp(product_id, "VF7110", 6)) { - version = get_pcb_revision_from_eeprom(); - if ((version == 'b' || version == 'B') && - !strcmp(name, "jh7110-starfive-visionfive-2-v1.3b")) + } else if (!strcmp(name, "starfive/jh7110-milkv-mars") && + !strncmp(get_product_id_from_eeprom(), "MARS", 4)) { + return 0; + } else if ((!strcmp(name, "starfive/jh7110-pine64-star64")) && + !strncmp(get_product_id_from_eeprom(), "STAR64", 6)) { + return 0; + } else if ((!strcmp(name, "starfive/jh7110-starfive-visionfive-2-v1.2a")) && + !strncmp(get_product_id_from_eeprom(), "VF7110", 6)) { + switch (get_pcb_revision_from_eeprom()) { + case 'a': + case 'A': return 0; - - if ((version == 'a' || version == 'A') && - !strcmp(name, "jh7110-starfive-visionfive-2-v1.2a")) + } + } else if ((!strcmp(name, "starfive/jh7110-starfive-visionfive-2-v1.2b")) && + !strncmp(get_product_id_from_eeprom(), "VF7110", 6)) { + switch (get_pcb_revision_from_eeprom()) { + case 'b': + case 'B': return 0; - } else if (!strncmp(product_id, "MARS", 4) && - !strcmp(name, "jh7110-milkv-mars")) { - return 0; - } else if (!strncmp(product_id, "STAR64", 6) && - !strcmp(name, "jh7110-pine64-star64")) { - return 0; + } } return -EINVAL;