Bug 276428 - NEC uPD720200 USB 3.0 Host Controller - Controller Halt/Reset
Summary: NEC uPD720200 USB 3.0 Host Controller - Controller Halt/Reset
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 14.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-usb (Nobody)
URL:
Keywords: crash
Depends on:
Blocks:
 
Reported: 2024-01-18 16:10 UTC by Slawomir Wojciech Wojtczak
Modified: 2024-11-13 14:30 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Slawomir Wojciech Wojtczak 2024-01-18 16:10:16 UTC
Hi,

this USB 3.0 controller from ThinkPad W520 often halts/resets itself rendering it unusable till next reboot.

# dmesg
xhci0: Controller halt timeout.
xhci0: Controller reset timeout.
xhci0: Controller reset timeout.
uhub2 on usbus1
uhub2: <(0x1033) XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus1
uhub2: 4 ports with 4 removable, self powered
xhci0: Resetting controller
usb_alloc_device: device init 2 failed (USB_ERR_TIMEOUT, ignored)
ugen1.2: <Unknown > at usbus1 (disconnected)
uhub_reattach_port: could not allocate new device
usb_alloc_device: device init 2 failed (USB_ERR_TIMEOUT, ignored)
ugen1.2: <Unknown > at usbus1 (disconnected)
uhub_reattach_port: could not allocate new device
uhub2: at usbus1, port 1, addr 1 (disconnected)
uhub2: detached
xhci0: Controller halt timeout.
xhci0: Controller reset timeout.

# pciconf -lv xhci0                                                   
xhci0@pci0:14:0:0:      class=0x0c0330 rev=0x04 hdr=0x00 vendor=0x1033 device=0x0194 subvendor=0x17aa subdevice=0x21cf
    vendor     = 'NEC Corporation'
    device     = 'uPD720200 USB 3.0 Host Controller'
    class      = serial bus
    subclass   = USB

Regards,
vermaden
Comment 1 Tomasz "CeDeROM" CEDRO 2024-01-18 16:54:02 UTC
Hey there :-) I have that controller in desktop as additional PCI-E card for USB access to bhyve vms. Works for me without a problem.

FreeBSD octagon 13.2-RELEASE-p8 FreeBSD 13.2-RELEASE-p8 GENERIC amd64

xhci1: <NEC uPD720200 USB 3.0 controller> mem 0xfe400000-0xfe401fff at device 0.0 on pci6
xhci1: 32 bytes context size, 32-bit DMA
usbus1 on xhci1
usbus1: 5.0Gbps Super Speed USB v3.0

xhci1@pci0:6:0:0:       class=0x0c0330 rev=0x03 hdr=0x00 vendor=0x1033 device=0x0194 subvendor=0x1028 subdevice=0x0498
    vendor     = 'NEC Corporation'
    device     = 'uPD720200 USB 3.0 Host Controller'
    class      = serial bus
    subclass   = USB

From the pciconf output I can see I have older revision rev=0x04 (you have rev=0x04) also the subvendor and subdevice differs.

Have you tried updating BIOS and controller firmware?

Have you tried using different USB cable?

Are you using USB HUB on the way?

Have you tried playing with sysctl values (man xhci)?

:-)
Comment 2 Tomasz "CeDeROM" CEDRO 2024-01-18 16:55:44 UTC
Also can you power_off / power_on / reset the hub with usbconfig ?
Comment 3 Slawomir Wojciech Wojtczak 2024-01-18 17:06:53 UTC
(In reply to Tomasz "CeDeROM" CEDRO from comment #2)

Thank You I will try all these suggestions.
Comment 4 Slawomir Wojciech Wojtczak 2024-01-18 17:14:51 UTC
(In reply to Tomasz "CeDeROM" CEDRO from comment #2)

The power on/off does not seem to work.

% usbconfig | grep -i xhci 
ugen1.1: <(0x1033) XHCI root HUB> at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)

% doas usbconfig -u 1 -a 1 power_off
usbconfig: could not set power OFF: Invalid argument

doas usbconfig -u 1 -a 1 power_on 
usbconfig: could not set power ON: Invalid argument
Comment 5 Tomasz "CeDeROM" CEDRO 2024-01-18 17:32:00 UTC
usbconfig -d 1.1 reset :-)

