I been trying to read child node property in a device tree.. Could not figured it out, can any one help here.
I have a dts
AA{
child 1: {
property 1 : XXX
property 2 : XXX
}
child 2 :{
property 1 : XXX
property 2 : XXX
}
BB{
child 1: {
property 1 : XXX
property 2 : XXX
}
child 2 :{
property 1 : XXX
property 2 : XXX
}
Is there any way of reading properies of child 2 in AA node of given dts ?
If I understood correctly you have to use something like
for_each_child_of_node().
Check for example drivers/input/keyboard/gpio_keys.c and Documentation/devicetree/bindings/input/gpio-keys.txt.Yes, you can do it. Just write a similar function as below and call it in AA with the path of the child node of BB.
For example, From AA if you need to access BB/child_2 property then pass the absolute path to of_find_node_by_path() function.
Also, check of_* family of function in the kernel that might be useful.