]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm64: versal-net: Add PL bit stream load support
authorPrasad Kummari <prasad.kummari@amd.com>
Thu, 27 Mar 2025 10:51:58 +0000 (16:21 +0530)
committerMichal Simek <michal.simek@amd.com>
Wed, 16 Apr 2025 11:44:44 +0000 (13:44 +0200)
Add support for loading the secure & non-secure pdi images and
PL bitstream on the Versal NET platform. The FPGA driver is enabled
to load the bitstream in PDI format on the AMD Versal NET device.
PDI is the new programmable device image format for Versal NET,
and the bitstream for the Versal NET platform is generated exclusively
in this format.

The source code for the versalnet loadpdi command and the
CONFIG_CMD_VERSAL_NET configuration has been removed. It now utilizes
the fpga load <dev> <address> <length> command to load secure &
non-secure pdi images.

Signed-off-by: Prasad Kummari <prasad.kummari@amd.com>
Link: https://lore.kernel.org/r/20250327105200.1262615-2-prasad.kummari@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
arch/arm/mach-versal-net/Kconfig
board/xilinx/versal-net/Kconfig [deleted file]
board/xilinx/versal-net/Makefile
board/xilinx/versal-net/board.c
board/xilinx/versal-net/cmds.c [deleted file]
configs/xilinx_versal_net_virt_defconfig
include/xilinx.h

index 54fb93aeb53a5ff0c69461698284d2410703bed3..7def7b9139ab42e62083978c8a85bb449c27bcc6 100644 (file)
@@ -45,6 +45,5 @@ config ZYNQ_SDHCI_MAX_FREQ
        default 200000000
 
 source "board/xilinx/Kconfig"
-source "board/xilinx/versal-net/Kconfig"
 
 endif
diff --git a/board/xilinx/versal-net/Kconfig b/board/xilinx/versal-net/Kconfig
deleted file mode 100644 (file)
index 2484429..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright (C) 2020 - 2022, Xilinx, Inc.
-# Copyright (C) 2022, Advanced Micro Devices, Inc.
-#
-
-if ARCH_VERSAL_NET
-
-config CMD_VERSAL_NET
-       bool "Enable Versal NET specific commands"
-       default y
-       depends on ZYNQMP_FIRMWARE
-       help
-         Select this to enable Versal NET specific commands.
-         Commands like versalnet loadpdi are enabled by this.
-
-endif
index f9ff07c11c6305c05f97a85141219e4ea16a78bf..2008d4e231c62cc15a0d30179864a1910aaab1e2 100644 (file)
@@ -7,4 +7,3 @@
 #
 
 obj-y  := board.o
-obj-$(CONFIG_CMD_VERSAL_NET)   += cmds.o
index f8ac54e35a84d30ba999bbe10f0b48192e1bda16..65b2a451ad7a36b8a2c5a5c3ccd930d93bffe456 100644 (file)
@@ -22,6 +22,7 @@
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <zynqmp_firmware.h>
+#include <versalpl.h>
 #include "../common/board.h"
 
 #include <linux/bitfield.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_FPGA_VERSALPL)
+static xilinx_desc versalpl = {
+       xilinx_versal_net, csu_dma, 1, &versal_op, 0, &versal_op, NULL,
+       FPGA_LEGACY
+};
+#endif
+
 int board_init(void)
 {
        printf("EL Level:\tEL%d\n", current_el());
 
+#if defined(CONFIG_FPGA_VERSALPL)
+       fpga_init();
+       fpga_add(fpga_xilinx, &versalpl);
+#endif
        return 0;
 }
 
diff --git a/board/xilinx/versal-net/cmds.c b/board/xilinx/versal-net/cmds.c
deleted file mode 100644 (file)
index e8b669f..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2023, Advanced Micro Devices, Inc.
- *
- * Michal Simek <michal.simek@amd.com>
- */
-
-#include <cpu_func.h>
-#include <command.h>
-#include <log.h>
-#include <memalign.h>
-#include <versalpl.h>
-#include <vsprintf.h>
-#include <zynqmp_firmware.h>
-
-/**
- * do_versalnet_load_pdi - Handle the "versalnet load pdi" command-line command
- * @cmdtp:      Command data struct pointer
- * @flag:       Command flag
- * @argc:       Command-line argument count
- * @argv:       Array of command-line arguments
- *
- * Processes the Versal NET load pdi command
- *
- * Return: return 0 on success, Error value if command fails.
- * CMD_RET_USAGE incase of incorrect/missing parameters.
- */
-static int do_versalnet_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc,
-                                char * const argv[])
-{
-       u32 buf_lo, buf_hi;
-       u32 ret_payload[PAYLOAD_ARG_CNT];
-       ulong addr, *pdi_buf;
-       size_t len;
-       int ret;
-
-       if (argc != cmdtp->maxargs) {
-               debug("pdi_load: incorrect parameters passed\n");
-               return CMD_RET_USAGE;
-       }
-
-       addr = simple_strtol(argv[1], NULL, 16);
-       if (!addr) {
-               debug("pdi_load: zero pdi_data address\n");
-               return CMD_RET_USAGE;
-       }
-
-       len = hextoul(argv[2], NULL);
-       if (!len) {
-               debug("pdi_load: zero size\n");
-               return CMD_RET_USAGE;
-       }
-
-       pdi_buf = (ulong *)ALIGN((ulong)addr, ARCH_DMA_MINALIGN);
-       if ((ulong)addr != (ulong)pdi_buf) {
-               memcpy((void *)pdi_buf, (void *)addr, len);
-               debug("Pdi addr:0x%lx aligned to 0x%lx\n",
-                     addr, (ulong)pdi_buf);
-       }
-
-       flush_dcache_range((ulong)pdi_buf, (ulong)pdi_buf + len);
-
-       buf_lo = lower_32_bits((ulong)pdi_buf);
-       buf_hi = upper_32_bits((ulong)pdi_buf);
-
-       ret = xilinx_pm_request(VERSAL_PM_LOAD_PDI, VERSAL_PM_PDI_TYPE, buf_lo,
-                               buf_hi, 0, ret_payload);
-       if (ret)
-               printf("PDI load failed with err: 0x%08x\n", ret);
-
-       return cmd_process_error(cmdtp, ret);
-}
-
-U_BOOT_LONGHELP(versalnet,
-       "loadpdi addr len - Load pdi image\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,
-                                           do_versalnet_load_pdi));
index 1604b5915db1fc7b0666add826c7a72538be9c60..404f8785dc78b0a5a606427243ab2a83c66e4077 100644 (file)
@@ -74,6 +74,8 @@ CONFIG_SIMPLE_PM_BUS=y
 CONFIG_CLK_VERSAL=y
 CONFIG_DFU_RAM=y
 CONFIG_ARM_FFA_TRANSPORT=y
+CONFIG_FPGA_XILINX=y
+CONFIG_FPGA_VERSALPL=y
 CONFIG_ZYNQ_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_CADENCE=y
index e4e297979882bbf150b6d0a9322b8e2f927e5b01..2b4d6c9bb06cdcbb358cd86c66952277caa860b1 100644 (file)
@@ -34,6 +34,7 @@ typedef enum {                        /* typedef xilinx_family */
        xilinx_zynq,            /* Zynq Family */
        xilinx_zynqmp,          /* ZynqMP Family */
        xilinx_versal,          /* Versal Family */
+       xilinx_versal_net,      /* Versal NET Family */
        max_xilinx_type         /* insert all new types before this */
 } xilinx_family;               /* end, typedef xilinx_family */