summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-10-24 06:49:47 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-10-24 12:57:45 -0700
commit708f6f1f21d4cee970c6bf7dadefee3936af228d (patch)
treeca066b948bbf51aca4ca6e8f3ac9c88d6633ee7a
parent97a37297557affef46b04330a4b3911b7f822dd7 (diff)
downloadchrome-ec-708f6f1f21d4cee970c6bf7dadefee3936af228d.tar.gz
host_event: Perform lpc_init_mask before keyboard/button init
keyboard/button init are responsible for checking if user requested manual recovery. However, by this time, hook init is not run and hence host event set operation for manual recovery is dropped. This change adds a call to lpc_init_mask before keyboard/button init operations are performed. BUG=b:68189465 BRANCH=None TEST=Verified that manual recovery works fine. Recovery using software command works too: reboot ap-off hostevent set 0x4000 powerb Change-Id: I15cb648d4b253a523293c7ab2cd3e8e08e31a763 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/735799 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--common/host_event_commands.c8
-rw-r--r--common/main.c11
-rw-r--r--include/lpc.h3
3 files changed, 15 insertions, 7 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index d2fa584855..917ce78e03 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -144,7 +144,7 @@ uint32_t __attribute__((weak)) lpc_override_always_report_mask(void)
return LPC_HOST_EVENT_ALWAYS_REPORT_DEFAULT_MASK;
}
-static void lpc_init_mask(void)
+void lpc_init_mask(void)
{
/*
* First check if masks were stashed before sysjump. If no masks were
@@ -156,12 +156,6 @@ static void lpc_init_mask(void)
lpc_override_always_report_mask();
}
-/*
- * This hook is required to run before chip gets to initialize LPC because
- * update host events will need the masks to be correctly restored.
- */
-DECLARE_HOOK(HOOK_INIT, lpc_init_mask, HOOK_PRIO_INIT_LPC - 1);
-
#endif
/*
diff --git a/common/main.c b/common/main.c
index e4cf2e01c7..48efa14f78 100644
--- a/common/main.c
+++ b/common/main.c
@@ -16,6 +16,7 @@
#include "flash.h"
#include "gpio.h"
#include "hooks.h"
+#include "lpc.h"
#include "keyboard_scan.h"
#ifdef CONFIG_MPU
#include "mpu.h"
@@ -150,6 +151,16 @@ test_mockable __keep int main(void)
#ifdef CONFIG_EEPROM
eeprom_init();
#endif
+
+ /*
+ * Keyboard scan init/Button init can set recovery events to
+ * indicate to host entry into recovery mode. Before this is
+ * done, lpc always report mask needs to be initialized
+ * correctly.
+ */
+#ifdef CONFIG_LPC
+ lpc_init_mask();
+#endif
#ifdef HAS_TASK_KEYSCAN
keyboard_scan_init();
#endif
diff --git a/include/lpc.h b/include/lpc.h
index a405e93d59..05b8d660e3 100644
--- a/include/lpc.h
+++ b/include/lpc.h
@@ -149,4 +149,7 @@ void lpc_update_host_event_status(void);
*/
uint32_t lpc_override_always_report_mask(void);
+/* Initialize LPC masks. */
+void lpc_init_mask(void);
+
#endif /* __CROS_EC_LPC_H */