@@ -19,7 +19,7 @@ Device connections alone do not create a dependency between the two devices.
They are only descriptions which are not tied to either of the devices directly.
A dependency between the two devices exists only if one of the two endpoint
devices requests a reference to the other. The descriptions themselves can be
-defined in firmware (not yet supported) or they can be built-in.
+defined in firmware or they can be built-in.
Usage
-----
@@ -7,6 +7,7 @@
*/
#include <linux/device.h>
+#include <linux/property.h>
static DEFINE_MUTEX(devcon_lock);
static LIST_HEAD(devcon_list);
@@ -31,10 +32,24 @@ void *device_connection_find_match(struct device *dev, const char *con_id,
struct device_connection *con;
void *ret = NULL;
int ep;
+ struct device_connection graph;
+ struct fwnode_handle *fwnode_ep;
+ struct fwnode_handle *remote;
if (!match)
return NULL;
+ fwnode_graph_for_each_endpoint(dev->fwnode, fwnode_ep) {
+ remote = fwnode_graph_get_remote_port_parent(fwnode_ep);
+ if (!remote)
+ continue;
+
+ graph.fwnode = remote;
+ ret = match(&graph, 0, data);
+ if (!IS_ERR(ret))
+ return ret;
+ }
+
mutex_lock(&devcon_lock);
list_for_each_entry(con, &devcon_list, list) {
@@ -734,11 +734,13 @@ struct device_dma_parameters {
* struct device_connection - Device Connection Descriptor
* @endpoint: The names of the two devices connected together
* @id: Unique identifier for the connection
+ * @fwnode: fwnode pointer for finding a connection from graph
* @list: List head, private, for internal use only
*/
struct device_connection {
const char *endpoint[2];
const char *id;
+ struct fwnode_handle *fwnode;
struct list_head list;
};
This patch adds graph parsing in device_connection_find_match(). The match function will be called with fwnode pointer in struct device_connection. So, a caller can check the matching by using it. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- Documentation/driver-api/device_connection.rst | 2 +- drivers/base/devcon.c | 15 +++++++++++++++ include/linux/device.h | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-)