xref: /openbmc/u-boot/arch/x86/cpu/tangier/sysreset.c (revision cbd2fba1)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
4  *
5  * Reset driver for tangier processor
6  */
7 
8 #include <common.h>
9 #include <dm.h>
10 #include <sysreset.h>
11 #include <asm/scu.h>
12 
13 static int tangier_sysreset_request(struct udevice *dev, enum sysreset_t type)
14 {
15 	int value;
16 
17 	switch (type) {
18 	case SYSRESET_WARM:
19 		value = IPCMSG_WARM_RESET;
20 		break;
21 	case SYSRESET_COLD:
22 		value = IPCMSG_COLD_RESET;
23 		break;
24 	default:
25 		return -ENOSYS;
26 	}
27 
28 	scu_ipc_simple_command(value, 0);
29 
30 	return -EINPROGRESS;
31 }
32 
33 static const struct udevice_id tangier_sysreset_ids[] = {
34 	{ .compatible = "intel,reset-tangier" },
35 	{ }
36 };
37 
38 static struct sysreset_ops tangier_sysreset_ops = {
39 	.request = tangier_sysreset_request,
40 };
41 
42 U_BOOT_DRIVER(tangier_sysreset) = {
43 	.name = "tangier-sysreset",
44 	.id = UCLASS_SYSRESET,
45 	.of_match = tangier_sysreset_ids,
46 	.ops = &tangier_sysreset_ops,
47 };
48