Skip to contentSkip to conversation

n_gsm serdev support and GNSS driver for droid4

PATCH Superseded Tony Lindgren 3 participants 26 messages Apr 30, 2020 – May 12, 2020

Subsystems (4)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v6 cover n_gsm serdev support and GNSS driver for droid4

Hi all,

Here's v6 set of these patches fixed up for Johan's earlier comments.

Getting rid of the custom chardev interface, and making things more generic also simplified things quite a bit. Thanks a lot Johan :)

This series does the following:

1. Adds functions to n_gsm.c for serdev-ngsm.c driver to use

2. Adds a generic serdev-ngsm.c driver that brings up the TS 27.010 TTY ports configured in devicetree with help of n_gsm.c

3. Allows the use of standard Linux device drivers for dedicated TS 27.010 channels for devices like GNSS and ALSA found on some modems for example

4. Adds a serdev-ngsm consumer driver for the GNSS device found on the Motorola Mapphone MDM6600 modem on devices like droid4

I've placed the serdev-ngsm.c under drivers/tty/serdev as it still seems to make most sense with no better places available. It's no longer an MFD driver as it really does not need to care what channel specific consumer drivers might be configured. So it now just uses of_platform_populate() to probe whatever child nodes it might find.

I'm not attached having the driver in drivers/tty/serdev. I just don't have any better locations in mind. So jsing Johan's earlier i2c example, the drivers/tty/serdev/serdev-ngsm.c driver is now a generic protocol and bus driver, so it's getting closer to the maybe the drivers/i2c/busses analogy :) Please do suggest better locations other than MFD and misc if you have better ideas.

Now without the chardev support, the /dev/gsmtty* using apps need to use "U1234AT+CFUN?" format for the packets. The advantage is less kernel code, and we keep the existing /dev/gsmtty* interface.

If we still really need the custom chardev support, that can now be added as needed with the channel specific consumer driver(s).

My guess is that at least with the pending ofono patches, we just want to use the raw interface for /dev/gsmtty* interface and stop pretending we have a modem that is AT compatible.

Regards,

Tony

Changes since v5:
- Based on comments from Johan, moved back to using the existing TS 27.010 TTYs created by n_gsm.c instaed of adding custom chardev support to deal with the Motorola custom protocol

- Based on comments from Johan, made the serdev-ngsm driver generic with just minimal quirk handling for the Motorola modem

- Dropped the Motorola custom protocol on top of TS 27.010 handling from serdev-ngsm.c as this can now be easily handled by the channel specific drivers as needed

- Added few more helpers to n_gsm.c for serdev-ngsm.c to use

- Added the channel specific GNSS driver for the Motorola modem

Changes since v4:
- Use drivers/tty/serdev/protocol directory for the driver instead of drivers/mfd as discussed on the lists for v3 set of patches
- Fix remove to call kfree only after removing device from the list

Changes since v3:
- Update list of folks in Cc, looks like I sent v3 only to Lee and lkml
- Init privdata before motmdm_register_dlci calls gsm_serdev_register_dlci
- Update binding based on Rob's comments for license and "allOf"

Changes since v2:
- Drop useless send_command indirection, use static motmdm_send_command

Changes since v1:

- Simplified usage and got rid of few pointless inline functions
- Added consumer MFD driver, devicetree binding, and dts changes

Tony Lindgren (6):
tty: n_gsm: Add support for serdev drivers
dt-bindings: serdev: ngsm: Add binding for serdev-ngsm
serdev: ngsm: Add generic serdev-ngsm driver
dt-bindings: gnss: Add binding for Motorola Mapphone MDM6600 GNSS
gnss: motmdm: Add support for Motorola Mapphone MDM6600 modem
ARM: dts: omap4-droid4: Configure modem for serdev-ngsm

 .../devicetree/bindings/gnss/motmdm.yaml      |  29 ++
 .../bindings/serdev/serdev-ngsm.yaml          |  64 +++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 .../boot/dts/motorola-mapphone-common.dtsi    |  14 +
 drivers/gnss/Kconfig                          |   8 +
 drivers/gnss/Makefile                         |   3 +
 drivers/gnss/motmdm.c                         | 419 ++++++++++++++++
 drivers/tty/n_gsm.c                           | 428 +++++++++++++++++
 drivers/tty/serdev/Kconfig                    |  10 +
 drivers/tty/serdev/Makefile                   |   1 +
 drivers/tty/serdev/serdev-ngsm.c              | 449 ++++++++++++++++++
 include/linux/serdev-gsm.h                    | 163 +++++++
 12 files changed, 1590 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gnss/motmdm.yaml
 create mode 100644 Documentation/devicetree/bindings/serdev/serdev-ngsm.yaml
 create mode 100644 drivers/gnss/motmdm.c
 create mode 100644 drivers/tty/serdev/serdev-ngsm.c
 create mode 100644 include/linux/serdev-gsm.h
Signature · 1 line
2.26.2
#1 lore raw

PATCH v6 1/6 tty: n_gsm: Add support for serdev drivers

We can make use of serdev drivers to do simple device drivers for TS 27.010 chanels, and we can handle vendor specific protocols on top of TS 27.010 with serdev drivers.

So far this has been tested with Motorola droid4 where there is a custom packet numbering protocol on top of TS 27.010 for the MDM6600 modem.

I initially though about adding the serdev support into a separate file, but that will take some refactoring of n_gsm.c. And I'd like to have things working first. Then later on we might want to consider splitting n_gsm.c into three pieces for core, tty and serdev parts. And then maybe the serdev related parts can be just moved to live under something like drivers/tty/serdev/protocol/ngsm.c.

---
 drivers/tty/n_gsm.c        | 428 +++++++++++++++++++++++++++++++++++++
 include/linux/serdev-gsm.h | 152 +++++++++++++
 2 files changed, 580 insertions(+)
 create mode 100644 include/linux/serdev-gsm.h
drivers/tty/n_gsm.c +428 -0
@@ -39,6 +39,7 @@
 #include <linux/file.h>
 #include <linux/uaccess.h>
 #include <linux/module.h>
+#include <linux/serdev.h>
 #include <linux/timer.h>
 #include <linux/tty_flip.h>
 #include <linux/tty_driver.h>
@@ -50,6 +51,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/gsmmux.h>
+#include <linux/serdev-gsm.h>
 
 static int debug;
 module_param(debug, int, 0600);
