]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_load.c
karo: tx6: factor out PMIC initialization
[karo-tx-uboot.git] / common / cmd_load.c
index 2c8dab1a0a6618dda63c174ff3bc6801b11b617b..0ce949683e257a4488ac6f9e6e9c69f7ed0f56f6 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2000-2004
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -149,7 +133,6 @@ static ulong load_serial(long offset)
        int     type;                           /* return code for record type  */
        ulong   addr;                           /* load address from S-Record   */
        ulong   size;                           /* number of bytes transferred  */
-       char    buf[32];
        ulong   store_addr;
        ulong   start_addr = ~0;
        ulong   end_addr   =  0;
@@ -198,8 +181,7 @@ static ulong load_serial(long offset)
                            start_addr, end_addr, size, size
                    );
                    flush_cache(start_addr, size);
-                   sprintf(buf, "%lX", size);
-                   setenv("filesize", buf);
+                   setenv_hex("filesize", size);
                    return (addr);
                case SREC_START:
                    break;
@@ -519,7 +501,6 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
 static ulong load_serial_bin(ulong offset)
 {
        int size, i;
-       char buf[32];
 
        set_kerm_bin_mode((ulong *) offset);
        size = k_recv();
@@ -539,8 +520,7 @@ static ulong load_serial_bin(ulong offset)
        flush_cache(offset, size);
 
        printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
-       sprintf(buf, "%X", size);
-       setenv("filesize", buf);
+       setenv_hex("filesize", size);
 
        return offset;
 }
@@ -965,7 +945,6 @@ static int getcxmodem(void) {
 static ulong load_serial_ymodem(ulong offset)
 {
        int size;
-       char buf[32];
        int err;
        int res;
        connection_info_t info;
@@ -1012,8 +991,7 @@ static ulong load_serial_ymodem(ulong offset)
        flush_cache(offset, size);
 
        printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
-       sprintf(buf, "%X", size);
-       setenv("filesize", buf);
+       setenv_hex("filesize", size);
 
        return offset;
 }
@@ -1064,8 +1042,8 @@ U_BOOT_CMD(
        "    - save S-Record file over serial line with offset 'off' and size 'size'"
 );
 #endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */
-#endif
-#endif
+#endif /* CONFIG_CMD_SAVES */
+#endif /* CONFIG_CMD_LOADS */
 
 
 #if defined(CONFIG_CMD_LOADB)
@@ -1085,7 +1063,7 @@ U_BOOT_CMD(
        " with offset 'off' and baudrate 'baud'"
 );
 
-#endif
+#endif /* CONFIG_CMD_LOADB */
 
 /* -------------------------------------------------------------------- */
 
@@ -1115,4 +1093,4 @@ U_BOOT_CMD(
        "[on|off]"
 );
 
-#endif
+#endif /* CONFIG_CMD_HWFLOW */