[PATCH v11 04/13] fpga: zynqmp: add str2flags call

Oleksandr Suvorov oleksandr.suvorov at foundries.io
Tue Jul 5 21:23:11 CEST 2022


Add a call to convert FPGA "compatible" string to a binary flag.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
Tested-by: Ricardo Salveti <ricardo at foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski at fastree3d.com>
---

(no changes since v1)

 drivers/fpga/zynqmppl.c | 9 +++++++++
 include/xilinx.h        | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
index 8ff12bf50a0..0ffcff0c148 100644
--- a/drivers/fpga/zynqmppl.c
+++ b/drivers/fpga/zynqmppl.c
@@ -304,10 +304,19 @@ static int zynqmp_pcap_info(xilinx_desc *desc)
 	return ret;
 }
 
+static int zynqmp_str2flag(xilinx_desc *desc, const char *str)
+{
+	if (!strncmp(str, "u-boot,fpga-legacy", 18))
+		return FPGA_LEGACY;
+
+	return 0;
+}
+
 struct xilinx_fpga_op zynqmp_op = {
 	.load = zynqmp_load,
 #if CONFIG_IS_ENABLED(FPGA_LOAD_SECURE)
 	.loads = zynqmp_loads,
 #endif
 	.info = zynqmp_pcap_info,
+	.str2flag = zynqmp_str2flag,
 };
diff --git a/include/xilinx.h b/include/xilinx.h
index d9e4b8da968..91179abe31f 100644
--- a/include/xilinx.h
+++ b/include/xilinx.h
@@ -60,6 +60,7 @@ struct xilinx_fpga_op {
 		     struct fpga_secure_info *fpga_sec_info);
 	int (*dump)(xilinx_desc *desc, const void *buf, size_t bsize);
 	int (*info)(xilinx_desc *desc);
+	int (*str2flag)(xilinx_desc *desc, const char *string);
 };
 
 /* Generic Xilinx Functions
-- 
2.36.1



More information about the U-Boot mailing list