@@ -150,6 +152,7 @@ struct gsm_dlci {
 	/* Data handling callback */
 	void (*data)(struct gsm_dlci *dlci, const u8 *data, int len);
 	void (*prev_data)(struct gsm_dlci *dlci, const u8 *data, int len);
+	struct gsm_serdev_dlci *ops; /* serdev dlci ops, if used */
 	struct net_device *net; /* network interface, if created */
 };
 
@@ -198,6 +201,7 @@ enum gsm_mux_state {
  */
 
 struct gsm_mux {
+	struct gsm_serdev *gsd;		/* Serial device bus data */
 	struct tty_struct *tty;		/* The tty our ldisc is bound to */
 	spinlock_t lock;
 	struct mutex mutex;
@@ -2346,6 +2350,430 @@ static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c)
 	return 0;
 }
 
+#ifdef CONFIG_SERIAL_DEV_BUS
+
+/**
+ * gsm_serdev_get_config - read ts 27.010 config
+ * @gsd:	serdev-gsm instance
+ * @c:		ts 27.010 config data
+ *
+ * See gsm_copy_config_values() for more information.
+ */
+int gsm_serdev_get_config(struct gsm_serdev *gsd, struct gsm_config *c)
+{
+	struct gsm_mux *gsm;
+
+	if (!gsd || !gsd->gsm)
+		return -ENODEV;
+
+	gsm = gsd->gsm;
+
+	if (!c)
+		return -EINVAL;
+
+	gsm_copy_config_values(gsm, c);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_get_config);
+
+/**
+ * gsm_serdev_set_config - set ts 27.010 config
+ * @gsd:	serdev-gsm instance
+ * @c:		ts 27.010 config data
+ *
+ * See gsm_config() for more information.
+ */
+int gsm_serdev_set_config(struct gsm_serdev *gsd, struct gsm_config *c)
+{
+	struct gsm_mux *gsm;
+
+	if (!gsd || !gsd->serdev || !gsd->gsm)
+		return -ENODEV;
+
+	gsm = gsd->gsm;
+
+	if (!c)
+		return -EINVAL;
+
+	return gsm_config(gsm, c);
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_set_config);
+
+static struct gsm_dlci *gsd_dlci_get(struct gsm_serdev *gsd, int line,
+				     bool allocate)
+{
+	struct gsm_mux *gsm;
+	struct gsm_dlci *dlci;
+
+	if (!gsd || !gsd->gsm)
+		return ERR_PTR(-ENODEV);
+
+	gsm = gsd->gsm;
+
+	if (line < 1 || line >= 63)
+		return ERR_PTR(-EINVAL);
+
+	mutex_lock(&gsm->mutex);
+
+	if (gsm->dlci[line]) {
+		dlci = gsm->dlci[line];
+		goto unlock;
+	} else if (!allocate) {
+		dlci = ERR_PTR(-ENODEV);
+		goto unlock;
+	}
+
+	dlci = gsm_dlci_alloc(gsm, line);
+	if (!dlci) {
+		gsm = ERR_PTR(-ENOMEM);
+		goto unlock;
+	}
+
+	gsm->dlci[line] = dlci;
+
+unlock:
+	mutex_unlock(&gsm->mutex);
+
+	return dlci;
+}
+
+static int gsd_dlci_receive_buf(struct gsm_dlci *dlci,
+				const unsigned char *buf,
+				size_t len)
+{
+	struct tty_port *port;
+
+	port = &dlci->port;
+	tty_insert_flip_string(port, buf, len);
+	tty_flip_buffer_push(port);
+
+	return len;
+}
+
+static void gsd_dlci_data(struct gsm_dlci *dlci, const u8 *buf, int len)
+{
+	struct gsm_mux *gsm = dlci->gsm;
+	struct gsm_serdev *gsd = gsm->gsd;
+
+	if (!gsd || !dlci->ops)
+		return;
+
+	switch (dlci->adaption) {
+	case 0:
+	case 1:
+		if (dlci->ops->receive_buf)
+			dlci->ops->receive_buf(dlci->ops, buf, len);
+		else
+			gsd_dlci_receive_buf(dlci, buf, len);
+		break;
+	default:
+		pr_warn("dlci%i adaption %i not yet implemented\n",
+			dlci->addr, dlci->adaption);
+		break;
+	}
+}
+
+/**
+ * gsm_serdev_write - write data to a ts 27.010 channel
+ * @gsd:	serdev-gsm instance
+ * @ops:	channel ops
+ * @buf:	write buffer
+ * @len:	buffer length
+ */
+int gsm_serdev_write(struct gsm_serdev *gsd, struct gsm_serdev_dlci *ops,
+		     const u8 *buf, int len)
+{
+	struct gsm_mux *gsm;
+	struct gsm_dlci *dlci;
+	struct gsm_msg *msg;
+	int h, size, total_size = 0;
+	u8 *dp;
+
+	if (!gsd || !gsd->gsm)
+		return -ENODEV;
+
+	gsm = gsd->gsm;
+
+	dlci = gsd_dlci_get(gsd, ops->line, false);
+	if (IS_ERR(dlci))
+		return PTR_ERR(dlci);
+
+	h = dlci->adaption - 1;
+
+	if (len > gsm->mtu)
+		len = gsm->mtu;
+
+	size = len + h;
+
+	msg = gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype);
+	if (!msg)
+		return -ENOMEM;
+
+	dp = msg->data;
+	switch (dlci->adaption) {
+	case 1:
+		break;
+	case 2:
+		*dp++ = gsm_encode_modem(dlci);
+		break;
+	}
+	memcpy(dp, buf, len);
+	gsm_data_queue(dlci, msg);
+	total_size += size;
+
+	return total_size;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_write);
+
+/**
+ * gsm_serdev_data_kick - indicate more data can be transmitted
+ * @gsd:	serdev-gsm instance
+ *
+ * See gsm_data_kick() for more information.
+ */
+void gsm_serdev_data_kick(struct gsm_serdev *gsd)
+{
+	struct gsm_mux *gsm;
+	unsigned long flags;
+
+	if (!gsd || !gsd->gsm)
+		return;
+
+	gsm = gsd->gsm;
+
+	spin_lock_irqsave(&gsm->tx_lock, flags);
+	gsm_data_kick(gsm);
+	spin_unlock_irqrestore(&gsm->tx_lock, flags);
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_data_kick);
+
+/**
+ * gsm_serdev_register_dlci - register a ts 27.010 channel
+ * @gsd:	serdev-gsm instance
+ * @ops:	channel ops
+ */
+int gsm_serdev_register_dlci(struct gsm_serdev *gsd,
+			     struct gsm_serdev_dlci *ops)
+{
+	struct gsm_dlci *dlci;
+	struct gsm_mux *gsm;
+	int retries;
+
+	if (!gsd || !gsd->gsm || !gsd->serdev)
+		return -ENODEV;
+
+	gsm = gsd->gsm;
+
+	if (!ops || !ops->line)
+		return -EINVAL;
+
+	dlci = gsd_dlci_get(gsd, ops->line, true);
+	if (IS_ERR(dlci))
+		return PTR_ERR(dlci);
+
+	if (dlci->state == DLCI_OPENING || dlci->state == DLCI_OPEN ||
+	    dlci->state == DLCI_CLOSING)
+		return -EBUSY;
+
+	mutex_lock(&dlci->mutex);
+	dlci->ops = ops;
+	dlci->modem_rx = 0;
+	dlci->prev_data = dlci->data;
+	dlci->data = gsd_dlci_data;
+	mutex_unlock(&dlci->mutex);
+
+	gsm_dlci_begin_open(dlci);
+
+	/*
+	 * Allow some time for dlci to move to DLCI_OPEN state. Otherwise
+	 * the serdev consumer driver can start sending data too early during
+	 * the setup, and the response will be missed by gms_queue() if we
+	 * still have DLCI_CLOSED state.
+	 */
+	for (retries = 10; retries > 0; retries--) {
+		if (dlci->state == DLCI_OPEN)
+			break;
+		msleep(100);
+	}
+
+	if (!retries)
+		dev_dbg(&gsd->serdev->dev, "dlci%i not currently active\n",
+			dlci->addr);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_register_dlci);
+
+/**
+ * gsm_serdev_unregister_dlci - unregister a ts 27.010 channel
+ * @gsd:	serdev-gsm instance
+ * @ops:	channel ops
+ */
+void gsm_serdev_unregister_dlci(struct gsm_serdev *gsd,
+				struct gsm_serdev_dlci *ops)
+{
+	struct gsm_mux *gsm;
+	struct gsm_dlci *dlci;
+
+	if (!gsd || !gsd->gsm || !gsd->serdev)
+		return;
+
+	gsm = gsd->gsm;
+
+	if (!ops || !ops->line)
+		return;
+
+	dlci = gsd_dlci_get(gsd, ops->line, false);
+	if (IS_ERR(dlci))
+		return;
+
+	mutex_lock(&dlci->mutex);
+	gsm_destroy_network(dlci);
+	dlci->data = dlci->prev_data;
+	dlci->ops = NULL;
+	mutex_unlock(&dlci->mutex);
+
+	gsm_dlci_begin_close(dlci);
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_unregister_dlci);
+
+static int gsm_serdev_output(struct gsm_mux *gsm, u8 *data, int len)
+{
+	struct serdev_device *serdev = gsm->gsd->serdev;
+
+	if (gsm->gsd->output)
+		return gsm->gsd->output(gsm->gsd, data, len);
+	else
+		return serdev_device_write_buf(serdev, data, len);
+}
+
+static int gsd_receive_buf(struct serdev_device *serdev, const u8 *data,
+			   size_t count)
+{
+	struct gsm_serdev *gsd = serdev_device_get_drvdata(serdev);
+	struct gsm_mux *gsm;
+	const unsigned char *dp;
+	int i;
+
+	if (WARN_ON(!gsd))
+		return 0;
+
+	gsm = gsd->gsm;
+
+	if (debug & 4)
+		print_hex_dump_bytes("gsd_receive_buf: ",
+				     DUMP_PREFIX_OFFSET,
+				     data, count);
+
+	for (i = count, dp = data; i; i--, dp++)
+		gsm->receive(gsm, *dp);
+
+	return count;
+}
+
+static void gsd_write_wakeup(struct serdev_device *serdev)
+{
+	serdev_device_write_wakeup(serdev);
+}
+
+static struct serdev_device_ops gsd_client_ops = {
+	.receive_buf = gsd_receive_buf,
+	.write_wakeup = gsd_write_wakeup,
+};
+
+int gsm_serdev_register_tty_port(struct gsm_serdev *gsd, int line)
+{
+	struct gsm_serdev_dlci *ops;
+	unsigned int base;
+	int error;
+
+	if (line < 1)
+		return -EINVAL;
+
+	ops = kzalloc(sizeof(*ops), GFP_KERNEL);
+	if (!ops)
+		return -ENOMEM;
+
+	ops->line = line;
+
+	error = gsm_serdev_register_dlci(gsd, ops);
+	if (error) {
+		kfree(ops);
+
+		return error;
+	}
+
+	base = mux_num_to_base(gsd->gsm);
+	tty_register_device(gsm_tty_driver, base + ops->line, NULL);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_register_tty_port);
+
+void gsm_serdev_unregister_tty_port(struct gsm_serdev *gsd, int line)
+{
+	struct gsm_dlci *dlci;
+	unsigned int base;
+
+	if (line < 1)
+		return;
+
+	dlci = gsd_dlci_get(gsd, line, false);
+	if (IS_ERR(dlci))
+		return;
+
+	base = mux_num_to_base(gsd->gsm);
+	tty_unregister_device(gsm_tty_driver, base + line);
+	gsm_serdev_unregister_dlci(gsd, dlci->ops);
+	kfree(dlci->ops);
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_unregister_tty_port);
+
+int gsm_serdev_register_device(struct gsm_serdev *gsd)
+{
+	struct gsm_mux *gsm;
+	int error;
+
+	if (WARN(!gsd || !gsd->serdev || !gsd->output,
+		 "serdev and output must be initialized\n"))
+		return -EINVAL;
+
+	serdev_device_set_client_ops(gsd->serdev, &gsd_client_ops);
+
+	gsm = gsm_alloc_mux();
+	if (!gsm)
+		return -ENOMEM;
+
+	gsm->encoding = 1;
+	gsm->tty = NULL;
+	gsm->gsd = gsd;
+	gsm->output = gsm_serdev_output;
+	gsd->gsm = gsm;
+	mux_get(gsd->gsm);
+
+	error = gsm_activate_mux(gsd->gsm);
+	if (error) {
+		gsm_cleanup_mux(gsd->gsm);
+		mux_put(gsd->gsm);
+
+		return error;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_register_device);
+
+void gsm_serdev_unregister_device(struct gsm_serdev *gsd)
+{
+	gsm_cleanup_mux(gsd->gsm);
+	mux_put(gsd->gsm);
+	gsd->gsm = NULL;
+}
+EXPORT_SYMBOL_GPL(gsm_serdev_unregister_device);
+
+#endif	/* CONFIG_SERIAL_DEV_BUS */
+
 /**
  *	gsmld_output		-	write to link
  *	@gsm: our mux
include/linux/serdev-gsm.h new file +152 -0

152 lines not on this page · raw message

Signature · 1 line
2.26.2
#4 lore raw

PATCH v6 2/6 dt-bindings: serdev: ngsm: Add binding for serdev-ngsm

In reply to Tony Lindgren

Add a binding document for a generic serdev-ngsm driver that can be used to bring up TS 27.010 line discipline with Linux n_gsm support on a serial port.

As the Motorola Mapphone modems require some custom handling, they are handled with a separate compatible.

Let's also add vendor string for ETSI as we're using a ETSI 3GPP TS 27.010 standard.

---
 .../bindings/serdev/serdev-ngsm.yaml          | 64 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 2 files changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serdev/serdev-ngsm.yaml
Documentation/devicetree/bindings/serdev/serdev-ngsm.yaml new file +64 -0
new file mode 100644
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serdev/serdev-ngsm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic serdev-ngsm TS 27.010 driver
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - etsi,3gpp-ts27010-adaption1
+      - motorola,mapphone-mdm6600-serial
+
+  ttymask:
+    $ref: /schemas/types.yaml#/definitions/uint64
+    description: Mask of the TS 27.010 channel TTY interfaces to start (64 bit)
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: motorola,mapphone-mdm6600-serial
+    then:
+      properties:
+        phys:
+          $ref: /schemas/types.yaml#/definitions/phandle-array
+          description: USB PHY needed for shared GPIO PM wake-up pins
+          maxItems: 1
+
+        phy-names:
+          description: Name of the USB PHY
+          const: usb
+
+      required:
+        - phys
+        - phy-names
+
+required:
+  - compatible
+  - ttymask
+  - "#address-cells"
+  - "#size-cells"
+
+examples:
+  - |
+    modem {
+      compatible = "motorola,mapphone-mdm6600-serial";
+      ttymask = <0 0x00001fee>;
+      phys = <&fsusb1_phy>;
+      phy-names = "usb";
+      #address-cells = <1>;
+      #size-cells = <0>;
+    };
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -323,6 +323,8 @@ patternProperties:
     description: Espressif Systems Co. Ltd.
   "^est,.*":
     description: ESTeem Wireless Modems
+  "^etsi,.*":
+    description: ETSI
   "^ettus,.*":
     description: NI Ettus Research
   "^eukrea,.*":
Signature · 1 line
2.26.2
#7 lore raw

PATCH v6 3/6 serdev: ngsm: Add generic serdev-ngsm driver

In reply to Tony Lindgren

We can have a generic serdev-ngsm driver bring up the TS 27.010 line discipline on the selected serial ports based on device tree data.

And we can now do standard Linux device driver for the dedicated TS 27.010 channels for devices like GNSS and ALSA found on modems.

---
 drivers/tty/serdev/Kconfig       |  10 +
 drivers/tty/serdev/Makefile      |   1 +
 drivers/tty/serdev/serdev-ngsm.c | 449 +++++++++++++++++++++++++++++++
 include/linux/serdev-gsm.h       |  11 +
 4 files changed, 471 insertions(+)
 create mode 100644 drivers/tty/serdev/serdev-ngsm.c
drivers/tty/serdev/Kconfig +10 -0
@@ -22,4 +22,14 @@ config SERIAL_DEV_CTRL_TTYPORT
 	depends on SERIAL_DEV_BUS != m
 	default y
 
+config SERIAL_DEV_N_GSM
+	tristate "Serial device TS 27.010 support"
+	help
+	  Select this if you want to use the TS 27.010 with a serial port with
+	  devices such as modems and GNSS devices.
+
+	  If unsure, say N.
+	depends on N_GSM
+	depends on SERIAL_DEV_CTRL_TTYPORT
+
 endif
drivers/tty/serdev/Makefile +1 -0
@@ -4,3 +4,4 @@ serdev-objs := core.o
 obj-$(CONFIG_SERIAL_DEV_BUS) += serdev.o
 
 obj-$(CONFIG_SERIAL_DEV_CTRL_TTYPORT) += serdev-ttyport.o
+obj-$(CONFIG_SERIAL_DEV_N_GSM) += serdev-ngsm.o
drivers/tty/serdev/serdev-ngsm.c new file +449 -0

449 lines not on this page · raw message

include/linux/serdev-gsm.h +11 -0
@@ -43,6 +43,17 @@ struct gsm_serdev_dlci {
 
 #if IS_ENABLED(CONFIG_N_GSM) && IS_ENABLED(CONFIG_SERIAL_DEV_BUS)
 
+/* TS 27.010 channel specific functions for consumer drivers */
+#if IS_ENABLED(CONFIG_SERIAL_DEV_N_GSM)
+extern int
+serdev_ngsm_register_dlci(struct device *dev, struct gsm_serdev_dlci *dlci);
+extern void serdev_ngsm_unregister_dlci(struct device *dev,
+					struct gsm_serdev_dlci *dlci);
+extern int serdev_ngsm_write(struct device *dev, struct gsm_serdev_dlci *ops,
+			     const u8 *buf, int len);
+#endif
+
+/* Interface for_gsm serdev support */
 extern int gsm_serdev_register_device(struct gsm_serdev *gsd);
 extern void gsm_serdev_unregister_device(struct gsm_serdev *gsd);
 extern int gsm_serdev_register_tty_port(struct gsm_serdev *gsd, int line);
Signature · 1 line
2.26.2
#9 lore raw

PATCH v6 4/6 dt-bindings: gnss: Add binding for Motorola Mapphone MDM6600 GNSS

In reply to Tony Lindgren

Add a binding document for Motorola Mapphone MDM6600 GNSS driver that can be used with phones such as droid4.

---
 .../devicetree/bindings/gnss/motmdm.yaml      | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gnss/motmdm.yaml
Documentation/devicetree/bindings/gnss/motmdm.yaml new file +29 -0
new file mode 100644
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gnss/motmdm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Motorola Mapphone MDM6600 GNSS binding
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+properties:
+  compatible:
+    const: motorola,mapphone-mdm6600-gnss
+
+  reg:
+    items:
+      description: TS 27.010 channel the GNSS device is using
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    gnss@4 {
+      compatible = "motorola,mapphone-mdm6600-gnss";
+      reg = <4>;
+    };
Signature · 1 line
2.26.2
#14 lore raw

PATCH v6 5/6 gnss: motmdm: Add support for Motorola Mapphone MDM6600 modem

In reply to Tony Lindgren

Motorola is using a custom TS 27.010 based serial port line discipline for various devices on the modem. These devices can be accessed on dedicated channels using Linux kernel serdev-ngsm driver.

For the GNSS on these devices, we need to kick the GNSS device at a desired rate. Otherwise the GNSS device stops sending data after a few minutes. The rate we poll data defaults to 1000 ms, and can be specified with a module option rate_ms between 1 to 16 seconds.

Note that AGPS with xtra2.bin is not yet supported, so getting a fix can take quite a while. And a recent gpsd is needed to parse the $GNGNS output, and to properly handle the /dev/gnss0 character device. I've confirmed it works properly with gpsd-3.20.

---
 drivers/gnss/Kconfig  |   8 +
 drivers/gnss/Makefile |   3 +
 drivers/gnss/motmdm.c | 419 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 430 insertions(+)
 create mode 100644 drivers/gnss/motmdm.c
drivers/gnss/Kconfig +8 -0
@@ -13,6 +13,14 @@ menuconfig GNSS
 
 if GNSS
 
+config GNSS_MOTMDM
+	tristate "Motorola Modem TS 27.010 serdev GNSS receiver support"
+	depends on SERIAL_DEV_N_GSM
+	---help---
+	  Say Y here if you have a Motorola modem using TS 27.010 line
+	  discipline for GNSS such as a Motorola Mapphone series device
+	  like Droid 4.
+
 config GNSS_SERIAL
 	tristate
 
drivers/gnss/Makefile +3 -0
@@ -6,6 +6,9 @@
 obj-$(CONFIG_GNSS)			+= gnss.o
 gnss-y := core.o
 
+obj-$(CONFIG_GNSS_MOTMDM)		+= gnss-motmdm.o
+gnss-motmdm-y := motmdm.o
+
 obj-$(CONFIG_GNSS_SERIAL)		+= gnss-serial.o
 gnss-serial-y := serial.o
 
drivers/gnss/motmdm.c new file +419 -0

419 lines not on this page · raw message

Signature · 1 line
2.26.2
#16 lore raw

PATCH v6 6/6 ARM: dts: omap4-droid4: Configure modem for serdev-ngsm

In reply to Tony Lindgren

Let's enable the TS 27.010 /dev/gsmmux* interfaces via Linux n_gsm that can be used for voice calls and SMS with commands using a custom Motorola format.

And let's also enable the kernel GNSS driver via serdev-ngsm that uses a dedicated TS 27.010 channel.

Note that voice call audio mixer is not supported yet.

---
 arch/arm/boot/dts/motorola-mapphone-common.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/boot/dts/motorola-mapphone-common.dtsi +14 -0
@@ -702,6 +702,20 @@ &uart1 {
 			       &omap4_pmx_core 0x110>;
 	uart-has-rtscts;
 	current-speed = <115200>;
+
+	modem {
+		compatible = "motorola,mapphone-mdm6600-serial";
+		ttymask = <0 0x00001fee>;
+		phys = <&fsusb1_phy>;
+		phy-names = "usb";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		gnss@4 {
+			compatible = "motorola,mapphone-mdm6600-gnss";
+			reg = <4>;
+		};
+	};
 };
 
 &uart3 {
Signature · 1 line
2.26.2
#18 lore raw
In reply to Tony Lindgren
Quoted 4 lines

My guess is that at least with the pending ofono patches, we just want to use the raw interface for /dev/gsmtty* interface and stop pretending we have a modem that is AT compatible.

I tried to get it to work... it was not fun and I did not get far.

I pushed my results...

user@devuan:/my/ofono$ git push
Counting objects: 10, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 1.17 KiB | 0 bytes/s, done.
Total 10 (delta 8), reused 0 (delta 0)
remote: Resolving deltas: 100% (8/8), completed with 8 local objects.
To github.com:pavelmachek/ofono.git
   fd34ca20..9042014b  mux-v1.29-1 -> mux-v1.29-1

Best regards,
Pavel

ofonod[12922]: drivers/atmodem/network-registration.c:at_netreg_probe() Probing creg
Have command of length 9 (AT+CREG=?)
or ^z
ofonod[12922]: Voice: > U0000AT+FOO\r
ofonod[12922]: InSMS: > U0000AT+FOO\r
ofonod[12922]: OutSMS: > U0000AT+FOO\r
ofonod[12922]: Voice: < U0000+FOO:ERROR=9\n
new bytes 18
Have line: U0000+FOO:ERROR=9
Last character is 13
command response: U0000+FOO:ERROR=9
ofonod[12922]: plugins/motmdm.c:foo_cb()
handle command response
ofonod[12922]: Voice: > U0000AT+SCRN=0\r
ofonod[12922]: OutSMS: < U0000+FOO:ERROR=9\n
new bytes 18
Have line: U0000+FOO:ERROR=9
Last character is 13
command response: U0000+FOO:ERROR=9
ofonod[12922]: plugins/motmdm.c:foo_cb()
handle command response
ofonod[12922]: InSMS: < U0000+FOO:ERROR=9\n
new bytes 18
Have line: U0000+FOO:ERROR=9
Last character is 13
command response: U0000+FOO:ERROR=9
ofonod[12922]: plugins/motmdm.c:foo_cb()
ofonod[12922]: plugins/motmdm.c:foo_cb() All channels working
handle command response
ofonod[12922]: Voice: < U0000+SCRN:OK\n
new bytes 14
Have line: U0000+SCRN:OK
Last character is 13
command response: U0000+SCRN:OK
ofonod[12922]: plugins/motmdm.c:scrn_cb()
handle command response
ofonod[12922]: Voice: > U0000AT+CFUN=1\r
ofonod[12922]: Voice: < U0000+CFUN:OK\n
new bytes 14
Have line: U0000+CFUN:OK
Last character is 13
command response: U0000+CFUN:OK
ofonod[12922]: plugins/motmdm.c:cfun_cb()
handle command response
ofonod[12922]: Voice: > U0000AT+CLIP=1\r
ofonod[12922]: Voice: < U0000+CLIP:OK\n
new bytes 14
Have line: U0000+CLIP:OK
Last character is 13
command response: U0000+CLIP:OK
handle command response
ofonod[12922]: Voice: > U0000AT+CCWA=1\r
ofonod[12922]: Voice: < U0000+CCWA:OK\n
new bytes 14
Have line: U0000+CCWA:OK
Last character is 13
command response: U0000+CCWA:OK
ofonod[12922]: drivers/motorolamodem/voicecall.c:motorola_voicecall_initialized() voicecall_init: registering to notifications

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#21 lore raw
In reply to Tony Lindgren

Hi!

Quoted 3 lines

Now without the chardev support, the /dev/gsmtty* using apps need to use "U1234AT+CFUN?" format for the packets. The advantage is less kernel code, and we keep the existing /dev/gsmtty* interface.

Actually... yes, this works. But no, this is not "existing" tty interface.

ttys work per character, and this interface definitely does not... it is "packet" based, write() syscalls need exactly right lengths. You can't just open minicom, and type "U1234...". You can't paste it, either (I tried). tty controls like start/stop bits and baud rate are useless here. CR/LF conversions are unwanted/dangerous because it is confusing hard to debug if you get them wrong.

Now, I don't see reason why this could not be made to work, and it may be more important to have something in mainline and work with that. So if you can make this into -next, I'll not complain too loudly. But it is... still wrong and I liked motmdm* more :-).

Best regards,

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#22 lore raw
Quoted 9 lines · Pavel Machek

Hi!

Quoted 3 lines

Now without the chardev support, the /dev/gsmtty* using apps need to use "U1234AT+CFUN?" format for the packets. The advantage is less kernel code, and we keep the existing /dev/gsmtty* interface.

Actually... yes, this works. But no, this is not "existing" tty interface.

Quoted 6 lines

ttys work per character, and this interface definitely does not... it is "packet" based, write() syscalls need exactly right lengths. You can't just open minicom, and type "U1234...". You can't paste it, either (I tried). tty controls like start/stop bits and baud rate are useless here. CR/LF conversions are unwanted/dangerous because it is confusing hard to debug if you get them wrong.

Yes.. That's what n_gsm spins up.

Quoted 4 lines

Now, I don't see reason why this could not be made to work, and it may be more important to have something in mainline and work with that. So if you can make this into -next, I'll not complain too loudly. But it is... still wrong and I liked motmdm* more :-).

