summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/riscv/Kconfig4
-rw-r--r--arch/riscv/cpu/jh7110/spl.c2
-rw-r--r--arch/riscv/include/asm/arch-jh7110/eeprom.h13
-rw-r--r--board/beagle/beaglev_fire/Kconfig43
-rw-r--r--board/beagle/beaglev_fire/MAINTAINERS7
-rw-r--r--board/beagle/beaglev_fire/Makefile6
-rw-r--r--board/beagle/beaglev_fire/beaglev_fire.c117
-rw-r--r--board/starfive/visionfive2/spl.c6
-rw-r--r--board/starfive/visionfive2/starfive_visionfive2.c4
-rw-r--r--board/starfive/visionfive2/visionfive2-i2c-eeprom.c64
-rw-r--r--configs/beaglev_fire_defconfig29
-rw-r--r--configs/starfive_visionfive2_defconfig2
-rw-r--r--doc/board/starfive/index.rst1
-rw-r--r--doc/board/starfive/jh7110_common.rst11
-rw-r--r--doc/board/starfive/orangepi_rv.rst35
-rw-r--r--drivers/pci/pcie_starfive_jh7110.c8
-rw-r--r--include/configs/beaglev_fire.h57
17 files changed, 375 insertions, 34 deletions
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/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..8b689a75013 100644
--- a/arch/riscv/include/asm/arch-jh7110/eeprom.h
+++ b/arch/riscv/include/asm/arch-jh7110/eeprom.h
@@ -9,8 +9,19 @@
#include <linux/types.h>
+/**
+ * get_pcb_revision_from_eeprom() - get the PCB revision
+ *
+ * @return: the PCB revision or 0 on error.
+ */
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/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 <[email protected]>
+M: Jamie Gibbons <[email protected]>
+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 <dm.h>
+#include <dm/devres.h>
+#include <env.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <linux/compat.h>
+#include <mpfs-mailbox.h>
+
+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/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c
index 2d9431d2976..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;
@@ -140,6 +143,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;
diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
index 6c39fd4af35..1a76f745ec8 100644
--- a/board/starfive/visionfive2/starfive_visionfive2.c
+++ b/board/starfive/visionfive2/starfive_visionfive2.c
@@ -63,12 +63,16 @@ 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)) {
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;
diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
index 17a44020bcf..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;
}
/**
@@ -386,6 +396,23 @@ static void set_bom_revision(char *string)
}
/**
+ * 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
*
* Takes a pointer to a string representing the numeric product ID in
@@ -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;
@@ -535,38 +565,20 @@ 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;
}
-/**
- * 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)
@@ -603,6 +615,8 @@ U_BOOT_LONGHELP(mac,
" - stores a StarFive PCB revision into the local EEPROM copy\n"
"mac bom_revision <A>\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 <VF7110A1-2228-D008E000-xxxxxxxx>\n"
" - stores a StarFive product ID into the local EEPROM copy\n"
"mac vendor <Vendor Name>\n"
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/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index a754134a313..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"
+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
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/jh7110_common.rst b/doc/board/starfive/jh7110_common.rst
index 77102fcc189..e9c0ed5b022 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,8 @@ 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
- 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 starfive_visionfive2_defconfig
+ 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
@@ -191,7 +190,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
----------------
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
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++) {
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 <linux/sizes.h>
+
+#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 <config_distro_bootcmd.h>
+
+#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 */