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. In any case, please report any bugs you might encounter.

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