summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bbaab7f)
raw | patch | inline | side by side (parent: bbaab7f)
author | Loic Pallardy <loic.pallardy@st.com> | |
Thu, 1 Mar 2018 16:23:55 +0000 (17:23 +0100) | ||
committer | Suman Anna <s-anna@ti.com> | |
Wed, 27 Feb 2019 20:35:17 +0000 (14:35 -0600) |
On some SoC architecture, it is needed to enable HW like
clock, bus, regulator, memory region... before loading
co-processor firmware.
This patch introduces prepare and unprepare ops to execute
platform specific function before firmware loading and after
stop execution.
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
[s-anna@ti.com: cherry-pick linux-remoteproc patchwork id '10251897']
Signed-off-by: Suman Anna <s-anna@ti.com>
clock, bus, regulator, memory region... before loading
co-processor firmware.
This patch introduces prepare and unprepare ops to execute
platform specific function before firmware loading and after
stop execution.
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
[s-anna@ti.com: cherry-pick linux-remoteproc patchwork id '10251897']
Signed-off-by: Suman Anna <s-anna@ti.com>
drivers/remoteproc/remoteproc_core.c | patch | blob | history | |
include/linux/remoteproc.h | patch | blob | history |
index 89580b957d66239ecdbde266ea4996c670965a50..c9be95b4e1ba84f1e94cbf4d0b13a6c1cedfafc5 100644 (file)
return ret;
}
+ /* Prepare rproc for firmware loading if needed */
+ if (rproc->ops->prepare) {
+ ret = rproc->ops->prepare(rproc);
+ if (ret) {
+ dev_err(dev, "can't prepare rproc %s: %d\n",
+ rproc->name, ret);
+ goto disable_iommu;
+ }
+ }
+
rproc->bootaddr = rproc_get_boot_addr(rproc, fw);
/* Load resource table, core dump segment list etc from the firmware */
ret = rproc_parse_fw(rproc, fw);
if (ret)
- goto disable_iommu;
+ goto unprepare_rproc;
/* reset max_notifyid */
rproc->max_notifyid = -1;
kfree(rproc->cached_table);
rproc->cached_table = NULL;
rproc->table_ptr = NULL;
+unprepare_rproc:
+ /* release HW resources if needed */
+ if (rproc->ops->unprepare)
+ rproc->ops->unprepare(rproc);
disable_iommu:
rproc_disable_iommu(rproc);
return ret;
/* clean up all acquired resources */
rproc_resource_cleanup(rproc);
+ /* release HW resources if needed */
+ if (rproc->ops->unprepare)
+ rproc->ops->unprepare(rproc);
+
rproc_disable_iommu(rproc);
/* Free the copy of the resource table */
index e0baae1659c2ac3a20753b7db9e652bad99f29bb..5efeb757f182ae8916649804f825efd083c80ecd 100644 (file)
/**
* struct rproc_ops - platform-specific device handlers
+ * @prepare: prepare device for code loading
+ * @unprepare: unprepare device after stop
* @start: power on the device and boot it
* @stop: power off the device
* @kick: kick a virtqueue (virtqueue id given as a parameter)
* @get_boot_addr: get boot address to entry point specified in firmware
*/
struct rproc_ops {
+ int (*prepare)(struct rproc *rproc);
+ int (*unprepare)(struct rproc *rproc);
int (*start)(struct rproc *rproc);
int (*stop)(struct rproc *rproc);
void (*kick)(struct rproc *rproc, int vqid);