diff mbox series

USB: serial: option: add u-blox LARA-R6 01B modem

Message ID 20230613141441.35866-1-davide.tronchin.94@gmail.com (mailing list archive)
State New, archived
Headers show
Series USB: serial: option: add u-blox LARA-R6 01B modem | expand

Commit Message

Davide Tronchin June 13, 2023, 2:14 p.m. UTC
The new LARA-R6 product variant identified by the "01B" string can be
configured (by AT interface) in three different USB modes:
* Default mode (Vendor ID: 0x1546 Product ID: 0x1311) with 4 serial
interfaces
* RmNet mode (Vendor ID: 0x1546 Product ID: 0x1312) with 4 serial
interfaces and 1 RmNet virtual network interface
* CDC-ECM mode (Vendor ID: 0x1546 Product ID: 0x1313) with 4 serial
interface and 1 CDC-ECM virtual network interface

In default mode LARA-R6 01B exposes the following interfaces:
If 0: Diagnostic
If 1: AT parser
If 2: AT parser
If 3: AT parser/alternative functions

In RmNet mode LARA-R6 01B exposes the following interfaces:
If 0: Diagnostic
If 1: AT parser
If 2: AT parser
If 3: AT parser/alternative functions
If 4: RMNET interface

In CDC-ECM mode LARA-R6 01B exposes the following interfaces:
If 0: Diagnostic
If 1: AT parser
If 2: AT parser
If 3: AT parser/alternative functions
If 4: CDC-ECM interface

Signed-off-by: Davide Tronchin <davide.tronchin.94@gmail.com>

---
 drivers/usb/serial/option.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Johan Hovold June 20, 2023, 6:21 a.m. UTC | #1
On Tue, Jun 13, 2023 at 04:14:41PM +0200, Davide Tronchin wrote:
> The new LARA-R6 product variant identified by the "01B" string can be
> configured (by AT interface) in three different USB modes:
> * Default mode (Vendor ID: 0x1546 Product ID: 0x1311) with 4 serial
> interfaces
> * RmNet mode (Vendor ID: 0x1546 Product ID: 0x1312) with 4 serial
> interfaces and 1 RmNet virtual network interface
> * CDC-ECM mode (Vendor ID: 0x1546 Product ID: 0x1313) with 4 serial
> interface and 1 CDC-ECM virtual network interface
> 
> In default mode LARA-R6 01B exposes the following interfaces:
> If 0: Diagnostic
> If 1: AT parser
> If 2: AT parser
> If 3: AT parser/alternative functions
> 
> In RmNet mode LARA-R6 01B exposes the following interfaces:
> If 0: Diagnostic
> If 1: AT parser
> If 2: AT parser
> If 3: AT parser/alternative functions
> If 4: RMNET interface
> 
> In CDC-ECM mode LARA-R6 01B exposes the following interfaces:
> If 0: Diagnostic
> If 1: AT parser
> If 2: AT parser
> If 3: AT parser/alternative functions
> If 4: CDC-ECM interface

Can you please also include the output of usb-devices for these
configurations?

> Signed-off-by: Davide Tronchin <davide.tronchin.94@gmail.com>
> 
> ---
>  drivers/usb/serial/option.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> index 644a55447fd7..5b684b6f5969 100644
> --- a/drivers/usb/serial/option.c
> +++ b/drivers/usb/serial/option.c
> @@ -1152,6 +1152,11 @@ static const struct usb_device_id option_ids[] = {
>  	  .driver_info = RSVD(4) },
>  	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1343),		/* u-blox LARA-L6 (ECM) */
>  	  .driver_info = RSVD(4) },
> +	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1311) },	/* u-blox LARA-R6 01B */
> +	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1312),		/* u-blox LARA-R6 01B (RMNET) */
> +	  .driver_info = RSVD(4) },
> +	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1313),		/* u-blox LARA-R6 01B (ECM) */
> +	  .driver_info = RSVD(4) },

These should all go above the 0x1341 PID.

I see that we used RSVD() also for the CDC interface for LARA-L6, but
shouldn't it be possible to use a more exact match instead? The
usb-devices output should tell.

>  	/* Quectel products using Quectel vendor ID */
>  	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff),
>  	  .driver_info = NUMEP2 },

Johan
Davide Tronchin June 21, 2023, 8:47 a.m. UTC | #2
> Can you please also include the output of usb-devices for these
> configurations?

The first 4 interfaces of all the 3 configurations (default, RMNET, ECM)
are the same.
Here below you can find debug/usb/devices file of the LARA-R6 01B module
in all the USB configurations.

Default:
T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#=  4 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1546 ProdID=1311 Rev= 0.00
S:  Manufacturer=u-blox
S:  Product=u-blox Modem
S:  SerialNumber=1478200b
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

RMNET:
T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#=  5 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1546 ProdID=1312 Rev= 0.00
S:  Manufacturer=u-blox
S:  Product=u-blox Modem
S:  SerialNumber=1478200b
C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

ECM:
T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#=  9 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1546 ProdID=1313 Rev= 0.00
S:  Manufacturer=u-blox
S:  Product=u-blox Modem
S:  SerialNumber=1478200b
C:* #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
A:  FirstIf#= 4 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
I:  If#= 5 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
I:* If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

> These should all go above the 0x1341 PID.

Thank you for your indication. In patch V2 i will provide this change.

> I see that we used RSVD() also for the CDC interface for LARA-L6, but
> shouldn't it be possible to use a more exact match instead? The
> usb-devices output should tell.

