diff options
author | Oleksandr Suvorov <oleksandr.suvorov@foundries.io> | 2022-07-22 17:16:08 +0300 |
---|---|---|
committer | Michal Simek <michal.simek@amd.com> | 2022-07-26 10:34:21 +0300 |
commit | 2c60514d9aecf7fbbbe3c4cb3a4a4acc421e5239 (patch) | |
tree | 69e88db3a21c5a88aa0f6261532696c300b4cce8 /drivers/fpga | |
parent | 282eed50ecb73c20dd35bf3ea7a579e79b20cd54 (diff) | |
download | u-boot-2c60514d9aecf7fbbbe3c4cb3a4a4acc421e5239.tar.xz |
fpga: add fpga_compatible2flag
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>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-8-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'drivers/fpga')
-rw-r--r-- | drivers/fpga/fpga.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c index 185bd547cb..4db5c0a91e 100644 --- a/drivers/fpga/fpga.c +++ b/drivers/fpga/fpga.c @@ -357,3 +357,29 @@ int fpga_info(int devnum) return fpga_dev_info(devnum); } + +#if CONFIG_IS_ENABLED(FPGA_LOAD_SECURE) +int fpga_compatible2flag(int devnum, const char *compatible) +{ + const fpga_desc * const desc = fpga_get_desc(devnum); + + if (!desc) + return 0; + + switch (desc->devtype) { +#if defined(CONFIG_FPGA_XILINX) + case fpga_xilinx: + { + xilinx_desc *xdesc = (xilinx_desc *)desc->devdesc; + + if (xdesc->operations && xdesc->operations->str2flag) + return xdesc->operations->str2flag(xdesc, compatible); + } +#endif + default: + break; + } + + return 0; +} +#endif |