summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMulin Chao <mlchao@nuvoton.com>2016-12-15 13:57:53 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-15 05:03:48 -0800
commitf5da4daf8cf0ea28a813e36f23a69612a100b55b (patch)
treea3260ad1821d53c176cf5c4761fe814ece8b4423
parent94d27d9779de6fe18c33945768abf1e97383c814 (diff)
downloadchrome-ec-f5da4daf8cf0ea28a813e36f23a69612a100b55b.tar.gz
npcx: lpc: clear EC_LPC_CMDR_BUSY status bit on init & LRESET asserted.
There's a small period between ec cleared EC_LPC_CMDR_BUSY status bit for sysjump and executed notify hook function to let lpc driver disable lpc's interrupts. If ec received a new host command in this period, EC_LPC_CMDR_BUSY status bit has chance not to be cleared since ec already jumped to the the other region. In case ec and host enter dead-lock loop, we need to clear it on lpc_init(). Since HIPMnST only can be reset by core domain reset, it's better to clear EC_LPC_CMDR_BUSY status bit when LRESET asserted. It makes host can reset host command mechanism if something wrong. BRANCH=none BUG=chrome-os-partner:60928 TEST=make BOARD=reef; pass the tests mentioned in issue #60928 Change-Id: I08ac0515cb2cfee277a7c7704d131574d928fb6b Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/419908 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--chip/npcx/lpc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c
index 63507ce1f1..3a916356f8 100644
--- a/chip/npcx/lpc.c
+++ b/chip/npcx/lpc.c
@@ -882,6 +882,8 @@ void lpc_lreset_pltrst_handler(void)
if (!pltrst_asserted)
host_register_init();
else {
+ /* Clear processing flag when LRESET is asserted */
+ CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
#ifdef CONFIG_CHIPSET_RESET_HOOK
/* Notify HOOK_CHIPSET_RESET */
hook_call_deferred(&lpc_chipset_reset_data, MSEC);
@@ -966,6 +968,12 @@ static void lpc_init(void)
EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED |
EC_HOST_CMD_FLAG_VERSION_3;
+ /*
+ * Clear processing flag before enabling lpc's interrupts in case
+ * it's set by the other command during sysjump.
+ */
+ CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
+
/* Turn on PMC2 for Host Command usage */
SET_BIT(NPCX_HIPMCTL(PMC_HOST_CMD), 0);
SET_BIT(NPCX_HIPMCTL(PMC_HOST_CMD), 1);