also see the bios setup options on power saving etc :-)
Comment 6 Slawomir Wojciech Wojtczak 2024-01-18 17:37:47 UTC
(In reply to Tomasz "CeDeROM" CEDRO from comment #1)

> Have you tried updating BIOS and controller firmware?

Do you have any guide on that?

> Have you tried using different USB cable?

It it a USB drive - a working one - works fine on other controller/port.
Comment 7 Tomasz "CeDeROM" CEDRO 2024-01-18 18:07:43 UTC
Here is the BIOS update download page:

https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-w-series-laptops/thinkpad-w520/downloads/driver-list/component?name=BIOS%2FUEFI&id=5AC6A815-321D-440E-8833-B07A93E0428C

This is the original drivers page for W520 and it states Renesas USB 3.0 controller:

https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-w-series-laptops/thinkpad-w520/downloads/ds015025-usb-30-driver-for-windows-7-32-bit-64-bit-vista-32-bit-64-bit-xp-thinkpad?category=USB%20Device,%20FireWire,%20IEEE%201394,%20Thunderbolt

Or the newer one but it also says "This software is Renesas' original device driver for Sunix USB3.0 Add-in Card for Windows Operating System that operates USB 3.0 Host controllers uPD720200 and uPD720200A":

https://pcsupport.lenovo.com/us/en/downloads/ds013548-usb-30-host-controller-driver-for-windows-7-32-bit-and-64-bit-vista-32-bit-and-64-bit-xp-thinkcentre-m-series-edge-series-thinkstation

I found some github repo with similar controller firmwares + update utility. This may come from/with a driver package. This NEC controler may be also customized by Renesas / Sunix thus different behavior?
Comment 8 Slawomir Wojciech Wojtczak 2024-01-18 18:17:30 UTC
(In reply to Tomasz "CeDeROM" CEDRO from comment #7)

Thank You - will try that later.
Comment 9 Tomasz "CeDeROM" CEDRO 2024-05-10 13:03:51 UTC
Did that help? :-)
Comment 10 Slawomir Wojciech Wojtczak 2024-05-22 21:56:16 UTC
(In reply to Tomasz "CeDeROM" CEDRO from comment #9)

Nope - but I have a 'proof' safe method to boot into months+ uptime.

1. Poweroff.
2. Detach all batteries from the laptop.
3. Wait 1 minute.
4. Attach batteries.
5. Power on w/o power adapter connected.
6. Connect to WiFi.
7. Attach power adapter.
Comment 11 Tomasz "CeDeROM" CEDRO 2024-05-23 02:33:06 UTC
Whoah that clearly looks like a firmware bug and something terrible to have on a laptop :-(

Does this happen also on Linux / Windoze? If not then probably BSD driver could prevent that somehow by clearing / setting initial controller config (maybe this needs to be done for that specific controller / firmware).

I do not observe such problems with my NEC PCI-E card.

On the other hand I have different ASMEDIA USB 3.0 controller onboard with some disconnects problems. I have found some utility (using FreeBSD boot media) to upgrade firmware and found firmware extracted from other more modern motherboard BIOS with the same chip. Some things improved but disconnects are still here. I have tried different firmwares and each one of them has some issues. This was extremely risky as it could brick the controller. At least I have verified this is not the OS but controller issue.

I hope firmware upgrade would fix your NEC controller.
Comment 12 Slawomir Wojciech Wojtczak 2024-05-23 21:44:58 UTC
(In reply to Tomasz "CeDeROM" CEDRO from comment #11)

I usually reboot my laptop once every two-three months - so doing that procedure is 4-6 times a year is not a problem :)