diff mbox series

[U-Boot,v2,19/24] remoteproc: Allow for individual remoteproc initialization

Message ID 20180827102755.5784-20-lokeshvutla@ti.com
State Accepted
Delegated to: Tom Rini
Headers show
Series Initial support Texas Instrument's AM654 Platform | expand

Commit Message

Lokesh Vutla Aug. 27, 2018, 10:27 a.m. UTC
Existing rproc_init() api tries to initialize all available
remoteproc devices. This will fail when there is dependency
among available remoteprocs. So introduce a separate api
that allows to initialize remoteprocs individually based
on id.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/remoteproc/rproc-uclass.c | 19 +++++++++++++++++++
 include/remoteproc.h              |  9 +++++++++
 2 files changed, 28 insertions(+)

Comments

Tom Rini Sept. 12, 2018, 12:42 a.m. UTC | #1
On Mon, Aug 27, 2018 at 03:57:50PM +0530, Lokesh Vutla wrote:

> Existing rproc_init() api tries to initialize all available
> remoteproc devices. This will fail when there is dependency
> among available remoteprocs. So introduce a separate api
> that allows to initialize remoteprocs individually based
> on id.
> 
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c
index 1fc3d424b3..c8a41a6332 100644
--- a/drivers/remoteproc/rproc-uclass.c
+++ b/drivers/remoteproc/rproc-uclass.c
@@ -272,6 +272,25 @@  int rproc_init(void)
 	return ret;
 }
 
+int rproc_dev_init(int id)
+{
+	struct udevice *dev = NULL;
+	int ret;
+
+	ret = uclass_get_device_by_seq(UCLASS_REMOTEPROC, id, &dev);
+	if (ret) {
+		debug("Unknown remote processor id '%d' requested(%d)\n",
+		      id, ret);
+		return ret;
+	}
+
+	ret = device_probe(dev);
+	if (ret)
+		debug("%s: Failed to initialize - %d\n", dev->name, ret);
+
+	return ret;
+}
+
 int rproc_load(int id, ulong addr, ulong size)
 {
 	struct udevice *dev = NULL;
diff --git a/include/remoteproc.h b/include/remoteproc.h
index c3c3f46a1a..a59dba8481 100644
--- a/include/remoteproc.h
+++ b/include/remoteproc.h
@@ -85,6 +85,14 @@  struct dm_rproc_ops {
  */
 int rproc_init(void);
 
+/**
+ * rproc_dev_init() - Initialize a remote proc device based on id
+ * @id:		id of the remote processor
+ *
+ * Return: 0 if all ok, else appropriate error value.
+ */
+int rproc_dev_init(int id);
+
 /**
  * rproc_is_initialized() - check to see if remoteproc devices are initialized
  *
@@ -150,6 +158,7 @@  int rproc_ping(int id);
 int rproc_is_running(int id);
 #else
 static inline int rproc_init(void) { return -ENOSYS; }
+static inline int rproc_dev_init(int id) { return -ENOSYS; }
 static inline bool rproc_is_initialized(void) { return false; }
 static inline int rproc_load(int id, ulong addr, ulong size) { return -ENOSYS; }
 static inline int rproc_start(int id) { return -ENOSYS; }