Skip to contentSkip to conversation

Add Qualcomm Gobi 2000 driver.

PATCH Superseded Elly Jones 5 participants 11 messages Oct 6, 2010 – Oct 15, 2010 1 message not in the archive

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Elly Jones

author
#0 lore raw

PATCH v2 1/1 Add Qualcomm Gobi 2000 driver.

From: Elizabeth Jones <[email protected]>

This driver is a rewrite of the original Qualcomm GPL driver, released as part of Qualcomm's "Code Aurora" initiative. The driver has been transformed into Linux kernel style and made to use kernel APIs where appropriate; some bugs have also been fixed. Note that the device in question requires firmware and a firmware loader; the latter has been written by mjg (see
http://www.codon.org.uk/~mjg59/gobi_loader/).

Special thanks go to Joe Perches <[email protected]> for major cleanup.

---
 drivers/net/usb/Kconfig          |    6 +
 drivers/net/usb/Makefile         |    2 +-
 drivers/net/usb/gobi/Makefile    |    2 +
 drivers/net/usb/gobi/README      |   30 +
 drivers/net/usb/gobi/qcusbnet.c  |  649 ++++++++++++++++
 drivers/net/usb/gobi/qcusbnet.h  |   24 +
 drivers/net/usb/gobi/qmi.c       |  358 +++++++++
 drivers/net/usb/gobi/qmi.h       |   67 ++
 drivers/net/usb/gobi/qmidevice.c | 1590 ++++++++++++++++++++++++++++++++++++++
 drivers/net/usb/gobi/qmidevice.h |   35 +
 drivers/net/usb/gobi/structs.h   |   92 +++
 11 files changed, 2854 insertions(+), 1 deletions(-)
 create mode 100755 drivers/net/usb/gobi/Makefile
 create mode 100755 drivers/net/usb/gobi/README
 create mode 100644 drivers/net/usb/gobi/qcusbnet.c
 create mode 100644 drivers/net/usb/gobi/qcusbnet.h
 create mode 100755 drivers/net/usb/gobi/qmi.c
 create mode 100755 drivers/net/usb/gobi/qmi.h
 create mode 100755 drivers/net/usb/gobi/qmidevice.c
 create mode 100755 drivers/net/usb/gobi/qmidevice.h
 create mode 100755 drivers/net/usb/gobi/structs.h
drivers/net/usb/Kconfig +6 -0
index d7b7018..8a210d9 100644
@@ -406,4 +406,10 @@ config USB_SIERRA_NET
 	  To compile this driver as a module, choose M here: the
 	  module will be called sierra_net.
 
+config USB_NET_GOBI
+	tristate "Qualcomm Gobi"
+	depends on USB_USBNET
+	help
+	  Choose this option if you have a Qualcomm Gobi 2000 cellular modem.
+
 endmenu
drivers/net/usb/Makefile +1 -1
index b13a279..c80e037 100644
@@ -25,4 +25,4 @@ obj-$(CONFIG_USB_NET_INT51X1)	+= int51x1.o
 obj-$(CONFIG_USB_CDC_PHONET)	+= cdc-phonet.o
 obj-$(CONFIG_USB_IPHETH)	+= ipheth.o
 obj-$(CONFIG_USB_SIERRA_NET)	+= sierra_net.o
-
+obj-$(CONFIG_USB_NET_GOBI)      += gobi/
drivers/net/usb/gobi/Makefile new file +2 -0
new file mode 100755
index 0000000..a6635f6
@@ -0,0 +1,2 @@
+obj-$(CONFIG_USB_NET_GOBI) += gobi.o
+gobi-objs += qcusbnet.o qmidevice.o qmi.o
drivers/net/usb/gobi/README new file +30 -0
new file mode 100755
index 0000000..113c523
@@ -0,0 +1,30 @@
+Qualcomm Gobi 2000 driver
+-------------------------
+
+This directory contains a driver for the Qualcomm Gobi 2000 CDMA/GSM modem. The
+device speaks a protocol called QMI with its host; this driver's responsibility
+is to multiplex transactions over QMI connections. Note that the relatively
+simple encoding defined in qmi.h and qmi.c is only the encapsulating protocol;
+the device speaks a more complex set of protocols embodied in the closed-source
+Gobi SDK which are necessary to use advanced features of the device.
+Furthermore, firmware (also proprietary) is needed to make the device useful. An
+open-source firmware loader exists: http://www.codon.org.uk/~mjg59/gobi_loader/.
+
+Interfaces:
+This driver presents two separate interfaces to userspace:
+- usbN, an ordinary usb network interface
+- /dev/qcqmiN, a channel to speak to the device using QMI messages
+The latter is for use by the Gobi SDK.
+
+History:
+This driver's original incarnation (of which this is a rewrite) was released
+under GPLv2 by Qualcomm on their Code Aurora site:
+https://www.codeaurora.org/gitweb/quic/la/?p=kernel/msm.git;a=commit;h=b5135a880f8942f990e8c2e383f7f876beacc55b
+
+Issues:
+Help and commentary on any of the issues below would be appreciated.
+- The locking in devqmi_close() is not threadsafe: we're walking a list of tasks
+  without holding a lock on the list. The original driver did this and I have
+  left it intact because I do not fully understand what's going on here.
+- The driver seems to deadlock very occasionally (one in ~6000 reboots during
+  stress testing). I've had no luck tracking this problem down.
drivers/net/usb/gobi/qcusbnet.c new file +649 -0

