[PATCH] riscv: Add support for BeagleV-Fire
Jamie Gibbons
jamie.gibbons at microchip.com
Tue Dec 9 12:45:21 CET 2025
Bring U-Boot support for the BeagleV-Fire by adding a defconfig and
supporting board files etc.
Signed-off-by: Jamie Gibbons <jamie.gibbons at microchip.com>
---
arch/riscv/Kconfig | 4 +
board/beagle/beaglev_fire/Kconfig | 39 ++++++++
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, 259 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 265b5320777..dd98dee8eab 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..279d38b3aa9
--- /dev/null
+++ b/board/beagle/beaglev_fire/Kconfig
@@ -0,0 +1,39 @@
+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
+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 <cyril.jean at microchip.com>
+M: Jamie Gibbons <jamie.gibbons at microchip.com>
+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 at 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 at 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 at 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 at 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..c476fb103c5
--- /dev/null
+++ b/configs/beaglev_fire_defconfig
@@ -0,0 +1,29 @@
+CONFIG_RISCV=y
+CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="microchip/mpfs-beaglev-fire"
+CONFIG_SYS_PROMPT="RISC-V # "
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_SYS_LOAD_ADDR=0x80200000
+CONFIG_TARGET_BEAGLEBOARD_BEAGLEVFIRE=y
+CONFIG_ARCH_RV64I=y
+CONFIG_RISCV_SMODE=y
+CONFIG_FIT=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_DISPLAY_CPUINFO=y
+CONFIG_DISPLAY_BOARDINFO=y
+CONFIG_SYS_CBSIZE=256
+CONFIG_SYS_PBSIZE=282
+CONFIG_SYS_BOOTM_LEN=0x4000000
+CONFIG_OVERWRITE_ETHADDR_ONCE=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_BOOTP_SEND_HOSTNAME=y
+CONFIG_SYSRESET=y
+CONFIG_MPFS_GPIO=y
+CONFIG_CMD_GPIO=y
+CONFIG_DM_GPIO=y
+CONFIG_MMC_SPI=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 <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 */
--
2.43.0
More information about the U-Boot
mailing list