linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
@ 2018-04-07 17:19 Tony Lindgren
  2018-04-07 17:19 ` [PATCH 2/2] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set Tony Lindgren
  2018-04-08  9:02 ` [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode Pavel Machek
  0 siblings, 2 replies; 14+ messages in thread
From: Tony Lindgren @ 2018-04-07 17:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, linux-serial, Alan Cox, Dan Williams, Jiri Prchal,
	Jiri Slaby, Marcel Partap, Merlijn Wajer,
	Michael Nazzareno Trimarchi, Michael Scott, Pavel Machek,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

Commit ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for
control dlci") added support for DLCI to stay in Asynchronous Disconnected
Mode (ADM). But we still get long delays waiting for commands to other
DLCI to complete:

--> 5) C: SABM(P)
Q>  0) C: UIH(F)
Q>  0) C: UIH(F)
Q>  0) C: UIH(F)
...

This happens because gsm_control_send() sets cretries timer to T2 that is
by default set to 34. This will cause resend for T2 times for the control
frame. In ADM mode, we will never get a response so the control frame, so
retries are just delaying all the commands.

Let's fix the issue by setting DLCI_MODE_ADM flag after detecting the ADM
mode for the control DLCI. Then we can use that in gsm_control_send() to
set retries to 1. This means the control frame will be sent once allowing
the other end at an opportunity to switch from ADM to ABM mode.

Note that retries will be decremented in gsm_control_retransmit() so
we don't want to set it to 0 here.

Fixes: ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for control dlci")
Cc: linux-serial@vger.kernel.org
Cc: Alan Cox <alan@llwyncelyn.cymru>
Cc: Dan Williams <dcbw@redhat.com>
Cc: Jiri Prchal <jiri.prchal@aksignal.cz>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Marcel Partap <mpartap@gmx.net>
Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Cc: Michael Scott <michael.scott@linaro.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Russ Gorby <russ.gorby@intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Cc: stable <stable@vger.kernel.org>
---
 drivers/tty/n_gsm.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -121,6 +121,9 @@ struct gsm_dlci {
 	struct mutex mutex;
 
 	/* Link layer */
+	int mode;
+#define DLCI_MODE_ABM		0	/* Normal Asynchronous Balanced Mode */
+#define DLCI_MODE_ADM		1	/* Asynchronous Disconnected Mode */
 	spinlock_t lock;	/* Protects the internal state */
 	struct timer_list t1;	/* Retransmit timer for SABM and UA */
 	int retries;
@@ -1364,7 +1367,13 @@ static struct gsm_control *gsm_control_send(struct gsm_mux *gsm,
 	ctrl->data = data;
 	ctrl->len = clen;
 	gsm->pending_cmd = ctrl;
-	gsm->cretries = gsm->n2;
+
+	/* If DLCI0 is in ADM mode skip retries, it won't respond */
+	if (gsm->dlci[0]->mode == DLCI_MODE_ADM)
+		gsm->cretries = 1;
+	else
+		gsm->cretries = gsm->n2;
+
 	mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100);
 	gsm_control_transmit(gsm, ctrl);
 	spin_unlock_irqrestore(&gsm->control_lock, flags);
@@ -1472,6 +1481,7 @@ static void gsm_dlci_t1(struct timer_list *t)
 			if (debug & 8)
 				pr_info("DLCI %d opening in ADM mode.\n",
 					dlci->addr);
+			dlci->mode = DLCI_MODE_ADM;
 			gsm_dlci_open(dlci);
 		} else {
 			gsm_dlci_close(dlci);
-- 
2.17.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/2] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set
  2018-04-07 17:19 [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode Tony Lindgren
@ 2018-04-07 17:19 ` Tony Lindgren
  2018-04-08  9:02 ` [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode Pavel Machek
  1 sibling, 0 replies; 14+ messages in thread
From: Tony Lindgren @ 2018-04-07 17:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, linux-serial, Alan Cox, Dan Williams, Jiri Prchal,
	Jiri Slaby, Marcel Partap, Merlijn Wajer,
	Michael Nazzareno Trimarchi, Michael Scott, Pavel Machek,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

At least on droid 4 with control channel in ADM mode, there is no response
to Modem Status Command (MSC). Currently gsmtty_modem_update() expects to
have data in dlci->modem_rx unless debug & 2 is set. This means that on
droid 4, things only work if debug & 2 is set.

Let's fix the issue by ignoring empty dlci->modem_rx for ADM mode. In
the AMD mode, CMD_MSC will never respond and gsm_process_modem() won't
get called to set dlci->modem_rx.

And according to ts_127010v140000p.pdf, MSC is only relevant if basic
option is chosen, so let's test for that too.

Fixes: ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for control dlci")
Cc: linux-serial@vger.kernel.org
Cc: Alan Cox <alan@llwyncelyn.cymru>
Cc: Dan Williams <dcbw@redhat.com>
Cc: Jiri Prchal <jiri.prchal@aksignal.cz>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Marcel Partap <mpartap@gmx.net>
Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Cc: Michael Scott <michael.scott@linaro.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Russ Gorby <russ.gorby@intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Cc: stable <stable@vger.kernel.org>
---
 drivers/tty/n_gsm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2871,11 +2871,22 @@ static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)
 static int gsm_carrier_raised(struct tty_port *port)
 {
 	struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);
+	struct gsm_mux *gsm = dlci->gsm;
+
 	/* Not yet open so no carrier info */
 	if (dlci->state != DLCI_OPEN)
 		return 0;
 	if (debug & 2)
 		return 1;
+
+	/*
+	 * Basic mode with control channel in ADM mode may not respond
+	 * to CMD_MSC at all and modem_rx is empty.
+	 */
+	if (gsm->encoding == 0 && gsm->dlci[0]->mode == DLCI_MODE_ADM &&
+	    !dlci->modem_rx)
+		return 1;
+
 	return dlci->modem_rx & TIOCM_CD;
 }
 
