remoteproc: Add new attach() remoteproc operation
authorMathieu Poirier <mathieu.poirier@linaro.org>
Tue, 14 Jul 2020 19:50:28 +0000 (13:50 -0600)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Fri, 17 Jul 2020 06:06:07 +0000 (23:06 -0700)
Add an new attach() operation in order to properly deal with
scenarios where the remoteproc core needs to attach to a
remote processor that has been booted by another entity.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Link: https://lore.kernel.org/r/20200714195035.1426873-3-mathieu.poirier@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/remoteproc_internal.h
include/linux/remoteproc.h

index 4ba7cb5..fc71086 100644 (file)
@@ -79,6 +79,14 @@ static inline int rproc_unprepare_device(struct rproc *rproc)
        return 0;
 }
 
+static inline int rproc_attach_device(struct rproc *rproc)
+{
+       if (rproc->ops->attach)
+               return rproc->ops->attach(rproc);
+
+       return 0;
+}
+
 static inline
 int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw)
 {
index 21182ad..bf6a310 100644 (file)
@@ -359,6 +359,7 @@ enum rsc_handling_status {
  * @unprepare: unprepare device after stop
  * @start:     power on the device and boot it
  * @stop:      power off the device
+ * @attach:    attach to a device that his already powered up
  * @kick:      kick a virtqueue (virtqueue id given as a parameter)
  * @da_to_va:  optional platform hook to perform address translations
  * @parse_fw:  parse firmware to extract information (e.g. resource table)
@@ -379,6 +380,7 @@ struct rproc_ops {
        int (*unprepare)(struct rproc *rproc);
        int (*start)(struct rproc *rproc);
        int (*stop)(struct rproc *rproc);
+       int (*attach)(struct rproc *rproc);
        void (*kick)(struct rproc *rproc, int vqid);
        void * (*da_to_va)(struct rproc *rproc, u64 da, size_t len);
        int (*parse_fw)(struct rproc *rproc, const struct firmware *fw);