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 <asm/io.h>
10#include <asm/psci.h>
11#include <asm/secure.h>
12
13int __secure psci_features(u32 function_id, u32 psci_fid)
14{
15	switch (psci_fid) {
16	case ARM_PSCI_0_2_FN_PSCI_VERSION:
17	case ARM_PSCI_0_2_FN_SYSTEM_RESET:
18		return 0x0;
19	}
20	/* case ARM_PSCI_0_2_FN_CPU_ON: */
21	/* case ARM_PSCI_0_2_FN_CPU_OFF: */
22	/* case ARM_PSCI_0_2_FN_AFFINITY_INFO: */
23	/* case ARM_PSCI_0_2_FN_MIGRATE_INFO_TYPE: */
24	/* case ARM_PSCI_0_2_FN_SYSTEM_OFF: */
25	return ARM_PSCI_RET_NI;
26}
27
28u32 __secure psci_version(void)
29{
30	return ARM_PSCI_VER_0_2;
31}
32
33#define RST_BASE	0xE6160000 /* Domain0 */
34#define RST_SRESCR0	(RST_BASE + 0x18)
35#define RST_SPRES	0x5AA58000
36
37void __secure __noreturn psci_system_reset(void)
38{
39	writel(RST_SPRES, RST_SRESCR0);
40
41	while (1)
42		;
43}
44
45int psci_update_dt(void *fdt)
46{
47	return 0;
48}
49