summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c52d91)
raw | patch | inline | side by side (parent: 3c52d91)
author | Suman Anna <s-anna@ti.com> | |
Mon, 15 Jan 2018 18:01:54 +0000 (12:01 -0600) | ||
committer | Suman Anna <s-anna@ti.com> | |
Wed, 19 Dec 2018 03:15:45 +0000 (21:15 -0600) |
A new api, rproc_get_id(), is added to allow remoteproc/rpmsg clients
to be able to retrieve a fixed unique 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.
This unique id needs to be supported for both DT and non-DT devices.
The platform device id or the remoteproc alias id are therefore
chosen for non-DT and DT devices respectively, with the assumption
that the remoteproc devices are created with known platform device
ids or alias ids in DT.
Signed-off-by: Suman Anna <s-anna@ti.com>
to be able to retrieve a fixed unique 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.
This unique id needs to be supported for both DT and non-DT devices.
The platform device id or the remoteproc alias id are therefore
chosen for non-DT and DT devices respectively, with the assumption
that the remoteproc devices are created with known platform device
ids or alias ids in DT.
Signed-off-by: Suman Anna <s-anna@ti.com>
drivers/remoteproc/remoteproc_core.c | patch | blob | history | |
include/linux/remoteproc.h | patch | blob | history |
index b870eebfb86b3556acfd205b5f6cb76e4170d606..a0af2471cdd3abb1c5735f211caef97c18e46ae6 100644 (file)
#include <linux/crc32.h>
#include <linux/virtio_ids.h>
#include <linux/virtio_ring.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
#include <asm/byteorder.h>
#include "remoteproc_internal.h"
rproc_trigger_recovery(rproc);
}
+/**
+ * rproc_get_id() - return the id for the rproc device
+ * @rproc: handle of a remote processor
+ *
+ * Each rproc device is associated with a platform device, which is created
+ * either from device tree (majority newer platforms) or using legacy style
+ * platform device creation (fewer legacy platforms). This function retrieves
+ * an unique id for each remote processor and is useful for clients needing
+ * to distinguish each of the remoteprocs. This unique id is derived using
+ * the platform device id for non-DT devices, or an alternate alias id for
+ * DT devices (since they do not have a valid platform device id). It is
+ * assumed that the platform devices were created with known ids or were
+ * given proper alias ids using the stem "rproc".
+ *
+ * Return: alias id for DT devices or platform device id for non-DT devices
+ * associated with the rproc
+ */
+int rproc_get_id(struct rproc *rproc)
+{
+ struct device *dev = rproc->dev.parent;
+ struct device_node *np = dev->of_node;
+ struct platform_device *pdev = to_platform_device(dev);
+
+ if (np)
+ return of_alias_get_id(np, "rproc");
+ else
+ return pdev->id;
+}
+EXPORT_SYMBOL(rproc_get_id);
+
/**
* rproc_boot() - boot a remote processor
* @rproc: handle of a remote processor
index 25a00c8b5b7f64ce8cce96e42fd8b3030cd93e76..475dfcf8079e4477ca928e41a2de86957362b1a4 100644 (file)
void rproc_shutdown(struct rproc *rproc);
void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type);
int rproc_coredump_add_segment(struct rproc *rproc, dma_addr_t da, size_t size);
+int rproc_get_id(struct rproc *rproc);
static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev)
{