"Das U-Boot" Source Tree
at master 43 lines 873 B view raw
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright (C) 2017 Masahiro Yamada <yamada.masahiro@socionext.com> 4 */ 5 6#include <dm.h> 7#include <sysreset.h> 8#include <linux/errno.h> 9#include <linux/psci.h> 10 11__weak int psci_sysreset_get_status(struct udevice *dev, char *buf, int size) 12{ 13 return -EOPNOTSUPP; 14} 15 16static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type) 17{ 18 switch (type) { 19 case SYSRESET_WARM: 20 case SYSRESET_COLD: 21 psci_sys_reset(type); 22 break; 23 case SYSRESET_POWER_OFF: 24 psci_sys_poweroff(); 25 break; 26 default: 27 return -EPROTONOSUPPORT; 28 } 29 30 return -EINPROGRESS; 31} 32 33static struct sysreset_ops psci_sysreset_ops = { 34 .request = psci_sysreset_request, 35 .get_status = psci_sysreset_get_status, 36}; 37 38U_BOOT_DRIVER(psci_sysreset) = { 39 .name = "psci-sysreset", 40 .id = UCLASS_SYSRESET, 41 .ops = &psci_sysreset_ops, 42 .flags = DM_FLAG_PRE_RELOC, 43};