summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDino Li <Dino.Li@ite.com.tw>2021-08-11 15:42:03 +0800
committerCommit Bot <commit-bot@chromium.org>2021-08-13 02:31:47 +0000
commita388377c7699bcbca57bb495a0e55ea7543b394d (patch)
tree1e4a19811752d76e4c0c79e02a776a642d0fd2de
parentde26838f8958b258d84ad2f2dbda790d6fdce1ce (diff)
downloadchrome-ec-a388377c7699bcbca57bb495a0e55ea7543b394d.tar.gz
zephyr: asurada: reload watchdog on each flash write
If AP sends write flash command continuously, EC might not have chance to go back to hook task to touch watchdog. Reload watchdog on each flash write to prevent the reset. BRANCH=none BUG=b:195954913 TEST=no watchdog reset during software sync. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I27bf921f1162f6d91b97918162c938985933f432 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088972 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/drivers/cros_flash/cros_flash_it8xxx2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c b/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
index 3cacca13cc..f238b1557b 100644
--- a/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
+++ b/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
@@ -178,6 +178,14 @@ static int cros_flash_it8xxx2_write(const struct device *dev, int offset,
return -EACCES;
}
+ /*
+ * If AP sends write flash command continuously, EC might not have
+ * chance to go back to hook task to touch watchdog. Reload watchdog
+ * on each flash write to prevent the reset.
+ */
+ if (IS_ENABLED(CONFIG_PLATFORM_EC_WATCHDOG))
+ watchdog_reload();
+
return flash_write(flash_controller, offset, src_data, size);
}