]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fpga: pass compatible flags to fpga_load()
authorOleksandr Suvorov <oleksandr.suvorov@foundries.io>
Fri, 22 Jul 2022 14:16:07 +0000 (17:16 +0300)
committerMichal Simek <michal.simek@amd.com>
Tue, 26 Jul 2022 07:34:21 +0000 (09:34 +0200)
These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

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-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>
boot/image-board.c
cmd/fpga.c
common/spl/spl_fit.c
drivers/fpga/fpga.c
drivers/fpga/xilinx.c
include/fpga.h

index 03c866b5fa8e18bf9d915e7cbc0b204a893c2e56..b846bff2491e3bd038b7793cb02cd1b7b6017bfe 100644 (file)
@@ -705,14 +705,14 @@ int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
                                                 img_len, BIT_FULL);
                        if (err)
                                err = fpga_load(devnum, (const void *)img_data,
-                                               img_len, BIT_FULL);
+                                               img_len, BIT_FULL, 0);
                } else {
                        name = "partial";
                        err = fpga_loadbitstream(devnum, (char *)img_data,
                                                 img_len, BIT_PARTIAL);
                        if (err)
                                err = fpga_load(devnum, (const void *)img_data,
-                                               img_len, BIT_PARTIAL);
+                                               img_len, BIT_PARTIAL, 0);
                }
 
                if (err)
index 3fdd0b35e80f3cb00328dc5aa5e269a2b54a5e7f..c4651dd403ea20e55970ca6e7331cbca83b0e98f 100644 (file)
@@ -178,7 +178,7 @@ static int do_fpga_load(struct cmd_tbl *cmdtp, int flag, int argc,
        if (ret)
                return ret;
 
-       return fpga_load(dev, (void *)fpga_data, data_size, BIT_FULL);
+       return fpga_load(dev, (void *)fpga_data, data_size, BIT_FULL, 0);
 }
 
 static int do_fpga_loadb(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -209,7 +209,7 @@ static int do_fpga_loadp(struct cmd_tbl *cmdtp, int flag, int argc,
        if (ret)
                return ret;
 
-       return fpga_load(dev, (void *)fpga_data, data_size, BIT_PARTIAL);
+       return fpga_load(dev, (void *)fpga_data, data_size, BIT_PARTIAL, 0);
 }
 #endif
 
@@ -315,7 +315,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc,
                        data_size = image_get_data_size(hdr);
                }
                return fpga_load(dev, (void *)data, data_size,
-                                 BIT_FULL);
+                                 BIT_FULL, 0);
        }
 #endif
 #if defined(CONFIG_FIT)
@@ -355,7 +355,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc,
                        return CMD_RET_FAILURE;
                }
 
-               return fpga_load(dev, fit_data, data_size, BIT_FULL);
+               return fpga_load(dev, fit_data, data_size, BIT_FULL, 0);
        }
 #endif
        default:
index 1bbf824684ae3b4b2efe86883a27ee7a04a0c4c3..3c5a91916cc9caad84f9b6c7feb105051c35988a 100644 (file)
@@ -581,6 +581,8 @@ static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node,
 {
        const char *compatible;
        int ret;
+       int devnum = 0;
+       int flags = 0;
 
        debug("FPGA bitstream at: %x, size: %x\n",
              (u32)fpga_image->load_addr, fpga_image->size);
@@ -591,8 +593,8 @@ static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node,
        else if (strcmp(compatible, "u-boot,fpga-legacy"))
                printf("Ignoring compatible = %s property\n", compatible);
 
-       ret = fpga_load(0, (void *)fpga_image->load_addr, fpga_image->size,
-                       BIT_FULL);
+       ret = fpga_load(devnum, (void *)fpga_image->load_addr,
+                       fpga_image->size, BIT_FULL, flags);
        if (ret) {
                printf("%s: Cannot load the image to the FPGA\n", __func__);
                return ret;
index efbac9f0c47192b1486c517296089392c71eccd6..185bd547cb5e4409c23bfc20c2dd352b4f406079 100644 (file)
@@ -252,7 +252,8 @@ int fpga_loads(int devnum, const void *buf, size_t size,
 /*
  * Generic multiplexing code
  */
-int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype)
+int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype,
+             int flags)
 {
        int ret_val = FPGA_FAIL;           /* assume failure */
        const fpga_desc *desc = fpga_validate(devnum, buf, bsize,
@@ -263,7 +264,7 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype)
                case fpga_xilinx:
 #if defined(CONFIG_FPGA_XILINX)
                        ret_val = xilinx_load(desc->devdesc, buf, bsize,
-                                             bstype, 0);
+                                             bstype, flags);
 #else
                        fpga_no_sup((char *)__func__, "Xilinx devices");
 #endif
index 5dd721575ec6fdacefe8484807904b3473adb214..d9951ca3ecff44814570433c7bc191047a66b30d 100644 (file)
@@ -135,7 +135,7 @@ int fpga_loadbitstream(int devnum, char *fpgadata, size_t size,
        dataptr += 4;
        printf("  bytes in bitstream = %d\n", swapsize);
 
-       return fpga_load(devnum, dataptr, swapsize, bstype);
+       return fpga_load(devnum, dataptr, swapsize, bstype, 0);
 }
 
 int xilinx_load(xilinx_desc *desc, const void *buf, size_t bsize,
index ec5144334df1f393930ca9e09b9c167e8d86b6d0..6365e1569e3e0a144e09c7bbc56b49bd40f89ad6 100644 (file)
@@ -64,7 +64,7 @@ int fpga_count(void);
 const fpga_desc *const fpga_get_desc(int devnum);
 int fpga_is_partial_data(int devnum, size_t img_len);
 int fpga_load(int devnum, const void *buf, size_t bsize,
-             bitstream_type bstype);
+             bitstream_type bstype, int flags);
 int fpga_fsload(int devnum, const void *buf, size_t size,
                fpga_fs_info *fpga_fsinfo);
 int fpga_loads(int devnum, const void *buf, size_t size,