plat_pm.c 1.3 KB
Newer Older
1
2
3
4
5
6
7
/*
 * Copyright (c) 2020, MediaTek Inc. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* common headers */
8
9
10
#include <arch_helpers.h>
#include <common/debug.h>
#include <drivers/gpio.h>
11
12
13
#include <lib/psci/psci.h>

/* mediatek platform specific headers */
14
#include <plat_params.h>
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*******************************************************************************
 * MTK handlers to shutdown/reboot the system
 ******************************************************************************/
static void __dead2 plat_mtk_system_reset(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();
}
31
32
33
34
35
36

/*******************************************************************************
 * MTK_platform handler called when an affinity instance is about to be turned
 * on. The level and mpidr determine the affinity instance.
 ******************************************************************************/
static const plat_psci_ops_t plat_plat_pm_ops = {
37
	.system_reset         = plat_mtk_system_reset,
38
39
40
41
42
43
44
45
46
};

int plat_setup_psci_ops(uintptr_t sec_entrypoint,
			const plat_psci_ops_t **psci_ops)
{
	*psci_ops = &plat_plat_pm_ops;

	return 0;
}