USB subsystem confuses serial devices with ehci controller

Bug #129433 reported by Sergio Callegari
8
Affects Status Importance Assigned to Milestone
linux-source-2.6.22 (Ubuntu)
Fix Released
Low
Tim Gardner

Bug Description

Binary package hint: linux-386

System configuration

DELL Latitude D820 laptop with
Kubuntu Linux Feisty
Kernel Linux version 2.6.20-16-generic (root@terranova) (gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)) #2 SMP Thu Jun 7 20:19:32 UTC 2007

I am trying to use a PCMCIA PC-CARD GPRS/UMTS/UMTS/HSDPA MODEM

PC-CARD is branded as ONDA NH501HS and is extremely popular in Italy since it is the "default" UMTS PC-CARD by the largest provider in the country (Telecom Italia / Tim / Alice).
PC-CARD is actually a re-branded ZTE MF330 so it should be quite popular in other countries as well.
Apparently, also the newer ONDA H600 is again a ZTE MF330, so the following should apply also to that card.

When the card is inserted into the PCMCIA slot, the following should happen:
- kernel should recognize an OHCI Host Controller
- kernel should recognize an ONDA CDMA Technologies MSM (Manufacturer: Qualcomm, Incorporated) attached to it
- kernel should configure 3 ttyUSB devices provided by the 3 serial interfaces of the ONDA MSM

Unfortunately, with the above kernel this does not happen
Rather, the kernel gets confused, detects an EHCI Controller, loads the kernel module for it and no serial interfaces appear.

As an hack, the correct behaviour can be obtained by blacklisting the ehci_hcd for instance in /etc/modprobe.d/blacklist-modem.
When the ehci_hcd is blacklisted everything works correctly and the ONDA Wireless UMTS PC-CARD gets perfectly usable.

I believe that the newer Sierra wireless PC-CARDS have a very similar problem (and probably are also based on a similar Qualcomm chipset).

Please report this upstream, so a proper fix can be introduced in the mainline kernel and the ONDA/ZTE PC-CARDS can be come nicely working under Linux and Ubuntu.

Possibly useful information:
- Linux kernel has already misbehaved on ehci, with blacklisting as quick hack to get the correct behaviour (see for instance bug 21613 on the ubuntu bug archive)
- USB Vendor/Product IDs of the ONDA CDMA Technologies MSM are 05c6/6613
- Some users have suggested adding the above ID couple as:
   { USB_DEVICE(0x05C6, 0x6613) }, /* Onda H600 ZTE MF330 */
in the array
   static struct usb_device_id id_table []
and in the
   static struct usb_device_id id_table_3port []
of the sierra.c file in the kernel sources, but I do not know if this is the correct location since the sierra.c file is meant for sierra's devices and the ONDA/ZTE one is not a sierra PC_CARD (to the best of my knowledge is not even a rebranded one, for instance it has a different AT extended command set).

Revision history for this message
Sergio Callegari (callegar) wrote :

Update:

There are actually 2 independent problems:

1) Problem 1.
Unless ehci_hcd is blacklisted it is impossible to use the USB interfaces on the PC card, regardless of any other patch on sierra.c or whatever.
I do not know the reason for this. Maybe it is tied to the usb suspend problems that are afflicting many usb users.

2) Problem 2.
Probably even after the ehci_hcd thing is fixed one shall need to correct the problems associated with the limited throughput of the usbserial converter. To the best of my knowledge this is due to the fact that the "general" usbserial connector associates too small buffers to the endpoints. Apparently for the ZTE MF330, Onda H600 and H501HS there are two solutions:
- either patch the sierra.c usbserial driver so that the ZTE MF330 and Onda PC CARDS can use it
- or patch the generic usbserial driver with the maxsize patch that is floating on the internet

Probably the sierra.c solution is more elegant. It can work since both the sierra PC CARDS and the ZTE/ONDA ones appear to have a similar qualcomm chipset.

