全志Tina Linux 修改串口(UART0->UART1)
说明:本人使用的是F133-A(D1s)
1.修改boot0和uboot的串口
1.1.修改sys_config.fex文件。
1)文件路径为:tina-d1-h/device/config/chips/d1s/configs/nezha/sys_config.fex
修改前:
[uart_para]
uart_debug_port = 0
uart_debug_tx = port:PF2<3><1><default><default>
uart_debug_rx = port:PF4<3><1><default><default>
修改后:
[uart_para]
uart_debug_port = 1
uart_debug_tx = port:PG06<2><1><default><default>
uart_debug_rx = port:PG07<2><1><default><default>
其中<3>改为<2> 需要查阅数据手册(D1s_Datasheet_V1.0)中 PG6、PG7 的UART1是 Function2 得知的
1.2.修改UBOOT CONSOLE INDEX
1)路径为:tina-d1-h/lichee/brandy-2.0/u-boot-2018/configs/sun20iw1p1_defconfig
2)在最后添加
CONFIG_SPECIFY_CONSOLE_INDEX=y
CONFIG_CONS_INDEX=2 #说明:这里是UART 1+1 = 2 串口号+1 (注意,这个注释记得去掉,否则编译报错)
2.修改kernel的串口
2.1.修改设备树(kernel使用的串口输出)
1)文件路径为:tina-d1-h/device/config/chips/d1s/configs/nezha/board.dts
修改前:
&uart0 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart0_pins_a>;
pinctrl-1 = <&uart0_pins_b>;
status = "okay";
};
&uart1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart1_pins_a>;
pinctrl-1 = <&uart1_pins_b>;
status = "disabled";
};
&uart2 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart2_pins_a>;
pinctrl-1 = <&uart2_pins_b>;
status = "disabled";
};
&uart3 {
compatible = "allwinner,sun20iw1-dsp-uart";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart3_pins_a>;
pinctrl-1 = <&uart3_pins_a>;
status = "disabled";
};
修改后:
&uart0 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart0_pins_a>;
pinctrl-1 = <&uart0_pins_b>;
status = "disabled";
};
&uart1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart1_pins_a>;
pinctrl-1 = <&uart1_pins_b>;
status = "okay";
};
&uart2 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart2_pins_a>;
pinctrl-1 = <&uart2_pins_b>;
status = "disabled";
};
&uart3 {
compatible = "allwinner,sun20iw1-dsp-uart";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart3_pins_a>;
pinctrl-1 = <&uart3_pins_a>;
status = "disabled";
};
2.2.修改启动bootargs
1)路径为:tina-d1-h/device/config/chips/d1s/configs/default/env.cfg
修改前:
#kernel command arguments
earlyprintk=sunxi-uart,0x02500000
initcall_debug=0
console=ttyS0,115200
修改后:
#kernel command arguments
earlyprintk=sunxi-uart,0x02500400
initcall_debug=0
console=ttyS1,115200
说明:earlyprintk=sunxi-uart,0x02500000 需要修改为 UART1 的地址,查阅手册可知为 0x02500400
|