Linux Device Tree notes __dts basic concepts and syntax __linux

Source: Internet
Author: User
Device Tree Manual (Device treehouse Usage) Original address: Http://www.devicetree.org/Device_Tree_Usage A more complete technical description of the Device data format, the reader can refer to the EPAPR specification ( Http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf)
Overview:ARM Device tree originated in OpenFirmware (of), in the past Linux, arch/arm/plat-xxx and arch/arm/mach-xxx are filled with a lot of garbage code, a considerable number of code is only in the description of board-level details, And these board-level details for the core, but is rubbish, such as board platform equipment, resource, I2c_board_info, Spi_board_info and a variety of hardware platform_data. In order to change this situation, Daniel of the Linux community refer to the flattened Device tree (FDT) used in architecture such as PowerPC, as well as the Device structure, in which the details of many hardware can be passed directly to Linux. It is no longer necessary to do a lot of redundant coding in kernel.

Device tree is a data structure that describes hardware, consisting of a series of named nodes and properties, and the node itself can contain child nodes. The so-called attribute, in fact, is the name and value that appear in pairs. In device tree, the descriptive information includes (the original information was mostly hard code to kernel): number and type of CPUs, memory base address and size, bus and bridge, peripheral connection, interrupt controller and interrupt usage, GPIO controller and GPIO usage, Clock controller and clock usage.

The system device tree is typically described as text by a. dts file, and the DTS file is converted to a binary file binary device a subtree (DTB) by Device Trees Compiler (DTC), and. dtb files can be parsed by the Linux kernel. With device tree can not change the Linux kernel in the case of different platforms to achieve no difference in support, just replace the corresponding DTS file, you can meet, of course, this will increase the volume of the kernel.
storage format for the device tree:Simply put, the device tree is a tree-shaped data structure that describes the hardware configuration and has only one root node [4]. It contains information about CPUs, physical memory, buses, serial ports, PHY, and other peripheral devices. The tree inherits the definition of the Open firmware IEEE 1275 device tree. The operating system can parse the structure at startup to configure the kernel to load the appropriate driver.
U-boot needs to pass the flat device tree to the kernel at the memory address. The tree consists of three main parts: header (header), structure block (Structure blocks), and string blocks (Strings block). In-memory allocation diagram is as follows:
------------------------------
Base-> | struct Boot_param_header |
------------------------------
| (Alignment Gap) (*) |
------------------------------
| Memory Reserve Map |
------------------------------
| (Alignment gap) |
------------------------------
| |
| Device-tree Structure |
| |
------------------------------
| (Alignment gap) |
------------------------------
| |
| Device-tree Strings |
| |
----->------------------------------
|
| ---(base + totalsize) <1> Header (header)
The header mainly describes some basic information about the device tree, such as the device tree size, the structure block offset address, the string block offset address, and so on. The offset address is calculated relative to the starting address of the device tree header.
struct Boot_param_header {
__be32 Magic; Device Tree Demon number, fixed as 0xd00dfeed
__be32 totalsize; Size of the entire device tree
__be32 off_dt_struct;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.