diff --git a/plat/mediatek/mt8192/drivers/rtc/rtc.c b/plat/mediatek/common/drivers/rtc/rtc_mt6359p.c similarity index 100% rename from plat/mediatek/mt8192/drivers/rtc/rtc.c rename to plat/mediatek/common/drivers/rtc/rtc_mt6359p.c diff --git a/plat/mediatek/mt8192/drivers/rtc/rtc.h b/plat/mediatek/common/drivers/rtc/rtc_mt6359p.h similarity index 98% rename from plat/mediatek/mt8192/drivers/rtc/rtc.h rename to plat/mediatek/common/drivers/rtc/rtc_mt6359p.h index 419bfe42c29c1b34b17c9ceecbd95b3ab3c11cfe..04726e3907f50f56f2f7c1e539739482e47a64e1 100644 --- a/plat/mediatek/mt8192/drivers/rtc/rtc.h +++ b/plat/mediatek/common/drivers/rtc/rtc_mt6359p.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef RTC_H -#define RTC_H +#ifndef RTC_MT6359P_H +#define RTC_MT6359P_H /* RTC registers */ enum { @@ -194,4 +194,4 @@ int32_t RTC_Write_Trigger(void); int32_t Writeif_unlock(void); void rtc_power_off_sequence(void); -#endif /* RTC_H */ +#endif /* RTC_MT6359P_H */ diff --git a/plat/mediatek/mt8192/include/rtc.h b/plat/mediatek/mt8192/include/rtc.h new file mode 100644 index 0000000000000000000000000000000000000000..a9c7bc83f4fa537135f40b1db9045e8b34ffa292 --- /dev/null +++ b/plat/mediatek/mt8192/include/rtc.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2021, MediaTek Inc. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef RTC_H +#define RTC_H + +#include + +#endif /* RTC_H */ diff --git a/plat/mediatek/mt8192/platform.mk b/plat/mediatek/mt8192/platform.mk index 49d1059bdd00c10042153204c1cb0bdf7aaef359..86e353f22c917d56c2ad112ac40932f942efb6a5 100644 --- a/plat/mediatek/mt8192/platform.mk +++ b/plat/mediatek/mt8192/platform.mk @@ -10,6 +10,7 @@ MTK_PLAT_SOC := ${MTK_PLAT}/${PLAT} PLAT_INCLUDES := -I${MTK_PLAT}/common/ \ -I${MTK_PLAT}/common/drivers/gic600/ \ -I${MTK_PLAT}/common/drivers/gpio/ \ + -I${MTK_PLAT}/common/drivers/rtc/ \ -I${MTK_PLAT}/common/drivers/timer/ \ -I${MTK_PLAT}/common/drivers/uart/ \ -I${MTK_PLAT}/common/lpm/ \ @@ -21,7 +22,6 @@ PLAT_INCLUDES := -I${MTK_PLAT}/common/ \ -I${MTK_PLAT_SOC}/drivers/mcdi/ \ -I${MTK_PLAT_SOC}/drivers/pmic/ \ -I${MTK_PLAT_SOC}/drivers/ptp3/ \ - -I${MTK_PLAT_SOC}/drivers/rtc/ \ -I${MTK_PLAT_SOC}/drivers/spmc/ GICV3_SUPPORT_GIC600 := 1 @@ -46,6 +46,7 @@ BL31_SOURCES += common/desc_image_load.c \ ${MTK_PLAT}/common/drivers/gpio/mtgpio_common.c \ ${MTK_PLAT}/common/drivers/pmic_wrap/pmic_wrap_init_v2.c \ ${MTK_PLAT}/common/drivers/rtc/rtc_common.c \ + ${MTK_PLAT}/common/drivers/rtc/rtc_mt6359p.c \ ${MTK_PLAT}/common/drivers/timer/mt_timer.c \ ${MTK_PLAT}/common/drivers/uart/uart.c \ ${MTK_PLAT}/common/lpm/mt_lp_rm.c \ @@ -57,7 +58,6 @@ BL31_SOURCES += common/desc_image_load.c \ ${MTK_PLAT_SOC}/aarch64/plat_helpers.S \ ${MTK_PLAT_SOC}/bl31_plat_setup.c \ ${MTK_PLAT_SOC}/drivers/pmic/pmic.c \ - ${MTK_PLAT_SOC}/drivers/rtc/rtc.c \ ${MTK_PLAT_SOC}/plat_pm.c \ ${MTK_PLAT_SOC}/plat_topology.c \ ${MTK_PLAT_SOC}/plat_sip_calls.c \ diff --git a/plat/mediatek/mt8195/include/rtc.h b/plat/mediatek/mt8195/include/rtc.h new file mode 100644 index 0000000000000000000000000000000000000000..a9c7bc83f4fa537135f40b1db9045e8b34ffa292 --- /dev/null +++ b/plat/mediatek/mt8195/include/rtc.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2021, MediaTek Inc. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef RTC_H +#define RTC_H + +#include + +#endif /* RTC_H */ diff --git a/plat/mediatek/mt8195/plat_pm.c b/plat/mediatek/mt8195/plat_pm.c index 7cc25655b81cbc56f6616fec2f6119651acc6b9f..522d4437a07a3ebef8c6989bfd40767f4535b803 100644 --- a/plat/mediatek/mt8195/plat_pm.c +++ b/plat/mediatek/mt8195/plat_pm.c @@ -20,6 +20,7 @@ #include #include #include +#include /* * Cluster state request: @@ -355,6 +356,7 @@ static void __dead2 plat_mtk_system_off(void) { INFO("MTK System Off\n"); + rtc_power_off_sequence(); pmic_power_off(); wfi(); diff --git a/plat/mediatek/mt8195/platform.mk b/plat/mediatek/mt8195/platform.mk index e37e4404d55133a7711452a90c36b633d7769a3b..4d3ad59e1bc14b3920c2f609cb7b3f67b082fdc8 100644 --- a/plat/mediatek/mt8195/platform.mk +++ b/plat/mediatek/mt8195/platform.mk @@ -10,6 +10,7 @@ MTK_PLAT_SOC := ${MTK_PLAT}/${PLAT} PLAT_INCLUDES := -I${MTK_PLAT}/common/ \ -I${MTK_PLAT}/common/drivers/gic600/ \ -I${MTK_PLAT}/common/drivers/gpio/ \ + -I${MTK_PLAT}/common/drivers/rtc/ \ -I${MTK_PLAT}/common/drivers/timer/ \ -I${MTK_PLAT_SOC}/drivers/gpio/ \ -I${MTK_PLAT_SOC}/drivers/mcdi/ \ @@ -39,6 +40,8 @@ BL31_SOURCES += common/desc_image_load.c \ ${MTK_PLAT}/common/drivers/gic600/mt_gic_v3.c \ ${MTK_PLAT}/common/drivers/gpio/mtgpio_common.c \ ${MTK_PLAT}/common/drivers/pmic_wrap/pmic_wrap_init_v2.c \ + ${MTK_PLAT}/common/drivers/rtc/rtc_common.c \ + ${MTK_PLAT}/common/drivers/rtc/rtc_mt6359p.c \ ${MTK_PLAT}/common/drivers/timer/mt_timer.c \ ${MTK_PLAT}/common/mtk_cirq.c \ ${MTK_PLAT}/common/mtk_plat_common.c \