developer | 2189d3a | 2020-04-17 17:14:23 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020, MediaTek Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | /* common headers */ |
developer | bd31bf0 | 2020-07-02 12:10:13 +0800 | [diff] [blame] | 8 | #include <arch_helpers.h> |
| 9 | #include <common/debug.h> |
| 10 | #include <drivers/gpio.h> |
developer | 2189d3a | 2020-04-17 17:14:23 +0800 | [diff] [blame] | 11 | #include <lib/psci/psci.h> |
| 12 | |
| 13 | /* mediatek platform specific headers */ |
developer | bd31bf0 | 2020-07-02 12:10:13 +0800 | [diff] [blame] | 14 | #include <plat_params.h> |
developer | 2189d3a | 2020-04-17 17:14:23 +0800 | [diff] [blame] | 15 | |
developer | bd31bf0 | 2020-07-02 12:10:13 +0800 | [diff] [blame] | 16 | /******************************************************************************* |
| 17 | * MTK handlers to shutdown/reboot the system |
| 18 | ******************************************************************************/ |
| 19 | static void __dead2 plat_mtk_system_reset(void) |
| 20 | { |
| 21 | struct bl_aux_gpio_info *gpio_reset = plat_get_mtk_gpio_reset(); |
| 22 | |
| 23 | INFO("MTK System Reset\n"); |
| 24 | |
| 25 | gpio_set_value(gpio_reset->index, gpio_reset->polarity); |
| 26 | |
| 27 | wfi(); |
| 28 | ERROR("MTK System Reset: operation not handled.\n"); |
| 29 | panic(); |
| 30 | } |
developer | 2189d3a | 2020-04-17 17:14:23 +0800 | [diff] [blame] | 31 | |
| 32 | /******************************************************************************* |
| 33 | * MTK_platform handler called when an affinity instance is about to be turned |
| 34 | * on. The level and mpidr determine the affinity instance. |
| 35 | ******************************************************************************/ |
| 36 | static const plat_psci_ops_t plat_plat_pm_ops = { |
developer | bd31bf0 | 2020-07-02 12:10:13 +0800 | [diff] [blame] | 37 | .system_reset = plat_mtk_system_reset, |
developer | 2189d3a | 2020-04-17 17:14:23 +0800 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | int plat_setup_psci_ops(uintptr_t sec_entrypoint, |
| 41 | const plat_psci_ops_t **psci_ops) |
| 42 | { |
| 43 | *psci_ops = &plat_plat_pm_ops; |
| 44 | |
| 45 | return 0; |
| 46 | } |