Yes.. There are issues too with the motmdm* char dev interface too.

I don't think it would work as is for devices with network interfaces on some channel, and continuation packets could need more handling possibly.

But let's try to get the basics sorted out first and use the "raw" gsmtty* interface. More stuff can always be added later as needed.

Regards,

Tony

#19 lore raw
In reply to Pavel Machek
Quoted 6 lines · Pavel Machek
Quoted 4 lines

My guess is that at least with the pending ofono patches, we just want to use the raw interface for /dev/gsmtty* interface and stop pretending we have a modem that is AT compatible.

I tried to get it to work... it was not fun and I did not get far.

OK. Yeah it's now 2020 and still dealing with serial port stuff :)

Quoted 11 lines

I pushed my results...

user@devuan:/my/ofono$ git push
Counting objects: 10, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 1.17 KiB | 0 bytes/s, done.
Total 10 (delta 8), reused 0 (delta 0)
remote: Resolving deltas: 100% (8/8), completed with 8 local objects.
To github.com:pavelmachek/ofono.git
   fd34ca20..9042014b  mux-v1.29-1 -> mux-v1.29-1

OK :) I still need to update the ALSA related patches on top of this $subject series.

Also what I've noticed is that modprobe n_gsm debug=0xff hex output is currently broken since commit 091cb0994edd ("lib/hexdump: make print_hex_dump_bytes() a nop on !DEBUG builds"). Reverting the commit fixes it.

