Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010
@ 2019-11-18 13:32 Daniele Palmas
  2019-11-28 18:12 ` Daniele Palmas
  2019-12-05 14:57 ` Johan Hovold
  0 siblings, 2 replies; 7+ messages in thread
From: Daniele Palmas @ 2019-11-18 13:32 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, Daniele Palmas

Telit FN980 flashing device 0x1bc7/0x9010 requires zero packet
to be sent if out data size is equal to the endpoint max size.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
---
 drivers/usb/serial/option.c   | 8 ++++++++
 drivers/usb/serial/usb-wwan.h | 1 +
 drivers/usb/serial/usb_wwan.c | 9 +++++++++
 3 files changed, 18 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e9491d400a24..c13e063cb399 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -567,6 +567,9 @@ static void option_instat_callback(struct urb *urb);
 /* Interface must have two endpoints */
 #define NUMEP2		BIT(16)
 
+/* Device needs ZLP */
+#define ZLP		BIT(17)
+
 
 static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -1196,6 +1199,8 @@ static const struct usb_device_id option_ids[] = {
 	  .driver_info = NCTRL(0) | RSVD(1) },
 	{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff),	/* Telit LN940 (MBIM) */
 	  .driver_info = NCTRL(0) },
+	{ USB_DEVICE(TELIT_VENDOR_ID, 0x9010),				/* Telit SBL FN980 flashing device */
+	  .driver_info = NCTRL(0) | ZLP },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
 	  .driver_info = RSVD(1) },
@@ -2097,6 +2102,9 @@ static int option_attach(struct usb_serial *serial)
 	if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
 		data->use_send_setup = 1;
 
