Lines Matching +full:rst +full:- +full:- +full:- +full:- +full:-

1 // SPDX-License-Identifier: GPL-2.0+
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
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()
42 static int ti_sci_reset_of_xlate(struct reset_ctl *rst, in ti_sci_reset_of_xlate() argument
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()
56 rst->id = args->args[0]; in ti_sci_reset_of_xlate()
57 rst->data = args->args[1]; in ti_sci_reset_of_xlate()
62 static int ti_sci_reset_request(struct reset_ctl *rst) in ti_sci_reset_request() argument
64 debug("%s(rst=%p)\n", __func__, rst); in ti_sci_reset_request()
68 static int ti_sci_reset_free(struct reset_ctl *rst) in ti_sci_reset_free() argument
70 debug("%s(rst=%p)\n", __func__, rst); in ti_sci_reset_free()
75 * ti_sci_reset_set() - program a device's reset
76 * @rst: Handle to a single reset signal
82 * The mechanism itself is a read-modify-write procedure, the current device
84 * set or un-set using the reset's mask, and the new reset value written by
89 static int ti_sci_reset_set(struct reset_ctl *rst, bool assert) in ti_sci_reset_set() argument
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()
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
130 static int ti_sci_reset_assert(struct reset_ctl *rst) in ti_sci_reset_assert() argument
132 debug("%s(rst=%p)\n", __func__, rst); in ti_sci_reset_assert()
133 return ti_sci_reset_set(rst, true); in ti_sci_reset_assert()
137 * ti_sci_reset_deassert() - deassert device reset
138 * @rst: Handle to a single reset signal
147 static int ti_sci_reset_deassert(struct reset_ctl *rst) in ti_sci_reset_deassert() argument
149 debug("%s(rst=%p)\n", __func__, rst); in ti_sci_reset_deassert()
150 return ti_sci_reset_set(rst, false); in ti_sci_reset_deassert()
154 * ti_sci_reset_status() - check device reset status
155 * @rst: Handle to a single reset signal
163 * Return: 0 if reset is deasserted, or a non-zero value if reset is asserted
165 static int ti_sci_reset_status(struct reset_ctl *rst) in ti_sci_reset_status() argument
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()
169 const struct ti_sci_dev_ops *dops = &sci->ops.dev_ops; in ti_sci_reset_status()
173 debug("%s(rst=%p)\n", __func__, rst); 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",