Stephen, any ideas what should be changed to fix it?

Regards,

Tony

#23 lore raw
In reply to Tony Lindgren

Hi!

Quoted 3 lines

My guess is that at least with the pending ofono patches, we just want to use the raw interface for /dev/gsmtty* interface and stop pretending we have a modem that is AT compatible.

Ok, so I got ofono back to work. ... I believe. It was not that bad. SMS send/receive and outgoing call start/hangup worked at some point (I did not play with mixers).

To github.com:pavelmachek/ofono.git
61d3d727..195760e9 mux-v1.29-1 -> mux-v1.29-1

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Tested-by on the v6 series
#25 lore raw
In reply to Tony Lindgren

Hi!

Quoted 10 lines

Now without the chardev support, the /dev/gsmtty* using apps need to use "U1234AT+CFUN?" format for the packets. The advantage is less kernel code, and we keep the existing /dev/gsmtty* interface.

If we still really need the custom chardev support, that can now be added as needed with the channel specific consumer driver(s).

My guess is that at least with the pending ofono patches, we just want to use the raw interface for /dev/gsmtty* interface and stop pretending we have a modem that is AT compatible.

The series:

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Reviewed-by on v6 1/6
#2 lore raw

Re: [PATCH 1/6] tty: n_gsm: Add support for serdev drivers

