From 6015c98be50f2fc571c294d2f2b0768212fb7e99 Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Fri, 24 Oct 2025 16:59:26 +0800 Subject: eeprom: starfive: Simplify get_ddr_size_from_eeprom() Directly return the DDR size instead of the field of 'DxxxExxx'. Move the function description to the header file. Return 0 instead of 0xFF if read_eeprom() fails. Reviewed-by: Heinrich Schuchardt Fixes: aea1bd95b61e ("eeprom: starfive: Enable ID EEPROM configuration") Signed-off-by: Hal Feng --- arch/riscv/cpu/jh7110/spl.c | 2 +- arch/riscv/include/asm/arch-jh7110/eeprom.h | 8 +++++++- board/starfive/visionfive2/visionfive2-i2c-eeprom.c | 17 +++-------------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/arch/riscv/cpu/jh7110/spl.c b/arch/riscv/cpu/jh7110/spl.c index 87aaf865246..3aece7d995b 100644 --- a/arch/riscv/cpu/jh7110/spl.c +++ b/arch/riscv/cpu/jh7110/spl.c @@ -41,7 +41,7 @@ int spl_dram_init(void) /* Read the definition of the DDR size from eeprom, and if not, * use the definition in DT */ - size = (get_ddr_size_from_eeprom() >> 16) & 0xFF; + size = get_ddr_size_from_eeprom(); if (check_ddr_size(size)) gd->ram_size = size << 30; diff --git a/arch/riscv/include/asm/arch-jh7110/eeprom.h b/arch/riscv/include/asm/arch-jh7110/eeprom.h index 45ad2a5f7bc..1ae9f2b840a 100644 --- a/arch/riscv/include/asm/arch-jh7110/eeprom.h +++ b/arch/riscv/include/asm/arch-jh7110/eeprom.h @@ -10,7 +10,13 @@ #include u8 get_pcb_revision_from_eeprom(void); -u32 get_ddr_size_from_eeprom(void); + +/** + * get_ddr_size_from_eeprom() - read DDR size from EEPROM + * + * @return: size in GiB or 0 on error. + */ +u8 get_ddr_size_from_eeprom(void); /** * get_mmc_size_from_eeprom() - read eMMC size from EEPROM diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c index 17a44020bcf..ca5039ee433 100644 --- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c +++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c @@ -550,23 +550,12 @@ u8 get_pcb_revision_from_eeprom(void) return pbuf.eeprom.atom1.data.pstr[6]; } -/** - * get_ddr_size_from_eeprom - get the DDR size - * pstr: VF7110A1-2228-D008E000-00000001 - * VF7110A1/VF7110B1 : VisionFive JH7110A /VisionFive JH7110B - * D008: 8GB LPDDR4 - * E000: No emmc device, ECxx: include emmc device, xx: Capacity size[GB] - * return: the field of 'D008E000' - */ - -u32 get_ddr_size_from_eeprom(void) +u8 get_ddr_size_from_eeprom(void) { - u32 pv = 0xFFFFFFFF; - if (read_eeprom()) - return pv; + return 0; - return hextoul(&pbuf.eeprom.atom1.data.pstr[14], NULL); + return (hextoul(&pbuf.eeprom.atom1.data.pstr[14], NULL) >> 16) & 0xFF; } u32 get_mmc_size_from_eeprom(void) -- cgit v1.2.3 From 78253aeeecdfea4c71779905ff2b400fa7400b1c Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Fri, 24 Oct 2025 16:59:27 +0800 Subject: eeprom: starfive: Correct get_pcb_revision_from_eeprom() pcb_revision is stored in the pcb_revision field of ATOM4. Correct it. Move the function description to the header file. Return 0 instead of 0xFF if read_eeprom() fails. Reviewed-by: Heinrich Schuchardt Fixes: aea1bd95b61e ("eeprom: starfive: Enable ID EEPROM configuration") Signed-off-by: Hal Feng --- arch/riscv/include/asm/arch-jh7110/eeprom.h | 5 +++++ board/starfive/visionfive2/visionfive2-i2c-eeprom.c | 11 ++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/arch/riscv/include/asm/arch-jh7110/eeprom.h b/arch/riscv/include/asm/arch-jh7110/eeprom.h index 1ae9f2b840a..8b689a75013 100644 --- a/arch/riscv/include/asm/arch-jh7110/eeprom.h +++ b/arch/riscv/include/asm/arch-jh7110/eeprom.h @@ -9,6 +9,11 @@ #include +/** + * get_pcb_revision_from_eeprom() - get the PCB revision + * + * @return: the PCB revision or 0 on error. + */ u8 get_pcb_revision_from_eeprom(void); /** diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c index ca5039ee433..986dcc94992 100644 --- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c +++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c @@ -535,19 +535,12 @@ int mac_read_from_eeprom(void) return 0; } -/** - * get_pcb_revision_from_eeprom - get the PCB revision - * - * 1.2A return 'A'/'a', 1.3B return 'B'/'b',other values are illegal - */ u8 get_pcb_revision_from_eeprom(void) { - u8 pv = 0xFF; - if (read_eeprom()) - return pv; + return 0; - return pbuf.eeprom.atom1.data.pstr[6]; + return pbuf.eeprom.atom4.data.pcb_revision; } u8 get_ddr_size_from_eeprom(void) -- cgit v1.2.3 From ab4f610debf2cb179174b043c14710c6f407a411 Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Fri, 24 Oct 2025 16:59:28 +0800 Subject: eeprom: starfive: Support eeprom data format v3 Add eeprom data format v3 support. Add onboard_module field in ATOM4 and add "mac onboard_module " command to modify it. The onboard module field marks the additional modules compared with VisionFive 2 board. Now we define bit7-1: reserved, bit0: WIFI/BT Signed-off-by: Hal Feng --- .../starfive/visionfive2/visionfive2-i2c-eeprom.c | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c index 986dcc94992..b9197cdd34f 100644 --- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c +++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c @@ -105,7 +105,8 @@ struct eeprom_atom4_data { u8 bom_revision; /* BOM version */ u8 mac0_addr[MAC_ADDR_BYTES]; /* Ethernet0 MAC */ u8 mac1_addr[MAC_ADDR_BYTES]; /* Ethernet1 MAC */ - u8 reserved[2]; + u8 onboard_module; /* Onboard module flag: bit7-1: reserved, bit0: WIFI/BT */ + u8 reserved; }; struct starfive_eeprom_atom4 { @@ -176,7 +177,7 @@ static void show_eeprom(void) printf("Vendor : %s\n", pbuf.eeprom.atom1.data.vstr); printf("Product full SN: %s\n", pbuf.eeprom.atom1.data.pstr); printf("data version: 0x%x\n", pbuf.eeprom.atom4.data.version); - if (pbuf.eeprom.atom4.data.version == 2) { + if (pbuf.eeprom.atom4.data.version == 2 || pbuf.eeprom.atom4.data.version == 3) { printf("PCB revision: 0x%x\n", pbuf.eeprom.atom4.data.pcb_revision); printf("BOM revision: %c\n", pbuf.eeprom.atom4.data.bom_revision); printf("Ethernet MAC0 address: %02x:%02x:%02x:%02x:%02x:%02x\n", @@ -187,6 +188,14 @@ static void show_eeprom(void) pbuf.eeprom.atom4.data.mac1_addr[0], pbuf.eeprom.atom4.data.mac1_addr[1], pbuf.eeprom.atom4.data.mac1_addr[2], pbuf.eeprom.atom4.data.mac1_addr[3], pbuf.eeprom.atom4.data.mac1_addr[4], pbuf.eeprom.atom4.data.mac1_addr[5]); + if (pbuf.eeprom.atom4.data.version == 3) { + char str[25] = "Onboard module: "; + + if (pbuf.eeprom.atom4.data.onboard_module & BIT(0)) + strcat(str, "WIFI/BT"); + + printf("%s\n", str); + } } else { printf("Custom data v%d is not Supported\n", pbuf.eeprom.atom4.data.version); dump_raw_eeprom(); @@ -260,6 +269,7 @@ static void init_local_copy(void) pbuf.eeprom.atom4.data.bom_revision = BOM_VERSION; set_mac_address(STARFIVE_DEFAULT_MAC0, 0); set_mac_address(STARFIVE_DEFAULT_MAC1, 1); + pbuf.eeprom.atom4.data.onboard_module = 0; } /** @@ -385,6 +395,23 @@ static void set_bom_revision(char *string) update_crc(); } +/** + * set_onboard_module() - stores a StarFive onboard module flag into the local EEPROM copy + * + * Takes a pointer to a string representing the numeric onboard module flag in + * Hexadecimal ("0" - "FF"), stores it in the onboard_module field of the + * EEPROM local copy, and updates the CRC of the local copy. + */ +static void set_onboard_module(char *string) +{ + u8 onboard_module; + + onboard_module = simple_strtoul(string, &string, 16); + pbuf.eeprom.atom4.data.onboard_module = onboard_module; + + update_crc(); +} + /** * set_product_id() - stores a StarFive product ID into the local EEPROM copy * @@ -478,6 +505,9 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } else if (!strcmp(cmd, "bom_revision")) { set_bom_revision(argv[2]); return 0; + } else if (!strcmp(cmd, "onboard_module")) { + set_onboard_module(argv[2]); + return 0; } else if (!strcmp(cmd, "product_id")) { set_product_id(argv[2]); return 0; @@ -585,6 +615,8 @@ U_BOOT_LONGHELP(mac, " - stores a StarFive PCB revision into the local EEPROM copy\n" "mac bom_revision \n" " - stores a StarFive BOM revision into the local EEPROM copy\n" + "mac onboard_module \n" + " - stores a StarFive onboard module flag into the local EEPROM copy\n" "mac product_id \n" " - stores a StarFive product ID into the local EEPROM copy\n" "mac vendor \n" -- cgit v1.2.3 From a10587939bcc7d9325dbe24cde335a65887f9377 Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Fri, 24 Oct 2025 16:59:29 +0800 Subject: pcie: starfive: Add a optional power gpio support Get and enable a optional power gpio. This feature is ported from the jh7110 pcie driver in Linux. VisionFive 2 Lite needs this gpio to enable the PCI bus device (M.2 M-Key) power. Signed-off-by: Hal Feng --- drivers/pci/pcie_starfive_jh7110.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/pcie_starfive_jh7110.c b/drivers/pci/pcie_starfive_jh7110.c index 761e64be58a..88a2bf84538 100644 --- a/drivers/pci/pcie_starfive_jh7110.c +++ b/drivers/pci/pcie_starfive_jh7110.c @@ -42,6 +42,7 @@ struct starfive_pcie { struct pcie_plda plda; struct clk_bulk clks; struct reset_ctl_bulk rsts; + struct gpio_desc power_gpio; struct gpio_desc reset_gpio; struct regmap *regmap; unsigned int stg_pcie_base; @@ -181,6 +182,10 @@ static int starfive_pcie_parse_dt(struct udevice *dev) dev_err(dev, "reset-gpio is not valid\n"); return -EINVAL; } + + gpio_request_by_name(dev, "enable-gpios", 0, &priv->power_gpio, + GPIOD_IS_OUT); + return 0; } @@ -202,6 +207,9 @@ static int starfive_pcie_init_port(struct udevice *dev) goto err_deassert_clk; } + if (dm_gpio_is_valid(&priv->power_gpio)) + dm_gpio_set_value(&priv->power_gpio, 1); + dm_gpio_set_value(&priv->reset_gpio, 1); /* Disable physical functions except #0 */ for (i = 1; i < PLDA_FUNC_NUM; i++) { -- cgit v1.2.3 From 3e9ee92d7f4485f6173eab9ba70ee3a657b3ab66 Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Fri, 24 Oct 2025 16:59:30 +0800 Subject: configs: visionfive2: Add VisionFive 2 Lite DT to OF_LIST So the VisionFive 2 Lite DT will be built and merged into FIT. Reviewed-by: E Shattow Signed-off-by: Hal Feng --- 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 a754134a313..4a21a8e2949 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -80,7 +80,7 @@ CONFIG_WGET_HTTPS=y CONFIG_CMD_BOOTSTAGE=y CONFIG_OF_BOARD=y CONFIG_DEVICE_TREE_INCLUDES="starfive-visionfive2-u-boot.dtsi" -CONFIG_OF_LIST="starfive/jh7110-deepcomputing-fml13v01 starfive/jh7110-milkv-mars starfive/jh7110-milkv-marscm-emmc starfive/jh7110-milkv-marscm-lite 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-milkv-marscm-emmc starfive/jh7110-milkv-marscm-lite starfive/jh7110-pine64-star64 starfive/jh7110-starfive-visionfive-2-v1.2a starfive/jh7110-starfive-visionfive-2-v1.3b starfive/jh7110-starfive-visionfive-2-lite" CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y -- cgit v1.2.3 From f566788ca12ae5070513fbd5bcea2e18433b4da6 Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Fri, 24 Oct 2025 16:59:31 +0800 Subject: board: starfive: spl: Support VisionFive 2 Lite Choose the matching FIT config on the VisionFive 2 Lite board. Reviewed-by: E Shattow Signed-off-by: Hal Feng --- board/starfive/visionfive2/spl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index 2d9431d2976..c607627e10f 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -140,6 +140,9 @@ int board_fit_config_name_match(const char *name) } else if (!strcmp(name, "starfive/jh7110-starfive-visionfive-2-v1.3b") && !strncmp(get_product_id_from_eeprom(), "VF7110B", 7)) { return 0; + } else if (!strcmp(name, "starfive/jh7110-starfive-visionfive-2-lite") && + !strncmp(get_product_id_from_eeprom(), "VF7110SL", 8)) { + return 0; } return -EINVAL; -- cgit v1.2.3 From 52c382798c552143f04c8a9d6d491f2063491472 Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Fri, 24 Oct 2025 16:59:32 +0800 Subject: board: starfive: visionfive2: Add VisionFive 2 Lite fdt selection Set $fdtfile to the VisionFive 2 Lite DTB if the board is matched. Reviewed-by: E Shattow Signed-off-by: Hal Feng --- board/starfive/visionfive2/starfive_visionfive2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index 6c39fd4af35..ff510a57df5 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -69,6 +69,8 @@ static void set_fdtfile(void) fdtfile = "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"; } else if (!strncmp(get_product_id_from_eeprom(), "VF7110B", 7)) { fdtfile = "starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"; + } else if (!strncmp(get_product_id_from_eeprom(), "VF7110SL", 8)) { + fdtfile = "starfive/jh7110-starfive-visionfive-2-lite.dtb"; } else { log_err("Unknown product\n"); return; -- cgit v1.2.3 From b2c92a7b1fdfdf918abcbf63891b502e4200560a Mon Sep 17 00:00:00 2001 From: E Shattow Date: Thu, 5 Mar 2026 09:00:20 -0800 Subject: board: starfive: visionfive2: Add Orange Pi RV selection by product_id Add XOPIRV identifier for Orange Pi RV to dts selection callback in SPL, and to fdtfile environment variable default value selection in payload. Signed-off-by: E Shattow Reviewed-by: Hal Feng Reviewed-by: Leo Yu-Chi Liang --- board/starfive/visionfive2/spl.c | 3 +++ board/starfive/visionfive2/starfive_visionfive2.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index c607627e10f..e231467f2a1 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -131,6 +131,9 @@ int board_fit_config_name_match(const char *name) !strncmp(get_product_id_from_eeprom(), "MARC", 4) && !get_mmc_size_from_eeprom()) { return 0; + } else if (!strcmp(name, "starfive/jh7110-orangepi-rv") && + !strncmp(get_product_id_from_eeprom(), "XOPIRV", 6)) { + return 0; } else if (!strcmp(name, "starfive/jh7110-pine64-star64") && !strncmp(get_product_id_from_eeprom(), "STAR64", 6)) { return 0; diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index ff510a57df5..1a76f745ec8 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -63,6 +63,8 @@ static void set_fdtfile(void) } else { fdtfile = "starfive/jh7110-milkv-marscm-lite.dtb"; } + } else if (!strncmp(get_product_id_from_eeprom(), "XOPIRV", 6)) { + fdtfile = "starfive/jh7110-orangepi-rv.dtb"; } else if (!strncmp(get_product_id_from_eeprom(), "STAR64", 6)) { fdtfile = "starfive/jh7110-pine64-star64.dtb"; } else if (!strncmp(get_product_id_from_eeprom(), "VF7110A", 7)) { -- cgit v1.2.3 From 473c1a766921faa4d19ceaad46f73a821c558ee5 Mon Sep 17 00:00:00 2001 From: E Shattow Date: Thu, 5 Mar 2026 09:00:21 -0800 Subject: configs: starfive: Add Orange Pi RV to visionfive2 Add Orange Pi RV to visionfive2 CONFIG_OF_LIST Signed-off-by: E Shattow Reviewed-by: Hal Feng Reviewed-by: Leo Yu-Chi Liang --- 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 4a21a8e2949..74a24dfd074 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -80,7 +80,7 @@ CONFIG_WGET_HTTPS=y CONFIG_CMD_BOOTSTAGE=y CONFIG_OF_BOARD=y CONFIG_DEVICE_TREE_INCLUDES="starfive-visionfive2-u-boot.dtsi" -CONFIG_OF_LIST="starfive/jh7110-deepcomputing-fml13v01 starfive/jh7110-milkv-mars starfive/jh7110-milkv-marscm-emmc starfive/jh7110-milkv-marscm-lite starfive/jh7110-pine64-star64 starfive/jh7110-starfive-visionfive-2-v1.2a starfive/jh7110-starfive-visionfive-2-v1.3b starfive/jh7110-starfive-visionfive-2-lite" +CONFIG_OF_LIST="starfive/jh7110-deepcomputing-fml13v01 starfive/jh7110-milkv-mars starfive/jh7110-milkv-marscm-emmc starfive/jh7110-milkv-marscm-lite starfive/jh7110-orangepi-rv starfive/jh7110-pine64-star64 starfive/jh7110-starfive-visionfive-2-v1.2a starfive/jh7110-starfive-visionfive-2-v1.3b starfive/jh7110-starfive-visionfive-2-lite" CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y -- cgit v1.2.3 From 3ff56c603a660bd14d70f5109071b3c2605539d7 Mon Sep 17 00:00:00 2001 From: E Shattow Date: Thu, 5 Mar 2026 09:00:22 -0800 Subject: doc: board: starfive: Add Xunlong OrangePi RV OrangePi RV is a board that uses the same EEPROM product serial identifier as the StarFive VisionFive 2 1.3b. In fact it is not completely compatible with the StarFive VisionFive 2 1.3b for use with Linux Kernel however it is good enough for use with U-Boot SPL and U-Boot Main. Describe how to set the devicetree search path and, for advanced users, suggest that it is possible to update the EEPROM data with an invented "XOPIRV" identifier for automatic board detection. Signed-off-by: E Shattow Reviewed-by: Leo Yu-Chi Liang --- doc/board/starfive/index.rst | 1 + doc/board/starfive/orangepi_rv.rst | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 doc/board/starfive/orangepi_rv.rst diff --git a/doc/board/starfive/index.rst b/doc/board/starfive/index.rst index f85d7376b44..0996e0a68aa 100644 --- a/doc/board/starfive/index.rst +++ b/doc/board/starfive/index.rst @@ -10,5 +10,6 @@ StarFive milk-v_mars milkv_marscm_emmc milkv_marscm_lite + orangepi_rv pine64_star64 visionfive2 diff --git a/doc/board/starfive/orangepi_rv.rst b/doc/board/starfive/orangepi_rv.rst new file mode 100644 index 00000000000..29cc58a1e2b --- /dev/null +++ b/doc/board/starfive/orangepi_rv.rst @@ -0,0 +1,35 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Xunlong OrangePi RV +=================== + +U-Boot for the OrangePi RV uses the same U-Boot binaries as the VisionFive 2 +board. In U-Boot SPL the actual board is detected as a VisionFive2 1.3b due to +a manufacturer problem and having the same EEPROM data as VisionFive2 1.3b. + +Device-tree selection +--------------------- + +U-Boot will set variable $fdtfile to starfive/jh7110-starfive-visionfive-2-v1.3b.dtb + +This is sufficient for U-Boot however fails to work correctly with the Linux Kernel. + +To overrule this selection the variable can be set manually and saved in the +environment + +:: + + env set fdtfile starfive/jh7110-orangepi-rv.dtb + env save + +EEPROM modification +------------------- + +For advanced users and developers an EEPROM identifier product serial number +beginning with "XOPIRV" will match the OrangePi RV and automatically set the +correct device-tree at U-Boot SPL phase. The procedure for writing EEPROM data +is not detailed here however is similar to that of the Pine64 Star64 and Milk-V +Mars CM. The write-protect disable pads on the Orange Pi RV circuit board +bottom are labeled WP and GND near the M.2 connector. + +.. include:: jh7110_common.rst -- cgit v1.2.3 From 24662f698f5ad6f444e6dc437c0b5a932726a6ef Mon Sep 17 00:00:00 2001 From: E Shattow Date: Thu, 5 Mar 2026 12:56:40 -0800 Subject: doc: board: starfive: jh7110 common give build output dir by env not arg Describe build with output directory as O= environment variable and not unrelated -O command line argument. Fixes: 8304f3226700 ("doc: board: starfive: update jh7110 common description") Signed-off-by: E Shattow Reviewed-by: Leo Yu-Chi Liang --- doc/board/starfive/jh7110_common.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/board/starfive/jh7110_common.rst b/doc/board/starfive/jh7110_common.rst index 77102fcc189..b0b60da0dc3 100644 --- a/doc/board/starfive/jh7110_common.rst +++ b/doc/board/starfive/jh7110_common.rst @@ -162,8 +162,8 @@ Build U-Boot git -C opensbi.git checkout v1.7 # always clean build directory when building OpenSBI due to incomplete # dependency tracking - make -C opensbi.git -O opensbi clean - make -C opensbi.git -O opensbi PLATFORM=generic + make -C opensbi.git O=opensbi clean + make -C opensbi.git O=opensbi PLATFORM=generic 4. Now build the First Stage BootLoader (U-Boot Secondary Program Loader) and Second Boot Loader (OpenSBI + U-Boot Main): @@ -171,9 +171,9 @@ Build U-Boot .. code-block:: console git clone https://source.denx.de/u-boot/u-boot.git u-boot.git - make -C u-boot.git -O u-boot starfive_visionfive2_defconfig + make -C u-boot.git O=u-boot starfive_visionfive2_defconfig export OPENSBI=opensbi/build/platform/generic/firmware/fw_dynamic.bin - make -C u-boot.git -O u-boot + make -C u-boot.git O=u-boot This will generate the U-Boot SPL image object post-processed with StarFive SPL headers (u-boot/spl/u-boot-spl.bin.normal.out) as well as the FIT image @@ -191,7 +191,7 @@ Build U-Boot --set-val SPL_DEBUG_UART_BASE 0x10000000 \ --set-val DEBUG_UART_SHIFT 2 - make -C u-boot.git -O u-boot olddefconfig + make -C u-boot.git O=u-boot olddefconfig Boot description ---------------- -- cgit v1.2.3 From 1edeb52086c6e160d93d86386505e6cc6ce1457c Mon Sep 17 00:00:00 2001 From: E Shattow Date: Thu, 5 Mar 2026 13:49:14 -0800 Subject: doc: board: starfive: jh7110 common update OPENSBI build env reference Describe build with OpenSBI fw_dynamic.bin path as OPENSBI= on the same line instead of as an export. Also remedy a typo which had the wrong directory path before the filename. Fixes: 8304f3226700 ("doc: board: starfive: update jh7110 common description") Signed-off-by: E Shattow Reviewed-by: Leo Yu-Chi Liang --- doc/board/starfive/jh7110_common.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/board/starfive/jh7110_common.rst b/doc/board/starfive/jh7110_common.rst index b0b60da0dc3..e9c0ed5b022 100644 --- a/doc/board/starfive/jh7110_common.rst +++ b/doc/board/starfive/jh7110_common.rst @@ -172,8 +172,7 @@ Build U-Boot git clone https://source.denx.de/u-boot/u-boot.git u-boot.git make -C u-boot.git O=u-boot starfive_visionfive2_defconfig - export OPENSBI=opensbi/build/platform/generic/firmware/fw_dynamic.bin - make -C u-boot.git O=u-boot + make -C u-boot.git O=u-boot OPENSBI=opensbi/platform/generic/firmware/fw_dynamic.bin This will generate the U-Boot SPL image object post-processed with StarFive SPL headers (u-boot/spl/u-boot-spl.bin.normal.out) as well as the FIT image -- cgit v1.2.3 From b51e59c8b34c780e28728bc0cb58783855c7ffbf Mon Sep 17 00:00:00 2001 From: Jamie Gibbons Date: Fri, 16 Jan 2026 14:08:30 +0000 Subject: riscv: Add support for BeagleV-Fire Bring U-Boot support for the BeagleV-Fire by adding a device tree and supporting board files etc. Signed-off-by: Jamie Gibbons Reviewed-by: Leo Yu-Chi Liang --- arch/riscv/Kconfig | 4 ++ board/beagle/beaglev_fire/Kconfig | 43 ++++++++++++ board/beagle/beaglev_fire/MAINTAINERS | 7 ++ board/beagle/beaglev_fire/Makefile | 6 ++ board/beagle/beaglev_fire/beaglev_fire.c | 117 +++++++++++++++++++++++++++++++ configs/beaglev_fire_defconfig | 29 ++++++++ include/configs/beaglev_fire.h | 57 +++++++++++++++ 7 files changed, 263 insertions(+) create mode 100644 board/beagle/beaglev_fire/Kconfig create mode 100644 board/beagle/beaglev_fire/MAINTAINERS create mode 100644 board/beagle/beaglev_fire/Makefile create mode 100644 board/beagle/beaglev_fire/beaglev_fire.c create mode 100644 configs/beaglev_fire_defconfig create mode 100644 include/configs/beaglev_fire.h diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 79867656b15..ad7589123c6 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -17,6 +17,9 @@ config TARGET_ANDES_VOYAGER config TARGET_BANANAPI_F3 bool "Support BananaPi F3 Board" +config TARGET_BEAGLEBOARD_BEAGLEVFIRE + bool "Support BeagleBoard BeagleV-Fire Board (based on Microchip MPFS)" + config TARGET_K230_CANMV bool "Support K230 CanMV Board" @@ -106,6 +109,7 @@ config SPL_ZERO_MEM_BEFORE_USE source "board/andestech/ae350/Kconfig" source "board/andestech/voyager/Kconfig" source "board/aspeed/ibex_ast2700/Kconfig" +source "board/beagle/beaglev_fire/Kconfig" source "board/canaan/k230_canmv/Kconfig" source "board/emulation/qemu-riscv/Kconfig" source "board/microchip/mpfs_generic/Kconfig" diff --git a/board/beagle/beaglev_fire/Kconfig b/board/beagle/beaglev_fire/Kconfig new file mode 100644 index 00000000000..7a8ecac8703 --- /dev/null +++ b/board/beagle/beaglev_fire/Kconfig @@ -0,0 +1,43 @@ +if TARGET_BEAGLEBOARD_BEAGLEVFIRE + +config SYS_BOARD + default "beaglev_fire" + +config SYS_VENDOR + default "beagle" + +config SYS_CPU + default "mpfs" + +config SYS_CONFIG_NAME + default "beaglev_fire" + +config TEXT_BASE + default 0x80000000 if !RISCV_SMODE + default 0x80200000 if RISCV_SMODE + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + select MICROCHIP_MPFS + select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT + imply SMP + imply CMD_DHCP + imply CMD_EXT2 + imply CMD_EXT4 + imply CMD_FAT + imply CMD_FS_GENERIC + imply CMD_NET + imply CMD_PING + imply CMD_MMC + imply DOS_PARTITION + imply EFI_PARTITION + imply IP_DYN + imply ISO_PARTITION + imply PHY_LIB + imply PHY_VITESSE + imply DM_MAILBOX + imply MPFS_MBOX + imply MISC + imply MPFS_SYSCONTROLLER +endif diff --git a/board/beagle/beaglev_fire/MAINTAINERS b/board/beagle/beaglev_fire/MAINTAINERS new file mode 100644 index 00000000000..a5dad93ee99 --- /dev/null +++ b/board/beagle/beaglev_fire/MAINTAINERS @@ -0,0 +1,7 @@ +BeagleBoard MPFS BeagleV-Fire +M: Cyril Jean +M: Jamie Gibbons +S: Maintained +F: board/beagle/beaglev_fire/ +F: include/configs/beaglev_fire.h +F: configs/beaglev_fire_defconfig \ No newline at end of file diff --git a/board/beagle/beaglev_fire/Makefile b/board/beagle/beaglev_fire/Makefile new file mode 100644 index 00000000000..a4109a8aad4 --- /dev/null +++ b/board/beagle/beaglev_fire/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2023 Microchip Technology Inc. +# + +obj-y += beaglev_fire.o \ No newline at end of file diff --git a/board/beagle/beaglev_fire/beaglev_fire.c b/board/beagle/beaglev_fire/beaglev_fire.c new file mode 100644 index 00000000000..b2f18c455b7 --- /dev/null +++ b/board/beagle/beaglev_fire/beaglev_fire.c @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019-2023 Microchip Technology Inc. + */ + +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define MPFS_SYSREG_SOFT_RESET ((unsigned int *)0x20002088) +#define PERIPH_RESET_VALUE 0x800001e8u + +#if IS_ENABLED(CONFIG_MPFS_SYSCONTROLLER) +static unsigned char mac_addr[6]; +#endif + +int board_init(void) +{ + /* For now nothing to do here. */ + + return 0; +} + +int board_early_init_f(void) +{ + unsigned int val; + + /* Reset uart, mmc peripheral */ + val = readl(MPFS_SYSREG_SOFT_RESET); + val = (val & ~(PERIPH_RESET_VALUE)); + writel(val, MPFS_SYSREG_SOFT_RESET); + + return 0; +} + +int board_late_init(void) +{ +#if IS_ENABLED(CONFIG_MPFS_SYSCONTROLLER) + u32 ret; + int node; + u8 device_serial_number[16] = {0}; + void *blob = (void *)gd->fdt_blob; + struct udevice *dev; + struct mpfs_sys_serv *sys_serv_priv; + + ret = uclass_get_device_by_name(UCLASS_MISC, "syscontroller", &dev); + if (ret) { + debug("%s: system controller setup failed\n", __func__); + return ret; + } + + sys_serv_priv = devm_kzalloc(dev, sizeof(*sys_serv_priv), GFP_KERNEL); + if (!sys_serv_priv) + return -ENOMEM; + + sys_serv_priv->dev = dev; + + sys_serv_priv->sys_controller = mpfs_syscontroller_get(dev); + ret = IS_ERR(sys_serv_priv->sys_controller); + if (ret) { + debug("%s: Failed to register system controller sub device ret=%d\n", __func__, ret); + return -ENODEV; + } + + ret = mpfs_syscontroller_read_sernum(sys_serv_priv, device_serial_number); + if (ret) { + printf("Cannot read device serial number\n"); + return -EINVAL; + } + + /* Update MAC address with device serial number */ + mac_addr[0] = 0x00; + mac_addr[1] = 0x04; + mac_addr[2] = 0xA3; + mac_addr[3] = device_serial_number[2]; + mac_addr[4] = device_serial_number[1]; + mac_addr[5] = device_serial_number[0]; + + node = fdt_path_offset(blob, "/soc/ethernet@20110000"); + if (node >= 0) { + ret = fdt_setprop(blob, node, "local-mac-address", mac_addr, 6); + if (ret) { + printf("Error setting local-mac-address property for ethernet@20110000\n"); + return -ENODEV; + } + } + + mpfs_syscontroller_process_dtbo(sys_serv_priv); +#endif + + return 0; +} + +int ft_board_setup(void *blob, struct bd_info *bd) +{ +#if IS_ENABLED(CONFIG_MPFS_SYSCONTROLLER) + u32 ret; + int node; + + node = fdt_path_offset(blob, "/soc/ethernet@20110000"); + if (node >= 0) { + ret = fdt_setprop(blob, node, "local-mac-address", mac_addr, 6); + if (ret) { + printf("Error setting local-mac-address property for ethernet@20110000\n"); + return -ENODEV; + } + } +#endif + + return 0; +} \ No newline at end of file diff --git a/configs/beaglev_fire_defconfig b/configs/beaglev_fire_defconfig new file mode 100644 index 00000000000..9ebb08abbfe --- /dev/null +++ b/configs/beaglev_fire_defconfig @@ -0,0 +1,29 @@ +CONFIG_RISCV=y +CONFIG_SYS_MALLOC_LEN=0x800000 +CONFIG_SYS_MALLOC_F_LEN=0x2800 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000 +CONFIG_ENV_SIZE=0x2000 +CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="microchip/mpfs-beaglev-fire" +CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_SYS_BOOTM_LEN=0x4000000 +CONFIG_SYS_LOAD_ADDR=0x80200000 +CONFIG_TARGET_BEAGLEBOARD_BEAGLEVFIRE=y +CONFIG_ARCH_RV64I=y +CONFIG_RISCV_SMODE=y +CONFIG_FIT=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_OF_BOARD_SETUP=y +CONFIG_DEFAULT_FDT_FILE="microchip/mpfs-beaglev-fire.dtb" +CONFIG_SYS_CBSIZE=256 +CONFIG_SYS_PBSIZE=282 +CONFIG_DISPLAY_CPUINFO=y +CONFIG_DISPLAY_BOARDINFO=y +CONFIG_SYS_PROMPT="RISC-V # " +CONFIG_CMD_GPIO=y +CONFIG_OF_UPSTREAM=y +CONFIG_BOOTP_SEND_HOSTNAME=y +CONFIG_MPFS_GPIO=y +CONFIG_MMC_SPI=y +CONFIG_SYSRESET=y diff --git a/include/configs/beaglev_fire.h b/include/configs/beaglev_fire.h new file mode 100644 index 00000000000..e3ee0f02f2d --- /dev/null +++ b/include/configs/beaglev_fire.h @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2023 Microchip Technology Inc. + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include + +#define CFG_SYS_SDRAM_BASE 0x80000000 + +/* Environment options */ + +#if defined(CONFIG_CMD_DHCP) +#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na) +#else +#define BOOT_TARGET_DEVICES_DHCP(func) +#endif + +#if defined(CONFIG_CMD_MMC) +#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) +#else +#define BOOT_TARGET_DEVICES_MMC(func) +#endif + +#define BOOT_TARGET_DEVICES(func) \ + BOOT_TARGET_DEVICES_MMC(func)\ + BOOT_TARGET_DEVICES_DHCP(func) + +#define BOOTENV_DESIGN_OVERLAYS \ + "design_overlays=" \ + "if test -n ${no_of_overlays}; then " \ + "setenv inc 1; " \ + "setenv idx 0; " \ + "fdt resize ${dtbo_size}; " \ + "while test $idx -ne ${no_of_overlays}; do " \ + "setenv dtbo_name dtbo_image${idx}; " \ + "setenv fdt_cmd \"fdt apply $\"$dtbo_name; " \ + "run fdt_cmd; " \ + "setexpr idx $inc + $idx; " \ + "done; " \ + "fi;\0 " \ + +#include + +#define CFG_EXTRA_ENV_SETTINGS \ + "bootm_size=0x10000000\0" \ + "kernel_addr_r=0x80200000\0" \ + "fdt_addr_r=0x8a000000\0" \ + "fdtoverlay_addr_r=0x8a080000\0" \ + "ramdisk_addr_r=0x8aa00000\0" \ + "scriptaddr=0x8e000000\0" \ + BOOTENV_DESIGN_OVERLAYS \ + BOOTENV \ + +#endif /* __CONFIG_H */ -- cgit v1.2.3