1 // SPDX-License-Identifier: GPL-2.0+
3 * Texas Instruments System Control Interface (TI SCI) system reset driver
5 * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
6 * Andreas Dannenberg <dannenberg@ti.com>
13 #include <linux/soc/ti/ti_sci_protocol.h>
16 * struct ti_sci_sysreset_data - sysreset controller information structure
17 * @sci: TI SCI handle used for communication with system controller
19 struct ti_sci_sysreset_data {
20 const struct ti_sci_handle *sci;
23 static int ti_sci_sysreset_probe(struct udevice *dev)
25 struct ti_sci_sysreset_data *data = dev_get_priv(dev);
27 debug("%s(dev=%p)\n", __func__, dev);
32 /* Store handle for communication with the system controller */
33 data->sci = ti_sci_get_handle(dev);
34 if (IS_ERR(data->sci))
35 return PTR_ERR(data->sci);
40 static int ti_sci_sysreset_request(struct udevice *dev, enum sysreset_t type)
42 struct ti_sci_sysreset_data *data = dev_get_priv(dev);
43 const struct ti_sci_handle *sci = data->sci;
44 const struct ti_sci_core_ops *cops = &sci->ops.core_ops;
47 debug("%s(dev=%p, type=%d)\n", __func__, dev, type);
49 ret = cops->reboot_device(sci);
51 dev_err(rst->dev, "%s: reboot_device failed (%d)\n",
57 static struct sysreset_ops ti_sci_sysreset_ops = {
58 .request = ti_sci_sysreset_request,
61 static const struct udevice_id ti_sci_sysreset_of_match[] = {
62 { .compatible = "ti,sci-sysreset", },
66 U_BOOT_DRIVER(ti_sci_sysreset) = {
67 .name = "ti-sci-sysreset",
68 .id = UCLASS_SYSRESET,
69 .of_match = ti_sci_sysreset_of_match,
70 .probe = ti_sci_sysreset_probe,
71 .priv_auto_alloc_size = sizeof(struct ti_sci_sysreset_data),
72 .ops = &ti_sci_sysreset_ops,