summaryrefslogtreecommitdiff
path: root/include/linux/remoteproc
diff options
context:
space:
mode:
authorMD Danish Anwar <danishanwar@ti.com>2023-01-06 15:10:43 +0300
committerMathieu Poirier <mathieu.poirier@linaro.org>2023-01-06 19:14:22 +0300
commit919e8942548aa878d374b1b51aa68fdf751f18b8 (patch)
tree93ee41fcd0eeb366ec72084abc4ac42e71235ece /include/linux/remoteproc
parent9b9ad70f28675c45ef93cfb6e4af9403cb7bd34c (diff)
downloadlinux-919e8942548aa878d374b1b51aa68fdf751f18b8.tar.xz
remoteproc: pru: Add APIs to get and put the PRU cores
Add two new APIs, pru_rproc_get() and pru_rproc_put(), to the PRU driver to allow client drivers to acquire and release the remoteproc device associated with a PRU core. The PRU cores are treated as resources with only one client owning it at a time. The pru_rproc_get() function returns the rproc handle corresponding to a PRU core identified by the device tree "ti,prus" property under the client node. The pru_rproc_put() is the complementary function to pru_rproc_get(). Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> Link: https://lore.kernel.org/r/20230106121046.886863-4-danishanwar@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'include/linux/remoteproc')
-rw-r--r--include/linux/remoteproc/pruss.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/remoteproc/pruss.h b/include/linux/remoteproc/pruss.h
index fbadfcfacb34..579dafbbaccf 100644
--- a/include/linux/remoteproc/pruss.h
+++ b/include/linux/remoteproc/pruss.h
@@ -28,4 +28,34 @@ enum pruss_pru_id {
PRUSS_NUM_PRUS,
};
+struct device_node;
+
+#if IS_ENABLED(CONFIG_PRU_REMOTEPROC)
+
+struct rproc *pru_rproc_get(struct device_node *np, int index,
+ enum pruss_pru_id *pru_id);
+void pru_rproc_put(struct rproc *rproc);
+
+#else
+
+static inline struct rproc *
+pru_rproc_get(struct device_node *np, int index, enum pruss_pru_id *pru_id)
+{
+ return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void pru_rproc_put(struct rproc *rproc) { }
+
+#endif /* CONFIG_PRU_REMOTEPROC */
+
+static inline bool is_pru_rproc(struct device *dev)
+{
+ const char *drv_name = dev_driver_string(dev);
+
+ if (strncmp(drv_name, PRU_RPROC_DRVNAME, sizeof(PRU_RPROC_DRVNAME)))
+ return false;
+
+ return true;
+}
+
#endif /* __LINUX_PRUSS_H */