In reply to Tony Lindgren

Hi!

Quoted 7 lines

We can make use of serdev drivers to do simple device drivers for TS 27.010 chanels, and we can handle vendor specific protocols on top of TS 27.010 with serdev drivers.

So far this has been tested with Motorola droid4 where there is a custom packet numbering protocol on top of TS 27.010 for the MDM6600 modem.

Quoted 8 lines

I initially though about adding the serdev support into a separate file, but that will take some refactoring of n_gsm.c. And I'd like to have things working first. Then later on we might want to consider splitting n_gsm.c into three pieces for core, tty and serdev parts. And then maybe the serdev related parts can be just moved to live under something like drivers/tty/serdev/protocol/ngsm.c.

If you fix error path below, you can add:

Quoted 15 lines
drivers/tty/n_gsm.c +15 -0
+static struct gsm_dlci *gsd_dlci_get(struct gsm_serdev *gsd, int line,
+				     bool allocate)
+{
+	struct gsm_mux *gsm;
+	struct gsm_dlci *dlci;
+
+	if (!gsd || !gsd->gsm)
+		return ERR_PTR(-ENODEV);
+
+	gsm = gsd->gsm;
+
+	if (line < 1 || line >= 63)
+		return ERR_PTR(-EINVAL);
+
+	mutex_lock(&gsm->mutex);

...

drivers/tty/n_gsm.c static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c) · line 2430

