From: Siddharth Gupta <sidgup@codeaurora.org>
To: ohad@wizery.com, bjorn.andersson@linaro.org
Cc: tsoni@codeaurora.org, linux-arm-msm@vger.kernel.org,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
rishabhb@codeaurora.org, Siddharth Gupta <sidgup@codeaurora.org>,
psodagud@codeaurora.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] remoteproc: core: Add an API for booting with firmware name
Date: Wed, 19 Feb 2020 18:11:52 -0800 [thread overview]
Message-ID: <1582164713-6413-2-git-send-email-sidgup@codeaurora.org> (raw)
In-Reply-To: <1582164713-6413-1-git-send-email-sidgup@codeaurora.org>
Add an API which allows to change the name of the firmware to be booted on
the specified rproc. This change gives us the flixibility to change the
firmware at run-time depending on the usecase. Some remoteprocs might use
a different firmware for testing, production and development purposes,
which may be selected based on the fuse settings during bootup.
Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org>
---
drivers/remoteproc/remoteproc_core.c | 34 ++++++++++++++++++++++++++++++++++
include/linux/remoteproc.h | 1 +
2 files changed, 35 insertions(+)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 097f33e..5ab65a4 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1779,6 +1779,40 @@ int rproc_boot(struct rproc *rproc)
EXPORT_SYMBOL(rproc_boot);
/**
+ * rproc_boot_with_fw() - boot a remote processor with the specified firmware
+ * @rproc: handle of a remote processor
+ * @firmware: name of the firmware to boot with
+ *
+ * Change the name of the firmware to be loaded to @firmware in the rproc
+ * structure, and call rproc_boot().
+ *
+ * Returns 0 on success, and an appropriate error value otherwise.
+ */
+int rproc_boot_with_fw(struct rproc *rproc, const char *firmware)
+{
+ char *p;
+
+ if (!rproc) {
+ pr_err("invalid rproc handle\n");
+ return -EINVAL;
+ }
+
+ if (firmware) {
+ p = kstrdup(firmware, GFP_KERNEL);
+ if (!p)
+ return -ENOMEM;
+
+ mutex_lock(&rproc->lock);
+ kfree(rproc->firmware);
+ rproc->firmware = p;
+ mutex_unlock(&rproc->lock);
+ }
+
+ return rproc_boot(rproc);
+}
+EXPORT_SYMBOL(rproc_boot_with_fw);
+
+/**
* rproc_shutdown() - power off the remote processor
* @rproc: the remote processor
*
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 16ad666..e2eaba9 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -609,6 +609,7 @@ rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len,
u32 da, const char *name, ...);
int rproc_boot(struct rproc *rproc);
+int rproc_boot_with_fw(struct rproc *rproc, const char *firmware);
void rproc_shutdown(struct rproc *rproc);
void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type);
int rproc_coredump_add_segment(struct rproc *rproc, dma_addr_t da, size_t size);
--
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-02-20 2:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 2:11 [PATCH 0/2] remoteproc: core: Add core functionality to the remoteproc framework Siddharth Gupta
2020-02-20 2:11 ` Siddharth Gupta [this message]
2020-02-24 18:30 ` [PATCH 1/2] remoteproc: core: Add an API for booting with firmware name Mathieu Poirier
2020-02-26 23:10 ` Siddharth Gupta
2020-02-20 2:11 ` [PATCH 2/2] remoteproc: core: Prevent sleep when rproc crashes Siddharth Gupta
2020-02-24 18:53 ` Mathieu Poirier
2020-04-07 18:00 ` Siddharth Gupta
2020-04-07 22:29 ` Bjorn Andersson
2020-04-07 22:59 ` rishabhb
2020-04-07 23:26 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1582164713-6413-2-git-send-email-sidgup@codeaurora.org \
--to=sidgup@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=psodagud@codeaurora.org \
--cc=rishabhb@codeaurora.org \
--cc=tsoni@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).