OpenWRT (RT5350) 使能两个串口

OpenWRT(RT5350) 默认使能一个串口(uartlite) ,当做console口了,另外一个串口(uartf)与gpio复用。

在查找资料的过程中,发现在新的内核中使用到了设备树(device tree)的概念,使用dts文件描述SOC的所有资源。

针对RT5350平台,系统相关配置文件有如下几个:

1、~/openwrt/build_dir/target-mispel_24kec+dsp_musl-1.1.10/linux-ramips_rt305x/linux-3.10.49/arch/mips/ralink/rt305x.c

2、~/openwrt/build_dir/target-mispel_24kec+dsp_musl-1.1.10/linux-ramips_rt305x/linux-3.10.49/drivers/pinctrl/pinctrl-rt2880.c

3、~/openwrt/target/linux/ramips/dts/rt5350.dtsi

4、~/openwrt/target/linux/ramips/dts/MPRA2.dts

两个C文件主要是针对硬件平台相关接口寄存器定义,与dts文件密切相关,添加调试信息做了跟踪,并不需要修改。

两个dts文件主要是对接口的配置,如系统启动输出串口设置,gpio口,spi,i2c接口设置等;

下面开始配置串口,使能两个串口:(关键的修改在两个dts文件)

1、MPRA2.dts中将state_default从以下内容:

gpio {

ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf";

ralink,function = "gpio";

};

 修改成:

gpio {

ralink,group = "i2c", "jtag", "rgmii", "mdio";

ralink,function = "gpio";

};

uartf {

ralink,group = "uartf";

ralink,function = "gpio uartf";

};

2、MPRA2.dts中注释掉该文件最后gpio_export的所有内容。

3、rt5350.dtsi需要修改bootargs以使uartlite仍然作为console:

(开启uartf之前,uartlite为ttyS0作为console的,开启uartf之后,uartf成为ttyS0,uartlite变为ttyS1)

chosen {

bootargs = "console=ttyS1,57600";

};

4、rt5350.dtsi中释掉uart@500中的status = “disabled”;

// status = "disabled";

 

至此,两个串口使能完毕!

 

posted @ 2015-08-29 15:08  小青年%  阅读(2182)  评论(0编辑  收藏  举报