X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=u-boot%2Fcommon%2Fcmd_flash.c;h=145729d999b61f544be9e85f6c05d01f40a3dcd4;hb=2172f8b55a945dbae66516701fd253001f365025;hp=39c710bb9417a8c896750fbf8829c1a9ef57bc09;hpb=b78dd0b24b119c0ff9caf174a6a76317c4d4f3b9;p=oweals%2Fu-boot_mod.git diff --git a/u-boot/common/cmd_flash.c b/u-boot/common/cmd_flash.c index 39c710b..145729d 100644 --- a/u-boot/common/cmd_flash.c +++ b/u-boot/common/cmd_flash.c @@ -27,7 +27,7 @@ #include #include -#if (CONFIG_COMMANDS & CFG_CMD_FLASH) +#if defined(CONFIG_CMD_FLASH) extern flash_info_t flash_info[]; /* info for FLASH chips */ @@ -180,7 +180,7 @@ static int addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last if(!found){ /* error, addres not in flash */ - printf("## Error: end address (0x%08lx) not in FLASH!\n", *addr_last); + printf_err("end address (0x%08lx) not in FLASH!\n", *addr_last); return(-1); } @@ -240,14 +240,14 @@ static int flash_fill_sect_ranges(ulong addr_first, ulong addr_last, int *s_firs if(addr_last > b_end){ s_last[bank] = s_end; } else { - puts("## Error: end address not on sector boundary\n"); + printf_err("end address not on sector boundary\n"); rcode = 1; break; } } if(s_last[bank] < s_first[bank]){ - puts("## Error: end sector precedes start sector\n"); + printf_err("end sector precedes start sector\n"); rcode = 1; break; } @@ -256,11 +256,11 @@ static int flash_fill_sect_ranges(ulong addr_first, ulong addr_last, int *s_firs addr_first = (sect == s_end) ? b_end + 1 : info->start[sect + 1]; (*s_count) += s_last[bank] - s_first[bank] + 1; } else if(addr_first >= info->start[0] && addr_first < b_end){ - puts("## Error: start address not on sector boundary\n"); + printf_err("start address not on sector boundary\n"); rcode = 1; break; } else if(s_last[bank] >= 0){ - puts("## Error: cannot span across banks when they are mapped in reverse order\n"); + printf_err("cannot span across banks when they are mapped in reverse order\n"); rcode = 1; break; } @@ -272,8 +272,9 @@ static int flash_fill_sect_ranges(ulong addr_first, ulong addr_last, int *s_firs int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){ flash_info_t *info; ulong bank, addr_first, addr_last; - int n, sect_first, sect_last; + int n; int rcode = 0; + int sect_first = 0, sect_last = 0; if(argc < 2){ print_cmd_help(cmdtp); @@ -292,7 +293,7 @@ int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){ if((n = abbrev_spec(argv[1], &info, §_first, §_last)) != 0){ if(n < 0){ - puts("## Error: bad sector spec\n"); + printf_err("bad sector spec\n"); return(1); } printf("Erase FLASH sectors %d-%d in bank #%d ", sect_first, sect_last, (info - flash_info) + 1); @@ -309,7 +310,7 @@ int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){ bank = simple_strtoul(argv[2], NULL, 16); if((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)){ - printf("## Error: only FLASH banks #1...#%d supported\n", CFG_MAX_FLASH_BANKS); + printf_err("only FLASH banks #1...#%d supported\n", CFG_MAX_FLASH_BANKS); return(1); } @@ -320,7 +321,7 @@ int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){ } if(addr_spec(argv[1], argv[2], &addr_first, &addr_last) < 0){ - printf("## Error: bad address format\n"); + printf_err("bad address format\n"); return(1); } @@ -353,7 +354,7 @@ int flash_sect_erase(ulong addr_first, ulong addr_last){ } printf("Erased sectors: %d\n\n", erased); } else if(rcode == 0){ - puts("## Error: start and/or end address not on sector boundary\n"); + printf_err("start and/or end address not on sector boundary\n"); rcode = 1; } return(rcode); @@ -373,4 +374,4 @@ U_BOOT_CMD(erase, 3, 1, do_flerase, "erase FLASH memory\n", "erase all\n" "\t- erase all FLASH banks\n"); -#endif /* CFG_CMD_FLASH */ +#endif /* CONFIG_CMD_FLASH */