android_kernel_motorola_sm6225/drivers/usb/serial
Tony Lindgren 3ca5b7b4af USB: serial: option: Add Motorola modem UARTs
commit 6caf0be40a707689e8ff8824fdb96ef77685b1ba upstream.

On Motorola Mapphone devices such as Droid 4 there are five USB ports
that do not use the same layout as Gobi 1K/2K/etc devices listed in
qcserial.c. So we should use qcaux.c or option.c as noted by
Dan Williams <dan.j.williams@intel.com>.

As the Motorola USB serial ports have an interrupt endpoint as shown
with lsusb -v, we should use option.c instead of qcaux.c as pointed out
by Johan Hovold <johan@kernel.org>.

The ff/ff/ff interfaces seem to always be UARTs on Motorola devices.
For the other interfaces, class 0x0a (CDC Data) should not in general
be added as they are typically part of a multi-interface function as
noted earlier by Bjørn Mork <bjorn@mork.no>.

However, looking at the Motorola mapphone kernel code, the mdm6600 0x0a
class is only used for flashing the modem firmware, and there are no
other interfaces. So I've added that too with more details below as it
works just fine.

The ttyUSB ports on Droid 4 are:

ttyUSB0 DIAG, CQDM-capable
ttyUSB1 MUX or NMEA, no response
ttyUSB2 MUX or NMEA, no response
ttyUSB3 TCMD
ttyUSB4 AT-capable

The ttyUSB0 is detected as QCDM capable by ModemManager. I think
it's only used for debugging with ModemManager --debug for sending
custom AT commands though. ModemManager already can manage data
connection using the USB QMI ports that are already handled by the
qmi_wwan.c driver.

To enable the MUX or NMEA ports, it seems that something needs to be
done additionally to enable them, maybe via the DIAG or TCMD port.
It might be just a NVRAM setting somewhere, but I have no idea what
NVRAM settings may need changing for that.

The TCMD port seems to be a Motorola custom protocol for testing
the modem and to configure it's NVRAM and seems to work just fine
based on a quick test with a minimal tcmdrw tool I wrote.

The voice modem AT-capable port seems to provide only partial
support, and no PM support compared to the TS 27.010 based UART
wired directly to the modem.

The UARTs added with this change are the same product IDs as the
Motorola Mapphone Android Linux kernel mdm6600_id_table. I don't
have any mdm9600 based devices, so I have only tested these on
mdm6600 based droid 4.

Then for the class 0x0a (CDC Data) mode, the Motorola Mapphone Android
Linux kernel driver moto_flashqsc.c just seems to change the
port->bulk_out_size to 8K from the default. And is only used for
flashing the modem firmware it seems.

I've verified that flashing the modem with signed firmware works just
fine with the option driver after manually toggling the GPIO pins, so
I've added droid 4 modem flashing mode to the option driver. I've not
added the other devices listed in moto_flashqsc.c in case they really
need different port->bulk_out_size. Those can be added as they get
tested to work for flashing the modem.

