名词解释
PMON:Process Monitor,一个开源的监控程序,兼具BIOS和bootloader功能,支持多种处理器架构,包括:MIPS、ARM、PowerPC等;
LS2K1000:龙芯中科技术股份有限公司研发的64位低功耗SoC芯片,属于龙芯2号系列;采用双核设计,主频为1GHz,处理器架构为MIPS。
1、前言
本文基于LS2K1000处理器(基于LS2K1000处理器设计的板卡)进行设备树分析。
内核设备树的路径为arch/mips/loongson2/dts/2k1000_board.dts,PMON设备树的路径为Targets/LS2K/conf/LS2K.dts。作为开发板的默认DTS文件,生成的DTB会编译进内核。内核对于设备树的处理逻辑为:若固件提供可用的DTB,则优先使用固件的DTB;若固件没有提供可用的DTB,则使用内核中的DTB。
2、DTS说明
2.1、compatible
值类型:<stringlist>
说明:compatible属性值由一个或多个字符串组成,从最具体到最一般,用于设备驱动程序选择;它们允许一个设备表达它与一系列类似设备的兼容性,可能允许单个设备驱动程序与多个设备匹配。
推荐的格式是“manufacturer,model”,其中manufacturer是描述制造商名称的字符串,model指定型号。
2.2、#address-cells与#size-cells
值类型:<u32>
说明:#address-cells和#size-cells属性可用于在device tree层次结构中具有子设备的任何设备节点中,并描述应如何对子设备节点进行寻址。#address-cells用于描述设备reg字段中用几个dword数据(1个dword数据占用4个字节)表示地址,#size-cells用于描述设备reg字段中用几个dword数据表示大小。
3、实例分析
3.1、根节点
/*
* 2K1000 Device Tree Source for LS2K1000 boards
*/
/dts-v1/;
/ {
model = "loongson,LS2k1000-EVP";
compatible = "loongson,ls2k";
#address-cells = <2>;
#size-cells = <2>;
};
/dts-v1/:用于指定设备树的版本号,它是设备树文件的头部,告诉内核如何解析设备树文件;必须出现在设备树文件的开头;
/:根节点;
model:属性值是一个<string>,用于指定设备的制造商型号;建议的格式是:“manufacturer,model”,其中manufacturer是描述制造商名称的字符串,model指定型号。
3.2、内存
// Since 2K1000 support > 4GiB DIMM, use 2 cell for address and size
memory {
name = "memory";
device_type = "memory";
reg = <0 0x00200000 0 0x09800000 // 216MiB at 2MiB
1 0x10000000 0 0xd0000000>; // 4G 7424 - 512 MiB at 4352MiB
};
name:属性值是一个<string>,用于指定节点名称;此属性已弃用,不建议使用,但是,它可能用于不符合Device Tree Specification的旧设备树;
device_type:属性值是一个<string>;IEEE 1275中使用了device_type属性来描述设备的FCode编程模型。由于Device Tree Specification没有FCode,因此不推荐使用该属性的新用法,并且为了与IEEE 1275派生的设备树兼容,该属性应仅包含在CPU和内存节点上;
reg属性中,地址被分为两段,低地址段为:0 0x00200000 0 0x09800000,其中,0 0x00200000为内存起始地址,0 0x09800000为内存大小;高地址段为:1 0x10000000 0 0xd0000000,其中,1 0x10000000为内存起始地址,0 0xd0000000为内存大小。
3.3、别名
aliases {
ethernet0 = &gmac0;
ethernet1 = &gmac1;
};
ethernet0和ethernet1分别为gmac0和gmac1的别名,其中,gmac0和gmac1分别为GMAC0和GMAC1控制器的标签名,下文会谈及。
3.4、SoC
// all soc device use 32bit address
soc {
compatible = "ls,nbus", "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x10000000 0 0x10000000 0x10000000
0x40000000 0 0x40000000 0x40000000
0x20000000 0 0x20000000 0x20000000
0x0d000000 0 0x0d000000 0x02000000>;
dma-coherent;
nr_cpus_loongson = <2>;
cores_per_package = <2>;
};
ranges属性中包含的是soc节点合法的地址范围和映射关系,分成了四段,分别为:0x10000000 0 0x10000000 0x10000000,其中0x10000000为soc节点的起始地址,0 0x10000000为对应父节点的起始地址,0x10000000为soc节点的地址大小;其余同上所述;
dma-coherent:由硬件维护cache一致性;若配置了dma-coherent属性,则内核按照coherent模式执行;若配置了non-coherent属性,则内核按照non-coherent模式执行;除了在DTS中配置这个属性外,固件中还需要配置相应的寄存器;
nr_cpus_loongson:物理CPU封装的数量;
cores_per_package:每个物理 CPU 封装内包含的 CPU 核心数量。
3.5、中断控制器
icu: interrupt-controller@1fe11400 {
compatible = "loongson,2k-icu";
interrupt-controller;
#interrupt-cells = <1>;
reg = <0x1fe11400 0x40>;
};
interrupt-controller:中断控制器;
#interrupt-cells:该中断控制器的中断指示符中cell的个数。
3.6、PCIE设备MSI中断
msi: pci-msi-controller@1fe114a0 {
compatible = "loongson,2k-pci-msi";
msi-controller;
interrupt-parent = <&icu>;
msi-mask = <0x000000c0 0x40000c00>;
reg = <0x1fe114a0 0x60>;
};
msi-controller:MSI中断控制器;
interrupt-parent = <&icu>:MSI中断控制器的父节点为中断控制器;
msi-mask:为1的位表示CPU中断控制器的对应的位可以用于MSI中断。
3.7、HDA控制器
/* HDA controller nodes:
* If you want to use the "hda" function,enable the "hda"
* controller by configure general configuration register 0.
*/
hda@0x400d0000 {
compatible = "loongson,ls-audio";
reg = <0x400d0000 0xffff>;
interrupt-parent = <&icu>;
interrupts = <12>;
};
interrupts = <12>:系统分配给该设备的中断号为12。
3.8、显示控制器
dc@0x400c0000 {
compatible = "loongson,ls-fb";
reg = <0x400c0000 0x10000
0x20000000 0x8000000>;
interrupt-parent = <&icu>;
interrupts = <36>;
output {
DVO0 = "disable";
DVO1 = "disable";
};
};
双路DVO接口显示被失能。
3.9、GPU
gpu@0x40080000 {
compatible = "loongson,galcore";
reg = <0x40080000 0x40000
0x2a000000 0x15000000>;
interrupt-parent = <&icu>;
interrupts = <37>;
};
reg:0x40080000 0x40000表示寄存器的起始地址和大小;0x2a000000 0x15000000表示GPU显存的起始地址和大小。
3.10、OHCI
ohci@0x40070000 {
compatible = "loongson,ls2k-ohci", "usb-ohci";
reg = <0x40070000 0x10000>;
interrupt-parent = <&icu>;
interrupts = <59>;
dma-mask = <0x0 0xffffffff>;
};
OHCI:Open Host Controller Interface,支持USB 1.1标准;
dma-mask:表示设备DMA能力;若设备只有32位DMA能力,则应该配置为0x0 0xffffffff,若设备有64位DMA能力,则应该配置成0xffffffff 0xffffffff。
3.11、EHCI
ehci@0x40060000 {
compatible = "loongson,ls2k-ehci", "usb-ehci";
reg = <0x40060000 0x10000>;
interrupt-parent = <&icu>;
interrupts = <58>;
dma-mask = <0xffffffff 0xffffffff>;
};
EHCI:Enhanced Host Controller Interface,支持USB 2.0标准。
3.12、OTG
otg@0x40000000 {
compatible = "loongson,dwc-otg", "dwc-otg";
reg = <0x40000000 0x40000>;
interrupt-parent = <&icu>;
interrupts = <57>;
dma-mask = <0x0 0xffffffff>;
};
OTG:On-The-Go,应用于不同设备之间的连接,进行数据交换。
3.13、AHCI
ahci@0x400e0000{
compatible = "snps,spear-ahci";
reg = <0x400e0000 0x10000>;
interrupt-parent = <&icu>;
interrupts = <27>;
dma-mask = <0x0 0xffffffff>;
};
AHCI:Advanced Host Controller Interface,用于访问硬盘。
3.14、GMAC控制器
gmac0: ethernet@0x40040000 {
compatible = "snps,dwmac-3.70a", "ls,ls-gmac";
reg = <0x40040000 0x10000>;
interrupt-parent = <&icu>;
interrupts = <20 21>;
interrupt-names = "macirq", "eth_wake_irq";
/*mac-address = [ 00 20 22 04 01 00 ]; [>mac 64:48:48:48:48:60 <]*/
phy-mode = "rgmii";
bus_id = <0x0>;
phy_addr = <0xffffffff>;
dma-mask = <0xffffffff 0xffffffff>;
};
gmac1: ethernet@0x40050000 {
compatible = "snps,dwmac-3.70a", "ls,ls-gmac";
reg = <0x40050000 0x10000>;
interrupt-parent = <&icu>;
interrupts = <22 23>;
interrupt-names = "macirq", "eth_wake_irq";
/*mac-address = [ 64 48 48 48 48 61 ]; [>mac 64:48:48:48:48:61 <]*/
phy-mode = "rgmii";
bus_id = <0x1>;
phy_addr = <0xffffffff>;
dma-mask = <0xffffffff 0xffffffff>;
};
interrupt-names = "macirq", "eth_wake_irq":GMAC控制器会处理两种中断,macirq和eth_wake_irq,对于GMAC0,分配的中断号分别为20和21;对于GMAC1,分配的中断号分别为22和23;
phy-mode = "rgmii":以太网MAC和PHY之间的通信接口为RGMII;
bus_id:设备的总线ID,GMAC0应配置为0,GMAC1应配置为1;
phy_addr:分配的PHY地址;配置的PHY地址应该和实际板卡的物理连接方式相对应,如果值为0xffffffff,则内核会自动检测PHY地址。
3.15、PCIE控制器
pcie0_port0@40100000 {
compatible = "loongson,ls-pcie";
interrupt-parent = <&icu>;
interrupts = <40>;
#address-cells = <3>;
#size-cells = <2>;
bus-range = <0x1 0x3>;
ranges = <0x02000000 0x0 0x40100000 0x40100000 0x0 0x8000000 //mem
0x01000000 0x0 0x18000000 0x18000000 0x0 0x0ff000>; //io
};
pcie0_port1@50000000 {
compatible = "loongson,ls-pcie";
interrupt-parent = <&icu>;
interrupts = <41>;
#address-cells = <3>;
#size-cells = <2>;
bus-range = <0x4 0x6>;
ranges = <0x02000000 0x0 0x50000000 0x50000000 0x0 0x4000000 //mem
0x01000000 0x0 0x18100000 0x18100000 0x0 0x100000>; //io
};
pcie0_port2@54000000 {
compatible = "loongson,ls-pcie";
interrupt-parent = <&icu>;
interrupts = <42>;
#address-cells = <3>;
#size-cells = <2>;
bus-range = <0x8 0xa>;
ranges = <0x02000000 0x0 0x54000000 0x54000000 0x0 0x4000000 //mem
0x01000000 0x0 0x18200000 0x18200000 0x0 0x100000>; //io
};
pcie0_port3@58000000 {
compatible = "loongson,ls-pcie";
interrupt-parent = <&icu>;
interrupts = <43>;
#address-cells = <3>;
#size-cells = <2>;
bus-range = <0xc 0xe>;
ranges = <0x02000000 0x0 0x58000000 0x58000000 0x0 0x8000000 //mem
0x01000000 0x0 0x18300000 0x18300000 0x0 0x100000>; //io
};
pcie1_port0@60000000 {
compatible = "loongson,ls-pcie";
interrupt-parent = <&icu>;
interrupts = <44>;
#address-cells = <3>;
#size-cells = <2>;
bus-range = <0x10 0x12>;
ranges = <0x02000000 0x0 0x60000000 0x60000000 0x0 0x18000000 //mem
0x01000000 0x0 0x18400000 0x18400000 0x0 0x100000>; //io
};
pcie1_port1@78000000 {
compatible = "loongson,ls-pcie";
interrupt-parent = <&icu>;
interrupts = <45>;
#address-cells = <3>;
#size-cells = <2>;
bus-range = <0x14 0x16>;
ranges = <0x02000000 0x0 0x78000000 0x78000000 0x0 0x8000000 //mem
0x01000000 0x0 0x18500000 0x18500000 0x0 0x100000>; //io
};
bus-range:分配给PCIE控制器的总线号范围;
ranges:表示此控制器下PCIE设备的MEM和IO空间。pcie0_port0的第一组地址表示MEM空间:0x02000000 0x0 0x40100000 0x40100000 0x0 0x80000000,0x02000000表示此地址为MEM空间,0x0 0x40100000表示映射到PCIE总线的起始地址,0x40100000表示对应的CPU地址空间的地址,0x0 0x80000000表示地址空间大小;第二组地址表示IO空间:0x01000000 0x0 0x18000000 0x18000000 0x0 0x0ff000,0x01000000表示此地址为IO空间,0x0 0x18000000表示映射到PCIE总线的起始地址,0x18000000表示对应的CPU地址空间的地址,0x0 0x0ff000表示地址空间大小;其余节点的分析同上所述。
3.16、serial
serial0x@0x1fe00000 {
device_type = "serial";
compatible = "ns16550,loongson";
reg = <0x1fe00000 0x100>;
clock-frequency = <125000000>;
interrupt-parent = <&icu>;
interrupts = <8>;
};
serial3x@0x1fe00300 {
device_type = "serial";
compatible = "ns16550,loongson";
reg = <0x1fe00300 0x100>;
clock-frequency = <125000000>;
interrupt-parent = <&icu>;
interrupts = <8>;
};
serial4x@0x1fe00400 {
device_type = "serial";
compatible = "ns16550,loongson";
reg = <0x1fe00400 0x100>;
clock-frequency = <125000000>;
interrupt-parent = <&icu>;
interrupts = <9>;
};
serial5x@0x1fe00500 {
device_type = "serial";
compatible = "ns16550,loongson";
reg = <0x1fe00500 0x100>;
clock-frequency = <125000000>;
interrupt-parent = <&icu>;
interrupts = <9>;
};
clock-frequency:串口使用的频率,单位为Hz。
3.17、GPIO
pioA:gpio@0x1fe10500 {
compatible = "ls,ls2k-gpio", "ls,ls-gpio";
reg = <0x1fe10500 0x38>;
ngpios = <64>;
gpio-controller;
#gpio-cells = <2>;
};
ngpios = <64>:芯片共有64个GPIO引脚;
gpio-controller:GPIO控制器;
#gpio-cells = <2>:当一个设备节点通过phandle引用该控制器节点时,需要提供2个额外的cells来完整地指定一个GPIO引脚及其配置。
3.18、I2C
i2c0: i2c@1fe01000 {
compatible = "loongson,ls-i2c";
reg = <0x1fe01000 0x8>;
interrupt-parent = <&icu>;
interrupts = <30>;
#address-cells = <1>;
#size-cells = <0>;
rtc@51 {
compatible = "nxp,pcf8563";
reg = <0x51>;
};
eeprom@57 {
compatible = "atmel,24c16";
reg = <0x57>;
pagesize = <16>;
};
};
i2c1: i2c@1fe01800 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "loongson,ls-i2c";
reg = <0x1fe01800 0x8>;
interrupt-parent = <&icu>;
interrupts = <31>;
codec@1a {
compatible = "codec_uda1342";
reg = <0x1a>;
};
eeprom@50 {
compatible = "eeprom-edid";
reg = <0x50>;
};
};
LS2K1000中有2个用于I2C设备的控制器,编号分别为0和1;
#address-cells = <1>和#size-cells = <0>代表挂载在I2C总线下的子设备地址用一个四字节数据表示并且没有偏移量;
I2C0总线下挂载两个子设备,一个是RTC,地址为0x51,另一个是eeprom,地址为0x57,pagesize = <16>表示eeprom的页大小为16KB,两个子设备共享父设备的中断号;I2C1总线分析同上所述。
i2c_dvo0:i2c@2 {
compatible = "i2c-gpio";
gpios = <&pioA 1 0 /* sda */
&pioA 0 0 /* scl */
>;
/*i2c-gpio,sda-open-drain;*/
/*i2c-gpio,scl-open-drain;*/
i2c-gpio,delay-us = <5>; /* ~100 kHz */
#address-cells = <1>;
#size-cells = <0>;
eeprom@50 {
compatible = "dvi-eeprom-edid";
reg = <0x50>;
};
};
i2c_dvo1:i2c@3 {
compatible = "i2c-gpio";
gpios = <&pioA 32 0 /* sda */
&pioA 33 0 /* scl */
>;
/*i2c-gpio,sda-open-drain;*/
/*i2c-gpio,scl-open-drain;*/
i2c-gpio,delay-us = <5>; /* ~100 kHz */
#address-cells = <1>;
#size-cells = <0>;
eeprom@50 {
compatible = "eeprom-edid";
reg = <0x50>;
};
};
gpios = <&pioA 1 0 /* sda */ //表示通过pioA控制器引脚1,使用低电平
&pioA 0 0 /* scl */> //表示通过pioA控制器引脚0,使用低电平
i2c-gpio,sda-open-drain和i2c-gpio,scl-open-drain用于配置sda和scl引脚的开漏状态;
delay-us描述的是I2C总线工作频率,计算公式为:500 / delay-us,单位为KHz。
3.19、SPI
spi0: spi@1fff0220 {
compatible = "loongson,ls-spi";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x1fff0220 0x6>;
spidev@0 {
compatible = "spansion,m25p80";
reg = <0>;
#address-cells = <1>;
#size-cells = <1>;
spi-max-frequency = <40000000>;
m25p,fast-read;
partition@0x0 { //PMON 1M
label = "pmon";
reg = <0x0 0x110000>; //start and size
//read-only;
};
partition@0x110000 { //kernel+ramfs 30M
label = "kernel";
reg = <0x00110000 0x01E00000>; //start and size
};
partition@0x01F10000 {
label = "rootfs";
reg = <0x01F10000 0x0>; //start and size
};
};
};
spi-max-frequency:SPI设备支持最大频率,单位为Hz。
3.20、RTC
rtc0: rtc@1fe07800 {
compatible = "loongson,ls-rtc";
reg = <0x1fe07800 0x100>;
interrupt-parent = <&icu>;
interrupts = <60>;
};
3.21、CAN
/* CAN controller nodes:
* If you want to use the "can" function,enable the "can"
* controller by configure general configuration register 0.
*/
can0: can@1fe00c00 {
compatible = "nxp,sja1000";
reg = <0x1fe00c00 0xff>;
interrupt-parent = <&icu>;
interrupts = <24>;
nxp,tx-output-mode = <0>;
nxp,tx-output-config = <0x16>;
nxp,external-clock-frequency = <125000000>;
};
can1: can@1fe00d00 {
compatible = "nxp,sja1000";
reg = <0x1fe00d00 0xff>;
interrupt-parent = <&icu>;
interrupts = <25>;
nxp,tx-output-mode = <0>;
nxp,tx-output-config = <0x16>;
nxp,external-clock-frequency = <125000000>;
};
tx-output-mode:用于选择CAN收发器的基本工作模式;
常见取值如下所示:
值 | 模式 | 说明 |
0 | Normal | 标准工作模式(默认) |
1 | Slew-rate limited | 限制压摆率模式(减小EMI,EMI为电磁干扰) |
2 | High-speed | 高速模式(增加驱动能力) |
3 | Silent | 静默模式(只接收不发送) |
4 | Standby | 待机模式(低功耗) |
tx-output-config:用于微调选定模式下的具体参数;
参数如下所示:
模式 | 含义 | 单位 |
Slew-rate limited | 压摆率等级 | 0~7(0为最慢) |
High-speed | 驱动电流等级 | 0~7(7为最强) |
典型配置寄存器结构如下所示:
Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
Mode[1:0] | Slew-rate[2:0] | Current[2:0] |
external-clock-frequency:外部参考时钟频率为125MHz。
3.22、PWM控制器
pwm0: pwm@1fe02000 {
compatible = "loongson,ls2k-pwm";
reg = <0x1fe02000 0x10>;
interrupt-parent = <&icu>;
interrupts = <32>;
};
pwm1: pwm@1fe02010 {
compatible = "loongson,ls2k-pwm";
reg = <0x1fe02010 0x10>;
interrupt-parent = <&icu>;
interrupts = <33>;
};
pwm2: pwm@1fe02020 {
compatible = "loongson,ls2k-pwm";
reg = <0x1fe02020 0x10>;
interrupt-parent = <&icu>;
interrupts = <34>;
};
pwm3: pwm@1fe02030 {
compatible = "loongson,ls2k-pwm";
reg = <0x1fe02030 0x10>;
interrupt-parent = <&icu>;
interrupts = <35>;
};
3.23、apbdma
/* APB DMA controller nodes:
* apbdma node specify the commom property for dma node.
* the #config-nr must be 2,Used to provide APB sel region
* and APB DMA controler information.
*/
apbdma: apbdma@1fe10438{
compatible = "loongson,ls-apbdma";
reg = <0x1fe10438 0x8>;
#config-nr = <2>;
};
此节点用于传递配置寄存器的地址;
#config-nr:值固定为2,用于限定DMA配置参数数量。
3.24、DMA控制器
/* DMA node should specify the apbdma-sel property using a
* phandle to the controller followed by number of APB sel
* region(max 9) and number of APB DMA controller(max 4).
*/
dma0: dma@1fe10c00 {
compatible = "loongson,ls-apbdma-0";
reg = <0x1fe10c00 0x8>;
apbdma-sel = <&apbdma 0x0 0x0>;
#dma-cells = <1>;
dma-channels = <1>;
dma-requests = <1>;
};
dma1: dma@1fe10c10 {
compatible = "loongson,ls-apbdma-1";
reg = <0x1fe10c10 0x8>;
apbdma-sel = <&apbdma 0x5 0x1>;
#dma-cells = <1>;
dma-channels = <1>;
dma-requests = <1>;
};
dma2: dma@1fe10c20 {
compatible = "loongson,ls-apbdma-2";
reg = <0x1fe10c20 0x8>;
apbdma-sel = <&apbdma 0x6 0x2>;
#dma-cells = <1>;
dma-channels = <1>;
dma-requests = <1>;
};
dma3: dma@1fe10c30 {
compatible = "loongson,ls-apbdma-3";
reg = <0x1fe10c30 0x8>;
apbdma-sel = <&apbdma 0x7 0x3>;
#dma-cells = <1>;
dma-channels = <1>;
dma-requests = <1>;
};
dma4: dma@1fe10c40 {
compatible = "loongson,ls-apbdma-4";
apbdma-sel = <&apbdma 0x0 0x0>;
reg = <0x1fe10c40 0x8>;
#dma-cells = <1>;
dma-channels = <1>;
dma-requests = <1>;
};
LS2K1000总共有5个用于APB设备的DMA控制器:编号为0~4;
apbdma-sel:apbdma控制器中sel域和对应的值。
&apbdma | 0x0 | 0x0 |
apb通道的父节点,固定为apbdma | sel域,取值范围为[0, 9] | DMA控制器编号,取值范围为[0, 4] |
dma-channels:DMA通道数,固定为1;
dma-requests:DMA请求数,固定为1。
3.25、SDIO
sdio@0x1fe0c000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "loongson,ls2k_sdio";
reg = <0x1fe0c000 0x1000>;
interrupt-parent = <&icu>;
interrupts = <39>;
interrupt-names = "ls2k_mci_irq";
dmas = <&dma1 1>;
dma-names = "sdio_rw";
dma-mask = <0xffffffff 0xffffffff>;
};
SDIO:Secure Digital Input and Output;
dma = <&dma1 1>:表示使用了DMA1控制器,通道数为1;
dma-names = "sdio_rw":DMA控制器名称,固定为sdio_rw。
3.26、音频设备
音频设备需要3个节点,分别为i2s、audio和sound。
i2s: i2s@0x1fe0d000 {
compatible = "loongson,ls-i2s";
reg = <0x1fe0d000 0x10>;
};
audio: audio@0x1fe0d000 {
compatible = "loongson,ls-pcm-audio";
reg = <0x1fe0d000 0x10>;
interrupt-parent = <&icu>;
interrupts = <54 55>;
interrupt-names = "i2s_irq0", "i2s_irq1";
dmas = <&dma2 1
&dma3 1>;
dma-names = "i2s_play", "i2s_record";
dma-mask = <0xffffffff 0xffffffff>;
};
sound {
compatible = "loongson,ls-sound";
loongson,i2s-controller = <&i2s>;
loongson,audio-codec = <&audio>;
codec-names = "rt5651","rt5651 Duplex", "rt5651-aif1", "rt5651.3-001a";
};
dma-names = "i2s_play", "i2s_record":DMA控制器名称,固定为“i2s_play”、“i2s_record”;
sound节点用于codec设备的注册,不需要对配置进行修改。
3.27、NAND
nand@0x1fe06040 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "loongson,ls-nand";
reg = <0x1fe06040 0x0
0x1fe06000 0x20>;
interrupt-parent = <&icu>;
interrupts = <52>;
interrupt-names = "nand_irq";
dmas = <&dma0 1>;
dma-names = "nand_rw";
dma-mask = <0xffffffff 0xffffffff>;
number-of-parts = <0x2>;
partition@0 {
label = "kernel_partition";
reg = <0x0000000 0x01e00000>;
};
partition@0x01400000 {
label = "os_partition";
reg = <0x01e00000 0x0>;
};
};
number-of-parts = <0x2>:表示共有2个分区;
分区0的reg = <0x00000000 0x01e00000>,其中0x00000000为分区起始地址,0x01e00000为分区大小;分区1同上所述。
3.28、hwmon
hwmon@0x1fe07000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "loongson,ls-hwmon";
reg = <0x1fe07000 0x1>;
max-id = <0>;
id = <0>;
};
hwmon:hardware monitoring framework(硬件监视框架);
max-id和id只有在多路才使用,单路上没有实际用处。
3.29、suspend_to_ram
suspend_to_ram {
suspend_addr = <0x1fc00500>;
};
描述系统挂起到RAM能力的硬件配置信息。
3.30、参数的传递
chosen {
/* the redundant spaces are used for save new boot args */
bootargs = "console=ttyS0,115200 root=/dev/sda2 rw";
};
bootargs:内核启动参数。
4、备注
外设之间可能存在复用关系,注意固件中的引脚复用配置以及设备树文件中的节点定义。