diff options
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index a8e47d3..715144af 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1985,6 +1985,34 @@ struct device_node *of_find_next_cache_node(const struct device_node *np) } /** + * of_graph_parse_endpoint() - parse common endpoint node properties + * @node: pointer to endpoint device_node + * @endpoint: pointer to the OF endpoint data structure + * + * The caller should hold a reference to @node. + */ +int of_graph_parse_endpoint(const struct device_node *node, + struct of_endpoint *endpoint) +{ + struct device_node *port_node = of_get_parent(node); + + memset(endpoint, 0, sizeof(*endpoint)); + + endpoint->local_node = node; + /* + * It doesn't matter whether the two calls below succeed. + * If they don't then the default value 0 is used. + */ + of_property_read_u32(port_node, "reg", &endpoint->port); + of_property_read_u32(node, "reg", &endpoint->id); + + of_node_put(port_node); + + return 0; +} +EXPORT_SYMBOL(of_graph_parse_endpoint); + +/** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node * @prev: previous endpoint node, or NULL to get first |