UART2 as 17—Customer Linux application NOT WORKING

Hi, Again the Uart issue , I didn’t find something that helps me on the web.
I changed the UART config via AT commands:
AT!MAPUART=16,1 # make the uart 1 as a linux console
AT!MAPUART=17,2 # make the uart 2 as Customer Linux application
after the reset i got this devices: ttyMSM0 ttyHS1.
when i trying to configure or open the ttyHS1 i got:
stty /dev/ttyHS1 115200
stty: invalid number ‘/dev/ttyHS1’
or picocom:
picocom -b 115200 --emap= /dev/ttyHS1

FATAL: failed to add port: Filedes is not a tty

what I missing? pls help.

Which module and firmware are you using

module : WP7611
uname -a : Linux swi-mdm9x28-wp 4.14.253 #1 PREEMPT Sun Mar 24 17:33:04 UTC 2024 armv7l GNU/Linux
AT!PACKAGE?
1105133_9911497_WP7611_02.37.03.00_00_Qualified_001.000_000
Release17 of yocto

How about using these commands?

Nope… :
stty -F /dev/ttyHS1 raw 115200 -crtscts
stty: /dev/ttyHS1: Input/output error

I don’t see problem with wp7605 FW R17 :

root@fx30:~# stty -F /dev/ttyHS1 raw 115200 -crtscts
root@fx30:~# ls /dev/ttyH*
/dev/ttyHS1
root@fx30:~# microcom /dev/ttyHS1 -s 115200
root@fx30:~# legato version
21.05.2.rc2_7f59219499ecf02274c4ac7575e4f8c5_modified
root@fx30:~# cm info
Device:                        WP7605
IMEI:                          353532100012345
IMEISV:                        12
FSN:                           2A917285012345
Firmware Version:              SWI9X07Y_02.37.06.05 b15b59 jenkins 2022/09/27 07:54:33
Bootloader Version:            SWI9X07Y_02.37.06.05 b15b59 jenkins 2022/09/27 07:54:33
MCU Version:
PRI Part Number (PN):          9908705
PRI Revision:                  002.010
Carrier PRI Name:              GENERIC
Carrier PRI Revision:          002.128_000
SKU:                           1104208
Last Reset Cause:              Reset, User Requested
Resets Count:                  Expected: 232    Unexpected: 0





root@fx30:~# microcom /dev/ttyAT
ati3
Manufacturer: Sierra Wireless, Incorporated
Model: WP7605
Revision: SWI9X07Y_02.37.06.05 b15b59 jenkins 2022/09/27 07:54:33
IMEI: 353532100012345
IMEI SV: 18
FSN: 2A917285012345
+GCAP: +CGSM

OK
ati8
Legato Ver: 21.05.2.rc2_7f59219499ecf02274c4ac7575e4f8c5_modified
Yocto Ver:  SWI9X07Y_03.01.07.00 2023-03-16_13:18:36
OS Ver: Linux version 4.14.253 (oe-user@oe-host) ( gcc version 9.3.0 (GCC), GNU ld (GNU Binutils) 2.34.0.20200220) #1 PREEMPT Thu Mar 16 11:08:58 UTC 2023
LK Ver: SWI9X07Y_03.01.07.00
RootFS Ver: SWI9X07Y_03.01.07.00 2023-03-16_13:18:36
UserFS Ver: unknown
MCU Ver: unknown

OK
at!mapuart?
!MAPUART: 16,17

OK






Maybe it related to DTS or the yocto build of my company ?

i don’t know, you can flash the official R17 FW and retry

Thank you for the fast replay!!! ill try

Ok so i flashed the stock one and (WP76xx_Release17_GENERIC.spk) and the UART working . but i cannot understand what the problem our recipes does not do anything with the uarts at all.
and one more question,
after I mapped the console to UART 1 there still where printouts possibly from the FSBL . can i change it too so there no prints from the UART2 at all?

No, you cannot change it for the SBL debug message

Ok so this is my problem :
mdm960-pinctrl 1000000.pinctrl: pin GPIO_4 already requested by 78b0000.serial; cannot claim for 78b0000.uart
[ 0.712771] mdm9607-inctrl 1000000.pinctrl: pin-4 (78b0000.uart) status -22

do you know why this conflict exist? AT commands should handle it or so?

Why did you change the dts file for uart

I am not this is the funny part. there is nothing in my layer that related to the uarts, serials etc…and still this what i get on the console

Then how can you explain the official image has no problem?

The error must be related to your modification …

