remoteproc: introduce rproc_get_by_phandle API

Allow users of remoteproc the ability to get a handle to an rproc by
passing a phandle supplied in the user's device tree node. This is
useful in situations that require manual booting of the rproc.

This patch uses the code removed by commit 40e575b1d0 ("remoteproc:
remove the get_by_name/put API") for the ref counting but is modified
to use a simple list and locking mechanism and has rproc_get_by_name
replaced with an rproc_get_by_phandle API.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
[fix order of Signed-off-by tags]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
This commit is contained in:
Dave Gerlach
2015-05-22 15:45:27 -05:00
committed by Ohad Ben-Cohen
parent 172e6ab1ca
commit fec47d8635
3 changed files with 60 additions and 3 deletions

View File

@@ -36,11 +36,11 @@
#define REMOTEPROC_H
#include <linux/types.h>
#include <linux/klist.h>
#include <linux/mutex.h>
#include <linux/virtio.h>
#include <linux/completion.h>
#include <linux/idr.h>
#include <linux/of.h>
/**
* struct resource_table - firmware resource table header
@@ -375,7 +375,7 @@ enum rproc_crash_type {
/**
* struct rproc - represents a physical remote processor device
* @node: klist node of this rproc object
* @node: list node of this rproc object
* @domain: iommu domain
* @name: human readable name of the rproc
* @firmware: name of firmware file to be loaded
@@ -407,7 +407,7 @@ enum rproc_crash_type {
* @has_iommu: flag to indicate if remote processor is behind an MMU
*/
struct rproc {
struct klist_node node;
struct list_head node;
struct iommu_domain *domain;
const char *name;
const char *firmware;
@@ -481,6 +481,7 @@ struct rproc_vdev {
u32 rsc_offset;
};
struct rproc *rproc_get_by_phandle(phandle phandle);
struct rproc *rproc_alloc(struct device *dev, const char *name,
const struct rproc_ops *ops,
const char *firmware, int len);