RK platform android system modifies uart2 debugging serial port to ordinary serial port

Under normal circumstances, ttyS2 (i.e. uart2) of RK series motherboards is basically designed as a debug port and provides fiq debugger function.
Change the debugging port to a normal serial port. The specific modifications are as follows:

  1. Remove the fiq debugger driver in the kernel:
//dts中disabled掉fiq debugger驱动节点
fiq-debugger {
    
    
    compatible = "rockchip,fiq-debugger";
    interrupts = <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>;
    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 = <&uart2_xfer>;
+   status = "disabled";
};

//或者注释掉kernel config里的FIQ_DEBUGGER相关配置
#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
  1. Open uart2 (because the debugging serial port needs to be closed before):
&uart2 {
    
    
-       status = "disabled";
+       status = "okay";
};
  1. Remove bootargs:
        chosen {
    
    
-               bootargs = "earlycon=uart8250,mmio32,0xff690000 vmalloc=496M";
+               //bootargs = "earlycon=uart8250,mmio32,0xff690000 vmalloc=496M";
        };
  1. Modify parameter.txt (remove ttyFIQ0):
-CMDLINE: console=ttyFIQ0 androidboot.baseband
+CMDLINE: console= androidboot.baseband
  1. Remove the console from the device/rockchip/common/recovery/etc/init.rc file:
service recovery /sbin/recovery
-    console
+    #console
     seclabel u:r:recovery:s0

After modification, compilation and burning, ttyS2 can be used as an ordinary serial port. Short-circuit TX and RX can receive it automatically!

Guess you like

Origin blog.csdn.net/weixin_45639314/article/details/132412447