diff options
author | Suman Anna | 2014-08-07 23:24:13 -0500 |
---|---|---|
committer | Murali Karicheri | 2015-05-12 11:49:01 -0500 |
commit | e4197abbb1835d5203a6012a9f535bbfe80306ac (patch) | |
tree | 4f61883065a0411ff422495e651300c95448556d | |
parent | b97d8d15aa4f2d79e83dcf3c60660492740c89a7 (diff) | |
download | linux-upstream/v4.0/rpmsg.tar.gz linux-upstream/v4.0/rpmsg.tar.xz linux-upstream/v4.0/rpmsg.zip |
remoteproc: add api for retrieving the rproc alias idupstream/v4.0/rpmsg
A new api, rproc_get_alias_id, is added to allow remoteproc/rpmsg
clients to be able to retrieve a fixed id associated with a rproc
device. Each of the rprocs is given an ida index as well, but this
is dynamic depending on the order rproc_alloc is called (probe order),
and also depends on what remote processor devices are instantiated.
The remoteproc alias id is therefore chosen, with the assumption that
the remoteproc devices are created with known alias ids in DT.
Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 23 | ||||
-rw-r--r-- | include/linux/remoteproc.h | 1 |
2 files changed, 23 insertions, 1 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 2d563e46730..73816000a3a 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/virtio_ids.h> | 41 | #include <linux/virtio_ids.h> |
42 | #include <linux/virtio_ring.h> | 42 | #include <linux/virtio_ring.h> |
43 | #include <linux/io.h> | 43 | #include <linux/io.h> |
44 | 44 | #include <linux/of.h> | |
45 | #include <asm/byteorder.h> | 45 | #include <asm/byteorder.h> |
46 | 46 | ||
47 | #include "remoteproc_internal.h" | 47 | #include "remoteproc_internal.h" |
@@ -1136,6 +1136,27 @@ static void rproc_crash_handler_work(struct work_struct *work) | |||
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | /** | 1138 | /** |
1139 | * rproc_get_alias_id() - return the alias id for the rproc device | ||
1140 | * @rproc: handle of a remote processor | ||
1141 | * | ||
1142 | * Each rproc device is associated with a platform device, but since the | ||
1143 | * devices are created from device tree, they do not have a valid platform | ||
1144 | * device id. This function returns an alternate DT-based alias id, and is | ||
1145 | * useful for clients needing to know an id for a processor. It is assumed | ||
1146 | * that the devices were given proper alias ids. | ||
1147 | * | ||
1148 | * Return: alias id associated with the rproc | ||
1149 | */ | ||
1150 | int rproc_get_alias_id(struct rproc *rproc) | ||
1151 | { | ||
1152 | struct device *dev = rproc->dev.parent; | ||
1153 | struct device_node *np = dev->of_node; | ||
1154 | |||
1155 | return of_alias_get_id(np, "rproc"); | ||
1156 | } | ||
1157 | EXPORT_SYMBOL(rproc_get_alias_id); | ||
1158 | |||
1159 | /** | ||
1139 | * rproc_boot() - boot a remote processor | 1160 | * rproc_boot() - boot a remote processor |
1140 | * @rproc: handle of a remote processor | 1161 | * @rproc: handle of a remote processor |
1141 | * | 1162 | * |
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index c5df397ecaa..44c2560bb6c 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h | |||
@@ -496,6 +496,7 @@ void rproc_shutdown(struct rproc *rproc); | |||
496 | void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type); | 496 | void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type); |
497 | int rproc_boot_ext_download(struct rproc *rproc); | 497 | int rproc_boot_ext_download(struct rproc *rproc); |
498 | struct rproc *rproc_vdev_to_rproc_safe(struct virtio_device *vdev); | 498 | struct rproc *rproc_vdev_to_rproc_safe(struct virtio_device *vdev); |
499 | int rproc_get_alias_id(struct rproc *rproc); | ||
499 | 500 | ||
500 | static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) | 501 | static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) |
501 | { | 502 | { |