dm: of_access: add of_alias_get_dev() and of_alias_dump()
- support get device_node by given stem and alias id; - dump of alias nodes added in aliases_lookup. Change-Id: I3ed8bd4692dd3fbbeebe9978a797a5a2dcf7eb23 Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
ebdb223312
commit
2e02c4e25b
|
|
@ -766,6 +766,42 @@ int of_alias_get_id(const struct device_node *np, const char *stem)
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct device_node *of_alias_get_dev(const char *stem, int id)
|
||||||
|
{
|
||||||
|
struct alias_prop *app;
|
||||||
|
struct device_node *np = NULL;
|
||||||
|
|
||||||
|
mutex_lock(&of_mutex);
|
||||||
|
list_for_each_entry(app, &aliases_lookup, link) {
|
||||||
|
if (strcmp(app->stem, stem) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (id == app->id) {
|
||||||
|
np = app->np;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutex_unlock(&of_mutex);
|
||||||
|
|
||||||
|
return np;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct device_node *of_alias_dump(void)
|
||||||
|
{
|
||||||
|
struct alias_prop *app;
|
||||||
|
struct device_node *np = NULL;
|
||||||
|
|
||||||
|
mutex_lock(&of_mutex);
|
||||||
|
list_for_each_entry(app, &aliases_lookup, link) {
|
||||||
|
printf("%s: Alias %s%d: %s, phandle=%d\n", __func__,
|
||||||
|
app->stem, app->id,
|
||||||
|
app->np->full_name, app->np->phandle);
|
||||||
|
}
|
||||||
|
mutex_unlock(&of_mutex);
|
||||||
|
|
||||||
|
return np;
|
||||||
|
}
|
||||||
|
|
||||||
struct device_node *of_get_stdout(void)
|
struct device_node *of_get_stdout(void)
|
||||||
{
|
{
|
||||||
return of_stdout;
|
return of_stdout;
|
||||||
|
|
|
||||||
|
|
@ -393,6 +393,22 @@ int of_alias_scan(void);
|
||||||
*/
|
*/
|
||||||
int of_alias_get_id(const struct device_node *np, const char *stem);
|
int of_alias_get_id(const struct device_node *np, const char *stem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* of_alias_get_dev - Get device_node by given stem and alias id
|
||||||
|
*
|
||||||
|
* Travels the lookup table to get the device_node by given stem and alias id.
|
||||||
|
*
|
||||||
|
* @stem: Alias stem of the given device_node
|
||||||
|
* @id: Alias id of the given device_node
|
||||||
|
* @return device_node, if found, else NULL
|
||||||
|
*/
|
||||||
|
struct device_node *of_alias_get_dev(const char *stem, int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* of_alias_dump - Dump of alias nodes added in aliases_lookup.
|
||||||
|
*/
|
||||||
|
struct device_node *of_alias_dump(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* of_get_stdout() - Get node to use for stdout
|
* of_get_stdout() - Get node to use for stdout
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue