* [PATCH 0/1] NET: usb: cdc_mbim: add quirk for supporting Telit LE922A
@ 2016-12-07 13:07 Daniele Palmas
[not found] ` <1481116068-32691-1-git-send-email-dnlplm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-08 18:02 ` [PATCH 0/1] " David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Daniele Palmas @ 2016-12-07 13:07 UTC (permalink / raw)
To: Bjørn Mork, Oliver Neukum; +Cc: netdev, linux-usb, Daniele Palmas
Telit LE922A MBIM based composition does not work properly
with altsetting toggle done in cdc_ncm_bind_common.
This patch adds CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE quirk
to avoid this procedure that, instead, is mandatory for
other modems.
References:
https://www.spinics.net/lists/linux-usb/msg149249.html
https://www.spinics.net/lists/linux-usb/msg149819.html
Thanks to Bjørn for the productive discussion and feedback!
Daniele Palmas (1):
NET: usb: cdc_mbim: add quirk for supporting Telit LE922A
drivers/net/usb/cdc_mbim.c | 21 +++++++++++++++++++++
drivers/net/usb/cdc_ncm.c | 14 +++++++++-----
include/linux/usb/cdc_ncm.h | 3 ++-
3 files changed, 32 insertions(+), 6 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] NET: usb: cdc_mbim: add quirk for supporting Telit LE922A
[not found] ` <1481116068-32691-1-git-send-email-dnlplm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-12-07 13:07 ` Daniele Palmas
2016-12-07 14:27 ` Bjørn Mork
0 siblings, 1 reply; 4+ messages in thread
From: Daniele Palmas @ 2016-12-07 13:07 UTC (permalink / raw)
To: Bjørn Mork, Oliver Neukum
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
Daniele Palmas
Telit LE922A MBIM based composition does not work properly
with altsetting toggle done in cdc_ncm_bind_common.
This patch adds CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE quirk
to avoid this procedure that, instead, is mandatory for
other modems.
Signed-off-by: Daniele Palmas <dnlplm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/net/usb/cdc_mbim.c | 21 +++++++++++++++++++++
drivers/net/usb/cdc_ncm.c | 14 +++++++++-----
include/linux/usb/cdc_ncm.h | 3 ++-
3 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 96a5028..3a98f37 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -602,6 +602,21 @@ static const struct driver_info cdc_mbim_info_ndp_to_end = {
.data = CDC_NCM_FLAG_NDP_TO_END,
};
+/* Some modems (e.g. Telit LE922A6) do not work properly with altsetting
+ * toggle done in cdc_ncm_bind_common. CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE
+ * flag is used to avoid this procedure.
+ */
+static const struct driver_info cdc_mbim_info_avoid_altsetting_toggle = {
+ .description = "CDC MBIM",
+ .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN,
+ .bind = cdc_mbim_bind,
+ .unbind = cdc_mbim_unbind,
+ .manage_power = cdc_mbim_manage_power,
+ .rx_fixup = cdc_mbim_rx_fixup,
+ .tx_fixup = cdc_mbim_tx_fixup,
+ .data = CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE,
+};
+
static const struct usb_device_id mbim_devs[] = {
/* This duplicate NCM entry is intentional. MBIM devices can
* be disguised as NCM by default, and this is necessary to
@@ -626,6 +641,12 @@ static const struct usb_device_id mbim_devs[] = {
{ USB_VENDOR_AND_INTERFACE_INFO(0x12d1, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
.driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end,
},
+
+ /* Telit LE922A6 in MBIM composition */
+ { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1041, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
+ .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle,
+ },
+
/* default entry */
{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
.driver_info = (unsigned long)&cdc_mbim_info_zlp,
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 877c951..afbfc0f 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -839,11 +839,18 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
+ /* Device-specific flags */
+ ctx->drvflags = drvflags;
+
/* Reset data interface. Some devices will not reset properly
* unless they are configured first. Toggle the altsetting to
- * force a reset
+ * force a reset.
+ * Some other devices do not work properly with this procedure
+ * that can be avoided using quirk CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE
*/
- usb_set_interface(dev->udev, iface_no, data_altsetting);
+ if (!(ctx->drvflags & CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE))
+ 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");
@@ -890,9 +897,6 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
/* finish setting up the device specific data */
cdc_ncm_setup(dev);
- /* Device-specific flags */
- ctx->drvflags = drvflags;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] NET: usb: cdc_mbim: add quirk for supporting Telit LE922A
2016-12-07 13:07 ` [PATCH 1/1] " Daniele Palmas
@ 2016-12-07 14:27 ` Bjørn Mork
0 siblings, 0 replies; 4+ messages in thread
From: Bjørn Mork @ 2016-12-07 14:27 UTC (permalink / raw)
To: Daniele Palmas; +Cc: Oliver Neukum, netdev, linux-usb
Daniele Palmas <dnlplm@gmail.com> writes:
> Telit LE922A MBIM based composition does not work properly
> with altsetting toggle done in cdc_ncm_bind_common.
>
> This patch adds CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE quirk
> to avoid this procedure that, instead, is mandatory for
> other modems.
>
> Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
Thanks. This looks as nice as we can possibly do for now. I am happy
to add
Reviewed-by: Bjørn Mork <bjorn@mork.no>
This patch also helped me understanding the problem you face even
better: It's not the "set_altsetting 0" that's causing problems, but the
"set_altsetting X" prior to that. And that is certainly not something
that a firmware should expect. I will look at the Huawei modem again
when I get some time and see if there is any way we can possibly avoid
it.
Bjørn
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/1] NET: usb: cdc_mbim: add quirk for supporting Telit LE922A
2016-12-07 13:07 [PATCH 0/1] NET: usb: cdc_mbim: add quirk for supporting Telit LE922A Daniele Palmas
[not found] ` <1481116068-32691-1-git-send-email-dnlplm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-12-08 18:02 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-12-08 18:02 UTC (permalink / raw)
To: dnlplm; +Cc: bjorn, oliver, netdev, linux-usb
From: Daniele Palmas <dnlplm@gmail.com>
Date: Wed, 7 Dec 2016 14:07:47 +0100
> Telit LE922A MBIM based composition does not work properly
> with altsetting toggle done in cdc_ncm_bind_common.
>
> This patch adds CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE quirk
> to avoid this procedure that, instead, is mandatory for
> other modems.
>
> References:
> https://www.spinics.net/lists/linux-usb/msg149249.html
> https://www.spinics.net/lists/linux-usb/msg149819.html
>
> Thanks to Bjørn for the productive discussion and feedback!
Patch applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-08 18:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 13:07 [PATCH 0/1] NET: usb: cdc_mbim: add quirk for supporting Telit LE922A Daniele Palmas
[not found] ` <1481116068-32691-1-git-send-email-dnlplm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-07 13:07 ` [PATCH 1/1] " Daniele Palmas
2016-12-07 14:27 ` Bjørn Mork
2016-12-08 18:02 ` [PATCH 0/1] " 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).