From 4a974141a5b70ce97800f209a6bc0644d8249c99 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 22 Sep 2016 13:28:10 -0700 Subject: chip/npcx: Fix interrupt enabling during lpc_init 1. interrupt enabling should be the last thing done when lpc_init completes required intialization 2. memset to 0 of static uninitialized variables is not required. Remove that. BUG=chrome-os-partner:57642 BRANCH=None TEST=Verified that LPC communication is fine after sysjump to RW. Change-Id: Ib8891dccf2b301590ebca41b75680d954d88a4d3 Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/388752 Tested-by: Mulin Chao Reviewed-by: Aaron Durbin Reviewed-by: Mulin Chao --- chip/npcx/lpc.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c index 7652b1bbeb..43330e906c 100644 --- a/chip/npcx/lpc.c +++ b/chip/npcx/lpc.c @@ -885,6 +885,11 @@ static void lpc_init(void) /* Write protect of Share memory */ NPCX_WIN_WR_PROT(1) = 0xFF; + /* We support LPC args and version 3 protocol */ + *(lpc_get_memmap_range() + EC_MEMMAP_HOST_CMD_FLAGS) = + EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED | + EC_HOST_CMD_FLAG_VERSION_3; + /* Turn on PMC2 for Host Command usage */ SET_BIT(NPCX_HIPMCTL(PMC_HOST_CMD), 0); SET_BIT(NPCX_HIPMCTL(PMC_HOST_CMD), 1); @@ -895,6 +900,10 @@ static void lpc_init(void) NPCX_SMC_CTL = NPCX_SMC_CTL&~0x7F; /* Clear status */ NPCX_SMC_STS = NPCX_SMC_STS; + + /* Restore event masks if needed */ + lpc_post_sysjump(); + /* Create mailbox */ /* @@ -928,18 +937,6 @@ static void lpc_init(void) #endif lpc_task_enable_irq(); - /* Initialize host args and memory map to all zero */ - memset(lpc_host_args, 0, sizeof(*lpc_host_args)); - memset(lpc_get_memmap_range(), 0, EC_MEMMAP_SIZE); - - /* We support LPC args and version 3 protocol */ - *(lpc_get_memmap_range() + EC_MEMMAP_HOST_CMD_FLAGS) = - EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED | - EC_HOST_CMD_FLAG_VERSION_3; - - /* Restore event masks if needed */ - lpc_post_sysjump(); - /* Sufficiently initialized */ init_done = 1; -- cgit v1.2.1