diff options
Diffstat (limited to 'board/xilinx')
| -rw-r--r-- | board/xilinx/Kconfig | 6 | ||||
| -rw-r--r-- | board/xilinx/common/board.c | 41 | ||||
| -rw-r--r-- | board/xilinx/common/cpu-info.c | 1 | ||||
| -rw-r--r-- | board/xilinx/common/fru.c | 1 | ||||
| -rw-r--r-- | board/xilinx/common/fru_ops.c | 2 | ||||
| -rw-r--r-- | board/xilinx/versal-net/board.c | 1 | ||||
| -rw-r--r-- | board/xilinx/versal-net/cmds.c | 7 | ||||
| -rw-r--r-- | board/xilinx/versal/board.c | 16 | ||||
| -rw-r--r-- | board/xilinx/versal/cmds.c | 2 | ||||
| -rw-r--r-- | board/xilinx/zynq/board.c | 2 | ||||
| -rw-r--r-- | board/xilinx/zynq/bootimg.c | 1 | ||||
| -rw-r--r-- | board/xilinx/zynq/cmds.c | 1 | ||||
| -rw-r--r-- | board/xilinx/zynqmp/Kconfig | 19 | ||||
| -rw-r--r-- | board/xilinx/zynqmp/Makefile | 4 | ||||
| -rw-r--r-- | board/xilinx/zynqmp/cmds.c | 430 | ||||
| -rw-r--r-- | board/xilinx/zynqmp/zynqmp-sm-k24-revA/psu_init_gpl.c | 23 | ||||
| -rw-r--r-- | board/xilinx/zynqmp/zynqmp.c | 22 | ||||
| -rw-r--r-- | board/xilinx/zynqmp/zynqmp_kria.env | 1 | ||||
| -rw-r--r-- | board/xilinx/zynqmp_r5/board.c | 2 |
19 files changed, 53 insertions, 529 deletions
diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig index 5c4ad8f1df9..c7df4ab5781 100644 --- a/board/xilinx/Kconfig +++ b/board/xilinx/Kconfig @@ -42,7 +42,7 @@ endif config XILINX_OF_BOARD_DTB_ADDR hex "Default DTB pickup address" - default 0x1000 if ARCH_VERSAL || ARCH_VERSAL_NET + default 0x1000 if ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2 default 0x8000 if MICROBLAZE default 0x100000 if ARCH_ZYNQ || ARCH_ZYNQMP default 0x23000000 if TARGET_XILINX_MBV @@ -52,10 +52,10 @@ config XILINX_OF_BOARD_DTB_ADDR config BOOT_SCRIPT_OFFSET hex "Boot script offset" - depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET || MICROBLAZE || TARGET_XILINX_MBV + depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2 || MICROBLAZE || TARGET_XILINX_MBV default 0xFC0000 if ARCH_ZYNQ || MICROBLAZE default 0x3E80000 if ARCH_ZYNQMP - default 0x7F80000 if ARCH_VERSAL || ARCH_VERSAL_NET + default 0x7F80000 if ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2 default 0 if TARGET_XILINX_MBV help Specifies distro boot script offset in NAND/QSPI/NOR flash. diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index b47d2d23f91..0b43407b9e9 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -6,7 +6,6 @@ * Michal Simek <michal.simek@amd.com> */ -#include <common.h> #include <efi.h> #include <efi_loader.h> #include <env.h> @@ -702,11 +701,6 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size) #define MAX_RAND_SIZE 8 int ft_board_setup(void *blob, struct bd_info *bd) { - size_t n = MAX_RAND_SIZE; - struct udevice *dev; - u8 buf[MAX_RAND_SIZE]; - int nodeoffset, ret; - static const struct node_info nodes[] = { { "arm,pl353-nand-r2p1", MTD_DEV_TYPE_NAND, }, }; @@ -714,41 +708,6 @@ int ft_board_setup(void *blob, struct bd_info *bd) 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; - } - - if (dm_rng_read(dev, buf, n)) { - debug("Reading RNG failed\n"); - return 0; - } - - if (!blob) { - debug("No FDT memory address configured. Please configure\n" - "the FDT address via \"fdt addr <address>\" command.\n" - "Aborting!\n"); - return 0; - } - - ret = fdt_check_header(blob); - if (ret < 0) { - debug("fdt_chosen: %s\n", fdt_strerror(ret)); - return ret; - } - - nodeoffset = fdt_find_or_add_subnode(blob, 0, "chosen"); - if (nodeoffset < 0) { - debug("Reading chosen node failed\n"); - return nodeoffset; - } - - ret = fdt_setprop(blob, nodeoffset, "kaslr-seed", buf, sizeof(buf)); - if (ret < 0) { - debug("Unable to set kaslr-seed on chosen node: %s\n", fdt_strerror(ret)); - return ret; - } - return 0; } #endif diff --git a/board/xilinx/common/cpu-info.c b/board/xilinx/common/cpu-info.c index bfe7f5b7e38..765bb24d937 100644 --- a/board/xilinx/common/cpu-info.c +++ b/board/xilinx/common/cpu-info.c @@ -4,7 +4,6 @@ * Michal Simek <michal.simek@amd.com> */ -#include <common.h> #include <init.h> #include <soc.h> diff --git a/board/xilinx/common/fru.c b/board/xilinx/common/fru.c index 12b21317496..8cf307e33f2 100644 --- a/board/xilinx/common/fru.c +++ b/board/xilinx/common/fru.c @@ -3,7 +3,6 @@ * (C) Copyright 2019 - 2020 Xilinx, Inc. */ -#include <common.h> #include <command.h> #include <fdtdec.h> #include <malloc.h> diff --git a/board/xilinx/common/fru_ops.c b/board/xilinx/common/fru_ops.c index 167252c240c..610293bccf7 100644 --- a/board/xilinx/common/fru_ops.c +++ b/board/xilinx/common/fru_ops.c @@ -4,13 +4,13 @@ * (C) Copyright 2022 - 2023, Advanced Micro Devices, Inc. */ -#include <common.h> #include <cpu_func.h> #include <env.h> #include <fdtdec.h> #include <log.h> #include <malloc.h> #include <net.h> +#include <linux/errno.h> #include <asm/io.h> #include <asm/arch/hardware.h> diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c index da03024e162..88e10fa7a7f 100644 --- a/board/xilinx/versal-net/board.c +++ b/board/xilinx/versal-net/board.c @@ -6,7 +6,6 @@ * Michal Simek <michal.simek@amd.com> */ -#include <common.h> #include <cpu_func.h> #include <fdtdec.h> #include <init.h> diff --git a/board/xilinx/versal-net/cmds.c b/board/xilinx/versal-net/cmds.c index b18a71fe52c..e8b669f0fd4 100644 --- a/board/xilinx/versal-net/cmds.c +++ b/board/xilinx/versal-net/cmds.c @@ -7,10 +7,10 @@ #include <cpu_func.h> #include <command.h> -#include <common.h> #include <log.h> #include <memalign.h> #include <versalpl.h> +#include <vsprintf.h> #include <zynqmp_firmware.h> /** @@ -71,10 +71,9 @@ static int do_versalnet_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc, return cmd_process_error(cmdtp, ret); } -static char versalnet_help_text[] = +U_BOOT_LONGHELP(versalnet, "loadpdi addr len - Load pdi image\n" - "load pdi image at ddr address 'addr' with pdi image size 'len'\n" -; + "load pdi image at ddr address 'addr' with pdi image size 'len'\n"); U_BOOT_CMD_WITH_SUBCMDS(versalnet, "Versal NET sub-system", versalnet_help_text, U_BOOT_SUBCMD_MKENT(loadpdi, 3, 1, diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 4f6d56119db..39474674cca 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -5,7 +5,6 @@ */ #include <command.h> -#include <common.h> #include <cpu_func.h> #include <env.h> #include <fdtdec.h> @@ -151,14 +150,29 @@ static int boot_targets_setup(void) break; case QSPI_MODE_24BIT: puts("QSPI_MODE_24\n"); + if (uclass_get_device_by_name(UCLASS_SPI, + "spi@f1030000", &dev)) { + debug("QSPI driver for QSPI device is not present\n"); + break; + } mode = "xspi0"; break; case QSPI_MODE_32BIT: puts("QSPI_MODE_32\n"); + if (uclass_get_device_by_name(UCLASS_SPI, + "spi@f1030000", &dev)) { + debug("QSPI driver for QSPI device is not present\n"); + break; + } mode = "xspi0"; break; case OSPI_MODE: puts("OSPI_MODE\n"); + if (uclass_get_device_by_name(UCLASS_SPI, + "spi@f1010000", &dev)) { + debug("OSPI driver for OSPI device is not present\n"); + break; + } mode = "xspi0"; break; case EMMC_MODE: diff --git a/board/xilinx/versal/cmds.c b/board/xilinx/versal/cmds.c index 2a74e49aede..c78793573e8 100644 --- a/board/xilinx/versal/cmds.c +++ b/board/xilinx/versal/cmds.c @@ -6,10 +6,10 @@ #include <cpu_func.h> #include <command.h> -#include <common.h> #include <log.h> #include <memalign.h> #include <versalpl.h> +#include <vsprintf.h> #include <zynqmp_firmware.h> static int do_versal_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc, diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 6c365910011..b9a91110ff7 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -4,7 +4,7 @@ * (C) Copyright 2013 - 2018 Xilinx, Inc. */ -#include <common.h> +#include <config.h> #include <debug_uart.h> #include <dfu.h> #include <init.h> diff --git a/board/xilinx/zynq/bootimg.c b/board/xilinx/zynq/bootimg.c index 2f55078dd76..79bec3a4cfb 100644 --- a/board/xilinx/zynq/bootimg.c +++ b/board/xilinx/zynq/bootimg.c @@ -3,7 +3,6 @@ * Copyright (C) 2018 Xilinx, Inc. */ -#include <common.h> #include <log.h> #include <part.h> #include <asm/global_data.h> diff --git a/board/xilinx/zynq/cmds.c b/board/xilinx/zynq/cmds.c index d7c7b2f2295..05ecb75406b 100644 --- a/board/xilinx/zynq/cmds.c +++ b/board/xilinx/zynq/cmds.c @@ -3,7 +3,6 @@ * Copyright (C) 2018 Xilinx, Inc. */ -#include <common.h> #include <command.h> #include <log.h> #include <asm/global_data.h> diff --git a/board/xilinx/zynqmp/Kconfig b/board/xilinx/zynqmp/Kconfig deleted file mode 100644 index ffa2f0215d4..00000000000 --- a/board/xilinx/zynqmp/Kconfig +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2018, Xilinx, Inc. -# -# SPDX-License-Identifier: GPL-2.0 - -if ARCH_ZYNQMP - -config CMD_ZYNQMP - bool "Enable ZynqMP specific commands" - depends on ZYNQMP_FIRMWARE - default y - help - Enable ZynqMP specific commands like "zynqmp secure" - which is used for zynqmp secure image verification. - The secure image is a xilinx specific BOOT.BIN with - either authentication or encryption or both encryption - and authentication feature enabled while generating - BOOT.BIN using Xilinx bootgen tool. - -endif diff --git a/board/xilinx/zynqmp/Makefile b/board/xilinx/zynqmp/Makefile index 204e4fadf0e..9ab50eca400 100644 --- a/board/xilinx/zynqmp/Makefile +++ b/board/xilinx/zynqmp/Makefile @@ -40,10 +40,6 @@ $(obj)/pm_cfg_obj.o: $(shell cd $(srctree); readlink -f $(CONFIG_ZYNQMP_SPL_PM_C endif endif -ifndef CONFIG_SPL_BUILD -obj-$(CONFIG_CMD_ZYNQMP) += cmds.o -endif - # Suppress "warning: function declaration isn't a prototype" CFLAGS_REMOVE_psu_init_gpl.o := -Wstrict-prototypes diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c deleted file mode 100644 index 9524688f27d..00000000000 --- a/board/xilinx/zynqmp/cmds.c +++ /dev/null @@ -1,430 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * (C) Copyright 2018 Xilinx, Inc. - * Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>> - */ - -#include <common.h> -#include <command.h> -#include <cpu_func.h> -#include <env.h> -#include <malloc.h> -#include <memalign.h> -#include <zynqmp_firmware.h> -#include <asm/arch/hardware.h> -#include <asm/arch/sys_proto.h> -#include <asm/io.h> -#include <mach/zynqmp_aes.h> - -static int do_zynqmp_verify_secure(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - u64 src_addr, addr; - u32 len, src_lo, src_hi; - u8 *key_ptr = NULL; - int ret; - u32 key_lo = 0; - u32 key_hi = 0; - u32 ret_payload[PAYLOAD_ARG_CNT]; - - if (argc < 4) - return CMD_RET_USAGE; - - src_addr = simple_strtoull(argv[2], NULL, 16); - len = hextoul(argv[3], NULL); - - if (argc == 5) - key_ptr = (uint8_t *)(uintptr_t)simple_strtoull(argv[4], - NULL, 16); - - if ((ulong)src_addr != ALIGN((ulong)src_addr, - CONFIG_SYS_CACHELINE_SIZE)) { - printf("Failed: source address not aligned:%lx\n", - (ulong)src_addr); - return -EINVAL; - } - - src_lo = lower_32_bits((ulong)src_addr); - src_hi = upper_32_bits((ulong)src_addr); - flush_dcache_range((ulong)src_addr, (ulong)(src_addr + len)); - - if (key_ptr) { - key_lo = lower_32_bits((ulong)key_ptr); - key_hi = upper_32_bits((ulong)key_ptr); - flush_dcache_range((ulong)key_ptr, - (ulong)(key_ptr + KEY_PTR_LEN)); - } - - ret = xilinx_pm_request(PM_SECURE_IMAGE, src_lo, src_hi, - key_lo, key_hi, ret_payload); - if (ret) { - printf("Failed: secure op status:0x%x\n", ret); - } else { - addr = (u64)ret_payload[1] << 32 | ret_payload[2]; - printf("Verified image at 0x%llx\n", addr); - env_set_hex("zynqmp_verified_img_addr", addr); - } - - return ret; -} - -static int do_zynqmp_mmio_read(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - u32 read_val, addr; - int ret; - - if (argc != cmdtp->maxargs) - return CMD_RET_USAGE; - - addr = hextoul(argv[2], NULL); - - ret = zynqmp_mmio_read(addr, &read_val); - if (!ret) - printf("mmio read value at 0x%x = 0x%x\n", - addr, read_val); - else - printf("Failed: mmio read\n"); - - return ret; -} - -static int do_zynqmp_mmio_write(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - u32 addr, mask, val; - int ret; - - if (argc != cmdtp->maxargs) - return CMD_RET_USAGE; - - addr = hextoul(argv[2], NULL); - mask = hextoul(argv[3], NULL); - val = hextoul(argv[4], NULL); - - ret = zynqmp_mmio_write(addr, mask, val); - if (ret != 0) - printf("Failed: mmio write\n"); - - return ret; -} - -static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc, - char * const argv[]) -{ - ALLOC_CACHE_ALIGN_BUFFER(struct zynqmp_aes, aes, 1); - - if (zynqmp_firmware_version() <= PMUFW_V1_0) { - puts("ERR: PMUFW v1.0 or less is detected\n"); - puts("ERR: Encrypt/Decrypt feature is not supported\n"); - puts("ERR: Please upgrade PMUFW\n"); - return CMD_RET_FAILURE; - } - - if (argc < cmdtp->maxargs - 1) - return CMD_RET_USAGE; - - aes->srcaddr = hextoul(argv[2], NULL); - aes->ivaddr = hextoul(argv[3], NULL); - aes->len = hextoul(argv[4], NULL); - aes->op = hextoul(argv[5], NULL); - aes->keysrc = hextoul(argv[6], NULL); - aes->dstaddr = hextoul(argv[7], NULL); - - if (aes->keysrc == 0) { - if (argc < cmdtp->maxargs) - return CMD_RET_USAGE; - - aes->keyaddr = hextoul(argv[8], NULL); - } - - return zynqmp_aes_operation(aes); -} - -#ifdef CONFIG_DEFINE_TCM_OCM_MMAP -static int do_zynqmp_tcm_init(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - u8 mode; - - if (argc != cmdtp->maxargs) - return CMD_RET_USAGE; - - if (strcmp(argv[2], "lockstep") && strcmp(argv[2], "split")) { - printf("mode param should be lockstep or split\n"); - return CMD_RET_FAILURE; - } - - mode = hextoul(argv[2], NULL); - if (mode != TCM_LOCK && mode != TCM_SPLIT) { - printf("Mode should be either 0(lock)/1(split)\n"); - return CMD_RET_FAILURE; - } - - dcache_disable(); - tcm_init(mode); - dcache_enable(); - - return CMD_RET_SUCCESS; -} -#endif - -static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc, - char * const argv[]) -{ - u32 addr, size; - - if (argc != cmdtp->maxargs) - return CMD_RET_USAGE; - - if (!strncmp(argv[2], "node", 4)) { - u32 id; - int ret; - - if (!strncmp(argv[3], "close", 5)) - return zynqmp_pmufw_config_close(); - - id = dectoul(argv[3], NULL); - if (!id) { - printf("Incorrect ID passed\n"); - return CMD_RET_USAGE; - } - - printf("Enable permission for node ID %d\n", id); - - ret = zynqmp_pmufw_node(id); - if (ret == -ENODEV) - ret = 0; - - return ret; - } - - addr = hextoul(argv[2], NULL); - size = hextoul(argv[3], NULL); - - zynqmp_pmufw_load_config_object((const void *)(uintptr_t)addr, - (size_t)size); - - return 0; -} - -static int do_zynqmp_rsa(struct cmd_tbl *cmdtp, int flag, int argc, - char * const argv[]) -{ - u64 srcaddr, mod, exp; - u32 srclen, rsaop, size, ret_payload[PAYLOAD_ARG_CNT]; - int ret; - - if (argc != cmdtp->maxargs) - return CMD_RET_USAGE; - - if (zynqmp_firmware_version() <= PMUFW_V1_0) { - puts("ERR: PMUFW v1.0 or less is detected\n"); - puts("ERR: Encrypt/Decrypt feature is not supported\n"); - puts("ERR: Please upgrade PMUFW\n"); - return CMD_RET_FAILURE; - } - - srcaddr = hextoul(argv[2], NULL); - srclen = hextoul(argv[3], NULL); - if (srclen != RSA_KEY_SIZE) { - puts("ERR: srclen should be equal to 0x200(512 bytes)\n"); - return CMD_RET_USAGE; - } - - mod = hextoul(argv[4], NULL); - exp = hextoul(argv[5], NULL); - rsaop = hextoul(argv[6], NULL); - if (!(rsaop == 0 || rsaop == 1)) { - puts("ERR: rsaop should be either 0 or 1\n"); - return CMD_RET_USAGE; - } - - memcpy((void *)srcaddr + srclen, (void *)mod, MODULUS_LEN); - - /* - * For encryption we load public exponent (key size 4096-bits), - * for decryption we load private exponent (32-bits) - */ - if (rsaop) { - memcpy((void *)srcaddr + srclen + MODULUS_LEN, - (void *)exp, PUB_EXPO_LEN); - size = srclen + MODULUS_LEN + PUB_EXPO_LEN; - } else { - memcpy((void *)srcaddr + srclen + MODULUS_LEN, - (void *)exp, PRIV_EXPO_LEN); - size = srclen + MODULUS_LEN + PRIV_EXPO_LEN; - } - - flush_dcache_range((ulong)srcaddr, - (ulong)(srcaddr) + roundup(size, ARCH_DMA_MINALIGN)); - - ret = xilinx_pm_request(PM_SECURE_RSA, upper_32_bits((ulong)srcaddr), - lower_32_bits((ulong)srcaddr), srclen, rsaop, - ret_payload); - if (ret || ret_payload[1]) { - printf("Failed: RSA status:0x%x, errcode:0x%x\n", - ret, ret_payload[1]); - return CMD_RET_FAILURE; - } - - return CMD_RET_SUCCESS; -} - -static int do_zynqmp_sha3(struct cmd_tbl *cmdtp, int flag, - int argc, char * const argv[]) -{ - u64 srcaddr, hashaddr; - u32 srclen, ret_payload[PAYLOAD_ARG_CNT]; - int ret; - - if (argc > cmdtp->maxargs || argc < (cmdtp->maxargs - 1)) - return CMD_RET_USAGE; - - if (zynqmp_firmware_version() <= PMUFW_V1_0) { - puts("ERR: PMUFW v1.0 or less is detected\n"); - puts("ERR: Encrypt/Decrypt feature is not supported\n"); - puts("ERR: Please upgrade PMUFW\n"); - return CMD_RET_FAILURE; - } - - srcaddr = hextoul(argv[2], NULL); - srclen = hextoul(argv[3], NULL); - - if (argc == 5) { - hashaddr = hextoul(argv[4], NULL); - flush_dcache_range(hashaddr, - hashaddr + roundup(ZYNQMP_SHA3_SIZE, - ARCH_DMA_MINALIGN)); - } else { - hashaddr = srcaddr; - } - - /* Check srcaddr or srclen != 0 */ - if (!srcaddr || !srclen) { - puts("ERR: srcaddr & srclen should not be 0\n"); - return CMD_RET_USAGE; - } - - flush_dcache_range(srcaddr, - srcaddr + roundup(srclen, ARCH_DMA_MINALIGN)); - - ret = xilinx_pm_request(PM_SECURE_SHA, 0, 0, 0, - ZYNQMP_SHA3_INIT, ret_payload); - if (ret || ret_payload[1]) { - printf("Failed: SHA INIT status:0x%x, errcode:0x%x\n", - ret, ret_payload[1]); - return CMD_RET_FAILURE; - } - - ret = xilinx_pm_request(PM_SECURE_SHA, upper_32_bits((ulong)srcaddr), - lower_32_bits((ulong)srcaddr), - srclen, ZYNQMP_SHA3_UPDATE, ret_payload); - if (ret || ret_payload[1]) { - printf("Failed: SHA UPDATE status:0x%x, errcode:0x%x\n", - ret, ret_payload[1]); - return CMD_RET_FAILURE; - } - - ret = xilinx_pm_request(PM_SECURE_SHA, upper_32_bits((ulong)hashaddr), - lower_32_bits((ulong)hashaddr), - ZYNQMP_SHA3_SIZE, ZYNQMP_SHA3_FINAL, - ret_payload); - if (ret || ret_payload[1]) { - printf("Failed: SHA FINAL status:0x%x, errcode:0x%x\n", - ret, ret_payload[1]); - return CMD_RET_FAILURE; - } - - return CMD_RET_SUCCESS; -} - -static struct cmd_tbl cmd_zynqmp_sub[] = { - U_BOOT_CMD_MKENT(secure, 5, 0, do_zynqmp_verify_secure, "", ""), - U_BOOT_CMD_MKENT(pmufw, 4, 0, do_zynqmp_pmufw, "", ""), - U_BOOT_CMD_MKENT(mmio_read, 3, 0, do_zynqmp_mmio_read, "", ""), - U_BOOT_CMD_MKENT(mmio_write, 5, 0, do_zynqmp_mmio_write, "", ""), - U_BOOT_CMD_MKENT(aes, 9, 0, do_zynqmp_aes, "", ""), - U_BOOT_CMD_MKENT(rsa, 7, 0, do_zynqmp_rsa, "", ""), - U_BOOT_CMD_MKENT(sha3, 5, 0, do_zynqmp_sha3, "", ""), -#ifdef CONFIG_DEFINE_TCM_OCM_MMAP - U_BOOT_CMD_MKENT(tcminit, 3, 0, do_zynqmp_tcm_init, "", ""), -#endif -}; - -/** - * do_zynqmp - Handle the "zynqmp" command-line command - * @cmdtp: Command data struct pointer - * @flag: Command flag - * @argc: Command-line argument count - * @argv: Array of command-line arguments - * - * Processes the zynqmp specific commands - * - * Return: return 0 on success and CMD_RET_USAGE incase of misuse and error - */ -static int do_zynqmp(struct cmd_tbl *cmdtp, int flag, int argc, - char *const argv[]) -{ - struct cmd_tbl *c; - int ret = CMD_RET_USAGE; - - if (argc < 2) - return CMD_RET_USAGE; - - c = find_cmd_tbl(argv[1], &cmd_zynqmp_sub[0], - ARRAY_SIZE(cmd_zynqmp_sub)); - if (c) - ret = c->cmd(c, flag, argc, argv); - - return cmd_process_error(c, ret); -} - -/***************************************************/ -U_BOOT_LONGHELP(zynqmp, - "secure src len [key_addr] - verifies secure images of $len bytes\n" - " long at address $src. Optional key_addr\n" - " can be specified if user key needs to\n" - " be used for decryption\n" - "zynqmp mmio_read address - read from address\n" - "zynqmp mmio_write address mask value - write value after masking to\n" - " address\n" - "zynqmp aes srcaddr ivaddr len aesop keysrc dstaddr [keyaddr] -\n" - " Encrypts or decrypts blob of data at src address and puts it\n" - " back to dstaddr using key and iv at keyaddr and ivaddr\n" - " respectively. keysrc value specifies from which source key\n" - " has to be used, it can be User/Device/PUF key. A value of 0\n" - " for KUP(user key),1 for DeviceKey and 2 for PUF key. The\n" - " aesop value specifies the operation which can be 0 for\n" - " decrypt and 1 for encrypt operation\n" -#ifdef CONFIG_DEFINE_TCM_OCM_MMAP - "zynqmp tcminit mode - Initialize the TCM with zeros. TCM needs to be\n" - " initialized before accessing to avoid ECC\n" - " errors. mode specifies in which mode TCM has\n" - " to be initialized. Supported modes will be\n" - " lock(0)/split(1)\n" -#endif - "zynqmp pmufw address size - load PMU FW configuration object\n" - "zynqmp pmufw node <id> - load PMU FW configuration object, <id> in dec\n" - "zynqmp pmufw node close - disable config object loading\n" - " node: keyword, id: NODE_ID in decimal format\n" - "zynqmp rsa srcaddr srclen mod exp rsaop -\n" - " Performs RSA encryption and RSA decryption on blob of data\n" - " at srcaddr and puts it back in srcaddr using modulus and\n" - " public or private exponent\n" - " srclen : must be key size(4096 bits)\n" - " exp : private key exponent for RSA decryption(4096 bits)\n" - " public key exponent for RSA encryption(32 bits)\n" - " rsaop : 0 for RSA Decryption, 1 for RSA Encryption\n" - "zynqmp sha3 srcaddr srclen [key_addr] -\n" - " Generates sha3 hash value for data blob at srcaddr and puts\n" - " 48 bytes hash value into srcaddr\n" - " Optional key_addr can be specified for saving sha3 hash value\n" - " Note: srcaddr/srclen should not be 0\n" - ); - -U_BOOT_CMD( - zynqmp, 9, 1, do_zynqmp, - "ZynqMP sub-system", - zynqmp_help_text -); diff --git a/board/xilinx/zynqmp/zynqmp-sm-k24-revA/psu_init_gpl.c b/board/xilinx/zynqmp/zynqmp-sm-k24-revA/psu_init_gpl.c index 166e61431ba..274203ffaa3 100644 --- a/board/xilinx/zynqmp/zynqmp-sm-k24-revA/psu_init_gpl.c +++ b/board/xilinx/zynqmp/zynqmp-sm-k24-revA/psu_init_gpl.c @@ -528,8 +528,8 @@ static unsigned long psu_mio_init_data(void) psu_mask_write(0xFF180124, 0x000000FEU, 0x00000002U); psu_mask_write(0xFF180128, 0x000000FEU, 0x00000002U); psu_mask_write(0xFF18012C, 0x000000FEU, 0x00000002U); - psu_mask_write(0xFF180130, 0x000000FEU, 0x000000C0U); - psu_mask_write(0xFF180134, 0x000000FEU, 0x000000C0U); + psu_mask_write(0xFF180130, 0x000000FEU, 0x00000000U); + psu_mask_write(0xFF180134, 0x000000FEU, 0x00000000U); psu_mask_write(0xFF180204, 0xFFFFFFFFU, 0x50000000U); psu_mask_write(0xFF180208, 0xFFFFFFFFU, 0x00B02020U); psu_mask_write(0xFF18020C, 0x00003FFFU, 0x00000FC0U); @@ -569,21 +569,16 @@ static unsigned long psu_peripherals_init_data(void) psu_mask_write(0xFD1A0100, 0x0001807CU, 0x00000000U); psu_mask_write(0xFF5E0238, 0x001A0000U, 0x00000000U); psu_mask_write(0xFF5E023C, 0x0093C018U, 0x00000000U); - psu_mask_write(0xFF5E0230, 0x00000008U, 0x00000000U); + psu_mask_write(0xFF5E0230, 0x00000002U, 0x00000000U); psu_mask_write(0xFF5E0238, 0x00000001U, 0x00000000U); psu_mask_write(0xFF180390, 0x00000004U, 0x00000004U); psu_mask_write(0xFF5E023C, 0x00000400U, 0x00000000U); - psu_mask_write(0xFF5E0238, 0x00000040U, 0x00000000U); - psu_mask_write(0xFF180310, 0x00008000U, 0x00000000U); - psu_mask_write(0xFF180320, 0x33840000U, 0x02840000U); - psu_mask_write(0xFF18031C, 0x7FFE0000U, 0x64500000U); - psu_mask_write(0xFF180358, 0x00000008U, 0x00000008U); - psu_mask_write(0xFF180324, 0x03C00000U, 0x00000000U); + psu_mask_write(0xFF5E0238, 0x00000080U, 0x00000000U); psu_mask_write(0xFF5E0238, 0x00000400U, 0x00000000U); psu_mask_write(0xFF5E0238, 0x00008000U, 0x00000000U); psu_mask_write(0xFF5E0238, 0x00000010U, 0x00000000U); psu_mask_write(0xFF5E0238, 0x00007800U, 0x00000000U); - psu_mask_write(0xFF5E0238, 0x00000004U, 0x00000000U); + psu_mask_write(0xFF5E0238, 0x00000006U, 0x00000000U); psu_mask_write(0xFF5E0238, 0x00040000U, 0x00000000U); psu_mask_write(0xFF4B0024, 0x000000FFU, 0x000000FFU); psu_mask_write(0xFFCA5000, 0x00001FFFU, 0x00000000U); @@ -591,13 +586,15 @@ static unsigned long psu_peripherals_init_data(void) psu_mask_write(0xFFA60040, 0x80000000U, 0x80000000U); psu_mask_write(0xFF260020, 0xFFFFFFFFU, 0x05F5DD18U); psu_mask_write(0xFF260000, 0x00000001U, 0x00000001U); - psu_mask_write(0xFF5E0250, 0x00000F0FU, 0x00000202U); + psu_mask_write(0xFF0A0284, 0x03FFFFFFU, 0x01000000U); + psu_mask_write(0xFF0A0288, 0x03FFFFFFU, 0x01000000U); + psu_mask_write(0xFF0A0014, 0x03FF03FFU, 0x02FF0100U); mask_delay(1); - psu_mask_write(0xFF5E0250, 0x00000F0FU, 0x00000002U); + psu_mask_write(0xFF0A0014, 0x03FF03FFU, 0x02FF0000U); mask_delay(5); - psu_mask_write(0xFF5E0250, 0x00000F0FU, 0x00000202U); + psu_mask_write(0xFF0A0014, 0x03FF03FFU, 0x02FF0100U); return 1; } diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index f370fb7347a..b4c15b041cc 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -4,7 +4,7 @@ * Michal Simek <michal.simek@amd.com> */ -#include <common.h> +#include <config.h> #include <command.h> #include <cpu_func.h> #include <debug_uart.h> @@ -285,6 +285,18 @@ int dram_init(void) #if !CONFIG_IS_ENABLED(SYSRESET) void reset_cpu(void) { + if (!IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE)) { + log_warning("reset failed: ZYNQMP_FIRMWARE disabled"); + return; + } + + /* In case of !CONFIG_ZYNQMP_FIRMWARE the call to 'xilinx_pm_request()' + * will be removed by the compiler due to the early return. + * If CONFIG_ZYNQMP_FIRMWARE is defined in SPL 'xilinx_pm_request()' + * will send command over IPI and requires pmufw to be present. + */ + xilinx_pm_request(PM_RESET_ASSERT, ZYNQMP_PM_RESET_SOFT, + PM_RESET_ACTION_ASSERT, 0, 0, NULL); } #endif @@ -519,6 +531,10 @@ int board_late_init(void) usb_ether_init(); #endif + multiboot = multi_boot(); + if (multiboot >= 0) + env_set_hex("multiboot", multiboot); + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { debug("Saved variables - Skipping\n"); return 0; @@ -531,10 +547,6 @@ int board_late_init(void) if (ret) return ret; - multiboot = multi_boot(); - if (multiboot >= 0) - env_set_hex("multiboot", multiboot); - if (IS_ENABLED(CONFIG_DISTRO_DEFAULTS)) { ret = boot_targets_setup(); if (ret) diff --git a/board/xilinx/zynqmp/zynqmp_kria.env b/board/xilinx/zynqmp/zynqmp_kria.env index 846eceb0118..69e333c5388 100644 --- a/board/xilinx/zynqmp/zynqmp_kria.env +++ b/board/xilinx/zynqmp/zynqmp_kria.env @@ -65,6 +65,7 @@ kd240_setup=i2c dev 1 && run usb_hub_init;zynqmp pmufw node 33; zynqmp pmufw nod tpm_setup=tpm autostart; board_setup=\ +zynqmp mmio_write 0xFFCA0010 0xfff 0; \ if test ${card1_name} = SCK-KV-G; then run kv260_setup; fi;\ if test ${card1_name} = SCK-KR-G; then run kr260_setup; fi;\ if test ${card1_name} = SCK-KD-G; then run kd240_setup; fi;\ diff --git a/board/xilinx/zynqmp_r5/board.c b/board/xilinx/zynqmp_r5/board.c index 5c5a2e93863..0c62b0013c4 100644 --- a/board/xilinx/zynqmp_r5/board.c +++ b/board/xilinx/zynqmp_r5/board.c @@ -3,9 +3,9 @@ * (C) Copyright 2018 Xilinx, Inc. (Michal Simek) */ -#include <common.h> #include <fdtdec.h> #include <init.h> +#include <linux/errno.h> int board_init(void) { |
