我正在编译OpenWrt(基于Linux的无线路由器),我在OpenWrt源上添加了一块板,我的板有两个uart端口,我可以声明并启用两个uart端口,两个uart端口名为’uartfull’,‘uartlite’.
‘uartlite’注册到’/ dev / ttyS1′,’uartfull’注册到’/ dev / ttyS0′.但我想要uartlite’/ dev / ttyS0’和’uartfull’到’/ dev / ttyS1’.
uartlite@c00 {
compatible = "ralink,rt5350-uart","ralink,rt2880-uart","ns16550a";
reg = <0xc00 0x100>;
resets = <&rstctrl 19>;
reset-names = "uartl";
interrupt-parent = <&intc>;
interrupts = <12>;
reg-shift = <2>;
};
uart@500 {
compatible = "ralink,"ns16550a";
reg = <0x500 0x100>;
resets = <&rstctrl 12>;
reset-names = "uart";
interrupt-parent = <&intc>;
interrupts = <5>;
reg-shift = <2>;
status = "okay";
};
这是我的dts文件中的’uartfull'(名称uart)和’uartlite’节点.我猜测是什么决定了设备名称(/ dev / ttyS0 / dev / ttyS1等等),我可以为这两个uart节点强制设备名称.
最佳答案
使用devicetree文件顶部的别名字段:
aliases {
serial0 = &uart0; // becomes /dev/ttyS0
serial1 = &uart2; // becomes /dev/ttyS1
serial2 = &uart5; // becomes /dev/ttyS2 (not /dev/ttyS3)
serial3 = &uart4; // becomes /dev/ttyS3 (not /dev/ttyS2)
};