summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/common
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2022-09-06 14:32:05 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-09-07 09:20:25 +0000
commita01f8bc450d782c9b0859c8caaaa3df87fe5a854 (patch)
treeb6f301ea3e7d09e256489c7c3f5918211ff9473c /src/soc/mediatek/common
parent70f30afa89b725aa8655bed881f823408ac54453 (diff)
soc/mediatek: a common implementation to register BL31 reset
The implementations of register_reset_to_bl31() are the same for MedaiTek platforms, so we extract them to soc/common/bl31.c. BUG=None TEST=build pass Change-Id: I297ea2e18a6d7e92236cf415844b166523616bdf Signed-off-by: Hung-Te Lin <hungte@chromium.org> Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67359 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/soc/mediatek/common')
-rw-r--r--src/soc/mediatek/common/bl31.c23
-rw-r--r--src/soc/mediatek/common/include/soc/bl31.h10
2 files changed, 33 insertions, 0 deletions
diff --git a/src/soc/mediatek/common/bl31.c b/src/soc/mediatek/common/bl31.c
new file mode 100644
index 0000000000..6a790982e2
--- /dev/null
+++ b/src/soc/mediatek/common/bl31.c
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <bl31.h>
+#include <console/console.h>
+#include <gpio.h>
+#include <soc/bl31.h>
+
+#include <arm-trusted-firmware/include/export/plat/mediatek/common/plat_params_exp.h>
+
+void register_reset_to_bl31(int gpio_index, bool active_high)
+{
+ static struct bl_aux_param_gpio param_reset = {
+ .h = { .type = BL_AUX_PARAM_MTK_RESET_GPIO },
+ };
+
+ if (active_high)
+ param_reset.gpio.polarity = ARM_TF_GPIO_LEVEL_HIGH;
+ else
+ param_reset.gpio.polarity = ARM_TF_GPIO_LEVEL_LOW;
+
+ param_reset.gpio.index = gpio_index;
+ register_bl31_aux_param(&param_reset.h);
+}
diff --git a/src/soc/mediatek/common/include/soc/bl31.h b/src/soc/mediatek/common/include/soc/bl31.h
new file mode 100644
index 0000000000..c596a8577b
--- /dev/null
+++ b/src/soc/mediatek/common/include/soc/bl31.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
+
+#ifndef _SOC_BL31_H_
+#define _SOC_BL31_H_
+
+#include <stdbool.h>
+
+void register_reset_to_bl31(int gpio_index, bool active_high);
+
+#endif /* _SOC_BL31_H_ */