feat(mt8196): add reset and poweroff function for PSCI call
Add reset and poweroff function for PSCI call.
Change-Id: I65b9e341b74f568f968f3c464a64ea754284cb8c
Signed-off-by: Yidi Lin <yidilin@chromium.org>
diff --git a/plat/mediatek/lib/system_reset/reset_cros.c b/plat/mediatek/lib/system_reset/reset_cros.c
index 40e68ba..5f97650 100644
--- a/plat/mediatek/lib/system_reset/reset_cros.c
+++ b/plat/mediatek/lib/system_reset/reset_cros.c
@@ -1,18 +1,25 @@
/*
- * Copyright (c) 2022, MediaTek Inc. All rights reserved.
+ * Copyright (c) 2022-2025, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
+
#include <arch_helpers.h>
#include <common/debug.h>
+#include <drivers/delay_timer.h>
#include <drivers/gpio.h>
+#if CONFIG_MTK_PMIC_SHUTDOWN_CFG
+#include <drivers/pmic/pmic_psc.h>
+#endif
#include <lib/mtk_init/mtk_init.h>
#include <lib/pm/mtk_pm.h>
#include <plat_params.h>
+#if !CONFIG_MTK_PMIC_SHUTDOWN_CFG
#include <pmic.h>
#include <rtc.h>
+#endif
static void __dead2 mtk_system_reset_cros(void)
{
@@ -31,8 +38,13 @@
{
INFO("MTK System Off\n");
+#if CONFIG_MTK_PMIC_SHUTDOWN_CFG
+ platform_power_hold(false);
+ mdelay(1000);
+#else
rtc_power_off_sequence();
pmic_power_off();
+#endif
wfi();
ERROR("MTK System Off: operation not handled.\n");
diff --git a/plat/mediatek/mt8196/include/platform_def.h b/plat/mediatek/mt8196/include/platform_def.h
index 72d83e6..83370d6 100644
--- a/plat/mediatek/mt8196/include/platform_def.h
+++ b/plat/mediatek/mt8196/include/platform_def.h
@@ -87,7 +87,7 @@
* GPIO related constants
******************************************************************************/
#define GPIO_BASE (IO_PHYS + 0x0002D000)
-#define RGU_BASE (IO_PHYS + 0x0C00B000)
+#define RGU_BASE (IO_PHYS + 0x0C010000)
#define DRM_BASE (IO_PHYS + 0x0000D000)
#define IOCFG_RT_BASE (IO_PHYS + 0x02000000)
#define IOCFG_RM1_BASE (IO_PHYS + 0x02020000)
diff --git a/plat/mediatek/mt8196/platform.mk b/plat/mediatek/mt8196/platform.mk
index 5050809..520771d 100644
--- a/plat/mediatek/mt8196/platform.mk
+++ b/plat/mediatek/mt8196/platform.mk
@@ -41,6 +41,7 @@
MODULES-y += $(MTK_PLAT)/common/lpm_v2
MODULES-y += $(MTK_PLAT)/lib/mtk_init
MODULES-y += $(MTK_PLAT)/lib/pm
+MODULES-y += $(MTK_PLAT)/lib/system_reset
MODULES-y += $(MTK_PLAT)/drivers/apusys
MODULES-y += $(MTK_PLAT)/drivers/cirq
MODULES-y += $(MTK_PLAT)/drivers/dp