|
@@ -1311,3 +1311,35 @@ fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode)
|
|
|
return endpoint;
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_endpoint);
|
|
|
+
|
|
|
+/**
|
|
|
+ * fwnode_graph_parse_endpoint - parse common endpoint node properties
|
|
|
+ * @fwnode: pointer to endpoint fwnode_handle
|
|
|
+ * @endpoint: pointer to the fwnode endpoint data structure
|
|
|
+ *
|
|
|
+ * Parse @fwnode representing a graph endpoint node and store the
|
|
|
+ * information in @endpoint. The caller must hold a reference to
|
|
|
+ * @fwnode.
|
|
|
+ */
|
|
|
+int fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode,
|
|
|
+ struct fwnode_endpoint *endpoint)
|
|
|
+{
|
|
|
+ struct fwnode_handle *port_fwnode = fwnode_get_parent(fwnode);
|
|
|
+
|
|
|
+ memset(endpoint, 0, sizeof(*endpoint));
|
|
|
+
|
|
|
+ endpoint->local_fwnode = fwnode;
|
|
|
+
|
|
|
+ if (is_acpi_node(port_fwnode)) {
|
|
|
+ fwnode_property_read_u32(port_fwnode, "port", &endpoint->port);
|
|
|
+ fwnode_property_read_u32(fwnode, "endpoint", &endpoint->id);
|
|
|
+ } else {
|
|
|
+ fwnode_property_read_u32(port_fwnode, "reg", &endpoint->port);
|
|
|
+ fwnode_property_read_u32(fwnode, "reg", &endpoint->id);
|
|
|
+ }
|
|
|
+
|
|
|
+ fwnode_handle_put(port_fwnode);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(fwnode_graph_parse_endpoint);
|