bootcycle: add resetcycle cmd - reset the bootcycle counter to 0
This commit is contained in:
parent
6ea75b8c9c
commit
5fc9ba0246
|
@ -58,7 +58,7 @@ static int valid_boot_cycle(struct sram_boot_cycle *sram)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_boot_cycle(struct sram_boot_cycle *sram)
|
static void reset_boot_cycle(struct sram_boot_cycle *sram)
|
||||||
{
|
{
|
||||||
sram->magic = BOOT_CYCLE_MAGIC;
|
sram->magic = BOOT_CYCLE_MAGIC;
|
||||||
sram->version = BOOT_CYCLE_VERSION;
|
sram->version = BOOT_CYCLE_VERSION;
|
||||||
|
@ -69,7 +69,7 @@ static void init_boot_cycle(struct sram_boot_cycle *sram)
|
||||||
void increase_boot_cycle(struct sram_boot_cycle *sram)
|
void increase_boot_cycle(struct sram_boot_cycle *sram)
|
||||||
{
|
{
|
||||||
if (!valid_boot_cycle(sram))
|
if (!valid_boot_cycle(sram))
|
||||||
init_boot_cycle(sram);
|
reset_boot_cycle(sram);
|
||||||
|
|
||||||
sram->counter++;
|
sram->counter++;
|
||||||
sram->crc = (uint32_t) crc32(0xdeadbeef, (void *)sram, sizeof(*sram) - 4);
|
sram->crc = (uint32_t) crc32(0xdeadbeef, (void *)sram, sizeof(*sram) - 4);
|
||||||
|
@ -80,6 +80,11 @@ int do_inccycle(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
|
||||||
return CMD_RET_SUCCESS;
|
return CMD_RET_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int do_resetcycle(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
|
||||||
|
reset_boot_cycle((void *) SRAM_BOOT_CYCLE);
|
||||||
|
return CMD_RET_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* report failure when we need to go to rescue */
|
/* report failure when we need to go to rescue */
|
||||||
int do_checkcycle(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
int do_checkcycle(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -123,4 +128,10 @@ U_BOOT_CMD(
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
U_BOOT_CMD(
|
||||||
|
resetcycle, 1, 0, do_resetcycle,
|
||||||
|
"resetcycle - reset boot cycle counter to 0\n",
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
#endif /* CFG_CMD_BOOTCYCLE */
|
#endif /* CFG_CMD_BOOTCYCLE */
|
||||||
|
|
Loading…
Reference in New Issue