mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-30 16:40:44 +09:00
dm: core: Add a way to find an ofnode by compatible string
Add an ofnode_by_compatible() to allow iterating through ofnodes with a given compatible string. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
c98ad4434c
commit
c60f671b65
@ -729,3 +729,15 @@ int ofnode_device_is_compatible(ofnode node, const char *compat)
|
|||||||
ofnode_to_offset(node),
|
ofnode_to_offset(node),
|
||||||
compat);
|
compat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ofnode ofnode_by_compatible(ofnode from, const char *compat)
|
||||||
|
{
|
||||||
|
if (of_live_active()) {
|
||||||
|
return np_to_ofnode(of_find_compatible_node(
|
||||||
|
(struct device_node *)ofnode_to_np(from), NULL,
|
||||||
|
compat));
|
||||||
|
} else {
|
||||||
|
return offset_to_ofnode(fdt_node_offset_by_compatible(
|
||||||
|
gd->fdt_blob, ofnode_to_offset(from), compat));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -678,6 +678,17 @@ int ofnode_read_resource(ofnode node, uint index, struct resource *res);
|
|||||||
int ofnode_read_resource_byname(ofnode node, const char *name,
|
int ofnode_read_resource_byname(ofnode node, const char *name,
|
||||||
struct resource *res);
|
struct resource *res);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ofnode_by_compatible() - Find the next compatible node
|
||||||
|
*
|
||||||
|
* Find the next node after @from that is compatible with @compat
|
||||||
|
*
|
||||||
|
* @from: ofnode to start from (use ofnode_null() to start at the beginning)
|
||||||
|
* @compat: Compatible string to match
|
||||||
|
* @return ofnode found, or ofnode_null() if none
|
||||||
|
*/
|
||||||
|
ofnode ofnode_by_compatible(ofnode from, const char *compat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ofnode_for_each_subnode() - iterate over all subnodes of a parent
|
* ofnode_for_each_subnode() - iterate over all subnodes of a parent
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user