[RK3399] 调试串口ttyS2改为普通串口

CPU:RK3399

系统:Android 7.1

 

 串口需求量大时,会选择使用 spi 转串口,但是数据量大或者波特率较高时,传输会丢包。

调试串口 ttyS2 也可以让出来,供上层使用,下面是将 ttyS2 改为普通串口。

 

1、在配置文件中关闭 FIQ

使用 rockchip_defconfig 文件,就在此文件中修改

diff --git a/kernel/arch/arm64/configs/rockchip_defconfig b/kernel/arch/arm64/configs/rockchip_defconfig
index dad111e..6d974cb 100644
--- a/kernel/arch/arm64/configs/rockchip_defconfig
+++ b/kernel/arch/arm64/configs/rockchip_defconfig
@@ -694,11 +694,7 @@ CONFIG_SW_SYNC=y
 CONFIG_SW_SYNC_USER=y
 CONFIG_ION=y
 CONFIG_ION_ROCKCHIP=y
-CONFIG_FIQ_DEBUGGER=y
-CONFIG_FIQ_DEBUGGER_NO_SLEEP=y
-CONFIG_FIQ_DEBUGGER_CONSOLE=y
-CONFIG_FIQ_DEBUGGER_CONSOLE_DEFAULT_ENABLE=y
-CONFIG_FIQ_DEBUGGER_TRUST_ZONE=y
+# CONFIG_FIQ_DEBUGGER is not set
 CONFIG_RK_CONSOLE_THREAD=y
 CONFIG_POWERVR_ROGUE_N=y
 CONFIG_COMMON_CLK_RK808=y

如果不用 rockchip_defconfig 文件,就直接修改 kernel 目录下的 .config 文件(与 rockchip_defconfig 相同),或者在 make menuconfig 中关闭

Device Drivers  --->

  [*] Staging drivers  --->

    Android  --->

      [ ] FIQ Mode Serial Debugger

 

2、dts 文件中关闭调试

diff --git a/kernel/arch/arm64/boot/dts/rockchip/rk3399-android.dtsi b/kernel/arch/arm64/boot/dts/rockchip/rk3399-android.dtsi
index cdd464d..2de1631 100644
--- a/kernel/arch/arm64/boot/dts/rockchip/rk3399-android.dtsi
+++ b/kernel/arch/arm64/boot/dts/rockchip/rk3399-android.dtsi
@@ -48,7 +48,8 @@
        compatible = "rockchip,android", "rockchip,rk3399";
 
        chosen {
-               bootargs = "earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 coherent_pool=1m";
+//             bootargs = "earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 coherent_pool=1m";
+               bootargs = "";
        };
 
        cpuinfo {
@@ -80,6 +81,7 @@
        fiq_debugger: fiq-debugger {
                compatible = "rockchip,fiq-debugger";
                rockchip,serial-id = <2>;
                rockchip,wake-irq = <0>;
                rockchip,irq-mode-enable = <0>;  /* If enable uart uses irq instead of fiq */
                rockchip,baudrate = <115200>;  /* Only 115200 and 1500000 */
                pinctrl-names = "default";
                pinctrl-0 = <&uart2c_xfer>;
                interrupts = 150 IRQ_TYPE_LEVEL_HIGH 0>;
+                status = "disabled";
        };

 

3、打开 ttyS2 串口,这样上层才能识别到 ttyS2

diff --git a/kernel/arch/arm64/boot/dts/rockchip/rk3399-mid-808-android.dts b/kernel/arch/arm64/boot/dts/rockchip/rk3399-mid-808-android.dts
old mode 100755
new mode 100644
index 60460be..57749a4
--- a/kernel/arch/arm64/boot/dts/rockchip/rk3399-mid-808-android.dts
+++ b/kernel/arch/arm64/boot/dts/rockchip/rk3399-mid-808-android.dts
@@ -725,6 +725,12 @@
        status = "okay";
 };
 
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart2c_xfer>;
+       status = "okay";
+};
+
 &usb_host0_ehci {
        status = "okay";
 };

 

4、修改 ttyS2 权限

diff --git a/device/rockchip/common/ueventd.rockchip.rc b/device/rockchip/common/ueventd.rockchip.rc
index 8d5d28d..9951398 100644
--- a/device/rockchip/common/ueventd.rockchip.rc
+++ b/device/rockchip/common/ueventd.rockchip.rc
@@ -59,6 +59,8 @@
#/dev/ttyS2 0660 bluetooth net_bt_stack
/dev/rtk_btusb 0660 bluetooth net_bt_stack

+/dev/ttyS2 0666 system system

 

此时开机进入 kernel 后,ttyS2 不会再输出打印信息,但是 u-boot 中的打印信息还在,但已经不影响上层使用。

 

转载于:https://www.cnblogs.com/lialong1st/p/11327238.html

你可能感兴趣的:([RK3399] 调试串口ttyS2改为普通串口)