-- 
2.17.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-07 17:19 [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode Tony Lindgren
  2018-04-07 17:19 ` [PATCH 2/2] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set Tony Lindgren
@ 2018-04-08  9:02 ` Pavel Machek
  2018-04-08 16:50   ` Tony Lindgren
  1 sibling, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2018-04-08  9:02 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

[-- Attachment #1: Type: text/plain, Size: 1478 bytes --]

Hi!

> Commit ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for
> control dlci") added support for DLCI to stay in Asynchronous Disconnected
> Mode (ADM). But we still get long delays waiting for commands to other
> DLCI to complete:
> 
> --> 5) C: SABM(P)
> Q>  0) C: UIH(F)
> Q>  0) C: UIH(F)
> Q>  0) C: UIH(F)
> ...
> 
> This happens because gsm_control_send() sets cretries timer to T2 that is
> by default set to 34. This will cause resend for T2 times for the control
> frame. In ADM mode, we will never get a response so the control frame, so
> retries are just delaying all the commands.
> 
> Let's fix the issue by setting DLCI_MODE_ADM flag after detecting the ADM
> mode for the control DLCI. Then we can use that in gsm_control_send() to
> set retries to 1. This means the control frame will be sent once allowing
> the other end at an opportunity to switch from ADM to ABM mode.
> 
> Note that retries will be decremented in gsm_control_retransmit() so
> we don't want to set it to 0 here.

Thanks!

I guess I'd like to test this on Droid4; there are fso-gsm0710muxd and
gsm0710muxd packages in Debian, but I assume those do multiplexing in
userspace and thus are not suitable?

Do you have a tool to use and a script?

Thanks and best regards,
									Pavel
									
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-08  9:02 ` [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode Pavel Machek
@ 2018-04-08 16:50   ` Tony Lindgren
  2018-04-08 19:06     ` Pavel Machek
  0 siblings, 1 reply; 14+ messages in thread
From: Tony Lindgren @ 2018-04-08 16:50 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

* Pavel Machek <pavel@ucw.cz> [180408 09:04]:
> I guess I'd like to test this on Droid4; there are fso-gsm0710muxd and
> gsm0710muxd packages in Debian, but I assume those do multiplexing in
> userspace and thus are not suitable?

I don't think those are needed, we now have kernel n_gsm driver do
most of the work for us :) Doing ldattach config is still needed,
but eventually we should have a serdev driver do that too for us.

So apps should only do the ldattach part if node yet already done,
and just attempt to use /dev/gsmtty* ports directly.

I did get serdev working with n_gsm several weeks ago with horrible
hacks, it needs quite a bit more work though before it's ready..

Then we need to add proxying of some /dev/gsmtty* ports to W3GLTE to
get that working (US only AFAIK for the band). It might make sense
to add the proxy features to ModemManager eventually.

> Do you have a tool to use and a script?

Yes I used the shell script I posted earlier, but forgot it also
needs the ldattach done.

Anyways, last night and today I wrote a quick test utility called
droid4-ngsm that initializes things and I can use to do some
experiments to get the ts27010 channel proxying to W3GLTE also
going:

http://github.com/tmlind/droid4-ngsm/

Sorry could not resist adding a test call feature too :)

