Merge tag 'mmc-2021-2-19' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
[pandora-u-boot.git] / common / update.c
index 808be08..f084895 100644 (file)
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include <mtd/cfi_flash.h>
 
-#ifdef CONFIG_DFU_TFTP
+#if defined(CONFIG_DFU_TFTP) || defined(CONFIG_UPDATE_TFTP)
 /* env variable holding the location of the update file */
 #define UPDATE_FILE_ENV                "updatefile"
 
@@ -99,7 +99,6 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 
        return rv;
 }
-#endif /* CONFIG_DFU_TFTP */
 
 #ifdef CONFIG_MTD_NOR_FLASH
 static int update_flash_protect(int prot, ulong addr_first, ulong addr_last)
@@ -216,6 +215,7 @@ static int update_flash(ulong addr_source, ulong addr_first, ulong size)
 #endif
        return 0;
 }
+#endif /* CONFIG_DFU_TFTP || CONFIG_UPDATE_TFTP */
 
 static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
                                                ulong *fladdr, ulong *size)
@@ -233,7 +233,7 @@ static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
        return 0;
 }
 
-#ifdef CONFIG_DFU_TFTP
+#if defined(CONFIG_DFU_TFTP) || defined(CONFIG_UPDATE_TFTP)
 int update_tftp(ulong addr, char *interface, char *devstring)
 {
        char *filename, *env_addr, *fit_image_name;
@@ -286,7 +286,7 @@ int update_tftp(ulong addr, char *interface, char *devstring)
 got_update_file:
        fit = map_sysmem(addr, 0);
 
-       if (!fit_check_format((void *)fit)) {
+       if (fit_check_format((void *)fit, IMAGE_SIZE_INVAL)) {
                printf("Bad FIT format of the update file, aborting "
                                                        "auto-update\n");
                return 1;
@@ -340,7 +340,7 @@ next_node:
 
        return ret;
 }
-#endif /* CONFIG_DFU_UPDATE */
+#endif /* CONFIG_DFU_UPDATE || CONFIG_UPDATE_TFTP */
 
 #ifdef CONFIG_UPDATE_FIT
 /**
@@ -363,7 +363,7 @@ int fit_update(const void *fit)
        if (!fit)
                return -EINVAL;
 
-       if (!fit_check_format((void *)fit)) {
+       if (fit_check_format((void *)fit, IMAGE_SIZE_INVAL)) {
                printf("Bad FIT format of the update file, aborting auto-update\n");
                return -EINVAL;
        }