UART to BLSP12 not detected

Hi,
I connected a Sigfox module by UART to the blsp_uart12 GPIOs (85 & 86). My kernel version is linaro-qcomlt-4.14.

The blsp_uart12 isn’t initialized in the device tree, so I added these lines (patch):

diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
index 5020191d9edf..c85ee440053a 100644
--- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
@@ -25,6 +25,7 @@
 		serial0 = &blsp2_uart1;
 		serial1 = &blsp2_uart2;
 		serial2 = &blsp1_uart1;
+		serial3 = &blsp2_uart5;
 		i2c0	= &blsp1_i2c2;
 		i2c1	= &blsp2_i2c1;
 		i2c2	= &blsp2_i2c0;
@@ -87,6 +88,15 @@
 			pinctrl-1 = <&blsp2_uart1_2pins_sleep>;
 		};
 
+		serial@75b4000 {
+                        label = "LS-UART0";
+                        status = "okay";
+                        pinctrl-names = "default", "sleep";
+                        pinctrl-0 = <&blsp2_uart5_2pins_default>;
+                        pinctrl-1 = <&blsp2_uart5_2pins_sleep>;
+                };
+
+
//		serial@75b1000 {
//			label = "LS-UART0";
//			status = "okay";
diff --git a/arch/arm64/boot/dts/qcom/msm8996-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8996-pins.dtsi
index ff862c8c828f..6e69c518c8e5 100644
--- a/arch/arm64/boot/dts/qcom/msm8996-pins.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996-pins.dtsi
@@ -215,6 +215,31 @@
 		};
 	};
 
+	//add uart
+	blsp2_uart5_2pins_default: blsp2_uart5_2pins {
+		pinmux {
+			function = "blsp_uart12";
+			pins = "gpio85", "gpio86";
+		};
+		pinconf {
+			pins = "gpio85", "gpio86";
+			drive-strength = <16>;
+			bias-disable;
+		};
+	};
+
+	blsp2_uart5_2pins_sleep: blsp2_uart5_2pins_sleep {
+		pinmux {
+			function = "gpio";
+			pins = "gpio85", "gpio86";
+		};
+		pinconf {
+			pins = "gpio85", "gpio86";
+			drive-strength = <2>;
+			bias-disable;
+		};
+	};
+
 	blsp2_i2c1_default: blsp2_i2c1 {
 		pinmux {
 			function = "blsp_i2c8";
diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index 39f69190eaa5..69564a389420 100644
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -700,6 +700,15 @@
 			clock-names = "core", "iface";
 			status = "disabled";>
 		};
+		 blsp2_uart5: serial@75b4000 {
+                        compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
+                        reg = <0x075b4000 0x1000>;
+                        interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+                        clocks = <&gcc GCC_BLSP2_UART6_APPS_CLK>,
+                                 <&gcc GCC_BLSP2_AHB_CLK>;
+                        clock-names = "core", "iface";
+                        status = "okay";
+                };

 		blsp1_spi0: spi@07575000 {
 			compatible = "qcom,spi-qup-v2.2.1";
-- 
2.20.1

The device is booting, and in /sys/devices/platform/soc the UART seems to be well created. But the device is not detected by the driver…

sh-5.0# cat 75b4000.serial/uevent
OF_NAME=serial
OF_FULLNAME=/soc/serial@75b4000
OF_COMPATIBLE_0=qcom,msm-uartdm-v1.4
OF_COMPATIBLE_1=qcom,msm-uartdm
OF_COMPATIBLE_N=2
OF_ALIAS_0=serial3
MODALIAS=of:NserialT<NULL>Cqcom,msm-uartdm-v1.4Cqcom,msm-uartdm

Any ideas on this ? (Hardware connections are good).
Thanks :slight_smile:

any related message in dmesg output? dmesg | grep -e uart -e serial

No, nothing…

There is something suspicious, in the device tree from linaro, the blsp2_uart2 is commented. There is maybe some issues with it…

(I didn’t find any proof that the blsp2_uart5 is working :thinking: )

I forgot to do add lines to the msm-serial driver :sweat_smile:

Kernel/drivers/tty/serial/msm_serial.c :

static struct msm_port msm_uart_ports[] = {
+	{
		.uart = {
+ 			.iotype = UPIO_MEM,
+ 			.ops = &msm_uart_pops,
+ 			.flags = UPF_BOOT_AUTOCONF,
+ 			.fifosize = 64,
+ 			.line = 3,
+		},
+
+	},
};
So ttyMSM3 is well initialized but the boot crash like in this post :
Is BLSP12(blsp2_uart5) tested for UART transfers?

Yeah, AFAIR its because this UART is reserved for ‘secure world’ and not accessible from regular OS. You either have to use an other UART instance or to get a modified firmware.

Yeah, thank you…
Is there a list with all usable UARTs ?

AFAIK all others are usable, as long as properly routed to usable pins