Linux DTS Analysis __linux

Source: Internet
Author: User
Tags ranges

1, now practical kernel 3.10 has begun to practical DTS method.


2, the DTS node of the wording

nodename@address{
        compatible=xxx;
        xxx;
};
@Address is not necessary when the device does not have an address.

3, bootloader boot will load DTB to the kernel, the kernel analysis DTB can know machine, so bootloader no longer need to pass the device ID number.

For example:

/{
	compatible = "rockchip,rk3288";//You can know machine
	Rockchip,sram = <&sram>;
	Interrupt-parent = <&gic>;\

4, #address-cell and #size-cell represent address and address lengths, respectively, and are only valid for the node that will be defined next

i2c0:i2c@ff650000 {
		compatible = "ROCKCHIP,RK30-I2C";
		reg = <0xff650000 0x1000>;
		interrupts = <gic_spi irq_type_level_high>;
		#address-cells = <1>;
		#size-cells = <0>;
rk808:rk808@1b {
		reg = <0x1b>;//address-cell=1,size-cell=0, so Reg has only one
		status = "Okay";
	};
}

5. reg is defined only by the parent node Address-cell and Size-cell

  #address-cells = <2>  
  #size-cells = <1>;
... 
i2c@1,0 {  
            compatible = "Acme,a1234-i2c-bus";  
            #address-cells = <1>;//Reg #size that defines the RTC node  
            -cells = <0>;  
            Reg = <1 0 0x1000>;//The reg structure is defined by the parent node, addr-cell=2,size-cell=1, so Reg has 3 members. 1 on behalf of the film, 0 for cheap, 0x1000 for the length  
            interrupts = < 6 2 >;  
            rtc@58 {  
                compatible = "maxim,ds1338";  
                Reg = <58>;  
                Interrupts = < 7 3 >;  
            }; 

6. "Reference" of the node

rk_screen:rk_screen{//xxx:xxx This format indicates that the node will be applied, the knot named the latter
compatible = "Rockchip,screen";
};

&rk_screen {//"address symbol similar to C language", reference rk_screen node
display-timings = <&disp_timings>;
};

disp_timings:display-timings {//generated knot named Display-timings. Disp_timings will be rk_screen practical
xxxxx

};

7. The nodes of the root node describe the view of the CPU, so the address area of the root node is directly located in the memory area of the CPU. After the bus bridge, the address often needs to be converted to the corresponding CPU memory mapping. The External-bus Ranges property defines how the address range after the External-bus bridge maps to the memory area of the CPU.

 #address-cells = <1>;  
#size-cells = <1>;    
。。。  
External-bus {#address-cells = <2> #size-cells = <1>; Ranges is the address translation table, the first few representative addresses. Determined by the parent node and the current node Address-cell.
In this case, the parent address-cell=1, the current address-cell=2, so the first two-bit address is represented.   The first one represents the system offset, the second represents the slice offset ranges = <0 0 0x10100000 0x10000//chipselect 1, Ethernet 1 0 0x10160000 0x10000//chipselect 2, I2C Controller 2 0 0x30000000  
            Chipselect 3, NOR Flash ethernet@0,0 {compatible = "smc,smc91c111";  
            Reg = <0 0 0x1000>;  
        Interrupts = < 5 2 >; }; 
Ranges is the address translation table where each item is a child address, a parent address, and a mapping of the size of the child address space. The child address, parent address in the mapping table takes the #address-cells of the child address space and the #address-cells size of the parent address space, respectively. For this example, the #address-cells of the child address space is 2 and the #address-cells value of the parent address space is 1, so the first 2 cell of 0 0 0x10100000 0x10000 is offset 0 on the External-bus back slice 0, The 3rd cell indicates that the address space of the External-bus 0 offset 0 is mapped to the 0x10100000 position of the CPU, and the 4th cell represents the size of the map as 0x10000.




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.