* [PATCH net,stable] cdc_ncm: toggle altsetting to force reset before setup
@ 2016-03-03 21:20 Bjørn Mork
2016-03-07 19:38 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Bjørn Mork @ 2016-03-03 21:20 UTC (permalink / raw)
To: Oliver Neukum
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
Bjørn Mork
Some devices will silently fail setup unless they are reset first.
This is necessary even if the data interface is already in
altsetting 0, which it will be when the device is probed for the
first time. Briefly toggling the altsetting forces a function
reset regardless of the initial state.
This fixes a setup problem observed on a number of Huawei devices,
appearing to operate in NTB-32 mode even if we explicitly set them
to NTB-16 mode.
Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
---
drivers/net/usb/cdc_ncm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index dc0212c3cc28..be927964375b 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -837,7 +837,11 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
- /* reset data interface */
+ /* Reset data interface. Some devices will not reset properly
+ * unless they are configured first. Toggle the altsetting to
+ * force a reset
+ */
+ usb_set_interface(dev->udev, iface_no, data_altsetting);
temp = usb_set_interface(dev->udev, iface_no, 0);
if (temp) {
dev_dbg(&intf->dev, "set interface failed\n");
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net,stable] cdc_ncm: toggle altsetting to force reset before setup
2016-03-03 21:20 [PATCH net,stable] cdc_ncm: toggle altsetting to force reset before setup Bjørn Mork
@ 2016-03-07 19:38 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-03-07 19:38 UTC (permalink / raw)
To: bjorn; +Cc: oliver, netdev, linux-usb
From: Bjørn Mork <bjorn@mork.no>
Date: Thu, 3 Mar 2016 22:20:53 +0100
> Some devices will silently fail setup unless they are reset first.
> This is necessary even if the data interface is already in
> altsetting 0, which it will be when the device is probed for the
> first time. Briefly toggling the altsetting forces a function
> reset regardless of the initial state.
>
> This fixes a setup problem observed on a number of Huawei devices,
> appearing to operate in NTB-32 mode even if we explicitly set them
> to NTB-16 mode.
>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-07 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-03 21:20 [PATCH net,stable] cdc_ncm: toggle altsetting to force reset before setup Bjørn Mork
2016-03-07 19:38 ` David Miller
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).