MSM8953 Android 9.0 開啟uart串列埠

feng5219發表於2020-11-18

目錄

MSM8953 Android 9.0 開啟uart6串列埠


msm8953 從硬體規格書中最多是支援4個串列埠,即除了列印串列埠外,另外還有3個串列埠可供系統使用,

本文以除錯中開啟uart6串列埠為例說明。

修改步驟如下:

1. 通過硬體資料確認裝置樹dtsi的修改

基地址:

中斷號:

跟進硬體資源修改msm8953.dtsi配置檔案

	blsp2_serial1: serial@7af0000 {
		compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
		reg = <0x7af0000 0x200>;
		interrupts = <0 307 0>;
		clocks = <&clock_gcc clk_gcc_blsp2_uart2_apps_clk>,
			<&clock_gcc clk_gcc_blsp2_ahb_clk>;
		clock-names = "core", "iface";
		pinctrl-names = "default","sleep";
		pinctrl-0 = <&uart6_active>;
		pinctrl-1 = <&uart6_sleep>;
		status = "ok";
	};

注意串列埠6也可以用作SPI的功能。

2.修改pinctrl配置:

			uart6_active: uart6_active {
				mux {
					pins = "gpio20", "gpio21";
					function = "blsp_uart6";
				};

				config {
					pins = "gpio20", "gpio21";
					drive-strength = <2>;
					bias-disable;
				};
			};

			uart6_sleep: uart6_sleep {
				mux {
					pins = "gpio20", "gpio21";
					function = "blsp_uart6";
				};

				config {
					pins = "gpio20", "gpio21";
					drive-strength = <2>;
					bias-pull-down;
				};
			};

3.串列埠驅動修改:

msm_serial.c增加一組串列埠配置

	{
		.uart = {
			.iotype = UPIO_MEM,
			.ops = &msm_uart_pops,
			.flags = UPF_BOOT_AUTOCONF,
			.fifosize = 64,
			.line = 3,
		},
	},

4.燒錄驗證:

[    1.233020] 78b0000.serial: ttyHSL2 at MMIO 0x78b0000 (irq = 68, base_baud = 1200000) is a MSM
[    1.233731] msm_serial 7af0000.serial: msm_serial: detected port #3
[    1.233766] msm_serial 7af0000.serial: uartclk = 19200000
[    1.233818] 7af0000.serial: ttyHSL3 at MMIO 0x7af0000 (irq = 69, base_baud = 1200000) is a MSM

啟動程式碼看到有新的串列埠節點載入,說明已修改成功。

 

文章圖片來源:

https://blog.csdn.net/xuecz1230/article/details/78672662

相關文章