mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
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 <jamie.gibbons@microchip.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
This commit is contained in:
committed by
Leo Yu-Chi Liang
parent
1edeb52086
commit
b51e59c8b3
@@ -17,6 +17,9 @@ config TARGET_ANDES_VOYAGER
|
|||||||
config TARGET_BANANAPI_F3
|
config TARGET_BANANAPI_F3
|
||||||
bool "Support BananaPi F3 Board"
|
bool "Support BananaPi F3 Board"
|
||||||
|
|
||||||
|
config TARGET_BEAGLEBOARD_BEAGLEVFIRE
|
||||||
|
bool "Support BeagleBoard BeagleV-Fire Board (based on Microchip MPFS)"
|
||||||
|
|
||||||
config TARGET_K230_CANMV
|
config TARGET_K230_CANMV
|
||||||
bool "Support K230 CanMV Board"
|
bool "Support K230 CanMV Board"
|
||||||
|
|
||||||
@@ -106,6 +109,7 @@ config SPL_ZERO_MEM_BEFORE_USE
|
|||||||
source "board/andestech/ae350/Kconfig"
|
source "board/andestech/ae350/Kconfig"
|
||||||
source "board/andestech/voyager/Kconfig"
|
source "board/andestech/voyager/Kconfig"
|
||||||
source "board/aspeed/ibex_ast2700/Kconfig"
|
source "board/aspeed/ibex_ast2700/Kconfig"
|
||||||
|
source "board/beagle/beaglev_fire/Kconfig"
|
||||||
source "board/canaan/k230_canmv/Kconfig"
|
source "board/canaan/k230_canmv/Kconfig"
|
||||||
source "board/emulation/qemu-riscv/Kconfig"
|
source "board/emulation/qemu-riscv/Kconfig"
|
||||||
source "board/microchip/mpfs_generic/Kconfig"
|
source "board/microchip/mpfs_generic/Kconfig"
|
||||||
|
|||||||
43
board/beagle/beaglev_fire/Kconfig
Normal file
43
board/beagle/beaglev_fire/Kconfig
Normal file
@@ -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
|
||||||
7
board/beagle/beaglev_fire/MAINTAINERS
Normal file
7
board/beagle/beaglev_fire/MAINTAINERS
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
BeagleBoard MPFS BeagleV-Fire
|
||||||
|
M: Cyril Jean <cyril.jean@microchip.com>
|
||||||
|
M: Jamie Gibbons <jamie.gibbons@microchip.com>
|
||||||
|
S: Maintained
|
||||||
|
F: board/beagle/beaglev_fire/
|
||||||
|
F: include/configs/beaglev_fire.h
|
||||||
|
F: configs/beaglev_fire_defconfig
|
||||||
6
board/beagle/beaglev_fire/Makefile
Normal file
6
board/beagle/beaglev_fire/Makefile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0+
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 Microchip Technology Inc.
|
||||||
|
#
|
||||||
|
|
||||||
|
obj-y += beaglev_fire.o
|
||||||
117
board/beagle/beaglev_fire/beaglev_fire.c
Normal file
117
board/beagle/beaglev_fire/beaglev_fire.c
Normal file
@@ -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;
|
||||||
|
}
|
||||||
29
configs/beaglev_fire_defconfig
Normal file
29
configs/beaglev_fire_defconfig
Normal file
@@ -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
|
||||||
57
include/configs/beaglev_fire.h
Normal file
57
include/configs/beaglev_fire.h
Normal file
@@ -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 */
|
||||||
Reference in New Issue
Block a user