高通配置uart

1.pingroup中添加GPIO24、25
kernel\msm-4.14\drivers\pinctrl\qcom\pinctrl-trinket.c
 1 enum trinket_functions {
 2     msm_mux_qup10_1,
 3 };
 4 
 5 static const char * const qup10_1_groups[] = {
 6          "gpio24", "gpio25",    //uart对应的gpio
 7  };
 8 
 9 static const struct msm_function trinket_functions[] = {
10     FUNCTION(qup10_1),
11 };
12 
13 static const struct msm_pingroup trinket_groups[] = {
14     [24] = PINGROUP(24, WEST, qup10, qup10_1, phase_flag3, NA, NA, NA, NA, NA, NA),    //[x]内uart对应的gpio
15     [25] = PINGROUP(25, WEST, qup10, qup10_1, phase_flag2, NA, NA, NA, NA, NA, NA),    //[x]内uart对应的gpio
16 };
2.添加pinctrl
kernel/msm-4.14/arch/arm64/boot/dts/qcom/trinket-pinctrl.dtsi
 1 &soc {
 2     tlmm: pinctrl@400000 {        
 3         qupv3_se5_2uart_pins: qupv3_se5_2uart_pins {
 4             qupv3_se5_2uart_active: qupv3_se5_2uart_active {
 5                 mux {
 6                     pins = "gpio24", "gpio25";
 7                     function = "qup10_1";    //对应pingroup的function
 8                 };
 9 
10                 config {
11                         pins = "gpio24", "gpio25";
12                         drive-strength = <2>;
13                         bias-disable;
14                 };
15             };
16 
17             qupv3_se5_2uart_sleep: qupv3_se5_2uart_sleep {
18                 mux {
19                         pins = "gpio24", "gpio25";
20                         function = "gpio";
21                 };
22 
23                 config {
24                         pins = "gpio24", "gpio25";
25                         drive-strength = <2>;
26                         bias-pull-down;
27                 };
28             };
29         };
30     };
31 };
3.添加uart配置
kernel/msm-4.14/arch/arm64/boot/dts/qcom/trinket-qupv3.dtsi
 1 &soc {    
 2     qupv3_se5_2uart: qcom,qup_uart@4c80000 {
 3         compatible = "qcom,msm-geni-serial-hs";    //HS驱动属性
 4         reg = <0x04c80000 0x4000>;    //<寄存器基址 寄存器范围>
 5         reg-names = "se_phys";
 6         clock-names = "se-clk", "m-ahb", "s-ahb";
 7         clocks = <&clock_gcc GCC_QUPV3_WRAP1_S0_CLK>,    //QUP_1 SE0对应GCC_QUPV3_WRAP1_S0_CLK
 8             <&clock_gcc GCC_QUPV3_WRAP_1_M_AHB_CLK>,    //QUP_1对应GCC_QUPV3_WRAP_1_M_AHB_CLK
 9             <&clock_gcc GCC_QUPV3_WRAP_1_S_AHB_CLK>;    //QUP_1对应GCC_QUPV3_WRAP_1_S_AHB_CLK
10         pinctrl-names = "default", "sleep";
11         pinctrl-0 = <&qupv3_se5_2uart_active>;
12         pinctrl-1 = <&qupv3_se5_2uart_sleep>;
13         //interrupts = <GIC_SPI 308 0>;    //ttyMSM的配置
14         interrupts-extended = <&intc GIC_SPI 308 0>,
15             <&tlmm 25 0>;    //配置RX的GPIO为中断
16         qcom,wakeup-byte = <0xFD>;    //唤醒byte
17         qcom,wrapper-core = <&qupv3_1>;    //QUP_1对应qupv3_1
18         status = "disabled";
19      };
20 };
4.添加别名和使能
kernel/msm-4.14/arch/arm64/boot/dts/qcom/trinket.dtsi
1 / {
2     aliases {
3         hsuart2 = &qupv3_se5_2uart;    //ttyHS配置hsuart, ttyMSM配置为serial
4     };
5 };
6 
7 &qupv3_se5_2uart {
8     status = "ok";
9 };

 

posted @ 2021-11-25 19:20  -青云  阅读(1917)  评论(0编辑  收藏  举报