Hmm it might be best to add the ts27010 support and proxying
eventually to ModemManager? I think ofono and others could still
use the /dev/gsmtty* ports for the modem as needed too?

Regards,

Tony




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-08 16:50   ` Tony Lindgren
@ 2018-04-08 19:06     ` Pavel Machek
  2018-04-08 23:57       ` Tony Lindgren
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2018-04-08 19:06 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

Hi!

> > Do you have a tool to use and a script?
> 
> Yes I used the shell script I posted earlier, but forgot it also
> needs the ldattach done.
> 
> Anyways, last night and today I wrote a quick test utility called
> droid4-ngsm that initializes things and I can use to do some
> experiments to get the ts27010 channel proxying to W3GLTE also
> going:
> 
> http://github.com/tmlind/droid4-ngsm/

Ok, now i'm confused. It wants to bind to ttyS0, but modem is on
ttyUSB4 AFAICT? Or is the modem connected to serial port, too? (Do I
need to enable some more drivers for that?)

I do have ttyS0, but I don't think there's anything attached there. Or
is ttyS0 for the LTE modem?


> Sorry could not resist adding a test call feature too :)

:-)

> Hmm it might be best to add the ts27010 support and proxying
> eventually to ModemManager? I think ofono and others could still
> use the /dev/gsmtty* ports for the modem as needed too?

I'm not sure how the userland should be designed...

Thanks,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-08 19:06     ` Pavel Machek
@ 2018-04-08 23:57       ` Tony Lindgren
  2018-04-09 10:54         ` Pavel Machek
  0 siblings, 1 reply; 14+ messages in thread
From: Tony Lindgren @ 2018-04-08 23:57 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

* Pavel Machek <pavel@ucw.cz> [180408 19:07]:
> Hi!
> 
> > > Do you have a tool to use and a script?
> > 
> > Yes I used the shell script I posted earlier, but forgot it also
> > needs the ldattach done.
> > 
> > Anyways, last night and today I wrote a quick test utility called
> > droid4-ngsm that initializes things and I can use to do some
> > experiments to get the ts27010 channel proxying to W3GLTE also
> > going:
> > 
> > http://github.com/tmlind/droid4-ngsm/
> 
> Ok, now i'm confused. It wants to bind to ttyS0, but modem is on
> ttyUSB4 AFAICT? Or is the modem connected to serial port, too? (Do I
> need to enable some more drivers for that?)
> 
> I do have ttyS0, but I don't think there's anything attached there. Or
> is ttyS0 for the LTE modem?

The ttyS0 is connected to mdm6600, and ttyUSB4 seems to be
some buggy subset of ttyS0 n_gsm dlci1. You need need at least
the following commits in current mainline kernel:

984c7706ff18 ("ARM: dts: omap4-droid4: Configure uart1 pins")
e5b9fd7bdeb5 ("ARM: dts: omap4-droid4: Configure MDM6600 USB PHY")

And then you need PHY_MAPPHONE_MDM6600 and CONFIG_N_GSM enabled.

Regards,