+	if (device_flags & ZLP)
+		data->use_zlp = 1;
+
 	spin_lock_init(&data->susp_lock);
 
 	usb_set_serial_data(serial, data);
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
index 1c120eaf4091..934e9361cf6b 100644
--- a/drivers/usb/serial/usb-wwan.h
+++ b/drivers/usb/serial/usb-wwan.h
@@ -38,6 +38,7 @@ struct usb_wwan_intf_private {
 	spinlock_t susp_lock;
 	unsigned int suspended:1;
 	unsigned int use_send_setup:1;
+	unsigned int use_zlp:1;
 	int in_flight;
 	unsigned int open_ports;
 	void *private;
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 7e855c87e4f7..8066b5e2d305 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -228,6 +228,15 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
 		} else {
 			intfdata->in_flight++;
 			spin_unlock_irqrestore(&intfdata->susp_lock, flags);
+			if (intfdata->use_zlp) {
+				unsigned int ep_maxp;
+
+				ep_maxp = usb_maxpacket(port->serial->dev,
+							this_urb->pipe, 1);
+
+				if (ep_maxp && (todo % ep_maxp == 0))
+					this_urb->transfer_flags |= URB_ZERO_PACKET;
+			}
 			err = usb_submit_urb(this_urb, GFP_ATOMIC);
 			if (err) {
 				dev_err(&port->dev,
-- 
2.17.1


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

* Re: [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010
  2019-11-18 13:32 [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010 Daniele Palmas
@ 2019-11-28 18:12 ` Daniele Palmas
  2019-11-28 18:18   ` Johan Hovold
  2019-12-05 14:57 ` Johan Hovold
  1 sibling, 1 reply; 7+ messages in thread
From: Daniele Palmas @ 2019-11-28 18:12 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb

Hi Johan,

Il giorno lun 18 nov 2019 alle ore 14:32 Daniele Palmas
<dnlplm@gmail.com> ha scritto:
>
> Telit FN980 flashing device 0x1bc7/0x9010 requires zero packet
> to be sent if out data size is equal to the endpoint max size.
>
> Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
> ---

Just to make sure that this time the patch arrived properly.

Thanks,
Daniele

>  drivers/usb/serial/option.c   | 8 ++++++++
>  drivers/usb/serial/usb-wwan.h | 1 +
>  drivers/usb/serial/usb_wwan.c | 9 +++++++++
>  3 files changed, 18 insertions(+)
>
> diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> index e9491d400a24..c13e063cb399 100644
> --- a/drivers/usb/serial/option.c
> +++ b/drivers/usb/serial/option.c
> @@ -567,6 +567,9 @@ static void option_instat_callback(struct urb *urb);
>  /* Interface must have two endpoints */
>  #define NUMEP2         BIT(16)
>
> +/* Device needs ZLP */
> +#define ZLP            BIT(17)
> +
>
>  static const struct usb_device_id option_ids[] = {
>         { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
> @@ -1196,6 +1199,8 @@ static const struct usb_device_id option_ids[] = {
>           .driver_info = NCTRL(0) | RSVD(1) },
>         { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff),    /* Telit LN940 (MBIM) */
>           .driver_info = NCTRL(0) },
> +       { USB_DEVICE(TELIT_VENDOR_ID, 0x9010),                          /* Telit SBL FN980 flashing device */
> +         .driver_info = NCTRL(0) | ZLP },
>         { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
>         { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
>           .driver_info = RSVD(1) },
> @@ -2097,6 +2102,9 @@ static int option_attach(struct usb_serial *serial)
>         if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
>                 data->use_send_setup = 1;
>
> +       if (device_flags & ZLP)
> +               data->use_zlp = 1;
> +
>         spin_lock_init(&data->susp_lock);
>
>         usb_set_serial_data(serial, data);
> diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
> index 1c120eaf4091..934e9361cf6b 100644
> --- a/drivers/usb/serial/usb-wwan.h
> +++ b/drivers/usb/serial/usb-wwan.h
> @@ -38,6 +38,7 @@ struct usb_wwan_intf_private {
>         spinlock_t susp_lock;
>         unsigned int suspended:1;
>         unsigned int use_send_setup:1;
> +       unsigned int use_zlp:1;
>         int in_flight;
>         unsigned int open_ports;
>         void *private;
> diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
> index 7e855c87e4f7..8066b5e2d305 100644
> --- a/drivers/usb/serial/usb_wwan.c
> +++ b/drivers/usb/serial/usb_wwan.c
> @@ -228,6 +228,15 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
>                 } else {
>                         intfdata->in_flight++;
>                         spin_unlock_irqrestore(&intfdata->susp_lock, flags);
> +                       if (intfdata->use_zlp) {
> +                               unsigned int ep_maxp;
> +
> +                               ep_maxp = usb_maxpacket(port->serial->dev,
> +                                                       this_urb->pipe, 1);
> +
> +                               if (ep_maxp && (todo % ep_maxp == 0))
> +                                       this_urb->transfer_flags |= URB_ZERO_PACKET;
> +                       }
>                         err = usb_submit_urb(this_urb, GFP_ATOMIC);
>                         if (err) {
>                                 dev_err(&port->dev,
> --
> 2.17.1
>

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

* Re: [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010
  2019-11-28 18:12 ` Daniele Palmas
@ 2019-11-28 18:18   ` Johan Hovold
  0 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2019-11-28 18:18 UTC (permalink / raw)
  To: Daniele Palmas; +Cc: Johan Hovold, linux-usb

On Thu, Nov 28, 2019 at 07:12:31PM +0100, Daniele Palmas wrote:
> Hi Johan,
> 
> Il giorno lun 18 nov 2019 alle ore 14:32 Daniele Palmas
> <dnlplm@gmail.com> ha scritto:
> >
> > Telit FN980 flashing device 0x1bc7/0x9010 requires zero packet
> > to be sent if out data size is equal to the endpoint max size.
> >
> > Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
> > ---
> 
> Just to make sure that this time the patch arrived properly.

I got it this time, thanks.

Johan

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

* Re: [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010
  2019-11-18 13:32 [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010 Daniele Palmas
  2019-11-28 18:12 ` Daniele Palmas
@ 2019-12-05 14:57 ` Johan Hovold
  2019-12-05 16:06   ` Daniele Palmas
  1 sibling, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2019-12-05 14:57 UTC (permalink / raw)
  To: Daniele Palmas; +Cc: Johan Hovold, linux-usb

On Mon, Nov 18, 2019 at 02:32:51PM +0100, Daniele Palmas wrote:
> Telit FN980 flashing device 0x1bc7/0x9010 requires zero packet
> to be sent if out data size is equal to the endpoint max size.
> 
> Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
> ---
>  drivers/usb/serial/option.c   | 8 ++++++++
>  drivers/usb/serial/usb-wwan.h | 1 +
>  drivers/usb/serial/usb_wwan.c | 9 +++++++++
>  3 files changed, 18 insertions(+)
> 
> diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> index e9491d400a24..c13e063cb399 100644
> --- a/drivers/usb/serial/option.c
> +++ b/drivers/usb/serial/option.c
> @@ -567,6 +567,9 @@ static void option_instat_callback(struct urb *urb);
>  /* Interface must have two endpoints */
>  #define NUMEP2		BIT(16)
>  
> +/* Device needs ZLP */
> +#define ZLP		BIT(17)
> +
>  
>  static const struct usb_device_id option_ids[] = {
>  	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
> @@ -1196,6 +1199,8 @@ static const struct usb_device_id option_ids[] = {
>  	  .driver_info = NCTRL(0) | RSVD(1) },
>  	{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff),	/* Telit LN940 (MBIM) */
>  	  .driver_info = NCTRL(0) },
> +	{ USB_DEVICE(TELIT_VENDOR_ID, 0x9010),				/* Telit SBL FN980 flashing device */
> +	  .driver_info = NCTRL(0) | ZLP },

Hmm. Could you post the lsusb -v output for this device?

I wonder whether using option is the right thing to do here. We're just
currently throwing everything modem related in here it seems. :)

>  	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
>  	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
>  	  .driver_info = RSVD(1) },
> @@ -2097,6 +2102,9 @@ static int option_attach(struct usb_serial *serial)
>  	if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
>  		data->use_send_setup = 1;
>  
> +	if (device_flags & ZLP)
> +		data->use_zlp = 1;
> +
>  	spin_lock_init(&data->susp_lock);
>  
>  	usb_set_serial_data(serial, data);
> diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
> index 1c120eaf4091..934e9361cf6b 100644
> --- a/drivers/usb/serial/usb-wwan.h
> +++ b/drivers/usb/serial/usb-wwan.h
> @@ -38,6 +38,7 @@ struct usb_wwan_intf_private {
>  	spinlock_t susp_lock;
>  	unsigned int suspended:1;
>  	unsigned int use_send_setup:1;
> +	unsigned int use_zlp:1;
>  	int in_flight;
>  	unsigned int open_ports;
>  	void *private;
> diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
> index 7e855c87e4f7..8066b5e2d305 100644
> --- a/drivers/usb/serial/usb_wwan.c
> +++ b/drivers/usb/serial/usb_wwan.c
> @@ -228,6 +228,15 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
>  		} else {
>  			intfdata->in_flight++;
>  			spin_unlock_irqrestore(&intfdata->susp_lock, flags);
> +			if (intfdata->use_zlp) {
> +				unsigned int ep_maxp;
> +
> +				ep_maxp = usb_maxpacket(port->serial->dev,
> +							this_urb->pipe, 1);
> +
> +				if (ep_maxp && (todo % ep_maxp == 0))
> +					this_urb->transfer_flags |= URB_ZERO_PACKET;

No need to do the transfer_length calculations here, the host-controller
driver will take care of that. Just set URB_ZERO_PACKET unconditionally
if the device requires it.

> +			}
>  			err = usb_submit_urb(this_urb, GFP_ATOMIC);
>  			if (err) {
>  				dev_err(&port->dev,

Johan

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

* Re: [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010
  2019-12-05 14:57 ` Johan Hovold
@ 2019-12-05 16:06   ` Daniele Palmas
  2019-12-06 15:43     ` Johan Hovold
  0 siblings, 1 reply; 7+ messages in thread
From: Daniele Palmas @ 2019-12-05 16:06 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb

Il giorno gio 5 dic 2019 alle ore 15:57 Johan Hovold
<johan@kernel.org> ha scritto:
>
> On Mon, Nov 18, 2019 at 02:32:51PM +0100, Daniele Palmas wrote:
> > Telit FN980 flashing device 0x1bc7/0x9010 requires zero packet
> > to be sent if out data size is equal to the endpoint max size.
> >
> > Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
> > ---
> >  drivers/usb/serial/option.c   | 8 ++++++++
> >  drivers/usb/serial/usb-wwan.h | 1 +
> >  drivers/usb/serial/usb_wwan.c | 9 +++++++++
> >  3 files changed, 18 insertions(+)
> >
> > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > index e9491d400a24..c13e063cb399 100644
> > --- a/drivers/usb/serial/option.c
> > +++ b/drivers/usb/serial/option.c
> > @@ -567,6 +567,9 @@ static void option_instat_callback(struct urb *urb);
> >  /* Interface must have two endpoints */
> >  #define NUMEP2               BIT(16)
> >
> > +/* Device needs ZLP */
> > +#define ZLP          BIT(17)
> > +
> >
> >  static const struct usb_device_id option_ids[] = {
> >       { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
> > @@ -1196,6 +1199,8 @@ static const struct usb_device_id option_ids[] = {
> >         .driver_info = NCTRL(0) | RSVD(1) },
> >       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff),    /* Telit LN940 (MBIM) */
> >         .driver_info = NCTRL(0) },
> > +     { USB_DEVICE(TELIT_VENDOR_ID, 0x9010),                          /* Telit SBL FN980 flashing device */
> > +       .driver_info = NCTRL(0) | ZLP },
>
> Hmm. Could you post the lsusb -v output for this device?
>

Bus 003 Device 004: ID 1bc7:9010 Telit Wireless Solutions
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x1bc7 Telit Wireless Solutions
  idProduct          0x9010
  bcdDevice            0.00
  iManufacturer           1 Telit Wireless Solutions
  iProduct                2 FN980m
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol     16
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength           42
  bNumDeviceCaps          3
  ** UNRECOGNIZED:  14 10 0a 00 01 00 00 00 00 11 00 00 30 40 0a 00 b0 40 0a 00
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat        2047 micro seconds
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      Link Power Management (LPM) Supported
Device Status:     0x0000
  (Bus Powered)

> I wonder whether using option is the right thing to do here. We're just
> currently throwing everything modem related in here it seems. :)
>

I understand your concern. At first, in fact, I tried to add support
for this in usb-serial-simple, but the change seemed to me more
impacting than the one I had to do for adding support in option.

Let me know if you want me to continue investigating the
usb-serial-simple way or you have another advice.

> >       { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
> >       { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
> >         .driver_info = RSVD(1) },
> > @@ -2097,6 +2102,9 @@ static int option_attach(struct usb_serial *serial)
> >       if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
> >               data->use_send_setup = 1;
> >
> > +     if (device_flags & ZLP)
> > +             data->use_zlp = 1;
> > +
> >       spin_lock_init(&data->susp_lock);
> >
> >       usb_set_serial_data(serial, data);
> > diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
> > index 1c120eaf4091..934e9361cf6b 100644
> > --- a/drivers/usb/serial/usb-wwan.h
> > +++ b/drivers/usb/serial/usb-wwan.h
> > @@ -38,6 +38,7 @@ struct usb_wwan_intf_private {
> >       spinlock_t susp_lock;
> >       unsigned int suspended:1;
> >       unsigned int use_send_setup:1;
> > +     unsigned int use_zlp:1;
> >       int in_flight;
> >       unsigned int open_ports;
> >       void *private;
> > diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
> > index 7e855c87e4f7..8066b5e2d305 100644
> > --- a/drivers/usb/serial/usb_wwan.c
> > +++ b/drivers/usb/serial/usb_wwan.c
> > @@ -228,6 +228,15 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
> >               } else {
> >                       intfdata->in_flight++;
> >                       spin_unlock_irqrestore(&intfdata->susp_lock, flags);
> > +                     if (intfdata->use_zlp) {
> > +                             unsigned int ep_maxp;
> > +
> > +                             ep_maxp = usb_maxpacket(port->serial->dev,
> > +                                                     this_urb->pipe, 1);
> > +
> > +                             if (ep_maxp && (todo % ep_maxp == 0))
> > +                                     this_urb->transfer_flags |= URB_ZERO_PACKET;
>
> No need to do the transfer_length calculations here, the host-controller
> driver will take care of that. Just set URB_ZERO_PACKET unconditionally
> if the device requires it.
>

Understood.

Thanks,
Daniele

> > +                     }
> >                       err = usb_submit_urb(this_urb, GFP_ATOMIC);
> >                       if (err) {
> >                               dev_err(&port->dev,
>
> Johan

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

* Re: [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010
  2019-12-05 16:06   ` Daniele Palmas
@ 2019-12-06 15:43     ` Johan Hovold
  2019-12-06 15:56       ` Daniele Palmas
  0 siblings, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2019-12-06 15:43 UTC (permalink / raw)
  To: Daniele Palmas; +Cc: Johan Hovold, linux-usb

On Thu, Dec 05, 2019 at 05:06:59PM +0100, Daniele Palmas wrote:
> Il giorno gio 5 dic 2019 alle ore 15:57 Johan Hovold
> <johan@kernel.org> ha scritto:
> >
> > On Mon, Nov 18, 2019 at 02:32:51PM +0100, Daniele Palmas wrote:
> > > Telit FN980 flashing device 0x1bc7/0x9010 requires zero packet
> > > to be sent if out data size is equal to the endpoint max size.
> > >
> > > Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
> > > ---
> > >  drivers/usb/serial/option.c   | 8 ++++++++
> > >  drivers/usb/serial/usb-wwan.h | 1 +
> > >  drivers/usb/serial/usb_wwan.c | 9 +++++++++
> > >  3 files changed, 18 insertions(+)
> > >
> > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > > index e9491d400a24..c13e063cb399 100644
> > > --- a/drivers/usb/serial/option.c
> > > +++ b/drivers/usb/serial/option.c
> > > @@ -567,6 +567,9 @@ static void option_instat_callback(struct urb *urb);
> > >  /* Interface must have two endpoints */
> > >  #define NUMEP2               BIT(16)
> > >
> > > +/* Device needs ZLP */
> > > +#define ZLP          BIT(17)
> > > +
> > >
> > >  static const struct usb_device_id option_ids[] = {
> > >       { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
> > > @@ -1196,6 +1199,8 @@ static const struct usb_device_id option_ids[] = {
> > >         .driver_info = NCTRL(0) | RSVD(1) },
> > >       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff),    /* Telit LN940 (MBIM) */
> > >         .driver_info = NCTRL(0) },
> > > +     { USB_DEVICE(TELIT_VENDOR_ID, 0x9010),                          /* Telit SBL FN980 flashing device */
> > > +       .driver_info = NCTRL(0) | ZLP },
> >
> > Hmm. Could you post the lsusb -v output for this device?
> >
> 
> Bus 003 Device 004: ID 1bc7:9010 Telit Wireless Solutions
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.10
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0        64
>   idVendor           0x1bc7 Telit Wireless Solutions
>   idProduct          0x9010
>   bcdDevice            0.00
>   iManufacturer           1 Telit Wireless Solutions
>   iProduct                2 FN980m
>   iSerial                 0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           32
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower                2mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass    255 Vendor Specific Subclass
>       bInterfaceProtocol     16
>       iInterface              0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x01  EP 1 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
> Binary Object Store Descriptor:
>   bLength                 5
>   bDescriptorType        15
>   wTotalLength           42
>   bNumDeviceCaps          3
>   ** UNRECOGNIZED:  14 10 0a 00 01 00 00 00 00 11 00 00 30 40 0a 00 b0 40 0a 00
>   SuperSpeed USB Device Capability:
>     bLength                10
>     bDescriptorType        16
>     bDevCapabilityType      3
>     bmAttributes         0x00
>     wSpeedsSupported   0x000e
>       Device can operate at Full Speed (12Mbps)
>       Device can operate at High Speed (480Mbps)
>       Device can operate at SuperSpeed (5Gbps)
>     bFunctionalitySupport   1
>       Lowest fully-functional device speed is Full Speed (12Mbps)
>     bU1DevExitLat          10 micro seconds
>     bU2DevExitLat        2047 micro seconds
>   USB 2.0 Extension Device Capability:
>     bLength                 7
>     bDescriptorType        16
>     bDevCapabilityType      2
>     bmAttributes   0x00000002
>       Link Power Management (LPM) Supported
> Device Status:     0x0000
>   (Bus Powered)
> 
> > I wonder whether using option is the right thing to do here. We're just
> > currently throwing everything modem related in here it seems. :)
> >
> 
> I understand your concern. At first, in fact, I tried to add support
> for this in usb-serial-simple, but the change seemed to me more
> impacting than the one I had to do for adding support in option.
> 
> Let me know if you want me to continue investigating the
> usb-serial-simple way or you have another advice.

Yeah, I was thinking along those lines as well. Let me get me get back
to you on that.

Johan

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

* Re: [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010
  2019-12-06 15:43     ` Johan Hovold
@ 2019-12-06 15:56       ` Daniele Palmas
  0 siblings, 0 replies; 7+ messages in thread
From: Daniele Palmas @ 2019-12-06 15:56 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb

Il giorno ven 6 dic 2019 alle ore 16:43 Johan Hovold
<johan@kernel.org> ha scritto:
>
> >
> > > I wonder whether using option is the right thing to do here. We're just
> > > currently throwing everything modem related in here it seems. :)
> > >
> >
> > I understand your concern. At first, in fact, I tried to add support
> > for this in usb-serial-simple, but the change seemed to me more
> > impacting than the one I had to do for adding support in option.
> >
> > Let me know if you want me to continue investigating the
> > usb-serial-simple way or you have another advice.
>
> Yeah, I was thinking along those lines as well. Let me get me get back
> to you on that.
>

Ok, thanks, I'll wait for your thoughts on that before submitting V3
for the current patch.

Regards,
Daniele

> Johan

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 13:32 [PATCH RESEND 1/1] usb: serial: option: add ZLP support for 0x1bc7/0x9010 Daniele Palmas
2019-11-28 18:12 ` Daniele Palmas
2019-11-28 18:18   ` Johan Hovold
2019-12-05 14:57 ` Johan Hovold
2019-12-05 16:06   ` Daniele Palmas
2019-12-06 15:43     ` Johan Hovold
2019-12-06 15:56       ` Daniele Palmas

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git