Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <lib/psci/psci.h> |
| 8 | #include <plat/arm/common/plat_arm.h> |
Emekcan Aras | 53e91a3 | 2021-11-17 18:45:32 +0000 | [diff] [blame] | 9 | #include <platform_def.h> |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 10 | /******************************************************************************* |
| 11 | * Export the platform handlers via plat_arm_psci_pm_ops. The ARM Standard |
| 12 | * platform layer will take care of registering the handlers with PSCI. |
| 13 | ******************************************************************************/ |
Emekcan Aras | 53e91a3 | 2021-11-17 18:45:32 +0000 | [diff] [blame] | 14 | |
| 15 | static void __dead2 corstone1000_system_reset(void) |
| 16 | { |
| 17 | |
| 18 | uint32_t volatile * const watchdog_ctrl_reg = (uint32_t *) SECURE_WATCHDOG_ADDR_CTRL_REG; |
| 19 | uint32_t volatile * const watchdog_val_reg = (uint32_t *) SECURE_WATCHDOG_ADDR_VAL_REG; |
| 20 | |
| 21 | *(watchdog_val_reg) = SECURE_WATCHDOG_COUNTDOWN_VAL; |
| 22 | *watchdog_ctrl_reg = SECURE_WATCHDOG_MASK_ENABLE; |
| 23 | while (1) { |
David Vincze | bfdb726 | 2022-03-03 14:35:51 +0100 | [diff] [blame] | 24 | wfi(); |
| 25 | } |
Emekcan Aras | 53e91a3 | 2021-11-17 18:45:32 +0000 | [diff] [blame] | 26 | } |
| 27 | |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 28 | plat_psci_ops_t plat_arm_psci_pm_ops = { |
Emekcan Aras | 53e91a3 | 2021-11-17 18:45:32 +0000 | [diff] [blame] | 29 | .system_reset = corstone1000_system_reset, |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 30 | .validate_ns_entrypoint = NULL |
| 31 | }; |
| 32 | |
| 33 | const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops) |
| 34 | { |
Emekcan Aras | 53e91a3 | 2021-11-17 18:45:32 +0000 | [diff] [blame] | 35 | ops = &plat_arm_psci_pm_ops; |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 36 | return ops; |
| 37 | } |