The patch involves adding the vendor/product ID to sierra.c as
{ USB_DEVICE(0x05C6, 0x6613) }, /* Onda H600 ZTE MF330 */
in the array
   static struct usb_device_id id_table []
and in the
   static struct usb_device_id id_table_1port [] // NOTE: this is 1 port, the 3 port in my previous post is wrong.

Revision history for this message
Chuck Short (zulcss) wrote :

Added the patch to my git tree.

Changed in linux-meta:
assignee: nobody → zulcss
Revision history for this message
Tim Gardner (timg-tpi) wrote :

Gutsy commit dee610d11dfdf343182a2f800c0cf0e15f21bd5d

Changed in linux-meta:
assignee: zulcss → timg-tpi
importance: Undecided → Low
status: New → Fix Committed
Revision history for this message
Henrik Nilsen Omma (henrik) wrote :

Moving milestone forward so we remember to test and confirm this fix in tribe 6.

Revision history for this message
Ben Collins (ben-collins) wrote :
Download full text (4.0 KiB)

linux-source-2.6.22 (2.6.22-11.32) gutsy; urgency=low

  [Amit Kucheria]

  * Build system: Allow custom builds to comprise multiple patches
  * Move UME to a Custom build and add first setup of thermal framework

  [Ben Collins]

  * ubuntu: Enable CONFIG_BLK_DEV_IO_TRACE
  * bcm203x: Fix firmware loading
    - LP: #85247
  * ubuntu: mtd changes caused module renaming. Ignore
  * rt: Do not patch top level Makefile for SUBLEVEL. Will always end up
    breaking

  [Chuck Short]

  * [USB] Unusual Device support for Gold MP3 Player Energy
    - LP: #125250
  * [SIERRA] Adds support for Onda H600 ZTE MF330
    - LP: #129433
  * [HDAPS] Add Thinkpad T61P to whitelist.
    - LP: #133636
  * [USB] Add support for Toshiba (Novatel Wireless) HSDPA for M400.
    - LP: #133650

  [Kyle McMartin]

  * apparmor 10.3 hooks
  * unionfs 2.1 hooks
  * nuke UNION_FS stuff from fs/{Kconfig,Makefile}

  [Tim Gardner]

  * Paravirt-ops I/O hypercalls
  * Fix lazy vmalloc bug for Gutsy
  * bluetooth headset patch
    - LP: #130870
  * Add the PCI ID of this ICH4 in list of laptops that use short cables.
  * v2.6.22.5 merge
  * Update Xen config options.
    - LP: #132726
  * Remove mtd modules from ABI
  * Support parallel=<n> in DEB_BUILD_OPTIONS
    - LP: #136426

  [Upstream Kernel Changes]

  * hwmon: fix w83781d temp sensor type setting
  * hwmon: (smsc47m1) restore missing name attribute
  * sky2: restore workarounds for lost interrupts
  * sky2: carrier management
  * sky2: check for more work before leaving NAPI
  * sky2: check drop truncated packets
  * revert "x86, serial: convert legacy COM ports to platform devices"
  * ACPICA: Fixed possible corruption of global GPE list
  * ACPICA: Clear reserved fields for incoming ACPI 1.0 FADTs
  * AVR32: Fix atomic_add_unless() and atomic_sub_unless()
  * r8169: avoid needless NAPI poll scheduling
  * forcedeth: fix random hang in forcedeth driver when using netconsole
  * libata: add ATI SB700 device IDs to AHCI driver
  * Hibernation: do not try to mark invalid PFNs as nosave
  * i386: allow debuggers to access the vsyscall page with compat vDSO
  * x86_64: Check for .cfi_rel_offset in CFI probe
  * x86_64: Change PMDS invocation to single macro
  * i386: Handle P6s without performance counters in nmi watchdog
  * i386: Fix double fault handler
  * JFFS2 locking regression fix.
  * [Input]: appletouch - improve powersaving for Geyser3 devices
  * [Input]: add driver for Fujitsu serial touchscreens
  * [sdhci]: add support to ENE-CB714
  * v2.6.22.5
  * [MTD] Makefile fix for mtdsuper
  * ocfs2: Fix bad source start calculation during kernel writes
  * NET: Share correct feature code between bridging and bonding
  * sky2: don't clear phy power bits
  * uml: fix previous request size limit fix
  * i386: fix lazy mode vmalloc synchronization for paravirt
  * signalfd: fix interaction with posix-timers
  * signalfd: make it group-wide, fix posix-timers scheduling
  * DCCP: Fix DCCP GFP_KERNEL allocation in atomic context
  * IPV6: Fix kernel panic while send SCTP data with IP fragments
  * IPv6: Invalid semicolon after if statement
  * Fix soft-fp underflow handling.
  * Netfilter: Missing Kbuild entry for netfil...

