1 // SPDX-License-Identifier: BSD-2-Clause 2 /* 3 * Copyright (c) 2021, Microchip 4 */ 5 6 #include <drivers/atmel_rstc.h> 7 #include <kernel/panic.h> 8 #include <sm/psci.h> 9 #include <sm/std_smc.h> 10 #include <stdint.h> 11 #include <trace.h> 12 13 void __noreturn psci_system_reset(void) 14 { 15 if (!atmel_rstc_available()) 16 panic(); 17 18 atmel_rstc_reset(); 19 } 20 21 int psci_features(uint32_t psci_fid) 22 { 23 switch (psci_fid) { 24 case ARM_SMCCC_VERSION: 25 case PSCI_PSCI_FEATURES: 26 case PSCI_VERSION: 27 return PSCI_RET_SUCCESS; 28 case PSCI_SYSTEM_RESET: 29 if (atmel_rstc_available()) 30 return PSCI_RET_SUCCESS; 31 return PSCI_RET_NOT_SUPPORTED; 32 default: 33 return PSCI_RET_NOT_SUPPORTED; 34 } 35 } 36 37 uint32_t psci_version(void) 38 { 39 return PSCI_VERSION_1_0; 40 } 41