diff options
Diffstat (limited to 'board/xilinx')
-rw-r--r-- | board/xilinx/Kconfig | 1 | ||||
-rw-r--r-- | board/xilinx/common/board.c | 31 | ||||
-rw-r--r-- | board/xilinx/mbv/Kconfig | 14 | ||||
-rw-r--r-- | board/xilinx/mbv/board.c | 10 | ||||
-rw-r--r-- | board/xilinx/versal-net/board.c | 32 | ||||
-rw-r--r-- | board/xilinx/versal/board.c | 2 | ||||
-rw-r--r-- | board/xilinx/zynqmp/zynqmp.c | 62 | ||||
-rw-r--r-- | board/xilinx/zynqmp/zynqmp_kria.env | 4 |
8 files changed, 139 insertions, 17 deletions
diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig index 843198fa0da..5c4ad8f1df9 100644 --- a/board/xilinx/Kconfig +++ b/board/xilinx/Kconfig @@ -45,6 +45,7 @@ config XILINX_OF_BOARD_DTB_ADDR default 0x1000 if ARCH_VERSAL || ARCH_VERSAL_NET default 0x8000 if MICROBLAZE default 0x100000 if ARCH_ZYNQ || ARCH_ZYNQMP + default 0x23000000 if TARGET_XILINX_MBV depends on OF_BOARD || OF_SEPARATE help Offset in the memory where the board configuration DTB is placed. diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 9641ed307b7..b47d2d23f91 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -12,6 +12,7 @@ #include <env.h> #include <image.h> #include <init.h> +#include <jffs2/load_kernel.h> #include <lmb.h> #include <log.h> #include <asm/global_data.h> @@ -20,6 +21,7 @@ #include <i2c.h> #include <linux/sizes.h> #include <malloc.h> +#include <mtd_node.h> #include "board.h" #include <dm.h> #include <i2c_eeprom.h> @@ -43,7 +45,7 @@ struct efi_fw_image fw_images[] = { .image_index = 1, }, #endif -#if defined(XILINX_UBOOT_IMAGE_GUID) +#if defined(XILINX_UBOOT_IMAGE_GUID) && defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME) { .image_type_id = XILINX_UBOOT_IMAGE_GUID, .fw_name = u"XILINX-UBOOT", @@ -103,10 +105,14 @@ static void xilinx_eeprom_legacy_cleanup(char *eeprom, int size) for (i = 0; i < size; i++) { byte = eeprom[i]; - /* Remove all non printable chars but ignore MAC address */ - if ((i < offsetof(struct xilinx_legacy_format, eth_mac) || - i >= offsetof(struct xilinx_legacy_format, unused1)) && - (byte < '!' || byte > '~')) { + /* Ignore MAC address */ + if (i >= offsetof(struct xilinx_legacy_format, eth_mac) && + i < offsetof(struct xilinx_legacy_format, unused1)) { + continue; + } + + /* Remove all non printable chars */ + if (byte < '!' || byte > '~') { eeprom[i] = 0; continue; } @@ -358,6 +364,14 @@ void *board_fdt_blob_setup(int *err) void *fdt_blob; *err = 0; + + if (IS_ENABLED(CONFIG_TARGET_XILINX_MBV)) { + fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR; + + if (fdt_magic(fdt_blob) == FDT_MAGIC) + return fdt_blob; + } + if (!IS_ENABLED(CONFIG_SPL_BUILD) && !IS_ENABLED(CONFIG_VERSAL_NO_DDR) && !IS_ENABLED(CONFIG_ZYNQMP_NO_DDR)) { @@ -693,6 +707,13 @@ int ft_board_setup(void *blob, struct bd_info *bd) u8 buf[MAX_RAND_SIZE]; int nodeoffset, ret; + static const struct node_info nodes[] = { + { "arm,pl353-nand-r2p1", MTD_DEV_TYPE_NAND, }, + }; + + if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS) && IS_ENABLED(CONFIG_NAND_ZYNQ)) + fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); + if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) { debug("No RNG device\n"); return 0; diff --git a/board/xilinx/mbv/Kconfig b/board/xilinx/mbv/Kconfig index d2dec397ed6..a3a6f212577 100644 --- a/board/xilinx/mbv/Kconfig +++ b/board/xilinx/mbv/Kconfig @@ -10,15 +10,25 @@ config SYS_CPU default "generic" config TEXT_BASE - default 0x80000000 if !RISCV_SMODE - default 0x80400000 if RISCV_SMODE && ARCH_RV32I + default 0x21200000 + +config SPL_TEXT_BASE + default 0x20000000 + +config SPL_OPENSBI_LOAD_ADDR + hex + default 0x20200000 config BOARD_SPECIFIC_OPTIONS def_bool y select GENERIC_RISCV + select SUPPORT_SPL imply BOARD_LATE_INIT + imply SPL_RAM_SUPPORT + imply SPL_RAM_DEVICE imply CMD_SBI imply CMD_PING + imply OF_HAS_PRIOR_STAGE source "board/xilinx/Kconfig" diff --git a/board/xilinx/mbv/board.c b/board/xilinx/mbv/board.c index ccf4395d6ac..c478f7e04a0 100644 --- a/board/xilinx/mbv/board.c +++ b/board/xilinx/mbv/board.c @@ -5,7 +5,17 @@ * Michal Simek <michal.simek@amd.com> */ +#include <spl.h> + int board_init(void) { return 0; } + +#ifdef CONFIG_SPL +u32 spl_boot_device(void) +{ + /* RISC-V QEMU only supports RAM as SPL boot device */ + return BOOT_DEVICE_RAM; +} +#endif diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c index 990ca1650aa..da03024e162 100644 --- a/board/xilinx/versal-net/board.c +++ b/board/xilinx/versal-net/board.c @@ -371,3 +371,35 @@ int dram_init(void) void reset_cpu(void) { } + +#if defined(CONFIG_ENV_IS_NOWHERE) +enum env_location env_get_location(enum env_operation op, int prio) +{ + u8 bootmode = versal_net_get_bootmode(); + + if (prio) + return ENVL_UNKNOWN; + + switch (bootmode) { + case EMMC_MODE: + case SD_MODE: + case SD1_LSHFT_MODE: + case SD_MODE1: + if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT)) + return ENVL_FAT; + if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4)) + return ENVL_EXT4; + return ENVL_NOWHERE; + case OSPI_MODE: + case QSPI_MODE_24BIT: + case QSPI_MODE_32BIT: + if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)) + return ENVL_SPI_FLASH; + return ENVL_NOWHERE; + case JTAG_MODE: + case SELECTMAP_MODE: + default: + return ENVL_NOWHERE; + } +} +#endif diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 8c2e614ad8a..4f6d56119db 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -291,6 +291,7 @@ void reset_cpu(void) { } +#if defined(CONFIG_ENV_IS_NOWHERE) enum env_location env_get_location(enum env_operation op, int prio) { u32 bootmode = versal_get_bootmode(); @@ -320,3 +321,4 @@ enum env_location env_get_location(enum env_operation op, int prio) return ENVL_NOWHERE; } } +#endif diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index ba49eb7be22..f370fb7347a 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -588,6 +588,7 @@ int mmc_get_env_dev(void) return bootseq; } +#if defined(CONFIG_ENV_IS_NOWHERE) enum env_location env_get_location(enum env_operation op, int prio) { u32 bootmode = zynqmp_get_bootmode(); @@ -621,11 +622,37 @@ enum env_location env_get_location(enum env_operation op, int prio) return ENVL_NOWHERE; } } +#endif #if defined(CONFIG_SET_DFU_ALT_INFO) #define DFU_ALT_BUF_LEN SZ_1K +static void mtd_found_part(u32 *base, u32 *size) +{ + struct mtd_info *part, *mtd; + + mtd_probe_devices(); + + mtd = get_mtd_device_nm("nor0"); + if (!IS_ERR_OR_NULL(mtd)) { + list_for_each_entry(part, &mtd->partitions, node) { + debug("0x%012llx-0x%012llx : \"%s\"\n", + part->offset, part->offset + part->size, + part->name); + + if (*base >= part->offset && + *base < part->offset + part->size) { + debug("Found my partition: %d/%s\n", + part->index, part->name); + *base = part->offset; + *size = part->size; + break; + } + } + } +} + void set_dfu_alt_info(char *interface, char *devstr) { int multiboot, bootseq = 0, len = 0; @@ -661,21 +688,38 @@ void set_dfu_alt_info(char *interface, char *devstr) len += snprintf(buf + len, DFU_ALT_BUF_LEN, ".bin fat %d 1", bootseq); #if defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME) - len += snprintf(buf + len, DFU_ALT_BUF_LEN, ";%s fat %d 1", - CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, bootseq); + if (strlen(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME)) + len += snprintf(buf + len, DFU_ALT_BUF_LEN, + ";%s fat %d 1", + CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, + bootseq); #endif break; case QSPI_MODE_24BIT: case QSPI_MODE_32BIT: - len += snprintf(buf + len, DFU_ALT_BUF_LEN, - "sf 0:0=boot.bin raw %x 0x1500000", - multiboot * SZ_32K); + { + u32 base = multiboot * SZ_32K; + u32 size = 0x1500000; + u32 limit = size; + + mtd_found_part(&base, &limit); + +#if defined(CONFIG_SYS_SPI_U_BOOT_OFFS) + size = limit; + limit = CONFIG_SYS_SPI_U_BOOT_OFFS; +#endif + + len += snprintf(buf + len, DFU_ALT_BUF_LEN, + "sf 0:0=boot.bin raw 0x%x 0x%x", + base, limit); #if defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME) && defined(CONFIG_SYS_SPI_U_BOOT_OFFS) - len += snprintf(buf + len, DFU_ALT_BUF_LEN, - ";%s raw 0x%x 0x500000", - CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, - multiboot * SZ_32K + CONFIG_SYS_SPI_U_BOOT_OFFS); + if (strlen(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME)) + len += snprintf(buf + len, DFU_ALT_BUF_LEN, + ";%s raw 0x%x 0x%x", + CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, + base + limit, size - limit); #endif + } break; default: return; diff --git a/board/xilinx/zynqmp/zynqmp_kria.env b/board/xilinx/zynqmp/zynqmp_kria.env index 0f940bd68f8..846eceb0118 100644 --- a/board/xilinx/zynqmp/zynqmp_kria.env +++ b/board/xilinx/zynqmp/zynqmp_kria.env @@ -17,6 +17,7 @@ bootcmd_usb0=devnum=0; run usb_boot bootcmd_usb1=devnum=1; run usb_boot bootcmd_usb2=devnum=2; run usb_boot bootcmd_usb3=devnum=3; run usb_boot +bootcmd_usb4=devnum=4; run usb_boot bootdelay=2 bootfstype=fat bootm_low=0 @@ -44,7 +45,8 @@ usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boo preboot=setenv boot_targets; setenv modeboot; run board_setup # SOM specific boot methods -som_cc_boot=if test ${card1_name} = SCK-KV-G; then setenv boot_targets mmc1 usb0 usb1 usb2 usb3 pxe dhcp && run distro_bootcmd; elif test ${card1_name} = SCK-KR-G; then setenv boot_targets usb0 usb1 usb2 usb3 pxe dhcp && run distro_bootcmd; else test ${card1_name} = SCK-KD-G; setenv boot_targets usb0 usb1 usb2 usb3 pxe dhcp && run distro_bootcmd; fi;" +usb_boot_devices='usb0 usb1 usb2 usb3 usb4' +som_cc_boot=if test ${card1_name} = SCK-KV-G; then setenv boot_targets mmc1 ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; elif test ${card1_name} = SCK-KR-G; then setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; else test ${card1_name} = SCK-KD-G; setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; fi;" som_mmc_boot=setenv boot_targets mmc0 && run distro_bootcmd k26_starter=SMK-K26-XCL2G |