Tony


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-08 23:57       ` Tony Lindgren
@ 2018-04-09 10:54         ` Pavel Machek
  2018-04-09 13:42           ` Tony Lindgren
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2018-04-09 10:54 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

Hi!

> > > > Do you have a tool to use and a script?
> > > 
> > > Yes I used the shell script I posted earlier, but forgot it also
> > > needs the ldattach done.
> > > 
> > > Anyways, last night and today I wrote a quick test utility called
> > > droid4-ngsm that initializes things and I can use to do some
> > > experiments to get the ts27010 channel proxying to W3GLTE also
> > > going:
> > > 
> > > http://github.com/tmlind/droid4-ngsm/
> > 
> > Ok, now i'm confused. It wants to bind to ttyS0, but modem is on
> > ttyUSB4 AFAICT? Or is the modem connected to serial port, too? (Do I
> > need to enable some more drivers for that?)
> > 
> > I do have ttyS0, but I don't think there's anything attached there. Or
> > is ttyS0 for the LTE modem?
> 
> The ttyS0 is connected to mdm6600, and ttyUSB4 seems to be
> some buggy subset of ttyS0 n_gsm dlci1. You need need at least
> the following commits in current mainline kernel:
> 
> 984c7706ff18 ("ARM: dts: omap4-droid4: Configure uart1 pins")
> e5b9fd7bdeb5 ("ARM: dts: omap4-droid4: Configure MDM6600 USB PHY")
> 
> And then you need PHY_MAPPHONE_MDM6600 and CONFIG_N_GSM enabled.

Ok, I should have all that enabled. But droid4-ngsm still fails:

user@devuan:/my/droid4-ngsm$ sudo ./droid4-ngsm
Starting ngsm..
Testing ngsm..
Could not open /dev/gsmtty1: Level 2 halted
Trying to start ngsm again: Level 2 halted
Starting ngsm..

commit 984c7706ff180e33096c57183435d925cb644576 says:

    ARM: dts: omap4-droid4: Configure uart1 pins

    These are needed to use the n_gsm driver for TS 27.010 UART
        multiplexing. Note that support for the OOB wake gpio is still
	    missing so the UART is not yet usable for n_gsm.

...am I still missing the OOB wake gpio support?

Thanks,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-09 10:54         ` Pavel Machek
@ 2018-04-09 13:42           ` Tony Lindgren
  2018-04-10 11:09             ` Pavel Machek
  2018-04-12 21:24             ` Pavel Machek
  0 siblings, 2 replies; 14+ messages in thread
From: Tony Lindgren @ 2018-04-09 13:42 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

* Pavel Machek <pavel@ucw.cz> [180409 10:56]:
> Ok, I should have all that enabled. But droid4-ngsm still fails:
> 
> user@devuan:/my/droid4-ngsm$ sudo ./droid4-ngsm
> Starting ngsm..
> Testing ngsm..
> Could not open /dev/gsmtty1: Level 2 halted
> Trying to start ngsm again: Level 2 halted
> Starting ngsm..

I guess you must have phy-mapphone-mdm6600 enabled as you a have
working modem over USB. What do you see in dmesg if you enable n_gsm
debug with modprobe n_gsm debug=0xff or on kernel cmdline?

> commit 984c7706ff180e33096c57183435d925cb644576 says:
> 
>     ARM: dts: omap4-droid4: Configure uart1 pins
> 
>     These are needed to use the n_gsm driver for TS 27.010 UART
>         multiplexing. Note that support for the OOB wake gpio is still
> 	    missing so the UART is not yet usable for n_gsm.
> 
> ...am I still missing the OOB wake gpio support?

We can get away without OOB wake gpio for a while as mdm6600 is not
yet suspended over USB. But if you have manually suspended mdm6600
USB interface via /sys, then it won't respond properly on n_gsm
either.

Regards,

Tony



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-09 13:42           ` Tony Lindgren
@ 2018-04-10 11:09             ` Pavel Machek
  2018-04-10 13:43               ` Tony Lindgren
  2018-04-12 21:24             ` Pavel Machek
  1 sibling, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2018-04-10 11:09 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]

On Mon 2018-04-09 06:42:59, Tony Lindgren wrote:
> * Pavel Machek <pavel@ucw.cz> [180409 10:56]:
> > Ok, I should have all that enabled. But droid4-ngsm still fails:
> > 
> > user@devuan:/my/droid4-ngsm$ sudo ./droid4-ngsm
> > Starting ngsm..
> > Testing ngsm..
> > Could not open /dev/gsmtty1: Level 2 halted
> > Trying to start ngsm again: Level 2 halted
> > Starting ngsm..
> 
> I guess you must have phy-mapphone-mdm6600 enabled as you a have
> working modem over USB. What do you see in dmesg if you enable n_gsm
> debug with modprobe n_gsm debug=0xff or on kernel cmdline?

Ok, I guess I can do that, but first:

Should the modem respond to AT commands on ttyS0? I launched minicom
(115200 8N1) and I'm not getting any responses.

> > commit 984c7706ff180e33096c57183435d925cb644576 says:
> > 
> >     ARM: dts: omap4-droid4: Configure uart1 pins
> > 
> >     These are needed to use the n_gsm driver for TS 27.010 UART
> >         multiplexing. Note that support for the OOB wake gpio is still
> > 	    missing so the UART is not yet usable for n_gsm.
> > 
> > ...am I still missing the OOB wake gpio support?
> 
> We can get away without OOB wake gpio for a while as mdm6600 is not
> yet suspended over USB. But if you have manually suspended mdm6600
> USB interface via /sys, then it won't respond properly on n_gsm
> either.

Ahha, ok.

Thanks,
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-10 11:09             ` Pavel Machek
@ 2018-04-10 13:43               ` Tony Lindgren
  0 siblings, 0 replies; 14+ messages in thread
From: Tony Lindgren @ 2018-04-10 13:43 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

* Pavel Machek <pavel@ucw.cz> [180410 11:11]:
> Should the modem respond to AT commands on ttyS0? I launched minicom
> (115200 8N1) and I'm not getting any responses.

Not that I know. At least I never got anything out of it. But who knows,
maybe it is in normal mode initially during boot or when mdm6600 is
being flashed.

Regards,

Tony


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-09 13:42           ` Tony Lindgren
  2018-04-10 11:09             ` Pavel Machek
@ 2018-04-12 21:24             ` Pavel Machek
  2018-04-13  0:24               ` Tony Lindgren
  1 sibling, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2018-04-12 21:24 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

[-- Attachment #1: Type: text/plain, Size: 3735 bytes --]

On Mon 2018-04-09 06:42:59, Tony Lindgren wrote:
> * Pavel Machek <pavel@ucw.cz> [180409 10:56]:
> > Ok, I should have all that enabled. But droid4-ngsm still fails:
> > 
> > user@devuan:/my/droid4-ngsm$ sudo ./droid4-ngsm
> > Starting ngsm..
> > Testing ngsm..
> > Could not open /dev/gsmtty1: Level 2 halted
> > Trying to start ngsm again: Level 2 halted
> > Starting ngsm..
> 
> I guess you must have phy-mapphone-mdm6600 enabled as you a have
> working modem over USB. What do you see in dmesg if you enable n_gsm
> debug with modprobe n_gsm debug=0xff or on kernel cmdline?

Ok, let me try... Got some debugging output, hopefully you can see
what is going on there?

Thanks,
							Pavel

sudo insmod /tmp/n_gsm.ko debug=0xff

user@devuan:/my/droid4-ngsm$ sudo ./droid4-ngsm
Starting ngsm..
Testing ngsm..
Could not open /dev/gsmtty1: Level 2 halted
Trying to start ngsm again: Level 2 halted
Starting ngsm..
Testing ngsm..
Could not open /dev/gsmtty1: Level 2 halted
Trying to start ngsm again: Level 2 halted
Starting ngsm..
^CCould not set conf: Interrupted system call
Could not start ngsm: Interrupted system call

[ 3378.381134] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host
[ 3408.460937] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host
[ 3413.633239] Q>  0) R: UIH(F)
[ 3413.639190] C3
[ 3413.642761] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3413.653564] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3413.978942] Q>  0) R: UIH(F)
[ 3413.984924] C3
[ 3413.988586] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3413.999114] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3414.328247] Q>  0) R: UIH(F)
[ 3414.333068] C3
[ 3414.336608] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3414.346984] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3414.679870] gsmld_output: 00000000: f9 03 3f 01 1c f9
..?...
[ 3414.690979] --> 0) C: SABM(P)
[ 3414.798370] gsmld_output: 00000000: f9 03 3f 01 1c f9
..?...
[ 3414.809570] --> 0) C: SABM(P)
[ 3414.918243] gsmld_output: 00000000: f9 03 3f 01 1c f9
..?...
[ 3414.928588] --> 0) C: SABM(P)
[ 3416.743682] Q>  0) R: UIH(F)
[ 3416.748352] C3
[ 3416.751800] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3416.762145] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3417.088256] Q>  0) R: UIH(F)
[ 3417.093078] C3
[ 3417.096679] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3417.107208] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3417.438201] Q>  0) R: UIH(F)
[ 3417.443206] C3
[ 3417.446990] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3417.457733] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3417.788330] gsmld_output: 00000000: f9 03 3f 01 1c f9
..?...
[ 3417.799163] --> 0) C: SABM(P)
[ 3417.918243] gsmld_output: 00000000: f9 03 3f 01 1c f9
..?...
[ 3417.929107] --> 0) C: SABM(P)
[ 3418.038208] gsmld_output: 00000000: f9 03 3f 01 1c f9
..?...
[ 3418.049102] --> 0) C: SABM(P)
[ 3419.854248] Q>  0) R: UIH(F)
[ 3419.859527] C3
[ 3419.863555] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3419.874481] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3420.208221] Q>  0) R: UIH(F)
[ 3420.213500] C3
[ 3420.217498] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3420.228393] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3420.598205] Q>  0) R: UIH(F)
[ 3420.603515] C3
[ 3420.607513] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
~....~
[ 3420.618377] gsmld_output: 00000000: 7e 01 ef c3 aa 7e
~....~
user@devuan:/my/droid4-ngsm$

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-12 21:24             ` Pavel Machek
@ 2018-04-13  0:24               ` Tony Lindgren
  2018-04-16  8:44                 ` Pavel Machek
  0 siblings, 1 reply; 14+ messages in thread
