Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46409 )
Change subject: soc/mediatek/mt8192: eint: unmask eint event mask register ......................................................................
soc/mediatek/mt8192: eint: unmask eint event mask register
eint event mask register is used to mask eint wakeup source on mt8192. 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.
BUG=b:169024614
Signed-off-by: G.Pangao gtk_pangao@mediatek.com Change-Id: I8ee80bf8302c146e09b74e9f6c6c49f501d7c1c4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/46409 Reviewed-by: Yu-Ping Wu yupingso@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/eint_event.c A src/soc/mediatek/mt8192/include/soc/eint_event.h 4 files changed, 33 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved
diff --git a/src/soc/mediatek/mt8192/Makefile.inc b/src/soc/mediatek/mt8192/Makefile.inc index dc6548b..ccf571e 100644 --- a/src/soc/mediatek/mt8192/Makefile.inc +++ b/src/soc/mediatek/mt8192/Makefile.inc @@ -2,6 +2,7 @@
bootblock-y += ../common/auxadc.c bootblock-y += bootblock.c +bootblock-y += eint_event.c bootblock-y += flash_controller.c bootblock-y += ../common/gpio.c gpio.c bootblock-y += ../common/i2c.c i2c.c diff --git a/src/soc/mediatek/mt8192/bootblock.c b/src/soc/mediatek/mt8192/bootblock.c index 5295422..1c95d65 100644 --- a/src/soc/mediatek/mt8192/bootblock.c +++ b/src/soc/mediatek/mt8192/bootblock.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <bootblock_common.h> +#include <soc/eint_event.h> #include <soc/mmu_operations.h> #include <soc/mt6315.h> #include <soc/mt6359p.h> @@ -18,4 +19,5 @@ mt6359p_init(); mt6315_init(); rtc_boot(); + unmask_eint_event_mask(); } diff --git a/src/soc/mediatek/mt8192/eint_event.c b/src/soc/mediatek/mt8192/eint_event.c new file mode 100644 index 0000000..b3538a1 --- /dev/null +++ b/src/soc/mediatek/mt8192/eint_event.c @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <soc/eint_event.h> + +void unmask_eint_event_mask(void) +{ + int i; + for (i = 0; i < ARRAY_SIZE(mtk_eint_event->eint_event_mask_clr); i++) + write32(&mtk_eint_event->eint_event_mask_clr[i], 0xffffffff); +} diff --git a/src/soc/mediatek/mt8192/include/soc/eint_event.h b/src/soc/mediatek/mt8192/include/soc/eint_event.h new file mode 100644 index 0000000..05d1fbc --- /dev/null +++ b/src/soc/mediatek/mt8192/include/soc/eint_event.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_MEDIATEK_MT8192_EINT_EVENT_H +#define SOC_MEDIATEK_MT8192_EINT_EVENT_H + +#include <device/mmio.h> +#include <soc/addressmap.h> + +/* eint event mask cler register */ +struct eint_event_reg { + uint32_t eint_event_mask_clr[7]; +}; + +/* eint_base + 0x880 is eint_event_mask_clr register with access type W1C. */ +static struct eint_event_reg *const mtk_eint_event = (void *)(EINT_BASE + 0x880); + +/* unmask eint event, eint can wakeup by spm */ +void unmask_eint_event_mask(void); + +#endif