riscv: Add support for BeagleV-Fire
PATCH 1/1 riscv: Add support for BeagleV-Fire
Bring U-Boot support for the BeagleV-Fire by adding a defconfig and supporting board files etc.
--- 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
arch/riscv/Kconfig +4 -0
@@ -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"
board/beagle/beaglev_fire/Kconfig new file +39 -0
@@ -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
board/beagle/beaglev_fire/MAINTAINERS new file +7 -0
@@ -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
board/beagle/beaglev_fire/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2023 Microchip Technology Inc. +# + +obj-y += beaglev_fire.o
board/beagle/beaglev_fire/beaglev_fire.c new file +117 -0
118 lines not on this page · raw message
configs/beaglev_fire_defconfig new file +29 -0
@@ -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
include/configs/beaglev_fire.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 263 lines · Jamie Gibbons
Bring U-Boot support for the BeagleV-Fire by adding a defconfig and supporting board files etc.
Signed-off-by Jamie Gibbons <[email protected]>--- 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.harch/riscv/Kconfig +4
-0@@ -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"board/beagle/beaglev_fire/Kconfig new file +39
-0@@ -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 +endifboard/beagle/beaglev_fire/MAINTAINERS new file +7
-0@@ -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_defconfigboard/beagle/beaglev_fire/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2023 Microchip Technology Inc. +# + +obj-y += beaglev_fire.oboard/beagle/beaglev_fire/beaglev_fire.c new file +117
-0@@ -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 ; +}configs/beaglev_fire_defconfig new file +19
-0@@ -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
configs/beaglev_fire_defconfig line 29
Quoted 10 lines
configs/beaglev_fire_defconfig new file +10
-0+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
I think you are missing CONFIG_OF_UPSTREAM=y. I applied this on top of next and only got things compiling after turning it manually on.
Quoted 53 lines
include/configs/beaglev_fire.h new file +47
-0@@ -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 \
include/configs/beaglev_fire.h line 57
Quoted 10 lines
include/configs/beaglev_fire.h new file +10
-0+"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 */
No luck with booting next(29ab19c2bead)+this yet, though. No output after
[9.356454] Boot image set name: "PolarFire-SoC-HSS::U-Boot"
Am I missing dependencies?
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center
Quoted 269 lines · Jan Kiszka
Quoted 268 lines · Jamie Gibbons
Bring U-Boot support for the BeagleV-Fire by adding a defconfig and supporting board files etc.
Signed-off-by Jamie Gibbons <[email protected]>--- 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.harch/riscv/Kconfig +4
-0@@ -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"board/beagle/beaglev_fire/Kconfig new file +39
-0@@ -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 +endifboard/beagle/beaglev_fire/MAINTAINERS new file +7
-0@@ -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_defconfigboard/beagle/beaglev_fire/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2023 Microchip Technology Inc. +# + +obj-y += beaglev_fire.oboard/beagle/beaglev_fire/beaglev_fire.c new file +117
-0@@ -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 ; +}configs/beaglev_fire_defconfig new file +24
-0@@ -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
Quoted 9 lines
configs/beaglev_fire_defconfig line 29
Quoted 5 lines
configs/beaglev_fire_defconfig new file +5
-0+CONFIG_SYSRESET=y +CONFIG_MPFS_GPIO=y +CONFIG_CMD_GPIO=y +CONFIG_DM_GPIO=y +CONFIG_MMC_SPI=yI think you are missing
CONFIG_OF_UPSTREAM=y. I applied this on top of next and only got things compiling after turning it manually on.
And another issue: CONFIG_DEFAULT_FDT_FILE is missing, leaving fdtfile uninitialized which means that distro_boot is incomplete.
Quoted 66 lines
Quoted 53 lines
include/configs/beaglev_fire.h new file +47
-0@@ -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 \include/configs/beaglev_fire.h line 57
Quoted 10 lines
include/configs/beaglev_fire.h new file +10
-0+"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 */ No luck with booting next(29ab19c2bead)+this yet, though. No output after
Quoted 2 lines
[9.356454] Boot image set name: "PolarFire-SoC-HSS::U-Boot"
This is probably some regression when using u-boot next.
Quoted 2 lines
Am I missing dependencies?
I have now this queue on top of v2026.01-rc5:
riscv: Add support for BeagleV-Fire
riscv: mpfs: move SoC level options to the CPU Kconfig
riscv: create a custom CPU implementation for PolarFire SoC
With this (and the config fixes above), upstream U-Boot finally starts. Also UEFI is working while it is broken with downstream linux4microchip+fpga-2025.10 which caused a lot of confusion to me regarding the upstream kernel status of the PolarFire.
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center
Hi Jan,
Apologies for the delayed response, I was off over the Christmas. Thank you for your thorough review and for testing the patch on top of U-Boot next.
Quoted 301 lines · Jan Kiszka
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Quoted 287 lines · Jan Kiszka
Quoted 286 lines · Jamie Gibbons
Bring U-Boot support for the BeagleV-Fire by adding a defconfig and
supporting board files etc.Signed-off-by Jamie Gibbons <[email protected]>---
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.ccreate mode 100644 configs/beaglev_fire_defconfig create mode 100644include/configs/beaglev_fire.harch/riscv/Kconfig +0
-0@@ -17,6 +17,9 @@ config TARGET_ANDES_VOYAGERconfig
TARGET_BANANAPI_F3
bool "Support BananaPi F3 Board"+config
TARGET_BEAGLEBOARD_BEAGLEVFIRE
+ bool "Support BeagleBoard BeagleV-Fire Board (based on Microchip MPFS)"
+
configTARGET_K230_CANMV
bool "Support K230 CanMV Board"arch/riscv/Kconfig +0
-0@@ -106,6 +109,7 @@ config SPL_ZERO_MEM_BEFORE_USEsource "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"board/beagle/beaglev_fire/Kconfig new file +39
-0@@ -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 +endifboard/beagle/beaglev_fire/MAINTAINERS new file +7
-0@@ -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_defconfigboard/beagle/beaglev_fire/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2023 Microchip Technology Inc. +# + +obj-y += beaglev_fire.oboard/beagle/beaglev_fire/beaglev_fire.c new file +52
-0@@ -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;board/beagle/beaglev_fire/beaglev_fire.c new file +7
-0+ + 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 subdevice 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;
+ }board/beagle/beaglev_fire/beaglev_fire.c new file +12
-0+ + /* 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;
+ }
+ }board/beagle/beaglev_fire/beaglev_fire.c new file +16
-0+ + 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;
+ }
+ }board/beagle/beaglev_fire/beaglev_fire.c new file +4
-0+#endif + + return 0; +}configs/beaglev_fire_defconfig new file +25
-0@@ -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=yQuoted 9 lines
configs/beaglev_fire_defconfig line 29
Quoted 4 lines
configs/beaglev_fire_defconfig new file +4
-0+CONFIG_MPFS_GPIO=y +CONFIG_CMD_GPIO=y +CONFIG_DM_GPIO=y +CONFIG_MMC_SPI=yI think you are missing
CONFIG_OF_UPSTREAM=y. I applied this on top of
next and only got things compiling after turning it manually on.
Quoted 4 lines
And another issue:
CONFIG_DEFAULT_FDT_FILEis missing, leaving fdtfile
uninitialized which means thatdistro_bootis incomplete.
You are correct, both of these configs are missing from the defconfig. I am not quite sure how I managed to miss those in creation of this patch, thanks for catching that.
Quoted 77 lines
Quoted 69 lines
Quoted 55 lines
include/configs/beaglev_fire.h new file +39
-0@@ -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; "\
+ "runfdt_cmd; " \
+ "setexpr idx $inc + $idx; " \
+ "done; " \
+ "fi;\0 " \include/configs/beaglev_fire.h new file +4
-0+ +#include <config_distro_bootcmd.h> + +#define CFG_EXTRA_ENV_SETTINGS \include/configs/beaglev_fire.h line 57
Quoted 10 lines
include/configs/beaglev_fire.h new file +10
-0+ "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 */ No luck with booting next(29ab19c2bead)+this yet, though. No output after
Quoted 2 lines
[9.356454] Boot image set name: "PolarFire-SoC-HSS::U-Boot"This is probably some regression when using u-boot next.
Quoted 2 lines
Am I missing dependencies?
Quoted 8 lines
I have now this queue on top of v2026.01-rc5:
riscv: Add support for BeagleV-Fire
riscv: mpfs: move SoC level options to the CPUKconfig
riscv: create a custom CPU implementation for PolarFire SoCWith this (and the config fixes above), upstream U-Boot finally starts.
Apologies, I got ahead of myself. When I sent this patch the above two patches I sent had not yet been merged. They are now both merged to next & master.
Thanks again for your feedback and for sharing your working queue. Should you need me to send a v2 to add the missing two configs or have any other issues please let me know, however, with the addition of the two configs, this should now be good to go.
Thanks again,
Jamie.
Quoted 13 lines
Apologies, I got ahead of myself. When I sent this patch the above two additional patches I sent had not yet been merged. They are now both merged to next & master.
Also UEFI is working while it is broken with downstream linux4microchip+fpga-2025.10 which caused a lot of confusion to me regarding the upstream kernel status of the PolarFire.
Jan
--
Siemens AG, Foundational Technologies
Linux Expert Center
Quoted 399 lines · On 06.01.26 12:55, [email protected] wrote:
Hi Jan,
Apologies for the delayed response, I was off over the Christmas. Thank you for your thorough review and for testing the patch on top of U-Boot next.
Quoted 301 lines · Jan Kiszka
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Quoted 287 lines · Jan Kiszka
Quoted 286 lines · Jamie Gibbons
Bring U-Boot support for the BeagleV-Fire by adding a defconfig and
supporting board files etc.Signed-off-by Jamie Gibbons <[email protected]>---
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.ccreate mode 100644 configs/beaglev_fire_defconfig create mode 100644include/configs/beaglev_fire.harch/riscv/Kconfig +0
-0@@ -17,6 +17,9 @@ config TARGET_ANDES_VOYAGERconfig
TARGET_BANANAPI_F3
bool "Support BananaPi F3 Board"+config
TARGET_BEAGLEBOARD_BEAGLEVFIRE
+ bool "Support BeagleBoard BeagleV-Fire Board (based on Microchip MPFS)"
+
configTARGET_K230_CANMV
bool "Support K230 CanMV Board"arch/riscv/Kconfig +0
-0@@ -106,6 +109,7 @@ config SPL_ZERO_MEM_BEFORE_USEsource "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"board/beagle/beaglev_fire/Kconfig new file +39
-0@@ -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 +endifboard/beagle/beaglev_fire/MAINTAINERS new file +7
-0@@ -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_defconfigboard/beagle/beaglev_fire/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2023 Microchip Technology Inc. +# + +obj-y += beaglev_fire.oboard/beagle/beaglev_fire/beaglev_fire.c new file +52
-0@@ -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;board/beagle/beaglev_fire/beaglev_fire.c new file +7
-0+ + 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 subdevice 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;
+ }board/beagle/beaglev_fire/beaglev_fire.c new file +12
-0+ + /* 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;
+ }
+ }board/beagle/beaglev_fire/beaglev_fire.c new file +16
-0+ + 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;
+ }
+ }board/beagle/beaglev_fire/beaglev_fire.c new file +4
-0+#endif + + return 0; +}configs/beaglev_fire_defconfig new file +25
-0@@ -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=yQuoted 9 lines
configs/beaglev_fire_defconfig line 29
Quoted 4 lines
configs/beaglev_fire_defconfig new file +4
-0+CONFIG_MPFS_GPIO=y +CONFIG_CMD_GPIO=y +CONFIG_DM_GPIO=y +CONFIG_MMC_SPI=yI think you are missing
CONFIG_OF_UPSTREAM=y. I applied this on top of
next and only got things compiling after turning it manually on.Quoted 4 lines
And another issue:
CONFIG_DEFAULT_FDT_FILEis missing, leaving fdtfile
uninitialized which means thatdistro_bootis incomplete.You are correct, both of these configs are missing from the defconfig. I am not quite sure how I managed to miss those in creation of this patch, thanks for catching that.
Quoted 77 lines
Quoted 69 lines
Quoted 55 lines
include/configs/beaglev_fire.h new file +39
-0@@ -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; "\
+ "runfdt_cmd; " \
+ "setexpr idx $inc + $idx; " \
+ "done; " \
+ "fi;\0 " \include/configs/beaglev_fire.h new file +4
-0+ +#include <config_distro_bootcmd.h> + +#define CFG_EXTRA_ENV_SETTINGS \include/configs/beaglev_fire.h line 57
Quoted 10 lines
include/configs/beaglev_fire.h new file +10
-0+ "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 */ No luck with booting next(29ab19c2bead)+this yet, though. No output after
Quoted 2 lines
[9.356454] Boot image set name: "PolarFire-SoC-HSS::U-Boot"This is probably some regression when using u-boot next.
Quoted 2 lines
Am I missing dependencies?
Quoted 8 lines
I have now this queue on top of v2026.01-rc5:
riscv: Add support for BeagleV-Fire
riscv: mpfs: move SoC level options to the CPUKconfig
riscv: create a custom CPU implementation for PolarFire SoCWith this (and the config fixes above), upstream U-Boot finally starts.
Quoted 8 lines
Apologies, I got ahead of myself. When I sent this patch the above two patches I sent had not yet been merged. They are now both merged to next & master.
Thanks again for your feedback and for sharing your working queue. Should you need me to send a v2 to add the missing two configs or have any other issues please let me know, however, with the addition of the two configs, this should now be good to go.
The 2 configs switches should go into the defconfig. So, if this patch is not yet queued (which seems to be so), I would recommend sending v2 with those included.
BTW, our CIP Debian image with all bits glued together is staged at [1]. U-Boot build is described in [2].
Thanks,
Jan
[1]
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/commits/wip/beaglev-fire?ref_type=heads
[2]
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/commit/c2522a186e52da32551d71d32cf5d5bd1a5077c3
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center