649 lines not on this page · raw message

drivers/net/usb/gobi/qcusbnet.h new file +24 -0
new file mode 100644
index 0000000..2f20868
@@ -0,0 +1,24 @@
+/* qcusbnet.h - gobi network device header
+ * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef QCUSBNET_QCUSBNET_H
+#define QCUSBNET_QCUSBNET_H
+
+extern int qc_suspend(struct usb_interface *iface, pm_message_t event);
+
+#endif /* !QCUSBNET_QCUSBNET_H */
drivers/net/usb/gobi/qmi.c new file +358 -0

358 lines not on this page · raw message

drivers/net/usb/gobi/qmi.h new file +67 -0

67 lines not on this page · raw message

drivers/net/usb/gobi/qmidevice.c new file +1590 -0

1,590 lines not on this page · raw message

drivers/net/usb/gobi/qmidevice.h new file +35 -0
new file mode 100755
index 0000000..5274a0d
@@ -0,0 +1,35 @@
+/* qmidevice.h - gobi QMI device header
+ * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef QCUSBNET_QMIDEVICE_H
+#define QCUSBNET_QMIDEVICE_H
+
+#include "structs.h"
+#include "qmi.h"
+
+void qc_setdown(struct qcusbnet *dev, u8 reason);
+void qc_cleardown(struct qcusbnet *dev, u8 reason);
+bool qc_isdown(struct qcusbnet *dev, u8 reason);
+
+int qc_startread(struct qcusbnet *dev);
+void qc_stopread(struct qcusbnet *dev);
+
+int qc_register(struct qcusbnet *dev);
+void qc_deregister(struct qcusbnet *dev);
+
+#endif /* !QCUSBNET_QMIDEVICE_H */
drivers/net/usb/gobi/structs.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw
Quoted 3 lines · Elly Jones

From: Elizabeth Jones <[email protected]>

 create mode 100644 drivers/net/usb/gobi/qcusbnet.h
 create mode 100755 drivers/net/usb/gobi/qmi.c

I believe all files should be 644.

maintainer
#2 lore raw
In reply to Elly Jones

From: Elly Jones <[email protected]>
Date: Wed, 6 Oct 2010 11:12:09 -0400

Quoted 9 lines

From: Elizabeth Jones <[email protected]>

This driver is a rewrite of the original Qualcomm GPL driver, released as part of Qualcomm's "Code Aurora" initiative. The driver has been transformed into Linux kernel style and made to use kernel APIs where appropriate; some bugs have also been fixed. Note that the device in question requires firmware and a firmware loader; the latter has been written by mjg (see
http://www.codon.org.uk/~mjg59/gobi_loader/).

Quoted 4 lines

Special thanks go to Joe Perches <[email protected]> for major cleanup.

I really think the firmware handling belongs in the kernel.

I've looked at the gobi_loader code and it's simpler than many of the gigabit ethernet driver firmware loader sequences in the tree already.

Requiring udev et al. magic only makes this networking device that much harder to use from an initrd.

I understand how this might be a bit clumsy since we'd need to make a dependency on the serial device since that is the mechanism by which the firmware is uploaded, but really I'd like you to consider it seriously.

#3 lore raw
Quoted 11 lines · David Miller

I've looked at the gobi_loader code and it's simpler than many of the gigabit ethernet driver firmware loader sequences in the tree already.

Requiring udev et al. magic only makes this networking device that much harder to use from an initrd.

I understand how this might be a bit clumsy since we'd need to make a dependency on the serial device since that is the mechanism by which the firmware is uploaded, but really I'd like you to consider it seriously.

