Merge tag 'mmc-2021-2-19' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
[pandora-u-boot.git] / common / flash.c
index 5f155ae..bb82385 100644 (file)
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <flash.h>
+#include <log.h>
+#include <uuid.h>
 
 #include <mtd/cfi_flash.h>
 
@@ -24,7 +26,7 @@ extern flash_info_t  flash_info[]; /* info for FLASH chips */
  * If necessary you have to map the second bank at lower addresses.
  */
 void
-flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
+flash_protect(int flag, ulong from, ulong to, flash_info_t *info)
 {
        ulong b_end;
        short s_end;
@@ -38,10 +40,10 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
        s_end = info->sector_count - 1; /* index of last sector */
        b_end = info->start[0] + info->size - 1;        /* bank end address */
 
-       debug ("flash_protect %s: from 0x%08lX to 0x%08lX\n",
-               (flag & FLAG_PROTECT_SET) ? "ON" :
-                       (flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
-               from, to);
+       debug("%s %s: from 0x%08lX to 0x%08lX\n", __func__,
+             (flag & FLAG_PROTECT_SET) ? "ON" :
+             (flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
+             from, to);
 
        /* There is nothing to do if we have no data about the flash
         * or the protect range and flash range don't overlap.
@@ -66,7 +68,7 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
 #else
                                info->protect[i] = 0;
 #endif /* CONFIG_SYS_FLASH_PROTECTION */
-                               debug ("protect off %d\n", i);
+                               debug("protect off %d\n", i);
                        }
                        else if (flag & FLAG_PROTECT_SET) {
 #if defined(CONFIG_SYS_FLASH_PROTECTION)
@@ -74,7 +76,7 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
 #else
                                info->protect[i] = 1;
 #endif /* CONFIG_SYS_FLASH_PROTECTION */
-                               debug ("protect on %d\n", i);
+                               debug("protect on %d\n", i);
                        }
                }
        }
@@ -84,7 +86,7 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
  */
 
 flash_info_t *
-addr2info (ulong addr)
+addr2info(ulong addr)
 {
        flash_info_t *info;
        int i;
@@ -119,12 +121,12 @@ addr2info (ulong addr)
  *                     (only some targets require alignment)
  */
 int
-flash_write (char *src, ulong addr, ulong cnt)
+flash_write(char *src, ulong addr, ulong cnt)
 {
        int i;
        ulong         end        = addr + cnt - 1;
-       flash_info_t *info_first = addr2info (addr);
-       flash_info_t *info_last  = addr2info (end );
+       flash_info_t *info_first = addr2info(addr);
+       flash_info_t *info_last  = addr2info(end);
        flash_info_t *info;
        __maybe_unused char *src_orig = src;
        __maybe_unused char *addr_orig = (char *)addr;