diff mbox

[RFC,5/6] remoteproc: Add posibility to probe a sub device.

Message ID 1511534202-12995-6-git-send-email-arnaud.pouliquen@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arnaud POULIQUEN Nov. 24, 2017, 2:36 p.m. UTC
From: Fabien Dessenne <fabien.dessenne@st.com>

When a remote processor registers, populate the device tree to probe
a potential sub-device. This capability is added to be able to add
a resource manger for the remote processor.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
---
 drivers/remoteproc/remoteproc_core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Bjorn Andersson Dec. 14, 2017, 6:24 a.m. UTC | #1
On Fri 24 Nov 06:36 PST 2017, Arnaud Pouliquen wrote:

> @@ -1343,6 +1344,11 @@ int rproc_add(struct rproc *rproc)
>  			return ret;
>  	}
>  
> +	/* add resource manager device */
> +	ret = devm_of_platform_populate(dev->parent);
> +	if (ret < 0)
> +		return ret;

With the Qualcomm remoteprocs we describe the communication links as
sub-nodes of the remoteproc node to allow binding drivers to channels by
compatible, provide properties to the devices and expose remote services
in DT (e.g. for the purpose of implementing regulators, clocks and other
resources for the system).

I'm surprised this has not been brought up yet for rpmsg, but I assume
it will come at some point, e.g. that we would have something like:

remoteproc {
	compatible = "acme,rproc";

	vdev0 {
		reg = <0>;

		acme_clocks: clock-controller {
			compatible = "acme,clock-controller";
			#clock-cells = <1>;
		};
	};
};


So blindly creating platform_devices for any subnodes of the remoteproc
node doesn't work for the Qualcomm drivers and won't work if we ever
want to describe something else than a platform driver as a child of any
other remoteproc.

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 870b1fb..3f39def 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -40,6 +40,7 @@ 
 #include <linux/crc32.h>
 #include <linux/virtio_ids.h>
 #include <linux/virtio_ring.h>
+#include <linux/of_platform.h>
 #include <asm/byteorder.h>
 
 #include "remoteproc_internal.h"
@@ -1343,6 +1344,11 @@  int rproc_add(struct rproc *rproc)
 			return ret;
 	}
 
+	/* add resource manager device */
+	ret = devm_of_platform_populate(dev->parent);
+	if (ret < 0)
+		return ret;
+
 	/* expose to rproc_get_by_phandle users */
 	mutex_lock(&rproc_list_mutex);
 	list_add(&rproc->node, &rproc_list);
@@ -1551,6 +1557,8 @@  int rproc_del(struct rproc *rproc)
 	list_del(&rproc->node);
 	mutex_unlock(&rproc_list_mutex);
 
+	of_platform_depopulate(rproc->dev.parent);
+
 	device_del(&rproc->dev);
 
 	return 0;