diff options
author | Andrew Davis <afd@ti.com> | 2024-08-02 10:21:02 -0500 |
---|---|---|
committer | Mathieu Poirier <mathieu.poirier@linaro.org> | 2024-08-21 11:21:02 -0600 |
commit | ce6acb2240f40f24bc7b9240e11bbfad7cf3d113 (patch) | |
tree | 0e191bcfcba327a9945ae00c354154b75fae45f4 /drivers/remoteproc/ti_sci_proc.h | |
parent | 9fedb829372d4bd176ad077a0f52bc47258aa178 (diff) | |
download | lwn-ce6acb2240f40f24bc7b9240e11bbfad7cf3d113.tar.gz lwn-ce6acb2240f40f24bc7b9240e11bbfad7cf3d113.zip |
remoteproc: k3: Factor out TI-SCI processor control OF get function
Building the TSP structure is common for users of the TI-SCI processor
control interface. Factor out this function and put it with the rest
of the TI-SCI processor control functions.
Signed-off-by: Andrew Davis <afd@ti.com>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
Link: https://lore.kernel.org/r/20240802152109.137243-3-afd@ti.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'drivers/remoteproc/ti_sci_proc.h')
-rw-r--r-- | drivers/remoteproc/ti_sci_proc.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/remoteproc/ti_sci_proc.h b/drivers/remoteproc/ti_sci_proc.h index 778558abcdcc..f3911ce75252 100644 --- a/drivers/remoteproc/ti_sci_proc.h +++ b/drivers/remoteproc/ti_sci_proc.h @@ -28,6 +28,32 @@ struct ti_sci_proc { u8 host_id; }; +static inline +struct ti_sci_proc *ti_sci_proc_of_get_tsp(struct device *dev, + const struct ti_sci_handle *sci) +{ + struct ti_sci_proc *tsp; + u32 temp[2]; + int ret; + + ret = of_property_read_u32_array(dev_of_node(dev), "ti,sci-proc-ids", + temp, 2); + if (ret < 0) + return ERR_PTR(ret); + + tsp = devm_kzalloc(dev, sizeof(*tsp), GFP_KERNEL); + if (!tsp) + return ERR_PTR(-ENOMEM); + + tsp->dev = dev; + tsp->sci = sci; + tsp->ops = &sci->ops.proc_ops; + tsp->proc_id = temp[0]; + tsp->host_id = temp[1]; + + return tsp; +} + static inline int ti_sci_proc_request(struct ti_sci_proc *tsp) { int ret; |