Attention is currently required from: Hung-Te Lin, Yidi Lin, Yu-Ping Wu.
Jarried Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84025?usp=email )
Change subject: soc/mediatek/mt8196: add unmask eint event for bootblock ......................................................................
soc/mediatek/mt8196: add unmask eint event for bootblock
EINT event mask register is used to mask EINT wakeup source. All wakeup sources are masked by default. Since most MediaTek SoCs do not have this design, we can't modify the kernel EINT upstream driver to solve the issue 'Can't wake using power button (cros_ec) or touchpad'. So we add a driver here to unmask all wakeup sources.
TEST=write eint data successfully. BUG=b:31709620
Change-Id: I4bf3820a89172186b8f51591f8760787affbb7a3 Signed-off-by: Chhao Chang ot_chhao.chang@mediatek.corp-partner.google.com --- M src/soc/mediatek/mt8196/Makefile.mk M src/soc/mediatek/mt8196/bootblock.c A src/soc/mediatek/mt8196/eint_event.c M src/soc/mediatek/mt8196/include/soc/addressmap.h A src/soc/mediatek/mt8196/include/soc/eint_event.h 5 files changed, 54 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/25/84025/1
diff --git a/src/soc/mediatek/mt8196/Makefile.mk b/src/soc/mediatek/mt8196/Makefile.mk index 5d26417..5070e8d 100644 --- a/src/soc/mediatek/mt8196/Makefile.mk +++ b/src/soc/mediatek/mt8196/Makefile.mk @@ -11,6 +11,7 @@ all-y += ../common/uart.c
bootblock-y += bootblock.c +bootblock-y += eint_event.c bootblock-y += ../common/mmu_operations.c bootblock-y += ../common/wdt.c ../common/wdt_req.c wdt.c
diff --git a/src/soc/mediatek/mt8196/bootblock.c b/src/soc/mediatek/mt8196/bootblock.c index 770c603..ba07e10 100644 --- a/src/soc/mediatek/mt8196/bootblock.c +++ b/src/soc/mediatek/mt8196/bootblock.c @@ -3,9 +3,11 @@ #include <bootblock_common.h> #include <soc/mmu_operations.h> #include <soc/wdt.h> +#include <soc/eint_event.h>
void bootblock_soc_init(void) { mtk_mmu_init(); mtk_wdt_init(); + unmask_eint_event_mask(); } diff --git a/src/soc/mediatek/mt8196/eint_event.c b/src/soc/mediatek/mt8196/eint_event.c new file mode 100644 index 0000000..dcfe080 --- /dev/null +++ b/src/soc/mediatek/mt8196/eint_event.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#include <soc/addressmap.h> +#include <console/console.h> +#include <soc/eint_event.h> + +void eint_clear_event_mask(uintptr_t base, unsigned int port_num) +{ + unsigned int i; + + for (i = 0; i < port_num; i++) + *(unsigned int *)(base + EVENT_MASK_CLEAN + i * NEXT_ADDRESS) = MASK_VALUE; + + dsb(); +} + +void unmask_eint_event_mask(void) +{ + eint_clear_event_mask(EINT_E_BASE, MAX_E); + eint_clear_event_mask(EINT_S_BASE, MAX_S); + eint_clear_event_mask(EINT_W_BASE, MAX_W); + eint_clear_event_mask(EINT_N_BASE, MAX_N); + eint_clear_event_mask(EINT_C_BASE, MAX_C); +} diff --git a/src/soc/mediatek/mt8196/include/soc/addressmap.h b/src/soc/mediatek/mt8196/include/soc/addressmap.h index 67faa0e..ff60ad8 100644 --- a/src/soc/mediatek/mt8196/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8196/include/soc/addressmap.h @@ -10,6 +10,14 @@ };
enum { + EINT_E_BASE = IO_PHYS + 0x02080000, + EINT_S_BASE = IO_PHYS + 0x02880000, + EINT_W_BASE = IO_PHYS + 0x03080000, + EINT_N_BASE = IO_PHYS + 0x03880000, + EINT_C_BASE = IO_PHYS + 0x0C54A000, +}; + +enum { MCUCFG_BASE = MCUSYS_BASE, };
@@ -103,7 +111,6 @@ SPMI_MST_BASE = IO_PHYS + 0x0C01C000, SPMI_MST_P_BASE = IO_PHYS + 0x0C01C800, SYSTIMER_BASE = IO_PHYS + 0x0C400000, - EINT_BASE = IO_PHYS + 0x0C54A000, DSI0_BASE = IO_PHYS + 0x22490000, DISP_DVO0 = IO_PHYS + 0x224C0000, EDP_BASE = IO_PHYS + 0x2EC40000, diff --git a/src/soc/mediatek/mt8196/include/soc/eint_event.h b/src/soc/mediatek/mt8196/include/soc/eint_event.h new file mode 100644 index 0000000..b559bf9 --- /dev/null +++ b/src/soc/mediatek/mt8196/include/soc/eint_event.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#include <device/mmio.h> + +#ifndef __SOC_MEDIATEK_COMMON_EINT_EVENT_H__ +#define __SOC_MEDIATEK_COMMON_EINT_EVENT_H__ + +#define EVENT_MASK_CLEAN 0x880 +#define NEXT_ADDRESS 4 +#define MASK_VALUE 0xFFFFFFFF +#define MAX_E 3 +#define MAX_S 2 +#define MAX_W 2 +#define MAX_N 2 +#define MAX_C 1 + +/* unmask eint event, eint can wakeup by spm */ +void unmask_eint_event_mask(void); +void eint_clear_event_mask(uintptr_t base, unsigned int port_num); + +#endif