2013-09-25 310 views
3

我正在編譯OpenWrt(基於Linux的無線路由器),我在OpenWrt源代碼中添加了一個板,我的板上有兩個uart端口,我可以聲明並啓用兩個uart端口,兩個uart端口分別命名爲'uartfull '和'uartlite'。如何在設備樹(.dts)文件中爲uart指定設備名稱?

'uartlite'被註冊到'/ dev/ttyS1','uartfull'被註冊到'/ dev/ttyS0'。但是我想要uartlite把'/ dev/ttyS0'和'uartfull'改爲'/ dev/ttyS1'。

[email protected] { 
     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>; 
    }; 

    [email protected] { 
     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"; 
    }; 

這是我的dts文件中的'uartfull'(名稱uart)和'uartlite'節點。我猜是什麼決定了設備名稱(/ dev/ttyS0/dev/ttyS1等),我可以強制這兩個uart節點的設備名稱。

+0

更改塊的順序。 – VivekD

回答

0

使用別名字段中的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) 

};