[RK3288][Android6.0] 调试笔记 --- 普通串口的添加 【转】

本文转载自:http://blog.csdn.net/kris_fei/article/details/54574073

 
标签: rk3288 串口添加
Platform: ROCKCHIP
OS: Android 6.0
Kernel: 3.10.92

uart0,1,3,4 (普通串口) 用的是同一个串口驱动.
uart2(调试串口)的驱动代码嵌在fiq debugger的code中.

相关的配置在rk3288.dtsi中:
aliases {
    serial0 = &uart_bt;
    serial1 = &uart_bb;
    serial2 = &uart_dbg;
    serial3 = &uart_gps;
    serial4 = &uart_exp;
    ......
}

uart_bb: serial@ff190000 {
    compatible = "rockchip,serial";
    reg = <0xff190000 0x100>;
    interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
    clock-frequency = <24000000>;
    clocks = <&clk_uart1>, <&clk_gates6 9>;
    clock-names = "sclk_uart", "pclk_uart";
    reg-shift = <2>;
    reg-io-width = <4>;
    dmas = <&pdma1 3>, <&pdma1 4>;
    #dma-cells = <2>;
    pinctrl-names = "default";
    pinctrl-0 = <&uart1_xfer &uart1_cts &uart1_rts>;
    status = "disabled";
};

假设这里要使用uart1,也就是uart_bb, 那么只要在主dts中添加:
&uart_bb {
        status = "okay";
        dma-names = "!tx", "!rx";
};

另外,由于uart1默认作为base band通信用,所以在.rc修改成你需要的权限
diff --git a/init.connectivity.rc b/init.connectivity.rc
index 71d125a..1e06417 100755
--- a/init.connectivity.rc
+++ b/init.connectivity.rc
@@ -54,10 +54,8 @@ on boot
 
 # bluetooth power up/down interface
     chmod 0660 /dev/ttyS0
-    chmod 0660 /dev/ttyS1
     chmod 0660 /dev/vflash
     chown bluetooth net_bt_stack /dev/vflash
-    chown bluetooth net_bt_stack /dev/ttyS1
     chown bluetooth net_bt_stack /dev/ttyS0
     chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type
     chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state
diff --git a/ueventd.rockchip.rc b/ueventd.rockchip.rc
index b7f45c2..c6d773a 100644
--- a/ueventd.rockchip.rc
+++ b/ueventd.rockchip.rc
@@ -31,6 +31,9 @@
 /dev/mirroring            0664   media      media
 /dev/iep                  0660   media      media
 
+#Kris
+/dev/ttyS1                0666   system     system
+
 # for Sensor HAL
 /dev/akm8973              0660   system     system
 /dev/accelerometer        0660   system     system

测试:
可以弄两块板子, 然后将两个一样的串口连接起来,一块收一块发
1.
# cat /dev/ttyS1
2.
# echo test > /dev/ttyS1
posted @ 2017-09-30 11:14  请给我倒杯茶  阅读(2049)  评论(0编辑  收藏  举报