From 7ae6bda8bd44aa8a906f42cbaa33710878247e5a Mon Sep 17 00:00:00 2001 From: Dino Li Date: Tue, 29 Sep 2020 18:42:49 +0800 Subject: 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 Signed-off-by: tim Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2438072 Reviewed-by: Jett Rink --- chip/it83xx/flash.c | 6 ++++++ 1 file changed, 6 insertions(+) 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. */ -- cgit v1.2.1