From: Tony Lindgren @ 2018-04-13  0:24 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

* Pavel Machek <pavel@ucw.cz> [180412 21:25]:
> sudo insmod /tmp/n_gsm.ko debug=0xff
> 
> user@devuan:/my/droid4-ngsm$ sudo ./droid4-ngsm
> Starting ngsm..
> Testing ngsm..
> Could not open /dev/gsmtty1: Level 2 halted
> Trying to start ngsm again: Level 2 halted
> Starting ngsm..
> Testing ngsm..
> Could not open /dev/gsmtty1: Level 2 halted
> Trying to start ngsm again: Level 2 halted
> Starting ngsm..
> ^CCould not set conf: Interrupted system call
> Could not start ngsm: Interrupted system call
> 
> [ 3378.381134] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host
> [ 3408.460937] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host
> [ 3413.633239] Q>  0) R: UIH(F)
> [ 3413.639190] C3
> [ 3413.642761] gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
> ~....~
> [ 3413.653564] gsmld_output: 00000000: 7e 01 ef c3 aa 7e

OK so no response from the modem. After few of the above
packets, you should then also see something coming back:

gsm_data_kick: 00000000: 7e 01 ef c3 aa 7e
gsmld_output: 00000000: 7e 01 ef c3 aa 7e
gsmld_output: 00000000: f9 03 3f 01 1c f9
--> 0) C: SABM(P)
gsmld_output: 00000000: f9 03 3f 01 1c f9
--> 0) C: SABM(P)
gsmld_receive: 00000000: f9 03 1f 01 36 f9
<-- 0) C: DM(P)
gsmld_output: 00000000: f9 03 3f 01 1c f9
--> 0) C: SABM(P)
gsmld_receive: 00000000: f9 03 1f 01 36 f9
<-- 0) C: DM(P)
DLCI 0 opening in ADM mode.

