Menu Close

Device Tree Reference Nodes

This article talks about the reference nodes in device trees, and how to use them.

For related subjects, please refer to the SOC Table of Contents.

 

As mentioned before, nodes have the following format:

[label:]node-name[@unit-address]

Recall that the point of labels is to make it easier to access the node, as we can directly use &label to access the node. This can be seen from the section below:

/{
aliases{
        can0 = &flexcan1;
};

cpus{
        #address-cells = <1>;
        #size-cells = <0>;

        cpu0:cpu@0{
               compatible = “arm,cortex-a7”;
               device_type = “cpu”;
               reg = <0>;
               };
        };

        intc:interrupt-controller@00a01000{
                compatible = “arm,cortex-a7-gic”;
                #interrupt-controller;
                reg = <0x00a01000 0x1000>,
                       <0x00a02000 0x100>;
        };
};

We can access the cpu@0 node through &cpu0, without needing to enter the complete entire name of the node. Another example is the node “intc: interrupt-controller@00a01000”, where the node label is “intc”. Writing “&intc” is clearly easier than writing “intc: interrupt-controller@00a01000”.

Thus, adding “label:” in front of a node to be used allows it to be referenced easier by just using “&label”.

Posted in Textbook and Training Project

Related Articles

Leave a Reply

Your email address will not be published.

Leave the field below empty!