设备树 ranges 属性 更全讲解
这篇文章讲得很好,但是缺少一些知识点
https://www.cnblogs.com/pengdonglin137/p/7401049.html
比如这种:
smb: smb@4000000 { compatible = "simple-bus"; #address-cells = <2>; #size-cells = <1>; ranges = <0 0 0x40000000 0x04000000>, <1 0 0x44000000 0x04000000>, <2 0 0x48000000 0x04000000>, <3 0 0x4c000000 0x04000000>, <7 0 0x10000000 0x00020000>;
smb@4000000 { motherboard { model = "V2M-P1"; arm,hbi = <0x190>; arm,vexpress,site = <0>; compatible = "arm,vexpress,v2m-p1", "simple-bus"; #address-cells = <2>; /* SMB chipselect number and offset */ #size-cells = <1>; #interrupt-cells = <1>; ranges; flash@0,00000000 { compatible = "arm,vexpress-flash", "cfi-flash"; reg = <0 0x00000000 0x04000000>, <1 0x00000000 0x04000000>; bank-width = <4>; partitions { compatible = "arm,arm-firmware-suite"; }; };
出自: buildroot-2020.11.1/output/build/linux-5.4.58/arch/arm/boot/dts/vexpress-v2p-ca9.dts
buildroot-2020.11.1/output/build/linux-5.4.58/arch/arm/boot/dts/vexpress-v2m.dtsi
这里:
ranges = <0 0 0x40000000 0x04000000>, <1 0 0x44000000 0x04000000>, <2 0 0x48000000 0x04000000>, <3 0 0x4c000000 0x04000000>, <7 0 0x10000000 0x00020000>; 每行第一个数字(0 1 2 3 7)是编号,表示不同range。对应 reg = <0 0x00000000 0x04000000>, 里的第一个数字 0 ranges = <编号 起始地址高32bit 起始地址低32bit 地址区域长度> reg = <编号 32bit偏移地址 地址区域长度>,