首先修改MT7620A的dts文件,路径为:/lede/target/linux/ramips/dts
在mt7620a.dtsi中,已经定义了uart: uart@500 和 uartlite: uartlite@c00,uartlite默认处于开启状态,uart则为 disabled。
uart: 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 = "disabled"; }; uartlite: uartlite@c00 { compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0xc00 0x100>; resets = <&rstctrl 19>; reset-names = "uartl"; interrupt-parent = <&intc>; interrupts = <12>; reg-shift = <2>; pinctrl-names = "default"; pinctrl-0 = <&uartlite_pins>; };
我们在需要打开第二个串口的机器的dts文件中设置uart为okay状态,例如:在YOUKU-YK1.dts文件中添加如下配置
&uart { status = "okay"; };
然后在pinctrl中配置相应管脚互用关系,添加uartf_gpio相应配置
&pinctrl { state_default: pinctrl0 { default { ralink,group = "i2c", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd"; ralink,function = "gpio"; }; uartf_gpio { ralink,group = "uartf"; ralink,function = "gpio uartf"; }; }; };
make clean
make V=99重新编译整个系统即可。
PS:打开uartf后这个串口默认为ttyS0,如果想让启动信息还从以前的串口打印出来需要添加如下配置
bootargs = "console=ttyS1,115200"; };
作者:mleaf
链接:http://www.mleaf.org/2017/06/02/openwrt%e5%bc%80%e5%90%afmt7620a%e7%ac%ac%e4%ba%8c%e4%b8%aa%e4%b8%b2%e5%8f%a3/
本站的文章和资源来自互联网或者站长的原创,按照 CC BY -NC -SA 3.0 CN协议发布和共享,转载或引用本站文章应遵循相同协议。如果有侵犯版权的资 源请尽快联系站长,我们会在24h内删除有争议的资源。欢迎大家多多交流,期待共同学习进步。