diff options
Diffstat (limited to 'drivers/of/base.c')
-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 a8e47d37cc7f..715144af3a83 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) | |||
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | /** | 1987 | /** |
1988 | * of_graph_parse_endpoint() - parse common endpoint node properties | ||
1989 | * @node: pointer to endpoint device_node | ||
1990 | * @endpoint: pointer to the OF endpoint data structure | ||
1991 | * | ||
1992 | * The caller should hold a reference to @node. | ||
1993 | */ | ||
1994 | int of_graph_parse_endpoint(const struct device_node *node, | ||
1995 | struct of_endpoint *endpoint) | ||
1996 | { | ||
1997 | struct device_node *port_node = of_get_parent(node); | ||
1998 | |||
1999 | memset(endpoint, 0, sizeof(*endpoint)); | ||
2000 | |||
2001 | endpoint->local_node = node; | ||
2002 | /* | ||
2003 | * It doesn't matter whether the two calls below succeed. | ||
2004 | * If they don't then the default value 0 is used. | ||
2005 | */ | ||
2006 | of_property_read_u32(port_node, "reg", &endpoint->port); | ||
2007 | of_property_read_u32(node, "reg", &endpoint->id); | ||
2008 | |||
2009 | of_node_put(port_node); | ||
2010 | |||
2011 | return 0; | ||
2012 | } | ||
2013 | EXPORT_SYMBOL(of_graph_parse_endpoint); | ||
2014 | |||
2015 | /** | ||
1988 | * of_graph_get_next_endpoint() - get next endpoint node | 2016 | * of_graph_get_next_endpoint() - get next endpoint node |
1989 | * @parent: pointer to the parent device node | 2017 | * @parent: pointer to the parent device node |
1990 | * @prev: previous endpoint node, or NULL to get first | 2018 | * @prev: previous endpoint node, or NULL to get first |