How to specify the device name for uart in the device tree (.dts) file?

I built OpenWrt (a Linux-based wireless router), I added the board to the OpenWrt source, my board has two uart ports, I can declare and enable two uart ports, two uart ports are called 'uartfull' and 'uartlite'.

"uartlite" is registered to "/ dev / ttyS1", and "uartfull" is registered to "/ dev / ttyS0". But I want uartlite on '/ dev / ttyS0' and 'uartfull' on '/ 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,rt5350-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0x500 0x100>; resets = <&rstctrl 12>; reset-names = "uart"; interrupt-parent = <&intc>; interrupts = <5>; reg-shift = <2>; status = "okay"; }; 

This is the "uartfull" (uart name) and the "uartlite" node in my dts file. I assumed that it defines the device name (/ dev / ttyS0 / dev / ttyS1, etc.), can I force the device name for these two uart nodes.

+4
source share
1 answer

Use the aliases field at the top of the devicetree file:

 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) 

};

0
source

All Articles