[PATCH v2 2/5] cmd: Add partial reconfiguration command
Naresh Kumar Ravulapalli
nareshkumar.ravulapalli at altera.com
Sat May 24 22:37:34 CEST 2025
Command to support FPGA partial reconfiguration (pr) is added.
Signed-off-by: Naresh Kumar Ravulapalli <nareshkumar.ravulapalli at altera.com>
---
cmd/Kconfig | 8 ++++++++
cmd/fpga.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 2d31abcef73..68143d62a44 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1229,6 +1229,14 @@ config CMD_FPGAD
fpga_get_reg() function. This functions similarly to the 'md'
command.
+config CMD_FPGA_PR
+ bool "fpga pr - support FPGA partial reconfiguration"
+ depends on CMD_FPGA && FPGA_ALTERA
+ select FPGA_PR
+ help
+ Command enables support for partial reconfiguration on supported
+ FPGA devices.
+
config CMD_FUSE
bool "fuse - support for the fuse subssystem"
help
diff --git a/cmd/fpga.c b/cmd/fpga.c
index 9dc7b63db5d..e4aa44ba7dd 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -2,6 +2,8 @@
/*
* (C) Copyright 2000, 2001
* Rich Ireland, Enterasys Networks, rireland at enterasys.com.
+ *
+ * Copyright (C) 2025 Altera Corporation <www.altera.com>
*/
/*
@@ -354,6 +356,31 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc,
}
#endif
+#if defined(CONFIG_CMD_FPGA_PR)
+static int do_fpga_pr(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+ const char *cmd;
+ char *region;
+ unsigned int region_num;
+ long dev;
+
+ if (argc != cmdtp->maxargs) {
+ printf("Error: argument count mismatch\n");
+ return CMD_RET_USAGE;
+ }
+
+ dev = do_fpga_get_device(argv[0]);
+ cmd = argv[1];
+ region_num = simple_strtoul(argv[2], ®ion, 10);
+ if (*region != '\0') {
+ printf("Error: region number '%s' is not a valid number\n", argv[2]);
+ return CMD_RET_USAGE;
+ }
+
+ return fpga_pr(dev, cmd, region_num);
+}
+#endif
+
static struct cmd_tbl fpga_commands[] = {
U_BOOT_CMD_MKENT(info, 1, 1, do_fpga_info, "", ""),
U_BOOT_CMD_MKENT(dump, 3, 1, do_fpga_dump, "", ""),
@@ -376,6 +403,9 @@ static struct cmd_tbl fpga_commands[] = {
#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
U_BOOT_CMD_MKENT(loads, 6, 1, do_fpga_loads, "", ""),
#endif
+#if defined(CONFIG_CMD_FPGA_PR)
+ U_BOOT_CMD_MKENT(pr, 3, 1, do_fpga_pr, "", ""),
+#endif
};
static int do_fpga_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -448,4 +478,12 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper,
" -Userkey address: address where user key is stored\n"
" NOTE: secure bitstream has to be created using Xilinx bootgen tool\n"
#endif
+#if defined(CONFIG_CMD_FPGA_PR)
+ "fpga pr <dev> <start|stop> <region>\n"
+ " Start or stop the partial reconfiguration process by freezing or\n"
+ " unfreezing the specified region\n"
+ " -start: starts the partial reconfiguration process\n"
+ " -stop: stops the partial reconfiguration process\n"
+ " -region: region number to undergo the partial reconfiguration process\n"
+#endif
);
--
2.35.3
More information about the U-Boot
mailing list