栗子1:
cpus { #address-cells = <1>; #size-cells = <0>; cpu@0 { compatible = "arm,cortex-a9"; reg = <0>; }; cpu@1 { compatible = "arm,cortex-a9"; reg = <1>; }; };
在上面的代码里面:
#address-cells = <1>;//表示用一个32位的数来描述地址
#size-cells = <0>;//表示用0个32位的数来描述该地址的大小
上面两个信息#address-cells和#size-cells主要用来描述子节点里面reg的信息
reg里面的个数,应该是address-cells + size-cells的整数倍
上面的解析为:reg的起始地址为0
regulators { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; reg_usb_otg1_vbus: regulator@0 { ... //其他一些信息 reg = <0x00001 0x01 0x000010 0x02>; }; };
上面的代码的解析为:
reg的起始地址为0x0001 大小为0x01
reg的起始地址为0x000010 大小为0x02
上面代码里面:address-cells + size-cells = 2
那么reg里面的描述值就应该是2个倍数。并且每2个为一组。
上面列举的regulator这个节点可能不是很适合这个里面,但是在这里,只是想描述address-cells 、size-cells、reg三者的关系。
例子3
external-bus { #address-cells = <2> #size-cells = <1>; ... 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>; }; };
设备树里面#address-cells 、#size-cells、reg三者的关系
原文:https://www.cnblogs.com/libra13179/p/11358117.html