mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
feat(mt8188): add reset and poweroff functions
- Add mtk_pm_system_reset_cros() for cros reset. - Add mtk_pm_system_off_cros() for cros power-off. TEST=build pass BUG=b:236331724 Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> Change-Id: I4117f6080e282551b37a936a490ab7b37ac31827
This commit is contained in:
parent
6ca2046ef1
commit
a72b9e7754
3 changed files with 71 additions and 0 deletions
56
plat/mediatek/lib/system_reset/reset_cros.c
Normal file
56
plat/mediatek/lib/system_reset/reset_cros.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2022, MediaTek Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <arch_helpers.h>
|
||||
#include <common/debug.h>
|
||||
#include <drivers/gpio.h>
|
||||
#include <lib/mtk_init/mtk_init.h>
|
||||
#include <lib/pm/mtk_pm.h>
|
||||
#include <plat_params.h>
|
||||
#include <pmic.h>
|
||||
#include <rtc.h>
|
||||
|
||||
static void __dead2 mtk_system_reset_cros(void)
|
||||
{
|
||||
struct bl_aux_gpio_info *gpio_reset = plat_get_mtk_gpio_reset();
|
||||
|
||||
INFO("MTK System Reset\n");
|
||||
|
||||
gpio_set_value(gpio_reset->index, gpio_reset->polarity);
|
||||
|
||||
wfi();
|
||||
ERROR("MTK System Reset: operation not handled.\n");
|
||||
panic();
|
||||
}
|
||||
|
||||
static void __dead2 mtk_system_off_cros(void)
|
||||
{
|
||||
INFO("MTK System Off\n");
|
||||
|
||||
rtc_power_off_sequence();
|
||||
pmic_power_off();
|
||||
|
||||
wfi();
|
||||
ERROR("MTK System Off: operation not handled.\n");
|
||||
panic();
|
||||
}
|
||||
|
||||
static struct plat_pm_reset_ctrl lib_reset_ctrl = {
|
||||
.system_off = mtk_system_off_cros,
|
||||
.system_reset = mtk_system_reset_cros,
|
||||
.system_reset2 = NULL,
|
||||
};
|
||||
|
||||
static int lib_reset_ctrl_init(void)
|
||||
{
|
||||
INFO("Reset init\n");
|
||||
|
||||
plat_pm_ops_setup_reset(&lib_reset_ctrl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
MTK_ARCH_INIT(lib_reset_ctrl_init);
|
14
plat/mediatek/lib/system_reset/rules.mk
Normal file
14
plat/mediatek/lib/system_reset/rules.mk
Normal file
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# Copyright (c) 2022, MediaTek Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
#
|
||||
|
||||
LOCAL_DIR := $(call GET_LOCAL_DIR)
|
||||
|
||||
MODULE := system_reset
|
||||
|
||||
LOCAL_SRCS-y := ${LOCAL_DIR}/reset_cros.c
|
||||
|
||||
$(eval $(call MAKE_MODULE,$(MODULE),$(LOCAL_SRCS-y),$(MTK_BL)))
|
|
@ -22,6 +22,7 @@ PLAT_INCLUDES := -I${MTK_PLAT}/common \
|
|||
MODULES-y += $(MTK_PLAT)/common
|
||||
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/cirq
|
||||
MODULES-y += $(MTK_PLAT)/drivers/dp
|
||||
MODULES-y += $(MTK_PLAT)/drivers/gic600
|
||||
|
|
Loading…
Add table
Reference in a new issue