[PATCH v11 14/35] remoteproc: k3-dsp: Correct Reset logic for devices without lresets

Beleswar Padhi
2025-04-25T10:42:41Z

The k3_dsp_rproc_reset() function erroneously asserts the local reset
even for devices which do not support it. Even though it results in a
no-operation, Update the logic to explicitly assert the local reset for
devices that support it and only the global reset for those that do not.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
Tested-by: Judith Mendez <jm@ti.com>
---
v11: Changelog:
1. Don't deassert lreset back if asserting module reset fails. [Andrew]
2. Put if-else block for code path with lreset and w/o lreset. [Andrew]
3. Carried T/B tag.

Link to v10:
https://lore.kernel.org/all/20250417182001.3903905-15-b-padhi@ti.com/

v10: Changelog:
1. Split [v9 12/26] into [v10 14/33] and [v10 15/33] patches.

Link to v9:
https://lore.kernel.org/all/20250317120622.1746415-13-b-padhi@ti.com/

drivers/remoteproc/ti_k3_dsp_remoteproc.c | 24 +++++++++--------------
1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
index 476f4e69d2c11..2ffcdba1c7754 100644
--- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
@@ -30,21 +30,15 @@ static int k3_dsp_rproc_reset(struct k3_rproc *kproc)
struct device *dev = kproc->dev;
int ret;

- ret = reset_control_assert(kproc->reset);
- if (ret) {
- dev_err(dev, "local-reset assert failed (%pe)\n", ERR_PTR(ret));
- return ret;
- }
-
- if (kproc->data->uses_lreset)
- return ret;
-
- ret = kproc->ti_sci->ops.dev_ops.put_device(kproc->ti_sci,
- kproc->ti_sci_id);
- if (ret) {
- dev_err(dev, "module-reset assert failed (%pe)\n", ERR_PTR(ret));
- if (reset_control_deassert(kproc->reset))
- dev_warn(dev, "local-reset deassert back failed\n");
+ if (kproc->data->uses_lreset) {
+ ret = reset_control_assert(kproc->reset);
+ if (ret)
+ dev_err(dev, "local-reset assert failed (%pe)\n", ERR_PTR(ret));
+ } else {
+ ret = kproc->ti_sci->ops.dev_ops.put_device(kproc->ti_sci,
+ kproc->ti_sci_id);
+ if (ret)
+ dev_err(dev, "module-reset assert failed (%pe)\n", ERR_PTR(ret));
}

return ret;
--
2.34.1