Read more...

Changed in linux-source-2.6.22:
status: Fix Committed → Fix Released
Revision history for this message
Sergio Callegari (callegar) wrote :

Notice that only half of the fix is available in gutsy 2.6.22 kernel.

Problem 1 is still open. The following UMTS PCMCIA card (and I believe also the sister cards Onda H600 and ZTE MF330, plus probably many other cards based on qualcomm chips) cannot be used if the kernel module ehci_hcd is loaded.

ONDA CDMA Technologies MSM
Manufacturer: Qualcomm, Incorporated
Speed: 12Mb/s (full)
USB Version: 1.10
Device Class: 00(>ifc )
Device Subclass: 00
Device Protocol: 00
Maximum Default Endpoint Size: 64
Number of Configurations: 1
Vendor Id: 05c6
Product Id: 6613
Revision Number: 0.00

In other terms one has to chose to have either a high speed link to a USB disk (with ehci_hcd) or to have a UMTS internet connection (with sierra) but not both.

Please check if this has been fixed upstream and backport fix in case. Otherwise please report the problem upstream. Please also consider changing priority from "low" since this bug seriously hinders the possibility of using a wireless UMTS internet connection.

For what concerns problem #2, this is in fact fixed in gutsy 2.6.22 kernel: once ehci_hcd, the UMTS adapter gets correctly managed by the sierra module.

Revision history for this message
Sergio Callegari (callegar) wrote :

Two more notes:

Note 1:
Problem #1 might be just a duplicate of https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/88746.
Apparently just too many people are lamenting the need to disable ehci_hcd to get things working (and obviously these are just a minority: the most will not even know about ehci and will just think that USB is still not well supported in linux and that they'll need to just avoid it given that their USB gadgets cannot be used).

Note 2:
If linux does maybe not yet shine on ehci, sure it shines in the ability to control what is going on.
So there is a very good news. As a workaround, rather than blacklisting ehci_hcd alltogether (that results in the loss of support for USB 2 peripherals), one can just selectively disable it on some hubs.

For instance, in my case, I can

sudo sh -c "echo -n 0000:04:00.2 > /sys/bus/pci/drivers/ehci_hcd/unbind"

and get my umts thing working. In principle it should not be too difficult to do it automatically when the device is detected.

Revision history for this message
Szusz (szusz) wrote :

My configuration:
DELL Latitude D620
Intel Centrino/ Core Duo T2400
1 GB RAM
Ubuntu 7.10 Gutsy with stock 2.6.22-14-generic kernel.

I have tried both, blacklisting ehci_hcd module, disabling it on the hub and unloading it manually. It all didn't work. Ehci_hcd module seems to be reloading automatically each time. For instance taking the card off the laptop, unloading the module, putting it back again gives following dmesg|tail output:

Oct 23 22:12:58 rlaptop kernel: [ 1927.968000] pccard: CardBus card inserted into slot 0
Oct 23 22:12:58 rlaptop kernel: [ 1927.968000] yenta EnE: chaning testregister 0xC9, 04 -> 04
Oct 23 22:12:58 rlaptop kernel: [ 1927.968000] PCI: Enabling device 0000:03:00.0 (0000 -> 0002)
Oct 23 22:12:58 rlaptop kernel: [ 1927.968000] ACPI: PCI Interrupt 0000:03:00.0[A] -> GSI 18 (level, low) -> IRQ 18
Oct 23 22:12:58 rlaptop kernel: [ 1927.968000] ohci_hcd 0000:03:00.0: OHCI Host Controller
Oct 23 22:12:58 rlaptop kernel: [ 1927.968000] ohci_hcd 0000:03:00.0: new USB bus registered, assigned bus number 1
Oct 23 22:12:58 rlaptop kernel: [ 1927.968000] ohci_hcd 0000:03:00.0: irq 18, io mem 0x24000000
Oct 23 22:12:58 rlaptop kernel: [ 1928.528000] usb usb1: configuration #1 chosen from 1 choice
Oct 23 22:12:58 rlaptop kernel: [ 1928.528000] hub 1-0:1.0: USB hub found
Oct 23 22:12:58 rlaptop kernel: [ 1928.528000] hub 1-0:1.0: 2 ports detected
Oct 23 22:13:01 rlaptop kernel: [ 1931.172000] usb 1-2: new full speed USB device using ohci_hcd and address 2
Oct 23 22:13:01 rlaptop kernel: [ 1931.384000] usb 1-2: configuration #1 chosen from 1 choice

But when I then unplug it and replug it ehci_hcd is back on place!

I dodn't try adding the device info to the sierra drive as the card is not being recognized properly yet.

Revision history for this message
Matt LaPaglia (mlapaglia) wrote :

I can confirm this bug is still present in the latest hardy.

modprobe -r ehci_hcd with the drive plugged in makes it succesfully mount (only when the player is in msc mode, not mtp).

running that command and then plugging in the media player doesn't work, ehci_hcd is automatically loaded and takes control.

mtp mode doesn't work, it doesn't mount and rhythmbox crashes when you plug a mtp mode device in.

Revision history for this message
Sergio Callegari (callegar) wrote :

Some news on the USB front:

1) ONDA N501HS, ONDA H600 and ZTE MF330 support is moving away from the sierra driver, towards the option one.
In one sense this is good: I was experiencing locks with the sierra driver, probably due to some flow control incompatibility with the ONDA card.
In some other sense this is bad: with the option driver the bitrate is very poor.

2) for what concerns the ehci_hcd issue, I have a permanent userspace (no kernel patching) udev-based hack for the ONDA N501HS:

Put a file named 50-fix-onda-n501hs.rules in /etc/udev/rules.d with the following content

# udev rule for ONDA N501HS
ACTION=="add", SUBSYSTEM=="pci", \
        ATTRS{vendor}=="0x1131", \
        ATTRS{device}=="0x1562" \
        RUN+="/usr/local/sbin/fix-onda-n501hs %b"

Put a file named fix-onda-n501hs in /usr/local/sbin and give it execute permission. Content should be:

#! /bin/sh

LOGFILE=/var/log/fix-onda-n501hs.log
DELAY=1

pciid=$1

echo $(date): invoked fix-onda >> "$LOGFILE"
echo $(date): pciid: $pciid >> "$LOGFILE"

( sleep $DELAY ; echo -n $pciid > /sys/bus/pci/drivers/ehci_hcd/unbind ; \
  echo $(date): finalized >> "$LOGFILE" ) &

Obviously, you can remove the echo logging stuff if you want, but as is it lets you see if the script was invoked by looking at /var/log/fix-onda-n501hs.log
The script is tied to the ONDA by the vendor and device numbers in the udev rule. I think that they might be the same for the other ONDA and ZTE cards, but I am not that sure.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.