Renesas USB 3.0 Controllers vs. Linux

USB 3.0 extension cards based on Renesas uPD720202 chipset appear to be somewhat problematic when Linux is used as operating system. This may also apply to other Renesas USB chipsets as well. This post is about the difficulties I experienced when trying to use such an extension card with Linux, and a tool to upload required firmware to the chipset.

Preface

The uPD720202 chipset requires additional firmware to operate. It must be either uploaded by the driver during initialization, or can be stored on an external EEPROM. Its open to the vendor to choose one of these options. For the first case, there exists a patch for the Linux kernel driver for this chipset to support uploading the firmware image at boot time. But apparently, this patch never made it into the kernel and I have not found the firmware image in the linux-firmware repository. Apparently, at least some of the cards equipped with an EEPROM do initially not function properly with Linux, and maybe even with Windows. They are either shipped with no firmware at all, or at least with outdated firmware.

Long story short: My card simply did nothing but pause the boot process for about 30 seconds until the driver gave up, complaining about being unable to setup the card and quitting with exit code -110:

Feb 5 19:43:18 atom kernel: [ 33.285715] xhci_hcd 0000:02:00.0: can’t setup: -110
Feb 5 19:43:18 atom kernel: [ 33.285944] xhci_hcd 0000:02:00.0: USB bus 6 deregistered
Feb 5 19:43:18 atom kernel: [ 33.286142] xhci_hcd 0000:02:00.0: init 0000:02:00.0 fail, -110
Feb 5 19:43:18 atom kernel: [ 33.286199] xhci_hcd: probe of 0000:02:00.0 failed with error -110

Dead ends …

So the question is: With which kind of extension card am I dealing with? The datasheet of the uPD720202 chipset provides information about some useful registers. The “External ROM Access Control and Status Register” suggests that my card is equipped with EEPROM, since the “External ROM Exists” bit is set (in fact, it is the only bit set after boot):

root@atom:~# setpci -s 02:00.0 f6.w
8000

So my first take was to update the firmware of the chipset. Sadly, I was unable to find any working tool which would enable me to upload the firmware into the EEPROM for Linux, even though the process itself is documented quite well in the datasheet of the chipset. In the end, I grabbed an old harddisk and installed Windows on it to be able to install the firmware which was kindly shipped with the driver disk. Pretty much hassle to be able to use a extension card … but at least, it works now? Well, not exactly. The card stops to work with Linux after the power supply is removed. Either the Windows driver does some magic to initalize the card, or the card is not really equipped with an EEPROM and needs to get a firmware upload at boot time?

… and working solutions quirks

The firmware upload functionality works independently from the firmware EEPROM, according to the chipset datasheet. More interestingly, uploaded firmware takes precedence over the firmware stored in the EEPROM. What if this could be done with Linux, too? During my research, I already stumbled upon a blog post discussing the possibility to interface with the chipset using “setpci”. Furthermore, some source code posted in the comments section claimed to implement the EEPROM read and write procedures outlined in the datasheet. This code, whose unknown author I would like to thank a lot, turned out to be a good starting point. I did some major refactoring, cleanup and bugfixing and implemented the firmware upload functionality according to the datasheet. And this did the trick! After uploading and re-initializing the driver, the card became fully functional.

upd72020x-load

The tool for uploading the firmware is called upd72020x-load and available from a GitHub repository. Refer to the README.md file for usage information. For my purposes, I also added the script check-and-init which scans for all uninitialized uPD720202 devices and tries to upload the firmware to them. I integrated the script into the boot process so I do not have to think about uploading the firmware at all. The firmware itself is not included, but it is easily possible to extract the firmware image from the updater for Windows.

upd72020x-load works for me, however: Use it at your own risk!

Closing Remarks

My card is equipped with the uPD720202 chipset. There exists a different version of this chipset, called uPD720201, which differs only in the number of USB ports provided. Especially, the procedures required to upload the firmware or to read and write the EEPROM are identical. However, i did not test upd72020x-flash with any of those extension cards. However, I got reports which confirmed that the tool works with uPD720201 based cards, too. In any case, please report any bugs you might encounter.

6 Gedanken zu „Renesas USB 3.0 Controllers vs. Linux“

  1. Hallo.
    Ich bin über deine Seite gestolpert, weil ich mein Lenovo ThinkPad T520 mit einem USB-3.0 Port nachträglich ausstatten wollte. Dazu habe ich die Version von StarTech.com gekauft und dann festgestellt, dass die ExpressCard eher das ganze System lahm legt als alles andere. Die angeschlossenen USB-Geräte wie zB. die Maus gibt jedenfalls kurz den Geist auf; kommt dann aber nach ein paar Sekunden wieder. Der Mauszeiger ist dann aber nicht mehr zu bedienen…
    Ich würde es ja gerne mit der hier vorgestellten Methode versuchen, kann jedoch die firmware auf der mitgelieferten CD nicht finden/extrahieren. Daher die Frage: Wie/Womit hast du das gemacht?

    Antworten
    • Ich habe den Installer einfach mit der Standard-Archivverwaltung von Gnome, file-roller, geöffnet. Geht wie ein einfaches Zip-Archiv. Darin fand sich dann “update.mem”. Und das war es auch schon …

      Zu deiner ExpressCard kann ich wenig sagen, die beschriebenen Symptome decken sich aber nicht mit meinen Erfahrungen. Ohne Firmware funktionierte die Karte bei mir einfach gar nicht. Du solltest sicher gehen, dass die Probleme bei dir nicht von anderer Seite kommen, denn so klingt das eher für mich.

      Antworten
  2. Hello,

    I am using a Startech ECUSB3S11 with Debian 9 an a Thinkpad X201 Tablet.
    The extension card ist working, I have only one problem:
    If the card is plugged and I want to shut down the laptop, the laptop will reboot after it is shut down.

    Is there a solution?

    Best wishes,

    Mario

    Antworten
    • Sorry but I do not know anything about your problem, Mario. It also rather sounds like a problem which might be related to the drivers. Or some BIOS/UEFI configuration about wake on USB? But that’s just wild guessing…

      Antworten
  3. Hi,
    at the end of the process I get the message
    ERROR: Writing firmware did not suceed, status register value: 80000020 ======> FAILED
    Do you have any pointers?
    OS is Ubuntu 20.04 (latest patches) and some PCIe Card I have picked up on Ebay.
    Your help is much appreciated
    Thomas

    Antworten

Schreibe einen Kommentar

Sofern nicht anders angegeben, stehen die Inhalte dieses Blogs unter der Lizenz
Creative Commons BY-NC-ND 3.0 Deutschland
Creative Commons Lizenzvertrag