要修改的文件有两个
mt7620a.dtsi
MT7620a.dts
1、进入target/linux/ramips/dts/ mt7620a.dtsi
把”disabled”改为”ok”,添加两行
uart@500 { compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0x500 0x100>; resets = <&rstctrl 12>; reset-names = "uart"; interrupt-parent = <&intc>; interrupts = <5>; reg-shift = <2>; status = "ok"; pinctrl-names = "default"; pinctrl-0 = <&uart_pins>; };
还要在pinctrl中添加如下:
uart_pins: uartf { uartf { ralink,group = "uartf"; ralink,function = "uartf"; }; };
因为这样添加了,就有两个串口了,原来的ttyS0会变成ttyS1,但是我们还是要用原来的串口作为调试串口,所以还要更改如下:
chosen { bootargs = "console=ttyS1,57600"; };
2、进入target/linux/ramips/dts/ MT7620a.dts
不能把第二个串口当做普通的gpio功能使用,所以要再group中把“uartf”去掉,修改如下:
pinctrl { state_default: pinctrl0 { gpio { ralink,group = "i2c"; ralink,function = "gpio"; }; }; };