All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: "Carl Yin(殷张成)" <carl.yin@quectel.com>
Cc: Reinhard Speyerer <rspmn@arcor.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] USB: serial: option: add Quectel BG95 modem
Date: Tue, 17 May 2022 16:44:57 +0200	[thread overview]
Message-ID: <YoO06aI15sGRimRo@hovoldconsulting.com> (raw)
In-Reply-To: <TYZPR06MB4270471E08BF0BCDBF24722186CE9@TYZPR06MB4270.apcprd06.prod.outlook.com>

On Tue, May 17, 2022 at 01:14:34AM +0000, Carl Yin(殷张成) wrote:
> Hi Reinhard:
>     Although BG95 supports at+qcfgext="usbnet", "rmnet", but lots of QMI message do not support, 
>     E.g WDS_START_NETWORK_INTERFACE, so "rmnet" is basically useless.

Sounds like a good idea to reserve interface 3 as Reinhard suggested
anyway for completeness.

You can mention that the configuration is incomplete, but please include
usb-devices output for also for rmnet so we have all the configurations
in the commit message.

> On Tuesday, May 17, 2022 at 05:13 AM +0000, Reinhard Speyerer wrote:
> 
> > On Mon, May 16, 2022 at 06:10:17AM +0000, Carl Yin(殷张成) wrote:
> > > The BG95 modem has 2 USB configurations that are configurable via the
> > > AT command AT+QCFGEXT="usbnet",["ecm"|"modem"] which make the
> > modem
> > > enumerate with the following interfaces, respectively:
> > >
> > > "modem": Diag + GNSS + Modem + Modem
> > > "ecm"  : DIAG + GNSS + Modem + ECM
> > 
> > Hi Carl,
> > 
> > what about the AT+QCFGEXT="usbnet","rmnet" configuration available on
> > several firmware versions which makes the BG95 enumerate as Diag + GNSS +
> > Modem + QMI:
> > 
> > T:  Bus=02 Lev=02 Prnt=06 Port=01 Cnt=02 Dev#=  8 Spd=480  MxCh= 0
> > D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> > P:  Vendor=2c7c ProdID=0700 Rev= 0.00
> > S:  Manufacturer=Quectel, Incorporated
> > S:  Product=Quectel LPWA Module
> > S:  SerialNumber=xxxxxxxx
> > C:* #Ifs= 4 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= 512 Ivl=0ms
> > E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 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= 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=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> > E:  Ad=84(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=qmi_wwan
> > E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> > E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > 
> > >
> > > A detailed description of the USB configuration for each mode follows:
> > >
> > > +QCFGEXT: "usbnet","modem"
> > > -------------------------
> > > T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
> > > D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> > > P:  Vendor=2c7c ProdID=0700 Rev= 0.00
> > > S:  Manufacturer=Quectel, Incorporated
> > > S:  Product=Quectel LPWA Module
> > > S:  SerialNumber=884328a2
> > > C:* #Ifs= 4 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= 512 Ivl=0ms
> > > E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 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= 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=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> > > E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
> > > E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> > > E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > >
> > > +QCFGEXT: "usbnet","ecm"
> > > -----------------------
> > > T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  4 Spd=480  MxCh= 0
> > > D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
> > > P:  Vendor=2c7c ProdID=0700 Rev= 0.00
> > > S:  Manufacturer=Quectel, Incorporated
> > > S:  Product=Quectel LPWA Module
> > > S:  SerialNumber=884328a2
> > > C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
> > > A:  FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
> > > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff 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= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E:  Ad=82(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=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> > > E:  Ad=84(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= 1 Cls=02(comm.) Sub=06 Prot=00
> > > Driver=cdc_ether
> > > E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
> > > I:  If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00
> > > Driver=cdc_ether
> > > I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00
> > > Driver=cdc_ether
> > > E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > >
> > > Signed-off-by: Carl Yin <carl.yin@quectel.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 152ad8826..f91b2a67d 100644
> > > --- a/drivers/usb/serial/option.c
> > > +++ b/drivers/usb/serial/option.c
> > > @@ -256,6 +256,7 @@ static void option_instat_callback(struct urb *urb);
> > >  #define QUECTEL_PRODUCT_RM500Q			0x0800
> > >  #define QUECTEL_PRODUCT_EC200S_CN		0x6002
> > >  #define QUECTEL_PRODUCT_EC200T			0x6026
> > > +#define QUECTEL_PRODUCT_BG95			0x0700

Please keep the defines sorted by PID.

> > >  #define CMOTECH_VENDOR_ID			0x16d8
> > >  #define CMOTECH_PRODUCT_6001			0x6001
> > > @@ -1143,6 +1144,10 @@ static const struct usb_device_id option_ids[] = {
> > >  	  .driver_info = ZLP },
> > >  	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) },
> > >  	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > > QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
> > > +	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_BG95, 0xff, 0xff, 0xff),
> > > +	  .driver_info = ZLP },
> > 
> > Could you please add a RSVD(3) flag to the driver_info here to avoid that the
> > option driver incorrectly binds to the QMI interface?

> > > +	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_BG95, 0xff, 0xfe, 0xff),
> > > +	  .driver_info = ZLP },

Wouldn't a single entry using USB_DEVICE_INTERFACE_CLASS() be enough to
cover all three configurations?

> > >
> > >  	{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
> > >  	{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
> > > --
> > > 2.17.1
> > >

Johan

  reply	other threads:[~2022-05-17 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  1:14 [PATCH] USB: serial: option: add Quectel BG95 modem Carl Yin(殷张成)
2022-05-17 14:44 ` Johan Hovold [this message]
2022-05-17 17:34 ` Reinhard Speyerer
  -- strict thread matches above, loose matches on Subject: below --
2022-05-16  6:10 Carl Yin(殷张成)
2022-05-16 21:12 ` Reinhard Speyerer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoO06aI15sGRimRo@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=carl.yin@quectel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rspmn@arcor.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.