|
|
@@ -1119,12 +1119,22 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
|
|
|
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;
|
|
|
@@ -1147,6 +1157,10 @@ clean_up_resources:
|
|
|
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;
|
|
|
@@ -1538,6 +1552,10 @@ void rproc_shutdown(struct rproc *rproc)
|
|
|
/* 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 */
|