summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/g/system.c7
-rw-r--r--chip/g/system_chip.h9
2 files changed, 14 insertions, 2 deletions
diff --git a/chip/g/system.c b/chip/g/system.c
index ac9a529d77..8495c43e6c 100644
--- a/chip/g/system.c
+++ b/chip/g/system.c
@@ -479,6 +479,13 @@ int system_process_retry_counter(void)
return corrupt_header(newer_image);
}
+void system_ensure_rollback(void)
+{
+ GWRITE_FIELD(PMU, LONG_LIFE_SCRATCH_WR_EN, REG0, 1);
+ GREG32(PMU, LONG_LIFE_SCRATCH0) = RW_BOOT_MAX_RETRY_COUNT + 1;
+ GWRITE_FIELD(PMU, LONG_LIFE_SCRATCH_WR_EN, REG0, 0);
+}
+
int system_rolling_reboot_suspected(void)
{
if (GREG32(PMU, LONG_LIFE_SCRATCH0) > 50) {
diff --git a/chip/g/system_chip.h b/chip/g/system_chip.h
index 251c2d3007..ce63f3eab8 100644
--- a/chip/g/system_chip.h
+++ b/chip/g/system_chip.h
@@ -57,8 +57,7 @@ int system_battery_cutoff_support_required(void);
*/
void system_update_rollback_mask(void);
-/*
- **
+/**
* Scan INFO1 rollback map and infomap fields of both RW and RW_B image
* headers, and return a string showing how many zeros are there at the base
* of in each of these objects.
@@ -68,4 +67,10 @@ void system_update_rollback_mask(void);
*/
void system_get_rollback_bits(char *value, size_t value_size);
+/**
+ * Set the rollback counter to a value which would ensure a rollback on the
+ * next boot.
+ */
+void system_ensure_rollback(void);
+
#endif /* __CROS_EC_SYSTEM_CHIP_H */