All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
To: u-boot@lists.denx.de
Cc: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>,
	Jorge Ramirez-Ortiz <jorge@foundries.io>,
	Michal Simek <michal.simek@xilinx.com>,
	Ricardo Salveti <ricardo@foundries.io>,
	Igor Opaniuk <igor.opaniuk@foundries.io>,
	Oleksandr Suvorov <oleksandr.suvorov@foundries.io>,
	Michal Simek <michal.simek@amd.com>
Subject: [PATCH v9 05/13] fpga: add fpga_compatible2flag
Date: Wed,  1 Jun 2022 11:46:15 +0300	[thread overview]
Message-ID: <20220601084623.16006-6-oleksandr.suvorov@foundries.io> (raw)
In-Reply-To: <20220601084623.16006-5-oleksandr.suvorov@foundries.io>

Add a "compatible" string to binary flag converter, which uses
a callback str2flag() of given FPGA driver if available.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
---

(no changes since v1)

 drivers/fpga/fpga.c | 26 ++++++++++++++++++++++++++
 include/fpga.h      |  1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c
index 3b0a44b2420..fbfdd406e3b 100644
--- a/drivers/fpga/fpga.c
+++ b/drivers/fpga/fpga.c
@@ -356,3 +356,29 @@ int fpga_info(int devnum)
 
 	return fpga_dev_info(devnum);
 }
+
+int fpga_compatible2flag(int devnum, const char *compatible)
+{
+	const fpga_desc * const desc = fpga_get_desc(devnum);
+
+	if (!desc)
+		return FPGA_FAIL;
+
+	switch (desc->devtype) {
+	case fpga_xilinx:
+#if defined(CONFIG_FPGA_XILINX)
+	{
+		xilinx_desc *xdesc = (xilinx_desc *)desc->devdesc;
+
+		if (xdesc->operations->str2flag)
+			return xdesc->operations->str2flag(xdesc, compatible);
+	}
+#else
+		return FPGA_FAIL;
+#endif
+	default:
+		break;
+	}
+
+	return 0;
+}
diff --git a/include/fpga.h b/include/fpga.h
index ec5144334df..2172b0d015e 100644
--- a/include/fpga.h
+++ b/include/fpga.h
@@ -75,5 +75,6 @@ int fpga_dump(int devnum, const void *buf, size_t bsize);
 int fpga_info(int devnum);
 const fpga_desc *const fpga_validate(int devnum, const void *buf,
 				     size_t bsize, char *fn);
+int fpga_compatible2flag(int devnum, const char *compatible);
 
 #endif	/* _FPGA_H_ */
-- 
2.36.1


  reply	other threads:[~2022-06-01  8:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01  8:46 [PATCH v9 00/13] fpga: zynqmp: Adding support of loading authenticated images Oleksandr Suvorov
2022-06-01  8:46 ` [PATCH v9 01/13] fpga: add option for loading FPGA secure bitstreams Oleksandr Suvorov
2022-06-01  8:46   ` [PATCH v9 02/13] fpga: xilinx: add missed identifier names Oleksandr Suvorov
2022-06-01  8:46     ` [PATCH v9 03/13] fpga: xilinx: add bitstream flags to driver desc Oleksandr Suvorov
2022-06-01  8:46       ` [PATCH v9 04/13] fpga: zynqmp: add str2flags call Oleksandr Suvorov
2022-06-01  8:46         ` Oleksandr Suvorov [this message]
2022-06-01  8:46           ` [PATCH v9 06/13] fpga: xilinx: pass compatible flags to xilinx_load() Oleksandr Suvorov
2022-06-01  8:46             ` [PATCH v9 07/13] fpga: pass compatible flags to fpga_load() Oleksandr Suvorov
2022-06-01  8:46               ` [PATCH v9 08/13] spl: fit: pass real " Oleksandr Suvorov
2022-06-01  8:46                 ` [PATCH v9 09/13] fpga: xilinx: pass compatible flags to load() callback Oleksandr Suvorov
2022-06-01  8:46                   ` [PATCH v9 10/13] fpga: zynqmp: optimize zynqmppl_load() code Oleksandr Suvorov
2022-06-01  8:46                     ` [PATCH v9 11/13] fpga: zynqmp: add bitstream compatible checking Oleksandr Suvorov
2022-06-01  8:46                       ` [PATCH v9 12/13] fpga: zynqmp: support loading authenticated images Oleksandr Suvorov
2022-06-01  8:46                         ` [PATCH v9 13/13] fpga: zynqmp: support loading encrypted bitfiles Oleksandr Suvorov
2022-06-07 12:44                         ` [PATCH v9 12/13] fpga: zynqmp: support loading authenticated images Michal Simek
2022-06-07 12:14                 ` [PATCH v9 08/13] spl: fit: pass real compatible flags to fpga_load() Michal Simek
2022-06-07 12:11           ` [PATCH v9 05/13] fpga: add fpga_compatible2flag Michal Simek
2022-06-07 13:14             ` Oleksandr Suvorov
2022-06-07 11:31       ` [PATCH v9 03/13] fpga: xilinx: add bitstream flags to driver desc Michal Simek
2022-06-07 11:37         ` Oleksandr Suvorov
2022-06-07 12:46           ` Michal Simek
2022-06-07 13:03             ` Oleksandr Suvorov
2022-06-07 11:54       ` Michal Simek
2022-06-02 15:11 ` [PATCH v9 00/13] fpga: zynqmp: Adding support of loading authenticated images Oleksandr Suvorov
2022-06-07 13:01   ` Adrian Fiergolski
2022-06-07 13:11     ` Oleksandr Suvorov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220601084623.16006-6-oleksandr.suvorov@foundries.io \
    --to=oleksandr.suvorov@foundries.io \
    --cc=adrian.fiergolski@fastree3d.com \
    --cc=igor.opaniuk@foundries.io \
    --cc=jorge@foundries.io \
    --cc=michal.simek@amd.com \
    --cc=michal.simek@xilinx.com \
    --cc=ricardo@foundries.io \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.