Do you have phy-mapphone-mdm6600 loaded? That is still needed to
configure all the boot mode pins for the modem so it is usable..
The UART will then work also without ohci-platform, just the
USB PHY is disabled without ohci-platform.

I have these in my .config:
CONFIG_SERIAL_8250_OMAP=y
CONFIG_SERIAL_8250_OMAP_TTYO_FIXUP=y
CONFIG_PHY_MAPPHONE_MDM6600=m
CONFIG_N_GSM=m

And then the two patches from $subject thread. I just tried
it with today's mainline kernel and it's still working for
me.

Maybe you're missing some related patch though if usingv4.16?

984c7706ff18 ("ARM: dts: omap4-droid4: Configure uart1 pins")
e5b9fd7bdeb5 ("ARM: dts: omap4-droid4: Configure MDM6600 USB PHY")
fdd192037fce ("ARM: dts: omap4-droid4: Fix USB PHY port naming")
bca809d8183c ("ARM: omap2plus_defconfig: Enable MDM6600 USB PHY")
077e1cde78c3 ("ARM: omap2plus_defconfig: Enable 8250_OMAP"

So maybe you're still using CONFIG_SERIAL_OMAP=y instead of
CONFIG_SERIAL_8250_OMAP=y?

Regards,

Tony

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-13  0:24               ` Tony Lindgren
@ 2018-04-16  8:44                 ` Pavel Machek
  2018-04-16 14:47                   ` Tony Lindgren
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2018-04-16  8:44 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

[-- Attachment #1: Type: text/plain, Size: 2215 bytes --]


> Do you have phy-mapphone-mdm6600 loaded? That is still needed to
> configure all the boot mode pins for the modem so it is usable..
> The UART will then work also without ohci-platform, just the
> USB PHY is disabled without ohci-platform.
> 
> I have these in my .config:
> CONFIG_SERIAL_8250_OMAP=y
> CONFIG_SERIAL_8250_OMAP_TTYO_FIXUP=y
> CONFIG_PHY_MAPPHONE_MDM6600=m
> CONFIG_N_GSM=m
> 
> And then the two patches from $subject thread. I just tried
> it with today's mainline kernel and it's still working for
> me.
> 
> Maybe you're missing some related patch though if usingv4.16?
> 
> 984c7706ff18 ("ARM: dts: omap4-droid4: Configure uart1 pins")
> e5b9fd7bdeb5 ("ARM: dts: omap4-droid4: Configure MDM6600 USB PHY")
> fdd192037fce ("ARM: dts: omap4-droid4: Fix USB PHY port naming")
> bca809d8183c ("ARM: omap2plus_defconfig: Enable MDM6600 USB PHY")
> 077e1cde78c3 ("ARM: omap2plus_defconfig: Enable 8250_OMAP"
> 
> So maybe you're still using CONFIG_SERIAL_OMAP=y instead of
> CONFIG_SERIAL_8250_OMAP=y?

Ahha, so first I missed two of the patches, and second, I was not
patient enough. I was stopping my test after first or second
error. Now I get... so I guess it works for me.

Thanks!

For the series:

Tested-by: Pavel Machek <pavel@ucw.cz>

								Pavel

user@devuan:/my/droid4-ngsm$ sudo ./droid4-ngsm
Starting ngsm..
Testing ngsm..
Could not open /dev/gsmtty1: Level 2 halted
Trying to start ngsm again: Level 2 halted
Starting ngsm..
Testing ngsm..
Could not open /dev/gsmtty1: Level 2 halted
Trying to start ngsm again: Level 2 halted
Starting ngsm..
Testing ngsm..
Could not open /dev/gsmtty1: Level 2 halted
Trying to start ngsm again: Level 2 halted
Starting ngsm..
Testing ngsm..
Could not open /dev/gsmtty1: Level 2 halted
Trying to start ngsm again: Level 2 halted
Starting ngsm..
Testing ngsm..
1> U0000AT+CFUN?
1<
Enable speaker phone..
2> U0001AT+EACC=3,0
2<
2> U0002AT+CMUT=0
2<
2> U0003AT+NREC=1
2<
2> U0004AT+CLVL=6
2<
Started ngsm, press Ctrl-C to exit when done



-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
  2018-04-16  8:44                 ` Pavel Machek
@ 2018-04-16 14:47                   ` Tony Lindgren
  0 siblings, 0 replies; 14+ messages in thread
From: Tony Lindgren @ 2018-04-16 14:47 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Greg Kroah-Hartman, linux-kernel, linux-serial, Alan Cox,
	Dan Williams, Jiri Prchal, Jiri Slaby, Marcel Partap,
	Merlijn Wajer, Michael Nazzareno Trimarchi, Michael Scott,
	Peter Hurley, Russ Gorby, Sascha Hauer, Sebastian Reichel

* Pavel Machek <pavel@ucw.cz> [180416 08:46]:
> Ahha, so first I missed two of the patches, and second, I was not
> patient enough. I was stopping my test after first or second
> error. Now I get... so I guess it works for me.

OK good to hear.

> For the series:
> 
> Tested-by: Pavel Machek <pavel@ucw.cz>

Thanks for testing.

> Testing ngsm..
> 1> U0000AT+CFUN?
> 1<

Hmm droid4-ngsm should show the response or error out as you
already probably figured out :)

Regards,

Tony

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-04-16 14:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-07 17:19 [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode Tony Lindgren
2018-04-07 17:19 ` [PATCH 2/2] tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set Tony Lindgren
2018-04-08  9:02 ` [PATCH 1/2] tty: n_gsm: Fix long delays with control frame timeouts in ADM mode Pavel Machek
2018-04-08 16:50   ` Tony Lindgren
2018-04-08 19:06     ` Pavel Machek
2018-04-08 23:57       ` Tony Lindgren
2018-04-09 10:54         ` Pavel Machek
2018-04-09 13:42           ` Tony Lindgren
2018-04-10 11:09             ` Pavel Machek
2018-04-10 13:43               ` Tony Lindgren
2018-04-12 21:24             ` Pavel Machek
2018-04-13  0:24               ` Tony Lindgren
2018-04-16  8:44                 ` Pavel Machek
2018-04-16 14:47                   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).