From 80fa75842dcf9f1b91bc58ff740a69dcdda70f78 Mon Sep 17 00:00:00 2001 From: Bo-Chen Chen Date: Thu, 1 Sep 2022 16:32:46 +0800 Subject: [PATCH] refator(mediatek): move pmic.[c|h] to common folder These two files are identical on MT8192 and MT8195. They can also be used on MT8188. So move them to common/drivers/pmic/. Signed-off-by: Bo-Chen Chen Change-Id: I8c12d15f1da79ab5767ac02b3ab70e8508155ee8 --- plat/mediatek/{mt8192 => }/drivers/pmic/pmic.c | 2 +- plat/mediatek/{mt8192 => }/drivers/pmic/pmic.h | 4 ++-- plat/mediatek/mt8192/platform.mk | 3 ++- plat/mediatek/mt8195/drivers/pmic/pmic.c | 13 ------------- plat/mediatek/mt8195/drivers/pmic/pmic.h | 15 --------------- plat/mediatek/mt8195/platform.mk | 3 ++- 6 files changed, 7 insertions(+), 33 deletions(-) rename plat/mediatek/{mt8192 => }/drivers/pmic/pmic.c (73%) rename plat/mediatek/{mt8192 => }/drivers/pmic/pmic.h (63%) delete mode 100644 plat/mediatek/mt8195/drivers/pmic/pmic.c delete mode 100644 plat/mediatek/mt8195/drivers/pmic/pmic.h diff --git a/plat/mediatek/mt8192/drivers/pmic/pmic.c b/plat/mediatek/drivers/pmic/pmic.c similarity index 73% rename from plat/mediatek/mt8192/drivers/pmic/pmic.c rename to plat/mediatek/drivers/pmic/pmic.c index cca441397..a11ad9a8b 100644 --- a/plat/mediatek/mt8192/drivers/pmic/pmic.c +++ b/plat/mediatek/drivers/pmic/pmic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, MediaTek Inc. All rights reserved. + * Copyright (c) 2022, MediaTek Inc. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/plat/mediatek/mt8192/drivers/pmic/pmic.h b/plat/mediatek/drivers/pmic/pmic.h similarity index 63% rename from plat/mediatek/mt8192/drivers/pmic/pmic.h rename to plat/mediatek/drivers/pmic/pmic.h index aac22afa3..6c10f65f6 100644 --- a/plat/mediatek/mt8192/drivers/pmic/pmic.h +++ b/plat/mediatek/drivers/pmic/pmic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, MediaTek Inc. All rights reserved. + * Copyright (c) 2022, MediaTek Inc. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,7 +7,7 @@ #ifndef PMIC_H #define PMIC_H -#define PMIC_PWRHOLD 0xa08 +#define PMIC_PWRHOLD (0xa08) /* external API */ void pmic_power_off(void); diff --git a/plat/mediatek/mt8192/platform.mk b/plat/mediatek/mt8192/platform.mk index ccc9a718e..efc14ecb6 100644 --- a/plat/mediatek/mt8192/platform.mk +++ b/plat/mediatek/mt8192/platform.mk @@ -12,6 +12,7 @@ PLAT_INCLUDES := -I${MTK_PLAT}/common/ \ -I${MTK_PLAT}/drivers/gic600/ \ -I${MTK_PLAT}/drivers/gpio/ \ -I${MTK_PLAT}/drivers/lpm/ \ + -I${MTK_PLAT}/drivers/pmic/ \ -I${MTK_PLAT}/drivers/pmic_wrap/ \ -I${MTK_PLAT}/drivers/rtc/ \ -I${MTK_PLAT}/drivers/timer/ \ @@ -55,6 +56,7 @@ BL31_SOURCES += common/desc_image_load.c \ ${MTK_PLAT}/drivers/gic600/mt_gic_v3.c \ ${MTK_PLAT}/drivers/gpio/mtgpio_common.c \ ${MTK_PLAT}/drivers/lpm/mt_lp_rm.c \ + ${MTK_PLAT}/drivers/pmic/pmic.c \ ${MTK_PLAT}/drivers/pmic_wrap/pmic_wrap_init_v2.c \ ${MTK_PLAT}/drivers/rtc/rtc_common.c \ ${MTK_PLAT}/drivers/rtc/rtc_mt6359p.c \ @@ -63,7 +65,6 @@ BL31_SOURCES += common/desc_image_load.c \ ${MTK_PLAT_SOC}/aarch64/platform_common.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}/plat_pm.c \ ${MTK_PLAT_SOC}/plat_topology.c \ ${MTK_PLAT_SOC}/plat_sip_calls.c \ diff --git a/plat/mediatek/mt8195/drivers/pmic/pmic.c b/plat/mediatek/mt8195/drivers/pmic/pmic.c deleted file mode 100644 index cca441397..000000000 --- a/plat/mediatek/mt8195/drivers/pmic/pmic.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2020, MediaTek Inc. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include - -void pmic_power_off(void) -{ - pwrap_write(PMIC_PWRHOLD, 0x0); -} diff --git a/plat/mediatek/mt8195/drivers/pmic/pmic.h b/plat/mediatek/mt8195/drivers/pmic/pmic.h deleted file mode 100644 index aac22afa3..000000000 --- a/plat/mediatek/mt8195/drivers/pmic/pmic.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2020, MediaTek Inc. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef PMIC_H -#define PMIC_H - -#define PMIC_PWRHOLD 0xa08 - -/* external API */ -void pmic_power_off(void); - -#endif /* PMIC_H */ diff --git a/plat/mediatek/mt8195/platform.mk b/plat/mediatek/mt8195/platform.mk index 3d0e64495..414d655b9 100644 --- a/plat/mediatek/mt8195/platform.mk +++ b/plat/mediatek/mt8195/platform.mk @@ -13,6 +13,7 @@ PLAT_INCLUDES := -I${MTK_PLAT}/common/ \ -I${MTK_PLAT}/drivers/gic600/ \ -I${MTK_PLAT}/drivers/gpio/ \ -I${MTK_PLAT}/drivers/lpm/ \ + -I${MTK_PLAT}/drivers/pmic/ \ -I${MTK_PLAT}/drivers/pmic_wrap/ \ -I${MTK_PLAT}/drivers/rtc/ \ -I${MTK_PLAT}/drivers/timer/ \ @@ -56,6 +57,7 @@ BL31_SOURCES += common/desc_image_load.c \ ${MTK_PLAT}/drivers/gic600/mt_gic_v3.c \ ${MTK_PLAT}/drivers/gpio/mtgpio_common.c \ ${MTK_PLAT}/drivers/lpm/mt_lp_rm.c \ + ${MTK_PLAT}/drivers/pmic/pmic.c \ ${MTK_PLAT}/drivers/pmic_wrap/pmic_wrap_init_v2.c \ ${MTK_PLAT}/drivers/rtc/rtc_common.c \ ${MTK_PLAT}/drivers/rtc/rtc_mt6359p.c \ @@ -77,7 +79,6 @@ BL31_SOURCES += common/desc_image_load.c \ ${MTK_PLAT_SOC}/drivers/mcdi/mt_mcdi.c \ ${MTK_PLAT_SOC}/drivers/mcdi/mt_lp_irqremain.c \ ${MTK_PLAT_SOC}/drivers/gpio/mtgpio.c \ - ${MTK_PLAT_SOC}/drivers/pmic/pmic.c \ ${MTK_PLAT_SOC}/drivers/ptp3/mtk_ptp3_main.c \ ${MTK_PLAT_SOC}/drivers/spmc/mtspmc.c \ ${MTK_PLAT_SOC}/plat_pm.c \