After this patch the output of /sys/kernel/debug/usb/devices has
the following for normal 22b8:2a70 mode including the related qmi_wwan
interfaces:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=22b8 ProdID=2a70 Rev= 0.00
S:  Manufacturer=Motorola, Incorporated
S:  Product=Flash MZ600
C:* #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=84(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=5ms
E:  Ad=86(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fb Prot=ff Driver=qmi_wwan
E:  Ad=87(I) Atr=03(Int.) MxPS=  64 Ivl=5ms
E:  Ad=88(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fb Prot=ff Driver=qmi_wwan
E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=5ms
E:  Ad=8a(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=07(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 7 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fb Prot=ff Driver=qmi_wwan
E:  Ad=8b(I) Atr=03(Int.) MxPS=  64 Ivl=5ms
E:  Ad=8c(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=08(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 8 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fb Prot=ff Driver=qmi_wwan
E:  Ad=8d(I) Atr=03(Int.) MxPS=  64 Ivl=5ms
E:  Ad=8e(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=09(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

In 22b8:900e "qc_dload" mode the device shows up as:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=22b8 ProdID=900e Rev= 0.00
S:  Manufacturer=Motorola, Incorporated
S:  Product=Flash MZ600
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

And in 22b8:4281 "ram_downloader" mode the device shows up as:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=22b8 ProdID=4281 Rev= 0.00
S:  Manufacturer=Motorola, Incorporated
S:  Product=Flash MZ600
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=fc Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

Cc: Bjørn Mork <bjorn@mork.no>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Lars Melin <larsm17@gmail.com>
Cc: Marcel Partap <mpartap@gmx.net>
Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Michael Scott <hashcode0f@gmail.com>
Cc: NeKit <nekit1000@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-25 10:48:01 +02:00
..
aircable.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00
ark3116.c USB: serial: ark3116: move TIOCGSERIAL ioctl case to function 2018-01-09 12:53:27 +01:00
belkin_sa.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
belkin_sa.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
bus.c USB: serial: use tty_port_register_device() 2018-05-17 11:22:00 +02:00
ch341.c USB: serial: ch341: fix type promotion bug in ch341_control_in() 2018-07-04 15:40:54 +02:00
console.c USB: serial: console: fix reported terminal settings 2018-12-13 09:16:15 +01:00
cp210x.c USB: serial: cp210x: add new device id 2019-04-03 06:26:25 +02:00
cyberjack.c USB: serial: cyberjack: use irqsave() in USB's complete callback 2018-06-26 14:13:53 +02:00
cypress_m8.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
cypress_m8.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
digi_acceleport.c USB: serial: digi_acceleport: rename tty flag variable 2018-06-27 07:59:03 +02:00
empeg.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00
ezusb_convert.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
f81232.c USB: serial: f81232: fix interrupt worker not stop 2019-05-10 17:54:10 +02:00
f81534.c USB: serial: f81534: fix tx error on some baud rate 2018-01-11 11:00:25 +01:00
ftdi_sio.c USB: serial: ftdi_sio: add ID for isodebug v1 2019-07-14 08:11:18 +02:00
ftdi_sio.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ftdi_sio_ids.h USB: serial: ftdi_sio: add ID for isodebug v1 2019-07-14 08:11:18 +02:00
garmin_gps.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
generic.c USB: serial: fix unthrottle races 2019-05-16 19:41:18 +02:00
io_16654.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
io_edgeport.c USB: serial: io_edgeport: use irqsave() in USB's complete callback 2018-06-26 14:30:17 +02:00
io_edgeport.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
io_ionsp.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
io_ti.c USB: serial: io_ti: use irqsave() in USB's complete callback 2018-06-26 14:34:32 +02:00
io_ti.h USB: serial: io_ti: fix array underflow in completion handler 2018-08-27 11:52:34 +02:00
io_usbvend.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
ipaq.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
ipw.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
ir-usb.c USB: serial: cast sizeof() to int when comparing with error code 2018-06-25 10:34:31 +02:00
iuu_phoenix.c USB: serial: iuu_phoenix: drop redundant input-speed re-encoding 2018-07-16 14:12:11 +02:00
iuu_phoenix.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
Kconfig USB: serial: simple: add libtransistor console 2018-04-16 09:19:53 +02:00
keyspan.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
keyspan_pda.c USB: serial: keyspan_pda: fix modem-status error handling 2018-07-06 10:32:14 +02:00
keyspan_usa26msg.h
keyspan_usa28msg.h
keyspan_usa49msg.h
keyspan_usa67msg.h
keyspan_usa90msg.h
kl5kusb105.c USB: serial: kl5kusb105: remove KLSI device id 2018-07-11 10:11:29 +02:00
kl5kusb105.h USB: serial: kl5kusb105: remove KLSI device id 2018-07-11 10:11:29 +02:00
kobil_sct.c USB: serial: kobil_sct: add missing version error handling 2018-07-06 10:42:42 +02:00
kobil_sct.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile-keyspan_pda_fw USB: add SPDX identifiers to all remaining Makefiles 2017-11-07 15:53:48 +01:00
mct_u232.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
mct_u232.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
metro-usb.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00
mos7720.c USB: serial: mos7720: fix mos_parport refcount imbalance on error path 2019-04-03 06:26:26 +02:00
mos7840.c USB-serial updates for v4.19-rc1 2018-07-20 21:47:15 +02:00
mxuport.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
navman.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00
omninet.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00
opticon.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00
option.c USB: serial: option: Add Motorola modem UARTs 2019-08-25 10:48:01 +02:00
oti6858.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00
oti6858.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
pl2303.c USB: serial: pl2303: add Allied Telesis VT-Kit3 2019-06-19 08:18:06 +02:00
pl2303.h USB: serial: pl2303: add Allied Telesis VT-Kit3 2019-06-19 08:18:06 +02:00
qcaux.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00
qcserial.c USB: serial: qcserial: add Sierra Wireless EM7565 2017-12-15 09:41:46 +01:00
quatech2.c USB: serial: quatech2: use irqsave() in USB's complete callback 2018-06-26 14:52:15 +02:00
safe_serial.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
sierra.c USB: serial: sierra: use irqsave() in USB's complete callback 2018-06-26 15:22:25 +02:00
spcp8x5.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
ssu100.c USB: serial: cast sizeof() to int when comparing with error code 2018-06-25 10:34:31 +02:00
symbolserial.c USB: serial: symbolserial: use irqsave() in USB's complete callback 2018-06-26 15:25:01 +02:00
ti_usb_3410_5052.c USB: serial: ti_usb_3410_5052: fix array underflow in completion handler 2018-08-27 11:53:19 +02:00
upd78f0730.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
usb-serial-simple.c USB: serial: simple: add Motorola Tetra TPG2200 device id 2019-01-31 08:14:34 +01:00
usb-serial.c USB/PHY patches for 4.18-rc1 2018-06-05 16:14:12 -07:00
usb-wwan.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
usb_debug.c USB: serial: usb_debug: add new USB device id 2017-11-28 09:54:11 +01:00
usb_wwan.c USB: serial: usb_wwan: use irqsave() in USB's complete callback 2018-06-26 15:28:15 +02:00
visor.c USB: serial: visor: handle potential invalid device configuration 2018-05-02 09:37:19 +02:00
visor.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
whiteheat.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
whiteheat.h USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
wishbone-serial.c USB: serial: Remove redundant license text 2017-11-04 11:55:38 +01:00
xsens_mt.c USB: serial: fix module-license macros 2017-11-04 11:58:00 +01:00