Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 2019 22:43:39 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        Mike Tancsa <mike@sentex.net>, freebsd-usb@FreeBSD.org
Subject:   Re: strange USB timing issue with u3g
Message-ID:  <2476a53c-e223-1c81-165c-73fa884f30da@selasky.org>
In-Reply-To: <3377e001-f035-acec-765c-aee7113f20d4@sentex.net>
References:  <3377e001-f035-acec-765c-aee7113f20d4@sentex.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3/12/19 9:49 PM, Mike Tancsa wrote:
> I have a strange issue I started to see on RELENG11 and RELENG12 that I
> am not sure when it started or if its always been there.  On an
> PCEngines APU3, with an LTE modem that works with the u3g driver, it
> will fail to attach if the box does not boot up fast enough. So I am
> guessing something gets messed up in initialization and timing ?
> 
> e.g. in loader.conf I have
> 
> autoboot_delay=2
> dcons_load="YES"
> amdsbwd_load="YES"
> u3g_load="YES"
> beastie_disable="YES"
> comconsole_speed="115200"
> console="comconsole"
> #hw.usb.debug=1
> 
> 
> If I pause at the boot or make the delay say 10 seconds, the device
> often errors out. The device normally looks like this
> 
> ugen2.1: <AMD EHCI root HUB> at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps)
> pwr=SAVE (0mA)
> ugen1.1: <AMD EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps)
> pwr=SAVE (0mA)
> ugen0.1: <0x1022 XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER
> (5.0Gbps) pwr=SAVE (0mA)
> ugen2.2: <vendor 0x0438 product 0x7900> at usbus2, cfg=0 md=HOST
> spd=HIGH (480Mbps) pwr=SAVE (100mA)
> ugen1.2: <vendor 0x0438 product 0x7900> at usbus1, cfg=0 md=HOST
> spd=HIGH (480Mbps) pwr=SAVE (100mA)
> ugen2.3: <HUAWEI Technology HUAWEI Mobile> at usbus2, cfg=0 md=HOST
> spd=FULL (12Mbps) pwr=ON (500mA)
> 
> ugen2.3: <HUAWEI Technology HUAWEI Mobile> at usbus2, cfg=0 md=HOST
> spd=FULL (12Mbps) pwr=ON (500mA)
> 
>    bLength = 0x0012
>    bDescriptorType = 0x0001
>    bcdUSB = 0x0200
>    bDeviceClass = 0x0000  <Probed by interface class>
>    bDeviceSubClass = 0x0000
>    bDeviceProtocol = 0x0000
>    bMaxPacketSize0 = 0x0040
>    idVendor = 0x12d1
>    idProduct = 0x1573
>    bcdDevice = 0x0228
>    iManufacturer = 0x0002  <HUAWEI Technology>
>    iProduct = 0x0003  <HUAWEI Mobile>
>    iSerialNumber = 0x0004  <0123456712ABCA17>
>    bNumConfigurations = 0x0003
> 
> 
> But about 50% of the time with a longer delay, at bootup time I get
> 
> uhub4: 4 ports with 4 removable, self powered
> usb_alloc_device: set address 3 failed (USB_ERR_STALLED, ignored)
> usbd_setup_device_desc: getting device descriptor at addr 3 failed,
> USB_ERR_STALLED
> usbd_req_re_enumerate: addr=3, set address failed! (USB_ERR_STALLED,
> ignored)
> usbd_setup_device_desc: getting device descriptor at addr 3 failed,
> USB_ERR_STALLED
> usbd_req_re_enumerate: addr=3, set address failed! (USB_ERR_STALLED,
> ignored)
> usbd_setup_device_desc: getting device descriptor at addr 3 failed,
> USB_ERR_STALLED
> 
> 
> vs
> 
> ugen0.1: <0x1022 XHCI root HUB> at usbus0
> ugen1.1: <AMD EHCI root HUB> at usbus1
> ugen2.1: <AMD EHCI root HUB> at usbus2
> uhub0: <0x1022 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
> uhub1: <AMD EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
> uhub2: <AMD EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus2
> mmcsd0: 4GB <SDHC SD04G 3.0 SN 014883B2 MFG 02/2018 by 39 PH> at mmc0
> 50.0MHz/4bit/65535-block
> Trying to mount root from ufs:/dev/mmcsd0s1a [ro]...
> uhub0: 4 ports with 4 removable, self powered
> uhub1: 2 ports with 2 removable, self powered
> uhub2: 2 ports with 2 removable, self powered
> Starting file system checks:
> /dev/mmcsd0s1a: FILE SYSTEM CLEAN; SKIPPING CHECKS
> /dev/mmcsd0s1a: clean, 386561 free (3113 frags, 47931 blocks, 0.1%
> fragmentation)
> ugen1.2: <vendor 0x0438 product 0x7900> at usbus1
> uhub3 on uhub1
> uhub3: <vendor 0x0438 product 0x7900, class 9/0, rev 2.00/0.18, addr 2>
> on usbus1
> ugen2.2: <vendor 0x0438 product 0x7900> at usbus2
> uhub4 on uhub2
> uhub4: <vendor 0x0438 product 0x7900, class 9/0, rev 2.00/0.18, addr 2>
> on usbus2
> /dev/mmcsd0s3: FILE SYSTEM CLEAN; SKIPPING CHECKS
> /dev/mmcsd0s3: clean, 2829 free (21 frags, 351 blocks, 0.7% fragmentation)
> /etc/rc: WARNING: hostid: unable to figure out a UUID from DMI data,
> generating a new one
> uhub3: 4 ports with 4 removable, self powered
> uhub4: 4 ports with 4 removable, self powered
> ugen2.3: <HUAWEI Technology HUAWEI Mobile> at usbus2
> u3g0 on uhub4
> u3g0: <HUAWEI Technology HUAWEI Mobile, class 0/0, rev 2.00/2.28, addr
> 3> on usbus2
> u3g0: Found 5 ports.
> 
> 
> Enabling debug will make it fail.  Any idea what it might be or how I
> can tweak it to it more reliably initializes ? I first start to notice
> it when I added a few more klds at boot time. This made the boot up
> process that much longer that I would run into this issue periodically.
> 

Hi,

Maybe the device expects some kind of BIOS to enumerate it quickly and 
if not, goes into sleep mode.

Try setting:
hw.usb.ehci.no_hs=1

In /boot/loader.conf .

Does this change anything?

USB devices are not allowed to return with a STALL-PID on set-address 
messages, so this is violation of established USB standards. Maybe you 
need a USB wire-analyzer to nail this issue.

There are a bunch of tunables for example:
hw.usb.timings

Which affect how the USB device is enumerated.

Is your device running the latest firmware from HUAWEI?

--HPS




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2476a53c-e223-1c81-165c-73fa884f30da>