From 102b0d2daa97dae68d3eed54d8fe37a9cc38a892 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:13:47 +0200 Subject: Adding upstream version 2.8.0+dfsg. Signed-off-by: Daniel Baumann --- plat/mediatek/lib/system_reset/reset_cros.c | 56 +++++++++++++++++++++++++++++ plat/mediatek/lib/system_reset/rules.mk | 14 ++++++++ 2 files changed, 70 insertions(+) create mode 100644 plat/mediatek/lib/system_reset/reset_cros.c create mode 100644 plat/mediatek/lib/system_reset/rules.mk (limited to 'plat/mediatek/lib/system_reset') diff --git a/plat/mediatek/lib/system_reset/reset_cros.c b/plat/mediatek/lib/system_reset/reset_cros.c new file mode 100644 index 0000000..40e68ba --- /dev/null +++ b/plat/mediatek/lib/system_reset/reset_cros.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2022, MediaTek Inc. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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); diff --git a/plat/mediatek/lib/system_reset/rules.mk b/plat/mediatek/lib/system_reset/rules.mk new file mode 100644 index 0000000..4f20663 --- /dev/null +++ b/plat/mediatek/lib/system_reset/rules.mk @@ -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))) -- cgit v1.2.3