diff options
Diffstat (limited to 'src/flash/nor/fm4.c')
-rw-r--r-- | src/flash/nor/fm4.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/flash/nor/fm4.c b/src/flash/nor/fm4.c index 7e3a1c5..4daec78 100644 --- a/src/flash/nor/fm4.c +++ b/src/flash/nor/fm4.c @@ -98,14 +98,15 @@ static int fm4_enter_flash_cpu_rom_mode(struct target *target) return ERROR_OK; } -static int fm4_flash_erase(struct flash_bank *bank, int first, int last) +static int fm4_flash_erase(struct flash_bank *bank, unsigned int first, + unsigned int last) { struct target *target = bank->target; struct working_area *workarea; struct reg_param reg_params[4]; struct armv7m_algorithm armv7m_algo; unsigned i; - int retval, sector; + int retval; const uint8_t erase_sector_code[] = { #include "../../../contrib/loaders/flash/fm4/erase.inc" }; @@ -115,7 +116,7 @@ static int fm4_flash_erase(struct flash_bank *bank, int first, int last) return ERROR_TARGET_NOT_HALTED; } - LOG_DEBUG("Spansion FM4 erase sectors %d to %d", first, last); + LOG_DEBUG("Spansion FM4 erase sectors %u to %u", first, last); retval = fm4_disable_hw_watchdog(target); if (retval != ERROR_OK) @@ -145,7 +146,7 @@ static int fm4_flash_erase(struct flash_bank *bank, int first, int last) init_reg_param(®_params[2], "r2", 32, PARAM_OUT); init_reg_param(®_params[3], "r3", 32, PARAM_IN); - for (sector = first; sector <= last; sector++) { + for (unsigned int sector = first; sector <= last; sector++) { uint32_t addr = bank->base + bank->sectors[sector].offset; uint32_t result; @@ -347,7 +348,6 @@ static int mb9bf_probe(struct flash_bank *bank) { struct fm4_flash_bank *fm4_bank = bank->driver_priv; uint32_t flash_addr = bank->base; - int i; switch (fm4_bank->variant) { case mb9bfx64: @@ -369,10 +369,10 @@ static int mb9bf_probe(struct flash_bank *bank) return ERROR_FLASH_OPER_UNSUPPORTED; } - LOG_DEBUG("%d sectors", bank->num_sectors); + LOG_DEBUG("%u sectors", bank->num_sectors); bank->sectors = calloc(bank->num_sectors, sizeof(struct flash_sector)); - for (i = 0; i < bank->num_sectors; i++) { + for (unsigned int i = 0; i < bank->num_sectors; i++) { if (i < 4) bank->sectors[i].size = 8 * 1024; else if (i == 4) @@ -409,7 +409,8 @@ static int s6e2cc_probe(struct flash_bank *bank) struct fm4_flash_bank *fm4_bank = bank->driver_priv; uint32_t u32_value; uint32_t flash_addr = bank->base; - int i, retval, num_sectors, num_extra_sectors; + int retval; + unsigned int i, num_extra_sectors, num_sectors; retval = target_read_u32(target, DFCTRLR, &u32_value); if (retval != ERROR_OK) @@ -435,7 +436,7 @@ static int s6e2cc_probe(struct flash_bank *bank) num_extra_sectors = (fm4_bank->macro_nr == 0) ? 1 : 4; bank->num_sectors = num_sectors + num_extra_sectors; - LOG_DEBUG("%d sectors", bank->num_sectors); + LOG_DEBUG("%u sectors", bank->num_sectors); bank->sectors = calloc(bank->num_sectors, sizeof(struct flash_sector)); for (i = 0; i < num_sectors; i++) { @@ -466,12 +467,11 @@ static int s6e2cc_probe(struct flash_bank *bank) static int s6e2dh_probe(struct flash_bank *bank) { uint32_t flash_addr = bank->base; - int i; bank->num_sectors = 10; bank->sectors = calloc(bank->num_sectors, sizeof(struct flash_sector)); - for (i = 0; i < bank->num_sectors; i++) { + for (unsigned int i = 0; i < bank->num_sectors; i++) { if (i < 4) bank->sectors[i].size = 8 * 1024; else if (i == 4) |