diff --git a/u-boot/common/cmd_bootcycle.c b/u-boot/common/cmd_bootcycle.c index 1860f4bcd0..1bb835f38b 100644 --- a/u-boot/common/cmd_bootcycle.c +++ b/u-boot/common/cmd_bootcycle.c @@ -66,17 +66,28 @@ static void reset_boot_cycle(struct sram_boot_cycle *sram) sram->crc = (uint32_t) crc32(0xdeadbeef, (void *)sram, sizeof(*sram) - 4); } -void increase_boot_cycle(struct sram_boot_cycle *sram) +void increase_boot_cycle(struct sram_boot_cycle *sram, uint32_t value) { if (!valid_boot_cycle(sram)) reset_boot_cycle(sram); - sram->counter++; + sram->counter += value; sram->crc = (uint32_t) crc32(0xdeadbeef, (void *)sram, sizeof(*sram) - 4); } int do_inccycle(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { - increase_boot_cycle((void *) SRAM_BOOT_CYCLE); + uint32_t value = 1; + + if (argc == 2) { + int given_value = (int)simple_strtol(argv[1], NULL, 10); + if (given_value > 0) { + value = given_value; + } else { + printf("Ignoring invalid argument %s\n", argv[1]); + } + } + + increase_boot_cycle((void *) SRAM_BOOT_CYCLE, value); return CMD_RET_SUCCESS; } @@ -123,7 +134,7 @@ U_BOOT_CMD( ); U_BOOT_CMD( - inccycle, 1, 0, do_inccycle, + inccycle, 2, 0, do_inccycle, "inccycle - increase boot cycle counter\n", NULL );