QCM2150 android10平台 uart移植

前言

我们当前使用该平台的GPIO16 GPIO17来做2线高速uart通信。如下图所示可以首先确认基地址:

QCM2150 android10平台 uart移植_第1张图片


一、BP侧修改

trustzone_images/core/buses/qup_accesscontrol/bear/config/QUPAC_8917_Access.xml

153    <device id=BLSP_UART_3_DEV_ACCESS>
154       <props name="CHIP_BUS_INDEX"      type=DALPROP_ATTR_TYPE_UINT32>     BLSP_UART_3               </props>
155       <props name="BUS_PROTOCOL"        type=DALPROP_ATTR_TYPE_UINT32>     PROTOCOL_UART_2_LINE      </props>-------PROTOCOL_UART_4_LINE  4线改2线
156       <props name="IS_GPIO_PROTECTED"   type=DALPROP_ATTR_TYPE_UINT32>     0                         </props>
157       <props name="GPIO_NUMBERS"        type=DALPROP_ATTR_TYPE_BYTE_SEQ>   16, 17, end       </props>-------------被修改16, 17, 18, 19, end
158       <props name="GPIO_RG_INDEX"       type=DALPROP_ATTR_TYPE_BYTE_SEQ>   end                       </props>
159       <props name="SUBSYSTEM_ID"        type=DALPROP_ATTR_TYPE_UINT32>     AC_NONE                   </props>
160       <props name="IS_PERSISTENT"       type=DALPROP_ATTR_TYPE_UINT32>     0                         </props>
161       <props name="CORE_RG_INDEX"       type=DALPROP_ATTR_TYPE_UINT32>     7                         </props>
162    </device>

编译生成devcfg 下载进去

二、AP修改

从下图看到dtsi 各个参数怎么配置的
QCM2150 android10平台 uart移植_第2张图片

QCM2150 android10平台 uart移植_第3张图片
对应msm8917.dtsi

	blsp2_uart1: serial@0x7aef000 {
        compatible = "qcom,msm-hsuart-v14";
            reg = <0x7aef000 0x200>,
                    <0x7ac4000 0x1f000>;
            reg-names = "core_mem", "bam_mem";
            interrupt-names = "core_irq", "bam_irq";
        #address-cells = <0>;
            interrupt-parent = <&blsp2_uart1>;
            interrupts = <0 1>;
        #interrupt-cells = <1>;
            interrupt-map-mask = <0xffffffff>;
            interrupt-map = <0 &intc 0 306 0
                            1 &intc 0 239 0>;

            //qcom,inject-rx-on-wakeup;
            //qcom,rx-char-to-inject = <0xfd>;

            qcom,bam-tx-ep-pipe-index = <0>;
            qcom,bam-rx-ep-pipe-index = <1>;
            qcom,master-id = <84>;
            clock-names = "core_clk", "iface_clk";
            clocks = <&clock_gcc clk_gcc_blsp2_uart1_apps_clk>,
                            <&clock_gcc clk_gcc_blsp2_ahb_clk>;
            pinctrl-names = "sleep", "default";
            pinctrl-0 = <&blsp2_uart1_sleep>;
            pinctrl-1 = <&blsp2_uart1_active>;
            qcom,msm-bus,name = "blsp2_uart1";
            qcom,msm-bus,num-cases = <2>;
            qcom,msm-bus,num-paths = <1>;
            qcom,msm-bus,vectors-KBps =
                            <84 512 0 0>,
                            <84 512 500 800>;
            status = "ok";
    };

对应msm8917-pinctrl.dtsi

        blsp2_uart1 {
                       blsp2_uart1_active: blsp2_uart1_active {
		                mux {
			               pins = "gpio16", "gpio17";
			               function = "blsp_uart5";
		               };
                               config {
			                pins = "gpio16", "gpio17";
	                                drive-strength = <2>;
			                bias-disable;
		               };
	                };
 
	               blsp2_uart1_sleep: blsp2_uart1_sleep {
		                mux {
			               pins = "gpio16", "gpio17";
			               function = "blsp_uart5";
		                };
		               config {
			               pins = "gpio16", "gpio17";
			               drive-strength = <2>;
			               bias-pull-down;
		               };
	               };
        };

注意需要把代码中被踩到的GPIO去掉。


DEBUG

1.如果测试有能写不能读,请将100改为-1;如此可以禁止休眠
kernel/msm-4.9/drivers/tty/serial/msm_serial_hs.c

@@ -3320,7 +3320,7 @@ static void  msm_serial_hs_rt_init(struct uart_port *uport)

        MSM_HS_INFO("%s(): Enabling runtime pm", __func__);
        pm_runtime_set_suspended(uport->dev);
-       pm_runtime_set_autosuspend_delay(uport->dev, 100);
+       pm_runtime_set_autosuspend_delay(uport->dev, -1);
        pm_runtime_use_autosuspend(uport->dev);
        mutex_lock(&msm_uport->mtx);
        msm_uport->pm_state = MSM_HS_PM_SUSPENDED;

2.利用测试程序进行测试,tx rx连接电脑进行测试
QCM2150 android10平台 uart移植_第4张图片

另外通过测试脚本也可以看到发送接收时间是不是正常,100ms就是异常了
QCM2150 android10平台 uart移植_第5张图片

你可能感兴趣的:(QCM2150,android,linux,uart)