summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDino Li <Dino.Li@ite.com.tw>2020-09-29 18:42:49 +0800
committerCommit Bot <commit-bot@chromium.org>2020-10-13 05:21:46 +0000
commit7ae6bda8bd44aa8a906f42cbaa33710878247e5a (patch)
tree7325cc26b5d5717b0f437553538f0b86e3e72016
parent1e41b8c4b09c42898358a67db8f75a50181c3621 (diff)
downloadchrome-ec-7ae6bda8bd44aa8a906f42cbaa33710878247e5a.tar.gz
it83xx/flash: add reload watchdog to prevent the reset
If requested erase size is too large at one time on KGD flash, we need to reload watchdog to prevent the reset. BUG=b:168869304 BRANCH=none TEST=ectool flasherase 0x80000 0x80000 Change-Id: I9a34b8132e17e4ee0a90874d6341ac1e4a3b60c1 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2438072 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--chip/it83xx/flash.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/chip/it83xx/flash.c b/chip/it83xx/flash.c
index c0e062bce4..4c4651f58b 100644
--- a/chip/it83xx/flash.c
+++ b/chip/it83xx/flash.c
@@ -496,6 +496,12 @@ int FLASH_DMA_CODE flash_physical_erase(int offset, int size)
for (; size > 0; size -= FLASH_SECTOR_ERASE_SIZE) {
dma_flash_erase(offset, FLASH_CMD_SECTOR_ERASE);
offset += FLASH_SECTOR_ERASE_SIZE;
+ /*
+ * If requested erase size is too large at one time on KGD
+ * flash, we need to reload watchdog to prevent the reset.
+ */
+ if (IS_ENABLED(IT83XX_CHIP_FLASH_IS_KGD) && (size > 0x10000))
+ watchdog_reload();
}
dma_reset_immu((v_addr + v_size) >= IMMU_TAG_INDEX_BY_DEFAULT);
/* get the ILM address of a flash offset. */