The device is capable of functioning in either UMTS or CDMA modes, and requires different firmware for each. Further, there's separate firmware images per carrier due to regulatory differences. To make things even more complicated, there's no consistency in the naming of the firmware (and we can't fix that, because the firmware is undistributable). The only way to do this in-kernel would seem to be to have a module parameter to pass a firmware name, which really doesn't seem elegant.

Signature · 1 line
Matthew Garrett | [email protected]
maintainer
#4 lore raw

From: Matthew Garrett <[email protected]>
Date: Fri, 8 Oct 2010 19:03:10 +0100

Quoted 14 lines · David Miller
Quoted 5 lines

I've looked at the gobi_loader code and it's simpler than many of the gigabit ethernet driver firmware loader sequences in the tree already.

Quoted 7 lines

Requiring udev et al. magic only makes this networking device that much harder to use from an initrd.

I understand how this might be a bit clumsy since we'd need to make a dependency on the serial device since that is the mechanism by which the firmware is uploaded, but really I'd like you to consider it seriously.

Quoted 7 lines

The device is capable of functioning in either UMTS or CDMA modes, and requires different firmware for each. Further, there's separate firmware images per carrier due to regulatory differences. To make things even more complicated, there's no consistency in the naming of the firmware (and we can't fix that, because the firmware is undistributable). The only way to do this in-kernel would seem to be to have a module parameter to pass a firmware name, which really doesn't seem elegant.

I don't think we want a driver in the tree for a device for which the firmware isn't even distributable.

#5 lore raw
Quoted 2 lines · David Miller

I don't think we want a driver in the tree for a device for which the firmware isn't even distributable.

Greg didn't seem to think this was a problem when he merged the serial driver.

Signature · 1 line
Matthew Garrett | [email protected]
maintainer
#6 lore raw

From: Matthew Garrett <[email protected]>
Date: Fri, 8 Oct 2010 19:18:51 +0100

Quoted 7 lines · David Miller
Quoted 3 lines

I don't think we want a driver in the tree for a device for which the firmware isn't even distributable.

Greg didn't seem to think this was a problem when he merged the serial driver.

That's Greg's problem.

I don't see how any distribution can properly support this device if it cannot work without non-distributable firmware.

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#8 lore raw
#9 lore raw

David,

Yes, your concern is valid. A distribution would have trouble supporting this out of the box unless they negotiated with Qualcomm. I believe that many years ago we had a similar situation with WiFi devices and firmware.

I think the right thing to do is to encourage vendors to allow redistribution of their firmware by showing them that the firmware is already freely available on other platforms.

-Jason

Quoted 16 lines · David Miller

From: Jason Glasgow <[email protected]>
Date: Fri, 8 Oct 2010 11:59:19 -0700

Quoted 7 lines

Firmware is available in Windows packages.  For example,

DW5620 Mobile Broadband mini-card
http://support.dell.com/support/downloads/download.aspx?c=us&cs=2684&l=en&s=pub&releaseid=R275082&SystemID=Lat_13&servicetag=4PLG5L1&os=W732&osl=en&deviceid=21977&devlib=0&typecnt=0&vercnt=2&catid=-1&impid=-1&formatcnt=0&libid=20&typeid=-1&dateid=-1&formatid=-1&source=-1&fileid=406043

<http://support.dell.com/support/downloads/download.aspx?c=us&cs=2684&l=en&s=pub&releaseid=R275082&SystemID=Lat_13&servicetag=4PLG5L1&os=W732&osl=en&deviceid=21977&devlib=0&typecnt=0&vercnt=2&catid=-1&impid=-1&formatcnt=0&libid=20&typeid=-1&dateid=-1&formatid=-1&source=-1&fileid=406043>The
problem is  that the firmware is non-redistributable, not non-distributable.

So address my concern, how could a distribution support this device out of the box?

I don't think it's possible.

#10 lore raw
In reply to David Miller
Quoted 2 lines · David Miller

I don't see how any distribution can properly support this device if it cannot work without non-distributable firmware.

Individual vendors may negotiate redistribution agreements with Qualcomm. We've carried drivers without redistributable firmware in the past (b43 had none for some time), so I don't see that we have any clear and established position on this.

Signature · 1 line
Matthew Garrett | [email protected]
author
#11 lore raw
In reply to David Miller
Quoted 23 lines · David Miller

From: Elly Jones <[email protected]>
Date: Wed, 6 Oct 2010 11:12:09 -0400

Quoted 9 lines

From: Elizabeth Jones <[email protected]>

This driver is a rewrite of the original Qualcomm GPL driver, released as part of Qualcomm's "Code Aurora" initiative. The driver has been transformed into Linux kernel style and made to use kernel APIs where appropriate; some bugs have also been fixed. Note that the device in question requires firmware and a firmware loader; the latter has been written by mjg (see
http://www.codon.org.uk/~mjg59/gobi_loader/).

Quoted 4 lines

Special thanks go to Joe Perches <[email protected]> for major cleanup.

I really think the firmware handling belongs in the kernel.

I've looked at the gobi_loader code and it's simpler than many of the gigabit ethernet driver firmware loader sequences in the tree already.

Quoted 7 lines

Requiring udev et al. magic only makes this networking device that much harder to use from an initrd.

I understand how this might be a bit clumsy since we'd need to make a dependency on the serial device since that is the mechanism by which the firmware is uploaded, but really I'd like you to consider it seriously.

Just to respond definitively to this: I believe the reasons mjg59 brought up are valid and I will not try to put a firmware loader for this device in kernel space. Additionally, Google could not in good conscience produce such a firmware loader, as we have access to Qualcomm's closed-source firmware loader. Expect a v3 of this patch shortly to address Joe Perches' concerns.

-- Elly