Quoted 4 lines
drivers/tty/n_gsm.c +4 -0
+	dlci = gsm_dlci_alloc(gsm, line);
+	if (!dlci) {
+		gsm = ERR_PTR(-ENOMEM);
+		goto unlock;

dlci = , or you get nice crash.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#24 lore raw
In reply to Pavel Machek
Quoted 6 lines · Pavel Machek

Hi!

Quoted 3 lines

My guess is that at least with the pending ofono patches, we just want to use the raw interface for /dev/gsmtty* interface and stop pretending we have a modem that is AT compatible.

Quoted 6 lines

Ok, so I got ofono back to work. ... I believe. It was not that bad. SMS send/receive and outgoing call start/hangup worked at some point (I did not play with mixers).

To github.com:pavelmachek/ofono.git
61d3d727..195760e9 mux-v1.29-1 -> mux-v1.29-1

OK good to hear and thanks for doing it.

Regards,

Tony

Reviewed-by on v6 2/6
#5 lore raw

Re: [PATCH 2/6] dt-bindings: serdev: ngsm: Add binding for serdev-ngsm

In reply to Tony Lindgren
Quoted 11 lines · Tony Lindgren

Add a binding document for a generic serdev-ngsm driver that can be used to bring up TS 27.010 line discipline with Linux n_gsm support on a serial port.

As the Motorola Mapphone modems require some custom handling, they are handled with a separate compatible.

Let's also add vendor string for ETSI as we're using a ETSI 3GPP TS 27.010 standard.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Reviewed-by on v6 3/6
#8 lore raw

Re: [PATCH 3/6] serdev: ngsm: Add generic serdev-ngsm driver

In reply to Tony Lindgren

Hi!

Quoted 11 lines

We can have a generic serdev-ngsm driver bring up the TS 27.010 line discipline on the selected serial ports based on device tree data.

And we can now do standard Linux device driver for the dedicated TS 27.010 channels for devices like GNSS and ALSA found on modems.

+++ b/drivers/tty/serdev/Kconfig

drivers/tty/serdev/Kconfig +0 -0
@@ -22,4 +22,14 @@ config SERIAL_DEV_CTRL_TTYPORT
 	depends on SERIAL_DEV_BUS != m
 	default y

drivers/tty/serdev/Kconfig config SERIAL_DEV_CTRL_TTYPORT · line 33

Quoted 10 lines
drivers/tty/serdev/Kconfig +9 -0
 
+config SERIAL_DEV_N_GSM
+	tristate "Serial device TS 27.010 support"
+	help
+	  Select this if you want to use the TS 27.010 with a serial port with
+	  devices such as modems and GNSS devices.
+
+	  If unsure, say N.
+	depends on N_GSM
+	depends on SERIAL_DEV_CTRL_TTYPORT

Normally, depends go after "tristate" and before "help" text. I did not realize this is valid code.

drivers/tty/serdev/serdev-ngsm.c line 249

Quoted 3 lines
drivers/tty/serdev/serdev-ngsm.c new file +3 -0
+/*
+ * Configure SoC 8250 device for 700 ms autosuspend delay, Values around 600 ms
+ * and shorter cause spurious wake-up events at least on droid 4. Also keep the

droid->Droid?

drivers/tty/serdev/serdev-ngsm.c line 281

Quoted 5 lines
drivers/tty/serdev/serdev-ngsm.c new file +5 -0
+static const struct serdev_ngsm_cfg motmdm_cfg = {
+	.gsm = &adaption1,
+	.init_retry_quirk = true,
+	.needs_usb_phy = true,
+	.aggressive_pm = true,

Umm. These are unsigned int:1, not bools, so = 1 would be expected here.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Reviewed-by on v6 4/6
#10 lore raw

Re: [PATCH 4/6] dt-bindings: gnss: Add binding for Motorola Mapphone MDM6600 GNSS

In reply to Tony Lindgren
Quoted 2 lines · Tony Lindgren

Add a binding document for Motorola Mapphone MDM6600 GNSS driver that can be used with phones such as droid4.

-> Droid 4.

Quoted 1 line

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Reviewed-by on v6 5/6
#15 lore raw

Re: [PATCH 5/6] gnss: motmdm: Add support for Motorola Mapphone MDM6600 modem

In reply to Tony Lindgren
Quoted 9 lines · Tony Lindgren

Motorola is using a custom TS 27.010 based serial port line discipline for various devices on the modem. These devices can be accessed on dedicated channels using Linux kernel serdev-ngsm driver.

For the GNSS on these devices, we need to kick the GNSS device at a desired rate. Otherwise the GNSS device stops sending data after a few minutes. The rate we poll data defaults to 1000 ms, and can be specified with a module option rate_ms between 1 to 16 seconds.

Quoted 6 lines

Note that AGPS with xtra2.bin is not yet supported, so getting a fix can take quite a while. And a recent gpsd is needed to parse the $GNGNS output, and to properly handle the /dev/gnss0 character device. I've confirmed it works properly with gpsd-3.20.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Acked-by on v6 6/6
#17 lore raw

Re: [PATCH 6/6] ARM: dts: omap4-droid4: Configure modem for serdev-ngsm

In reply to Tony Lindgren
Quoted 10 lines · Tony Lindgren

Let's enable the TS 27.010 /dev/gsmmux* interfaces via Linux n_gsm that can be used for voice calls and SMS with commands using a custom Motorola format.

And let's also enable the kernel GNSS driver via serdev-ngsm that uses a dedicated TS 27.010 channel.

Note that voice call audio mixer is not supported yet.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
maintainer
#11 lore raw

Re: [PATCH 4/6] dt-bindings: gnss: Add binding for Motorola Mapphone MDM6600 GNSS

In reply to Tony Lindgren
Quoted 9 lines · Tony Lindgren

Add a binding document for Motorola Mapphone MDM6600 GNSS driver that can be used with phones such as droid4.

---
 .../devicetree/bindings/gnss/motmdm.yaml      | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gnss/motmdm.yaml

My bot found errors running 'make dt_binding_check' on your patch:

Documentation/devicetree/bindings/gnss/motmdm.example.dts:19.11-21: Warning (reg_format): /example-0/gnss@4:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1) Documentation/devicetree/bindings/gnss/motmdm.example.dt.yaml: Warning (pci_device_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/gnss/motmdm.example.dt.yaml: Warning (pci_device_bus_num): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/gnss/motmdm.example.dt.yaml: Warning (simple_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/gnss/motmdm.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/gnss/motmdm.example.dt.yaml: Warning (spi_bus_reg): Failed prerequisite 'reg_format'

See https://patchwork.ozlabs.org/patch/1280739

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.

maintainer
#12 lore raw

Re: [PATCH 4/6] dt-bindings: gnss: Add binding for Motorola Mapphone MDM6600 GNSS

In reply to Tony Lindgren
Quoted 30 lines · Tony Lindgren

Add a binding document for Motorola Mapphone MDM6600 GNSS driver that can be used with phones such as droid4.

---
 .../devicetree/bindings/gnss/motmdm.yaml      | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gnss/motmdm.yaml
Documentation/devicetree/bindings/gnss/motmdm.yaml new file +16 -0
new file mode 100644
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gnss/motmdm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Motorola Mapphone MDM6600 GNSS binding
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+properties:
+  compatible:
+    const: motorola,mapphone-mdm6600-gnss
+
+  reg:

Documentation/devicetree/bindings/gnss/motmdm.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/gnss/motmdm.yaml new file +10 -0
+    items:
+      description: TS 27.010 channel the GNSS device is using
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    gnss@4 {

This is a child of what's in patch 2? I think I'd just combine this schema into it.

Or you can leave it, but better to have complete examples (which will help fix what my bot reports). Examples have a default #address/size-cells of 1.

Quoted 5 lines
Documentation/devicetree/bindings/gnss/motmdm.yaml new file +3 -0
+      compatible = "motorola,mapphone-mdm6600-gnss";
+      reg = <4>;
+    };
Signature · 1 line
2.26.2
#13 lore raw

Re: [PATCH 4/6] dt-bindings: gnss: Add binding for Motorola Mapphone MDM6600 GNSS

Quoted 36 lines · Rob Herring
Quoted 35 lines · Tony Lindgren

Add a binding document for Motorola Mapphone MDM6600 GNSS driver that can be used with phones such as droid4.

---
 .../devicetree/bindings/gnss/motmdm.yaml      | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gnss/motmdm.yaml
Documentation/devicetree/bindings/gnss/motmdm.yaml new file +21 -0
new file mode 100644
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gnss/motmdm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Motorola Mapphone MDM6600 GNSS binding
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+properties:
+  compatible:
+    const: motorola,mapphone-mdm6600-gnss
+
+  reg:
+    items:
+      description: TS 27.010 channel the GNSS device is using
+
+required:
+  - compatible
Quoted 8 lines

Documentation/devicetree/bindings/gnss/motmdm.yaml line 26

Quoted 5 lines
Documentation/devicetree/bindings/gnss/motmdm.yaml new file +5 -0
+  - reg
+
+examples:
+  - |
+    gnss@4 {

This is a child of what's in patch 2? I think I'd just combine this schema into it.

Yes it's a child node for patch 2 in this series. I'll combine them into a single binding.

Quoted 3 lines

Or you can leave it, but better to have complete examples (which will help fix what my bot reports). Examples have a default #address/size-cells of 1.

OK. In this case we have just #size-cells = <0>.

Regards,

Tony

#3 lore raw

Re: [PATCH 1/6] tty: n_gsm: Add support for serdev drivers

In reply to Pavel Machek
Quoted 16 lines · Pavel Machek
Quoted 15 lines
drivers/tty/n_gsm.c +15 -0
+static struct gsm_dlci *gsd_dlci_get(struct gsm_serdev *gsd, int line,
+				     bool allocate)
+{
+	struct gsm_mux *gsm;
+	struct gsm_dlci *dlci;
+
+	if (!gsd || !gsd->gsm)
+		return ERR_PTR(-ENODEV);
+
+	gsm = gsd->gsm;
+
+	if (line < 1 || line >= 63)
+		return ERR_PTR(-EINVAL);
+
+	mutex_lock(&gsm->mutex);

...

Quoted 6 lines

drivers/tty/n_gsm.c static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c) · line 2430

Quoted 4 lines
drivers/tty/n_gsm.c +4 -0
+	dlci = gsm_dlci_alloc(gsm, line);
+	if (!dlci) {
+		gsm = ERR_PTR(-ENOMEM);
+		goto unlock;

dlci = , or you get nice crash.

Ah thanks yeah we return dlci and need to set dlci instead:

	if (!dlci) {
		dlci = ERR_PTR(-ENOMEM);
		goto unlock;
	}

Regards,

Tony

#20 lore raw
In reply to Tony Lindgren
Quoted 9 lines · Tony Lindgren
Quoted 6 lines · Pavel Machek
Quoted 4 lines

My guess is that at least with the pending ofono patches, we just want to use the raw interface for /dev/gsmtty* interface and stop pretending we have a modem that is AT compatible.

I tried to get it to work... it was not fun and I did not get far.

OK. Yeah it's now 2020 and still dealing with serial port stuff :)

Yeah, and scary thing is... it is 2020 and serial port is _still_ complex and hard to understand and debug :-).

Quoted 2 lines

OK :) I still need to update the ALSA related patches on top of this $subject series.

Let me know when you have these.

Pavel

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
maintainer Reviewed-by on v6 2/6
#6 lore raw

Re: [PATCH 2/6] dt-bindings: serdev: ngsm: Add binding for serdev-ngsm

In reply to Tony Lindgren
Quoted 10 lines · Tony Lindgren

Add a binding document for a generic serdev-ngsm driver that can be used to bring up TS 27.010 line discipline with Linux n_gsm support on a serial port.

As the Motorola Mapphone modems require some custom handling, they are handled with a separate compatible.

Let's also add vendor string for ETSI as we're using a ETSI 3GPP TS 27.010 standard.

Quoted 7 lines
---
 .../bindings/serdev/serdev-ngsm.yaml          | 64 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 2 files changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serdev/serdev-ngsm.yaml