1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * This file implements basic PSCI support for Renesas r8a779a0 SoC
4  *
5  * Copyright (C) 2020 Renesas Electronics Corp.
6  *
7  */
8 
9 #include <common.h>
10 #include <asm/io.h>
11 #include <asm/psci.h>
12 #include <asm/secure.h>
13 
psci_features(u32 function_id,u32 psci_fid)14 int __secure psci_features(u32 function_id, u32 psci_fid)
15 {
16 	switch (psci_fid) {
17 	case ARM_PSCI_0_2_FN_PSCI_VERSION:
18 	case ARM_PSCI_0_2_FN_SYSTEM_RESET:
19 		return 0x0;
20 	}
21 	/* case ARM_PSCI_0_2_FN_CPU_ON: */
22 	/* case ARM_PSCI_0_2_FN_CPU_OFF: */
23 	/* case ARM_PSCI_0_2_FN_AFFINITY_INFO: */
24 	/* case ARM_PSCI_0_2_FN_MIGRATE_INFO_TYPE: */
25 	/* case ARM_PSCI_0_2_FN_SYSTEM_OFF: */
26 	return ARM_PSCI_RET_NI;
27 }
28 
psci_version(void)29 u32 __secure psci_version(void)
30 {
31 	return ARM_PSCI_VER_0_2;
32 }
33 
34 #define RST_BASE	0xE6160000 /* Domain0 */
35 #define RST_SRESCR0	(RST_BASE + 0x18)
36 #define RST_SPRES	0x5AA58000
37 
psci_system_reset(void)38 void __secure __noreturn psci_system_reset(void)
39 {
40 	writel(RST_SPRES, RST_SRESCR0);
41 
42 	while (1)
43 		;
44 }
45 
psci_update_dt(void * fdt)46 int psci_update_dt(void *fdt)
47 {
48 	return 0;
49 }
50