diff options
author | Sarangdhar Joshi <spjoshi@codeaurora.org> | 2017-05-27 02:51:01 +0300 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2017-05-27 04:11:33 +0300 |
commit | 7e83cab824a86704cdbd7735c19d34e0ce423dc5 (patch) | |
tree | 7274a1af97a011d06371e1ad463a8066f43ae8d7 /drivers/remoteproc | |
parent | 1efa30d0895e7e9a58a59b0880b330b38245be68 (diff) | |
download | linux-7e83cab824a86704cdbd7735c19d34e0ce423dc5.tar.xz |
remoteproc: Modify recovery path to use rproc_{start,stop}()
Replace rproc_shutdown() by rproc_stop() and rproc_boot() by
rproc_start() in the recovery path, in order to avoid remoteproc
resources re-allocation overhead and to assist with extracting the
coredumps after stopping the remote processor.
Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index c8cb54bedd9a..369ba0f8429c 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1051,23 +1051,40 @@ static int rproc_stop(struct rproc *rproc) */ int rproc_trigger_recovery(struct rproc *rproc) { - dev_err(&rproc->dev, "recovering %s\n", rproc->name); + const struct firmware *firmware_p; + struct device *dev = &rproc->dev; + int ret; + + dev_err(dev, "recovering %s\n", rproc->name); init_completion(&rproc->crash_comp); - /* shut down the remote */ - /* TODO: make sure this works with rproc->power > 1 */ - rproc_shutdown(rproc); + ret = mutex_lock_interruptible(&rproc->lock); + if (ret) + return ret; + + ret = rproc_stop(rproc); + if (ret) + goto unlock_mutex; /* wait until there is no more rproc users */ wait_for_completion(&rproc->crash_comp); - /* - * boot the remote processor up again - */ - rproc_boot(rproc); + /* load firmware */ + ret = request_firmware(&firmware_p, rproc->firmware, dev); + if (ret < 0) { + dev_err(dev, "request_firmware failed: %d\n", ret); + goto unlock_mutex; + } - return 0; + /* boot the remote processor up again */ + ret = rproc_start(rproc, firmware_p); + + release_firmware(firmware_p); + +unlock_mutex: + mutex_unlock(&rproc->lock); + return ret; } /** |