版權聲明:本文為博主原創文章,未經博主允許不得轉載。
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 = ;
clock-frequency = <24000000>;
clocks = , ;
clock-names = "sclk_uart", "pclk_uart";
reg-shift = <2>;
reg-io-width = <4>;
dmas = , ;
#dma-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = ;
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