1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
11 SYSRESET_WARM, /* Reset CPU, keep GPIOs active */
12 SYSRESET_COLD, /* Reset CPU and GPIOs */
13 SYSRESET_POWER, /* Reset PMIC (remove and restore power) */
20 * request() - request a sysreset of the given type
22 * Note that this function may return before the reset takes effect.
24 * @type: Reset type to request
25 * @return -EINPROGRESS if the reset has been started and
26 * will complete soon, -EPROTONOSUPPORT if not supported
27 * by this device, 0 if the reset has already happened
28 * (in which case this method will not actually return)
30 int (*request)(struct udevice *dev, enum sysreset_t type);
32 * get_status() - get printable reset status information
34 * @buf: Buffer to receive the textual reset information
35 * @size: Size of the passed buffer
36 * @return 0 if OK, -ve on error
38 int (*get_status)(struct udevice *dev, char *buf, int size);
41 #define sysreset_get_ops(dev) ((struct sysreset_ops *)(dev)->driver->ops)
44 * sysreset_request() - request a sysreset
46 * @type: Reset type to request
47 * @return 0 if OK, -EPROTONOSUPPORT if not supported by this device
49 int sysreset_request(struct udevice *dev, enum sysreset_t type);
52 * get_status() - get printable reset status information
54 * @buf: Buffer to receive the textual reset information
55 * @size: Size of the passed buffer
56 * @return 0 if OK, -ve on error
58 int sysreset_get_status(struct udevice *dev, char *buf, int size);
61 * sysreset_walk() - cause a system reset
63 * This works through the available sysreset devices until it finds one that can
64 * perform a reset. If the provided sysreset type is not available, the next one
67 * If this function fails to reset, it will display a message and halt
69 * @type: Reset type to request
70 * @return -EINPROGRESS if a reset is in progress, -ENOSYS if not available
72 int sysreset_walk(enum sysreset_t type);
75 * sysreset_walk_halt() - try to reset, otherwise halt
77 * This calls sysreset_walk(). If it returns, indicating that reset is not
78 * supported, it prints a message and halts.
80 void sysreset_walk_halt(enum sysreset_t type);
83 * reset_cpu() - calls sysreset_walk(SYSRESET_WARM)
85 void reset_cpu(ulong addr);