Low speed uart on blsp1_uart0?

Hi Guys,

I’m trying to setup blsp1_uart0(GPIO0 & GPIO1) as serial.

cat /proc/device-tree/aliases/serial3 
/soc/serial@756f000

cat /sys/bus/platform/devices/756f000.serial/uevent 
OF_NAME=serial
OF_FULLNAME=/soc/serial@756f000
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

[ 2.589597] msm_serial 7570000.serial: msm_serial: detected port #2
[ 2.589665] msm_serial 7570000.serial: uartclk = 19200000
[ 2.589758] 7570000.serial: ttyMSM2 at MMIO 0x7570000 (irq = 9, base_baud = 1200000) is a MSM
[ 2.590089] serial serial0: tty port ttyMSM2 registered
[ 2.590560] msm_serial 75b0000.serial: msm_serial: detected port #0
[ 2.590633] msm_serial 75b0000.serial: uartclk = 7372800
[ 2.590721] 75b0000.serial: ttyMSM0 at MMIO 0x75b0000 (irq = 13, base_baud = 460800) is a MSM
[ 2.590759] msm_serial: console setup on port #0
[ 4.022005] console [ttyMSM0] enabled
[ 4.027490] msm_serial: driver initialized

I have verified blsp1_qup0 as I2C & SPI. Now i’m trying to verify blsp1_uart0. blsp1_uart0 is not getting registered with msm_serial driver & i don’t see any device node.

question: BLSP1_UART0 is reserved by proprietary binary from access?

regards,
parbatha

Could you provide changes you applied in the device tree so we can check?

Hi Loic,

Following are changes made in dts.

— 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 = &blsp1_uart0;
i2c0 = &blsp1_i2c2;
i2c1 = &blsp2_i2c1;
i2c2 = &blsp2_i2c0;
@@ -85,6 +86,14 @@
pinctrl-1 = <&blsp2_uart1_2pins_sleep>;
};
+serial@756f000 {
+label = “LS-UART2”;
+status = “okay”;
+pinctrl-names = “default”, “sleep”;
+pinctrl-0 = <&blsp1_uart0_2pins_default>;
+pinctrl-1 = <&blsp1_uart0_2pins_sleep>;
+};

// serial@75b1000 {
// label = “LS-UART0”;
// status = “okay”;
@@ -108,7 +117,7 @@
spi@07575000 {
/* On Low speed expansion */
label = “LS-SPI0”;
-status = “okay”;
+status = “disabled”;
};
i2c@075b5000 {
diff --git a/arch/arm64/boot/dts/qcom/msm8996-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8996-pins.dtsi
index 29ad359e…022760c4 100644
— a/arch/arm64/boot/dts/qcom/msm8996-pins.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996-pins.dtsi
@@ -165,6 +165,30 @@
};
};
+blsp1_uart0_2pins_default: blsp1_uart0_2pins {
+pinmux {
+function = “blsp_uart1”;
+pins = “gpio0”, “gpio1”;
+};
+pinconf {
+pins = “gpio0”, “gpio1”;
+drive-strength = <16>;
+bias-disable;
+};
+};
+
+blsp1_uart0_2pins_sleep: blsp1_uart0_2pins_sleep {
+pinmux {
+function = “gpio”;
+pins = “gpio0”, “gpio1”;
+};
+pinconf {
+pins = “gpio0”, “gpio1”;
+drive-strength = <2>;
+bias-disable;
+};
+};
+
blsp2_uart1_4pins_default: blsp2_uart1_4pins {
pinmux {
function = “blsp_uart8”;
diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index 980b41a…7bfd20b 100644
— a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -701,6 +701,16 @@
status = “disabled”;
};
+blsp1_uart0: serial@756f000 {
+compatible = “qcom,msm-uartdm-v1.4”, “qcom,msm-uartdm”;
+reg = <0x0756f000 0x1000>;
+interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+clocks = <&gcc GCC_BLSP1_UART1_APPS_CLK>,
+<&gcc GCC_BLSP1_AHB_CLK>;
+clock-names = “core”, “iface”;
+status = “disabled”;
+};
+

regards,
parbatha

update:

I think issue is in driver side(drivers/tty/serial/msm_serial.c).

In probe:

if (unlikely(line < 0 || line >= UART_NR))
return -ENXIO;

UART_NR array_size is limited to three serial port. so fourth port fails.

static struct msm_port msm_uart_ports[] = {
{

#define UART_NR ARRAY_SIZE(msm_uart_ports)

[ 5.343010] msm_serial 756f000.serial: msm_serial: detected port #3
[ 5.343093] msm_serial 756f000.serial: uartclk = 19200000
[ 5.343196] msm_serial: probe of 756f000.serial failed with error -22

I will debug from my side.

provide input why serial port limited to three. correct me if i’m wrong.

Following code change in driver fixed the issue.(/dev/ttyMSM3)

drivers/tty/serial/msm_serial.c

static struct msm_port msm_uart_ports[] = {
                        .line = 2,
                },
        },
      +{
               +.uart = {
                       +.iotype = UPIO_MEM,
                       +.ops = &msm_uart_pops,
                       +.flags = UPF_BOOT_AUTOCONF,
                       +.fifosize = 64,
                       +.line = 3,
               +},
      +},

Yes this looks like old legacy code which needs to be fixed, as a quick fix you can try to add a fourth port.

Great!

I assume we should change this to dynamic alloc.