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 */