]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_fuse.c
sunxi: increase SYS_MONITOR_LEN
[karo-tx-uboot.git] / common / cmd_fuse.c
index f24c01c2d9ee29206f75d55cbec8b3a36cf73bcf..4d4f77a72d2c3725c19703f2e3b4ff1e1e32735e 100644 (file)
@@ -6,23 +6,7 @@
  * Copyright 2008 Silicon Turnkey Express, Inc.
  * Martha Marx <mmarx@silicontkx.com>
  *
- * 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+
  */
 
 #include <common.h>
@@ -49,15 +33,8 @@ static int confirm_prog(void)
                                        "what you are doing!\n"
                        "\nReally perform this fuse programming? <y/N>\n");
 
-       if (getc() == 'y') {
-               int c;
-
-               putc('y');
-               c = getc();
-               putc('\n');
-               if (c == '\r')
-                       return 1;
-       }
+       if (confirm_yesno())
+               return 1;
 
        puts("Fuse programming aborted\n");
        return 0;
@@ -86,13 +63,13 @@ static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                printf("Reading bank %u:\n", bank);
                for (i = 0; i < cnt; i++, word++) {
                        if (!(i % 4))
-                               printf("\nWord 0x%.8x:", word);
+                               printf("\nWord 0x%08x:", word);
 
                        ret = fuse_read(bank, word, &val);
                        if (ret)
                                goto err;
 
-                       printf(" %.8x", val);
+                       printf(" %08x", val);
                }
                putc('\n');
        } else if (!strcmp(op, "sense")) {
@@ -104,13 +81,13 @@ static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                printf("Sensing bank %u:\n", bank);
                for (i = 0; i < cnt; i++, word++) {
                        if (!(i % 4))
-                               printf("\nWord 0x%.8x:", word);
+                               printf("\nWord 0x%08x:", word);
 
                        ret = fuse_sense(bank, word, &val);
                        if (ret)
                                goto err;
 
-                       printf(" %.8x", val);
+                       printf(" %08x", val);
                }
                putc('\n');
        } else if (!strcmp(op, "prog")) {
@@ -121,7 +98,7 @@ static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                        if (strtou32(argv[i], 16, &val))
                                return CMD_RET_USAGE;
 
-                       printf("Programming bank %u word 0x%.8x to 0x%.8x...\n",
+                       printf("Programming bank %u word 0x%08x to 0x%08x...\n",
                                        bank, word, val);
                        if (!confirmed && !confirm_prog())
                                return CMD_RET_FAILURE;
@@ -137,8 +114,8 @@ static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                        if (strtou32(argv[i], 16, &val))
                                return CMD_RET_USAGE;
 
-                       printf("Overriding bank %u word 0x%.8x with "
-                                       "0x%.8x...\n", bank, word, val);
+                       printf("Overriding bank %u word 0x%08x with 0x%08x...\n",
+                               bank, word, val);
                        ret = fuse_override(bank, word, val);
                        if (ret)
                                goto err;
@@ -151,7 +128,7 @@ static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 
 err:
        puts("ERROR\n");
-       return ret;
+       return CMD_RET_FAILURE;
 }
 
 U_BOOT_CMD(