Merge git://git.denx.de/u-boot-imx
[oweals/u-boot.git] / drivers / fpga / fpga.c
index d94eb5cc25c4fce6c4df48bd22c39a659b709378..ac01612d7518549ca4c245ef997adbb3919eb7ef 100644 (file)
@@ -31,7 +31,7 @@ static void fpga_no_sup(char *fn, char *msg)
        else if (msg)
                printf("No support for %s.\n", msg);
        else
-               printf("No FPGA suport!\n");
+               printf("No FPGA support!\n");
 }
 
 
@@ -120,7 +120,7 @@ static int fpga_dev_info(int devnum)
 }
 
 /*
- * fgpa_init is usually called from misc_init_r() and MUST be called
+ * fpga_init is usually called from misc_init_r() and MUST be called
  * before any of the other fpga functions are used.
  */
 void fpga_init(void)
@@ -148,20 +148,21 @@ int fpga_add(fpga_type devtype, void *desc)
 {
        int devnum = FPGA_INVALID_DEVICE;
 
+       if (!desc) {
+               printf("%s: NULL device descriptor\n", __func__);
+               return devnum;
+       }
+
        if (next_desc < 0) {
                printf("%s: FPGA support not initialized!\n", __func__);
        } else if ((devtype > fpga_min_type) && (devtype < fpga_undefined)) {
-               if (desc) {
-                       if (next_desc < CONFIG_MAX_FPGA_DEVICES) {
-                               devnum = next_desc;
-                               desc_table[next_desc].devtype = devtype;
-                               desc_table[next_desc++].devdesc = desc;
-                       } else {
-                               printf("%s: Exceeded Max FPGA device count\n",
-                                      __func__);
-                       }
+               if (next_desc < CONFIG_MAX_FPGA_DEVICES) {
+                       devnum = next_desc;
+                       desc_table[next_desc].devtype = devtype;
+                       desc_table[next_desc++].devdesc = desc;
                } else {
-                       printf("%s: NULL device descriptor\n", __func__);
+                       printf("%s: Exceeded Max FPGA device count\n",
+                              __func__);
                }
        } else {
                printf("%s: Unsupported FPGA type %d\n", __func__, devtype);
@@ -170,6 +171,15 @@ int fpga_add(fpga_type devtype, void *desc)
        return devnum;
 }
 
+/*
+ * Return 1 if the fpga data is partial.
+ * This is only required for fpga drivers that support bitstream_type.
+ */
+int __weak fpga_is_partial_data(int devnum, size_t img_len)
+{
+       return 0;
+}
+
 /*
  * Convert bitstream data and load into the fpga
  */