Probably USB_DEVICE_AND_INTERFACE_INFO would not match LARA-R6 01B
serial composition since R6 01B has:
- Diagnostic
    Cls=ff(vend.) Sub=ff Prot=30
- all the other serial interfaces
    Cls=ff(vend.) Sub=ff Prot=ff
Could you kindly offer any recommendations?
Maybe USB_DEVICE_INTERFACE_CLASS ca be used instead of
USB_DEVICE_AND_INTERFACE_INFO.
Johan Hovold June 21, 2023, 9:07 a.m. UTC | #3
On Wed, Jun 21, 2023 at 10:47:30AM +0200, Davide Tronchin wrote:
> > Can you please also include the output of usb-devices for these
> > configurations?
> 
> The first 4 interfaces of all the 3 configurations (default, RMNET, ECM)
> are the same.
> Here below you can find debug/usb/devices file of the LARA-R6 01B module
> in all the USB configurations.

Thanks, can you include this in the commit message for v2 as well?

> ECM:
> T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#=  9 Spd=480  MxCh= 0
> D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
> P:  Vendor=1546 ProdID=1313 Rev= 0.00
> S:  Manufacturer=u-blox
> S:  Product=u-blox Modem
> S:  SerialNumber=1478200b
> C:* #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
> A:  FirstIf#= 4 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
> I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
> E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
> E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> I:  If#= 5 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
> I:* If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
> E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

> > I see that we used RSVD() also for the CDC interface for LARA-L6, but
> > shouldn't it be possible to use a more exact match instead? The
> > usb-devices output should tell.
> 
> Probably USB_DEVICE_AND_INTERFACE_INFO would not match LARA-R6 01B
> serial composition since R6 01B has:
> - Diagnostic
>     Cls=ff(vend.) Sub=ff Prot=30
> - all the other serial interfaces
>     Cls=ff(vend.) Sub=ff Prot=ff
> Could you kindly offer any recommendations?
> Maybe USB_DEVICE_INTERFACE_CLASS ca be used instead of
> USB_DEVICE_AND_INTERFACE_INFO.

Right, I had USB_DEVICE_INTERFACE_CLASS() in mind for the ECM
configuration. That should avoid the need for RSVD().

Johan
Davide Tronchin June 21, 2023, 12:53 p.m. UTC | #4
> > The first 4 interfaces of all the 3 configurations (default, RMNET, ECM)
> > are the same.
> > Here below you can find debug/usb/devices file of the LARA-R6 01B module
> > in all the USB configurations.

> Thanks, can you include this in the commit message for v2 as well?

Sure.

> Right, I had USB_DEVICE_INTERFACE_CLASS() in mind for the ECM
> configuration. That should avoid the need for RSVD().

If possible, i would use USB_DEVICE_INTERFACE_CLASS() for all the
R6 01B USB configurations. Something like:

{ USB_DEVICE_INTERFACE_CLASS(UBLOX_VENDOR_ID, 0x1311, 0xff) },
{ USB_DEVICE_INTERFACE_CLASS(UBLOX_VENDOR_ID, 0x1312, 0xff),
  .driver_info = RSVD(4) },
{ USB_DEVICE_INTERFACE_CLASS(UBLOX_VENDOR_ID, 0x1313, 0xff) },

Reservation is required for RMNET on port 4, as the RMNET port also 
has USB interface class 255:

If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan

What do you think?

Davide
Johan Hovold June 21, 2023, 4:11 p.m. UTC | #5
On Wed, Jun 21, 2023 at 02:53:14PM +0200, Davide Tronchin wrote:
> > > The first 4 interfaces of all the 3 configurations (default, RMNET, ECM)
> > > are the same.
> > > Here below you can find debug/usb/devices file of the LARA-R6 01B module
> > > in all the USB configurations.
> 
> > Thanks, can you include this in the commit message for v2 as well?
> 
> Sure.
> 
> > Right, I had USB_DEVICE_INTERFACE_CLASS() in mind for the ECM
> > configuration. That should avoid the need for RSVD().
> 
> If possible, i would use USB_DEVICE_INTERFACE_CLASS() for all the
> R6 01B USB configurations. Something like:
> 
> { USB_DEVICE_INTERFACE_CLASS(UBLOX_VENDOR_ID, 0x1311, 0xff) },
> { USB_DEVICE_INTERFACE_CLASS(UBLOX_VENDOR_ID, 0x1312, 0xff),
>   .driver_info = RSVD(4) },
> { USB_DEVICE_INTERFACE_CLASS(UBLOX_VENDOR_ID, 0x1313, 0xff) },
> 
> Reservation is required for RMNET on port 4, as the RMNET port also 
> has USB interface class 255:
> 
> If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
> 
> What do you think?

That should work, but I don't think you should use more specific
matching than required either. So I'd suggest sticking with USB_DEVICE()
for the other two configurations.

Johan
diff mbox series

Patch

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 644a55447fd7..5b684b6f5969 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1152,6 +1152,11 @@  static const struct usb_device_id option_ids[] = {
 	  .driver_info = RSVD(4) },
 	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1343),		/* u-blox LARA-L6 (ECM) */
 	  .driver_info = RSVD(4) },
+	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1311) },	/* u-blox LARA-R6 01B */
+	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1312),		/* u-blox LARA-R6 01B (RMNET) */
+	  .driver_info = RSVD(4) },
+	{ USB_DEVICE(UBLOX_VENDOR_ID, 0x1313),		/* u-blox LARA-R6 01B (ECM) */
+	  .driver_info = RSVD(4) },
 	/* Quectel products using Quectel vendor ID */
 	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff),
 	  .driver_info = NUMEP2 },