Lines Matching +full:sci +full:- +full:reset

1 // SPDX-License-Identifier: GPL-2.0+
3 * Texas Instruments System Control Interface (TI SCI) reset driver
5 * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
8 * Loosely based on Linux kernel reset-ti-sci.c...
14 #include <reset-uclass.h>
18 * struct ti_sci_reset_data - reset controller information structure
19 * @sci: TI SCI handle used for communication with system controller
22 const struct ti_sci_handle *sci; member
32 return -ENOMEM; in ti_sci_reset_probe()
35 data->sci = ti_sci_get_handle(dev); in ti_sci_reset_probe()
36 if (IS_ERR(data->sci)) in ti_sci_reset_probe()
37 return PTR_ERR(data->sci); in ti_sci_reset_probe()
45 debug("%s(rst=%p, args_count=%d)\n", __func__, rst, args->args_count); in ti_sci_reset_of_xlate()
47 if (args->args_count != 2) { in ti_sci_reset_of_xlate()
48 debug("Invalid args_count: %d\n", args->args_count); in ti_sci_reset_of_xlate()
49 return -EINVAL; in ti_sci_reset_of_xlate()
53 * On TI SCI-based devices, the reset provider id field is used as a in ti_sci_reset_of_xlate()
54 * device ID, and the data field is used as the associated reset mask. in ti_sci_reset_of_xlate()
56 rst->id = args->args[0]; in ti_sci_reset_of_xlate()
57 rst->data = args->args[1]; in ti_sci_reset_of_xlate()
75 * ti_sci_reset_set() - program a device's reset
76 * @rst: Handle to a single reset signal
80 * reset using the TI SCI protocol. The device's reset is asserted if the
82 * The mechanism itself is a read-modify-write procedure, the current device
83 * reset register is read using a TI SCI device operation, the new value is
84 * set or un-set using the reset's mask, and the new reset value written by
85 * using another TI SCI device operation.
91 struct ti_sci_reset_data *data = dev_get_priv(rst->dev); in ti_sci_reset_set()
92 const struct ti_sci_handle *sci = data->sci; in ti_sci_reset_set() local
93 const struct ti_sci_dev_ops *dops = &sci->ops.dev_ops; in ti_sci_reset_set()
97 ret = dops->get_device_resets(sci, rst->id, &reset_state); in ti_sci_reset_set()
99 dev_err(rst->dev, "%s: get_device_resets failed (%d)\n", in ti_sci_reset_set()
105 reset_state |= rst->data; in ti_sci_reset_set()
107 reset_state &= ~rst->data; in ti_sci_reset_set()
109 ret = dops->set_device_resets(sci, rst->id, reset_state); in ti_sci_reset_set()
111 dev_err(rst->dev, "%s: set_device_resets failed (%d)\n", in ti_sci_reset_set()
120 * ti_sci_reset_assert() - assert device reset
121 * @rst: Handle to a single reset signal
123 * This function implements the reset driver op to assert a device's reset
124 * using the TI SCI protocol. This invokes the function ti_sci_reset_set()
126 * argument set to true for asserting the reset.
137 * ti_sci_reset_deassert() - deassert device reset
138 * @rst: Handle to a single reset signal
140 * This function implements the reset driver op to deassert a device's reset
141 * using the TI SCI protocol. This invokes the function ti_sci_reset_set()
143 * argument set to false for deasserting the reset.
154 * ti_sci_reset_status() - check device reset status
155 * @rst: Handle to a single reset signal
157 * This function implements the reset driver op to return the status of a
158 * device's reset using the TI SCI protocol. The reset register value is read
159 * by invoking the TI SCI device operation .get_device_resets(), and the
160 * status of the specific reset is extracted and returned using this reset's
161 * reset mask.
163 * Return: 0 if reset is deasserted, or a non-zero value if reset is asserted
167 struct ti_sci_reset_data *data = dev_get_priv(rst->dev); in ti_sci_reset_status()
168 const struct ti_sci_handle *sci = data->sci; in ti_sci_reset_status() local
169 const struct ti_sci_dev_ops *dops = &sci->ops.dev_ops; in ti_sci_reset_status()
175 ret = dops->get_device_resets(sci, rst->id, &reset_state); in ti_sci_reset_status()
177 dev_err(rst->dev, "%s: get_device_resets failed (%d)\n", in ti_sci_reset_status()
182 return reset_state & rst->data; in ti_sci_reset_status()
186 { .compatible = "ti,sci-reset", },
200 .name = "ti-sci-reset",