spmi: msm: add arbiter version 5 support
[platform/kernel/u-boot.git] / drivers / sysreset / sysreset_psci.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2017 Masahiro Yamada <yamada.masahiro@socionext.com>
4  */
5
6 #include <common.h>
7 #include <dm.h>
8 #include <sysreset.h>
9 #include <linux/errno.h>
10 #include <linux/psci.h>
11
12 static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type)
13 {
14         switch (type) {
15         case SYSRESET_WARM:
16         case SYSRESET_COLD:
17                 psci_sys_reset(type);
18                 break;
19         case SYSRESET_POWER_OFF:
20                 psci_sys_poweroff();
21                 break;
22         default:
23                 return -ENOSYS;
24         }
25
26         return -EINPROGRESS;
27 }
28
29 static struct sysreset_ops psci_sysreset_ops = {
30         .request = psci_sysreset_request,
31 };
32
33 U_BOOT_DRIVER(psci_sysreset) = {
34         .name = "psci-sysreset",
35         .id = UCLASS_SYSRESET,
36         .ops = &psci_sysreset_ops,
37 };