Linux设备树详解Device Tree dts

请highlight“   //--> ”查看注释



/ {  //-->0 根节点

        compatible = "acme,coyotes-revenge";  //-->0 compatible = "<manufacturer1>,<model1>","<manufacturer1>,<model2>";其后的字符串表征可兼容的其他设备
        #address-cells = <1>;  //-->1.1 root结点的#address-cells = <1>;和#size-cells = <1>;决定了serial、gpio、spi等结点(没有指定则使用根节点设置)的address和length字段的cells
        #size-cells = <1>;  
        interrupt-parent = <&intc>;  //-->2.1 设备结点透过它来指定它所依附的中断控制器的phandle,即为&intc
      
        cpus {  //-->0 节点cpu
            #address-cells = <1>;  //-->1.2 表示标准格式reg = <address1 length1 [address2 length2] [address3 length3] ... >.中的reg中有一个槽来说明寄存器地址
            #size-cells = <0>;  //-->1.3 0表示没有槽来说明寄存器的容量大小
            cpu@0 {  
                compatible = "arm,cortex-a9";  
                reg = <0>;  //-->1.0 此处0跟node名字中“@0”对应
            };  
            cpu@1 {  
                compatible = "arm,cortex-a9";  
                reg = <1>;  
            };  
        };  
      
        serial@101f0000 {  
            compatible = "arm,pl011";  
            reg = <0x101f0000 0x1000 >;  //-->1.4 即从0x101f0000到0x101f0fff
            interrupts = < 1 0 >;  
        };  
      
        serial@101f2000 {  
            compatible = "arm,pl011";  
            reg = <0x101f2000 0x1000 >;  
            interrupts = < 2 0 >;  
        };  
      
        gpio@101f3000 {  
            compatible = "arm,pl061";  
            reg = <0x101f3000 0x1000  
                   0x101f4000 0x0010>;  
            interrupts = < 3 0 >;  
        };  
      
        intc: interrupt-controller@10140000 {  //-->xx:xxx,说明xx是xxx类型的device
            compatible = "arm,pl190";  
            reg = <0x10140000 0x1000 >;  
            interrupt-controller;  
            #interrupt-cells = <2>;  //-->2.2 有两个槽,第一为interrupt line number;第二个为encode flags such as active high vs. active low, or edge vs. level sensitive
        };  
      
        spi@10115000 {  
            compatible = "arm,pl022";  
            reg = <0x10115000 0x1000 >;  
            interrupts = < 4 0 >;  
        };  
      
        external-bus {  
            #address-cells = <2>  //-->1.5 两个address槽,用于有external bus的情况来选择内部bus或是外部bus
            #size-cells = <1>;  
            ranges = <0 0  0x10100000   0x10000     // Chipselect 1, Ethernet  
                      1 0  0x10160000   0x10000     // Chipselect 2, i2c controller  
                      2 0  0x30000000   0x1000000>; // Chipselect 3, NOR Flash  
      
            ethernet@0,0 {  
                compatible = "smc,smc91c111";  
                reg = <0 0 0x1000>;  
                interrupts = < 5 2 >;  
            };  
      
            i2c@1,0 {  
                compatible = "acme,a1234-i2c-bus";  
                #address-cells = <1>;  
                #size-cells = <0>;  
                reg = <1 0 0x1000>;  
                interrupts = < 6 2 >;  
                rtc@58 {  
                    compatible = "maxim,ds1338";  
                    reg = <58>;  
                    interrupts = < 7 3 >;  
                };  
            };  
      
            flash@2,0 {  
                compatible = "samsung,k8f1315ebm", "cfi-flash";  
                reg = <2 0 0x4000000>;  
            };  
        };  
    }; 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值