顶层结构
/ {
compatible = "rockchip,rk3588";
interrupt-parent = <&gic>;
#address-cells = <2>;
#size-cells = <2>;
aliases {
...
};
clocks {
...
};
cpus {
...
};
...
};
- / 节点:根节点,描述整个设备树的属性。
- compatible:指定设备的兼容性字符串,这里表示兼容 “rockchip,rk3588”。
- interrupt-parent:指定中断控制器的父节点,这里是 &gic。
- #address-cells 和 #size-cells:定义地址和大小单元的数量,这里都为 2。
Aliases
aliases {
csi2dcphy0 = &csi2_dcphy0;
...
};
- aliases:定义一些易于使用的别名,简化对设备节点的引用。
时钟配置
clocks {
compatible = "simple-bus";
#address-cells = <2>;
#size-cells = <2>;
ranges;
spll: spll {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <702000000>;
clock-output-names = "spll";
};
xin32k: xin32k {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <32768>;
clock-output-names = "xin32k";
};
...
};
- clocks:定义时钟相关的信息。
- compatible:指定设备的兼容性,这里是 “simple-bus”。
- spll 和 xin32k:定义固定频率的时钟。
CPU 节点
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu-map {
cluster0 {
core0 {
cpu = <&cpu_l0>;
};
...
};
...
};
cpu_l0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-a55";
reg = <0x0>;
enable-method = "psci";
capacity-dmips-mhz = <530>;
clocks = <&scmi_clk SCMI_CLK_CPUL>;
operating-points-v2 = <&cluster0_opp_table>;
cpu-idle-states = <&CPU_SLEEP>;
i-cache-size = <32768>;
i-cache-line-size = <64>;
i-cache-sets = <128>;
d-cache-size = <32768>;
d-cache-line-size = <64>;
d-cache-sets = <128>;
next-level-cache = <&l2_cache_l0>;
#cooling-cells = <2>;
dynamic-power-coefficient = <100>;
};
...
};
- cpus:定义 CPU 的相关信息。
- cpu-map:定义 CPU 的层次结构。
- cpu_l0:具体 CPU 的描述。
- device_type:设备类型为 “cpu”。
- compatible:兼容的 CPU 类型为 “arm,cortex-a55”。
- reg:CPU 在设备树中的地址。
- enable-method:启用 CPU 的方法,这里是 “psci”。
- capacity-dmips-mhz:CPU 每 MHz 的 DMIPS 值。
- clocks:CPU 使用的时钟。
- operating-points-v2:CPU 的工作点(频率和电压)。
- cpu-idle-states:CPU 的空闲状态。
- i-cache-size/d-cache-size:指令和数据缓存的大小。
- i-cache-line-size/d-cache-line-size:缓存行大小。
- i-cache-sets/d-cache-sets:缓存集合数目。
- next-level-cache:下一级缓存。
- #cooling-cells:用于热管理的降温单元数。
- dynamic-power-coefficient:动态功耗系数。
电源管理
pmu: power-management@fd8d8000 {
compatible = "rockchip,rk3588-pmu", "syscon", "simple-mfd";
reg = <0x0 0xfd8d8000 0x0 0x400>;
power: power-controller {
compatible = "rockchip,rk3588-power-controller";
#power-domain-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
...
};
};
- pmu:电源管理单元。
- compatible:表示兼容 “rockchip,rk3588-pmu”,“syscon”,“simple-mfd”。
- reg:设备寄存器地址和大小。
- power-controller:电源控制器的属性。
- #power-domain-cells:电源域单元数。
- #address-cells/#size-cells:地址和大小单元数。
- status:设备状态,这里是 “okay”。
中断控制器
gic: interrupt-controller@fe600000 {
compatible = "arm,gic-v3";
#interrupt-cells = <3>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
interrupt-controller;
reg = <0x0 0xfe600000 0 0x10000>, /* GICD */
<0x0 0xfe680000 0 0x100000>; /* GICR */
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
its0: msi-controller@fe640000 {
compatible = "arm,gic-v3-its";
msi-controller;
#msi-cells = <1>;
reg = <0x0 0xfe640000 0x0 0x20000>;
};
its1: msi-controller@fe660000 {
compatible = "arm,gic-v3-its";
msi-controller;
#msi-cells = <1>;
reg = <0x0 0xfe660000 0x0 0x20000>;
};
};
- gic:中断控制器。
- compatible:表示兼容 “arm,gic-v3”。
- #interrupt-cells:中断单元数。
- #address-cells/#size-cells:地址和大小单元数。
- ranges:地址范围。
- interrupt-controller:标记这是一个中断控制器。
- reg:寄存器地址和大小。
- interrupts:中断信息,类型为 GIC PPI,编号为 9,触发类型为高电平。
- its0 和 its1:中断翻译服务器(ITS)控制器。
- compatible:表示兼容 “arm,gic-v3-its”。
- msi-controller:标记这是一个 MSI 控制器。
- #msi-cells:MSI 单元数。
- reg:寄存器地址和大小。
其他设备
文件中还定义了其他许多设备,如 USB 控制器、显示子系统、音频子系统、各种总线接口(I2C、SPI、UART 等)、GPU、NPU、VPU、SATA 控制器等。每个设备节点通常包含以下信息:
- compatible:设备的兼容性字符串。
- reg:设备寄存器地址和大小。
- interrupts:设备中断信息。
- clocks 和 clock-names:时钟信息。
- resets 和 reset-names:复位信息。
- status:设备状态(如 “okay” 或 “disabled”)。