Ok so i narrowed it down to one specific patch :

From bfca167356adef07b2bca2288a63a8b6fceb2d75 Mon Sep 17 00:00:00 2001
From: Ilan Ganor <ilan@kamacode.com>
Date: Fri, 9 Feb 2024 15:08:35 +0200
Subject: [PATCH] personal gpio

---
 arch/arm/configs/mdm9607_defconfig    |   1 +
 arch/arm64/boot/dts/qcom/mdm9607.dtsi |  12 +++
 drivers/misc/Kconfig                  |   4 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/personal_pm.c            | 131 ++++++++++++++++++++++++++
 include/dt-bindings/gpio/gpio.h       |   3 +
 6 files changed, 152 insertions(+)
 create mode 100644 drivers/misc/personal_pm.c

diff --git a/arch/arm/configs/mdm9607_defconfig b/arch/arm/configs/mdm9607_defconfig
index e320a8a5c71c..e861fcdc2741 100644
--- a/arch/arm/configs/mdm9607_defconfig
+++ b/arch/arm/configs/mdm9607_defconfig
@@ -454,3 +454,4 @@ CONFIG_IMA_TRUSTED_KEYRING=y
 
 # Sierra USB
 CONFIG_SIERRA_USB_COMP=y
+CONFIG_PERSONAL_PM=y
diff --git a/arch/arm64/boot/dts/qcom/mdm9607.dtsi b/arch/arm64/boot/dts/qcom/mdm9607.dtsi
index f05b18f23cea..dfbd2431ad69 100644
--- a/arch/arm64/boot/dts/qcom/mdm9607.dtsi
+++ b/arch/arm64/boot/dts/qcom/mdm9607.dtsi
@@ -18,6 +18,7 @@
 #include <dt-bindings/regulator/qcom,rpm-smd-regulator.h>
 #include <dt-bindings/spmi/spmi.h>
 #include <dt-bindings/iio/qcom,spmi-vadc.h>
+#include <dt-bindings/gpio/gpio.h>
 
 #define MHZ_TO_MBPS(mhz, w) ((mhz * 1000000 * w) / (1024 * 1024))
 #define BW_OPP_ENTRY(mhz, w) opp-mhz {opp-hz = /bits/ 64 <MHZ_TO_MBPS(mhz, w)>;}
@@ -110,6 +111,17 @@
 	#size-cells = <1>;
 	ranges;
 
