From f5da4daf8cf0ea28a813e36f23a69612a100b55b Mon Sep 17 00:00:00 2001 From: Mulin Chao Date: Thu, 15 Dec 2016 13:57:53 +0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/419908 Reviewed-by: Aaron Durbin --- chip/npcx/lpc.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- cgit v1.2.1