From 2f4a59037990891570af032f7ce41397b499347a Mon Sep 17 00:00:00 2001 From: Dino Li Date: Wed, 22 Jul 2015 11:39:54 +0800 Subject: [PATCH] it8380dev: fix reset cause symptom: there are many reset cause while chip power on. root cause: there is no default value for bram. Signed-off-by: Dino Li BRANCH=none BUG=none TEST=1. "power-on" reset cause still exist. 2. console "reboot" hard, preserve, and ap-off. 3. console "sysjump" rw and ro. Change-Id: Ie190ade4990bfaf46e73746ac5019f61307c81e5 Reviewed-on: https://chromium-review.googlesource.com/286281 Reviewed-by: Randall Spangler Reviewed-by: Alec Berg Commit-Queue: Dino Li Tested-by: Dino Li --- chip/it83xx/system.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/chip/it83xx/system.c b/chip/it83xx/system.c index 8d434c9c5c..f0cb9ddd73 100644 --- a/chip/it83xx/system.c +++ b/chip/it83xx/system.c @@ -51,10 +51,14 @@ static void check_reset_cause(void) flags |= RESET_FLAG_POWER_ON; /* Restore then clear saved reset flags. */ - flags |= REG8(IT83XX_BRAM_BASE+BRAM_INDEX_SAVED_RESET_FLAGS) << 24; - flags |= REG8(IT83XX_BRAM_BASE+BRAM_INDEX_SAVED_RESET_FLAGS+1) << 16; - flags |= REG8(IT83XX_BRAM_BASE+BRAM_INDEX_SAVED_RESET_FLAGS+2) << 8; - flags |= REG8(IT83XX_BRAM_BASE+BRAM_INDEX_SAVED_RESET_FLAGS+3); + if (!(flags & RESET_FLAG_POWER_ON)) { + const uint32_t addr = + IT83XX_BRAM_BASE+BRAM_INDEX_SAVED_RESET_FLAGS; + flags |= REG8(addr + 0) << 24; + flags |= REG8(addr + 1) << 16; + flags |= REG8(addr + 2) << 8; + flags |= REG8(addr + 3); + } REG8(IT83XX_BRAM_BASE+BRAM_INDEX_SAVED_RESET_FLAGS) = 0; REG8(IT83XX_BRAM_BASE+BRAM_INDEX_SAVED_RESET_FLAGS+1) = 0;