+        personal_station-pm {
+                compatible = "personal,personal_station-pm";
+                platform-unique;
+                status = "okay";
+		pin_numbers = <7 8 13 35 32 33>;
+		pin_names = 	"SYS_PWR_OFF", "ROUTER_RESET", "JETSON_RESET", "TP1", "TP2", "12V_TZ";
+		//GPIOF_OUT_INIT_LOW  GPIOF_OUT_INIT_HIGH GPIOF_IN
+		pin_states = <GPIOF_OUT_INIT_LOW GPIOF_OUT_INIT_LOW GPIOF_OUT_INIT_LOW GPIOF_IN GPIOF_IN GPIOF_IN>;
+		pin_init_val = <0 0 0 0 0 0>;
+        };
+
 	intc: interrupt-controller@b000000 {
 		compatible = "qcom,msm-qgic2";
 		interrupt-controller;
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 3c6ecc0b15e6..c0835a436c77 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -605,6 +605,10 @@ config SIERRA_TZDEV
 
 	  If in doubt, say N.
 
+config PERSONAL_PM
+        tristate "personal power mangment driver"
+        help
+          driver handling named GPIO and initial status settings.
 
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c7c51d59a7bf..9c1a17d2ffb3 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -92,3 +92,4 @@ $(obj)/lkdtm_rodata_objcopy.o: $(obj)/lkdtm_rodata.o FORCE
 obj-$(CONFIG_OKL4_USER_VIPC)    += okl4-vipc.o
 obj-$(CONFIG_OKL4_GUEST)        += okl4-panic.o
 obj-$(CONFIG_OKL4_LINK_SHBUF)    += okl4-link-shbuf.o
+obj-$(CONFIG_PERSONAL_PM)      += personal_pm.o
diff --git a/drivers/misc/personal_pm.c b/drivers/misc/personal_pm.c
new file mode 100644
index 000000000000..f66d49030031
--- /dev/null
+++ b/drivers/misc/personal_pm.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2010 Amarula Solutions.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kallsyms.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of_gpio.h>
+#include <linux/platform_device.h>
+#include <linux/pm.h>
+#include <linux/regulator/consumer.h>
+
+struct personal_station {
+	int	n0_general_som_to_pos_61;
+};
+
+
+struct regulator * v3v3_supply;
+
+
+static int personal_station_request_export(struct device *dev, int flags)
+{
+	struct device_node *np = dev->of_node;
+	int ret;
+	u32 tmp;
+	u8 num_relays, i;
+	u32 pin_num, pin_init_val, pin_stat;
+	const char *oh_name;
+
+	if (!of_get_property(np, "pin_numbers", &tmp))
+		goto error_parse;
+	if (!of_get_property(np, "pin_names", &tmp))
+		goto error_parse;
+	if (!of_get_property(np, "pin_states", &tmp))
+		goto error_parse;
+	if (!of_get_property(np, "pin_init_val", &tmp))
+		goto error_parse;
+	num_relays = tmp / (sizeof(u32));
+	dev_info(dev, "num_relays %d\n", num_relays);
+	for (i = 0; i < num_relays; i++) {
+		if (of_property_read_u32_index(np, "pin_numbers", i, &pin_num))
+			goto error_parse;
+		if (of_property_read_u32_index(np, "pin_init_val", i, &pin_init_val))
+			goto error_parse;
+		if (of_property_read_u32_index(np, "pin_states", i, &pin_stat))
+			goto error_parse;
+		if (of_property_read_string_index(np, "pin_names", i, &oh_name))
+			goto error_parse;
+		ret = devm_gpio_request_one(dev, pin_num, pin_stat, oh_name);
+		if (ret) {
+			dev_err(dev, "Failed to request GPIO %d, error %d\n",
+				pin_num, ret);
+			return ret;
+		}
+		gpio_export(pin_num, 1);
+		gpio_export_link(dev, oh_name, pin_num);
+	}
+	return 0;
+
+error_parse: 
+	dev_err(dev, "Failed to parse DT\n");
+	return -EINVAL;
+}
+
+static int personal_station_probe(struct platform_device *pdev)
+{
+	struct personal_station *priv;
+	int ret;
+
+	if (!pdev->dev.of_node) {
+		dev_err(&pdev->dev, "This driver support only DT init\n");
+		return -EINVAL;
+	}
+	priv = devm_kzalloc(&pdev->dev,
+			sizeof(struct personal_station), GFP_KERNEL);
+	if (!priv) {
+		dev_err(&pdev->dev, "Failed to allocate memory\n");
+		return -ENOMEM;
+	}
+
+	platform_set_drvdata(pdev, priv);
+	ret = personal_station_request_export(&pdev->dev, GPIOF_OUT_INIT_LOW);
+	dev_info(&pdev->dev, "Probed\n");
+
+	return 0;
+}
+
+static int personal_station_remove(struct platform_device *pdev)
+{
+	platform_set_drvdata(pdev, NULL);
+
+	return 0;
+}
+
+static const struct of_device_id personal_station_match[] = {
+	{ .compatible = "personal,personal_station-pm", },
+	{ },
+};
+
+static struct platform_driver personal_station_driver = {
+	.probe		= personal_station_probe,
+	.remove		= personal_station_remove,
+	.driver		= {
+		.name	= "personal_station-pm",
+		.of_match_table = of_match_ptr(personal_station_match),
+	},
+};
+
+static int __init personal_station_init(void)
+{
+	return platform_driver_register(&personal_station_driver);
+}
+
+static void __exit personal_station_exit(void)
+{
+	platform_driver_unregister(&personal_station_driver); 
+}
+
+module_init(personal_station_init);
+module_exit(personal_station_exit);
+
+MODULE_ALIAS("platform:personal_station-pm");
+MODULE_DESCRIPTION("Personal Station Board Driver");
+MODULE_LICENSE("GPL");
diff --git a/include/dt-bindings/gpio/gpio.h b/include/dt-bindings/gpio/gpio.h
index 32dd58a3d13c..cc235fe315a7 100644
--- a/include/dt-bindings/gpio/gpio.h
+++ b/include/dt-bindings/gpio/gpio.h
@@ -33,4 +33,7 @@
 #define GPIO_SLEEP_MAINTAIN_VALUE 0
 #define GPIO_SLEEP_MAY_LOOSE_VALUE 8
 
+#define GPIOF_IN 1
+#define GPIOF_OUT_INIT_LOW 0
+#define GPIOF_OUT_INIT_HIGH 2
 #endif
-- 
2.17.1

and here no changes or anything that related to the uarts or serial :weary: