2

I have a device tree that I want to override some node's reg value. The problem is that my understanding the name of the node has to match the reg value. How can this node's reg change without overriding the parent node.

Example:

\{

parent_name : parent {
   n10 : node@10 {
       reg = <10>;
  };

   n100 : node@100 {
      reg = <100>;
   };
};

To override node@100 to have a different reg value, can this be done:

&n100 {
  reg = <200>;
}

If this is done, the reg of node@100 will be 200 which is not what the specs says.

0andriy
  • 4,183
  • 1
  • 24
  • 37
hesham_EE
  • 1,125
  • 13
  • 24
  • "*the name of the node has to match the reg value*" -- Correct. You should not try to "redefine" the reg property. Rather you actually need to create a whole new node with the proper node name & unit address. You can delete the old node using `/delete-node/ node@100;`. – sawdust Feb 11 '23 at 00:05
  • Thanks! Post it as an answer, if you don't mind. – hesham_EE Feb 11 '23 at 02:37

2 Answers2

0

the name of the node has to match the reg value

Correct, the Device Tree Specification does mention this requirement.

You should not try to "redefine" the reg property which would create a discrepancy.
Rather you could create a whole new node with the proper node name & unit address.

You can delete the old node using

/delete-node/ node@100;

or

/delete-node/ &n100;

Note that /delete-node/ is a directive to the DT compiler, and is not some kind of comment.
Refer to Device Tree Source Undocumented for more details.

Rachid K.
  • 4,490
  • 3
  • 11
  • 30
sawdust
  • 16,103
  • 3
  • 40
  • 50
0

I actually think in this situation deleting the node is not the right thing to do. If it's only the reg property that is desired to be overwritten.

In this case you'd then have something like:

&n100 {
   /delete-property/ reg;
   reg = <200>;
};

The /delete-xxx/ syntax only works when invoking the device tree compiler however (i.e. in a dtsi/dts). It doesn't work for overlays.

BevanWeiss
  • 135
  • 1
  • 15