Menu Close

Linux Device Tree Structures

This article talks about the structure of Linux device trees.

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

 

The main components of device trees are nodes, which form the tree structure and have the following characteristics:

  • Each device tree file only has one root node.
  • Besides the root node, each node only has a single parent node.
  • Each device on the development board should be able to correspond with a node.
  • Each node can have several property values to describe node characteristics.
  • Each node has their own node name.
  • Nodes can either have a parallel relationship or a nested parent/child relationship. This allows for an easy description of device relations.

A sample device tree structure can be as follows:

/{                                            // Root node
        node1{                                // Node node1
               property1 = value1;            // node1’s property property1
               property2 = value2;            // node1’s property property2
               …
        };

        node2{                                // Node node2
               property3 = value3;            // node2’s property property3
               …
               node3{                         // node2’s child node node3
                       property4 = value4;    // node3’s property property4
                       …
               };
        };
};

Note that the / in the first line represents the root node. We see the parent node of node1 and node2 is root node, while the parent node of node3 is node2. Thus, node2 and node3 have a parent/child relationship.

As node1 and node2 are under the root node, they can be used to represent two SoC controllers. node3 represents a device mounted under I2C, such as eeprom or RTC.

Posted in Textbook and Training Project

Related Articles

Leave a Reply

Your email address will not be published.

Leave the field below empty!