How to force a USB 3.0 port to work in USB 2.0 mode in Linux?

I am aware that I can disable USB 3.0 in the BIOS. But is there a way to force a USB 3.0 port to work in USB 2.0 mode inside a running Linux?

On Linux on some platforms in BIOS modes, you can use the following command to force USB 2.0 modes for your USB ports:

lspci -nn | grep USB 
| cut -d '[' -f3 | cut -d ']' -f1 
| xargs -I@ setpci -H1 -d @ d0.l=0

Following is an explanation of what the commands do.

The controllers have a register XUSB2PR – xHC USB 2.0 Port Routing Register – at address 0xd0 (check http://www.intel.com/content/www/us/en/chipsets/7-series-chipset-pch-datasheet.html for more details). When the XUSB2PR register is set to 0, it routes all the corresponding USB 2.0 port pins to the EHCI controller and RMH #1. The USB 2.0 port is masked from the xHC and the USB 2.0 port’s OC pin is routed to the EHCI controller. The command setpci -H1 -d @ d0.l=0 does this.

setpci needs the vendor and device ID. So the first 2 lines find all USB controller’s IDs and pass them to xargs to invoke setpci.

If you would like to do the settings manually, one example is as follows for your reference:

# lspci -nn | grep USB
00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI [8086:8c31] (rev 05)
00:1a.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 [8086:8c2d] (rev 05)
00:1d.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 [8086:8c26] (rev 05)

# setpci -H1 -d 8086:8c31 d0.l=0
# setpci -H1 -d 8086:8c26 d0.l=0
# setpci -H1 -d 8086:8c2d d0.l=0
Answered by Eric Z Ma.

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

4 comments:

  1. If I do so and I try to use my v4l device (Hercules Webcam), I get this in dmesg:

    [363965.965532] usb 3-1.2.1: new full-speed USB device number 10 using ehci-pci
    [363966.075645] usb 3-1.2.1: New USB device found, idVendor=06f8, idProduct=3009
    [363966.075647] usb 3-1.2.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [363966.202241] media: Linux media interface: v0.10
    [363966.236743] Linux video capture interface: v2.00
    [363966.275630] gspca_main: v2.14.0 registered
    [363966.294248] gspca_main: gspca_pac7302-2.14.0 probing 06f8:3009
    [363966.294791] input: gspca_pac7302 as /devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.2/3-1.2.1/input/input24
    [363966.294928] usbcore: registered new interface driver gspca_pac7302
    [364011.422012] gspca_pac7302 3-1.2.1:1.0: alt 6 – bandwidth not wide enough, trying again
    [364011.488262] gspca_pac7302 3-1.2.1:1.0: alt 5 – bandwidth not wide enough, trying again
    [364030.522898] gspca_pac7302 3-1.2.1:1.0: alt 6 – bandwidth not wide enough, trying again
    [364030.589523] gspca_pac7302 3-1.2.1:1.0: alt 5 – bandwidth not wide enough, trying again
    [364321.331830] gspca_pac7302 3-1.2.1:1.0: alt 6 – bandwidth not wide enough, trying again
    [364321.377832] gspca_pac7302: reg_w_page() failed i: 42 v: 00 error -32
    [364321.456486] gspca_pac7302 3-1.2.1:1.0: URB error -71, resubmitting
    [364321.552482] gspca_pac7302 3-1.2.1:1.0: URB error -71, resubmitting
    [364321.648481] gspca_pac7302 3-1.2.1:1.0: URB error -71, resubmitting
    [364321.744484] gspca_pac7302 3-1.2.1:1.0: URB error -71, resubmitting
    [364321.840482] gspca_pac7302 3-1.2.1:1.0: URB error -71, resubmitting
    [364321.936491] gspca_pac7302 3-1.2.1:1.0: URB error -71, resubmitting

    The “bandwidth not wide enough, trying again” are new here, when I enable USB 3.0 again, I still got the URB error messages when I try to $ cat /dev/video0.

  2. If you add the ‘-t’ parameter, the commands that xargs builds and runs will be echoed.

    | xargs -t -I@ setpci -H1 -d @ d0.l=1
    instead of
    | xargs -I@ setpci -H1 -d @ d0.l=0

    in my case on a Dell Latitude E7440
    root@e7440:~# lspci -nn | grep USB | cut -d ‘[‘ -f3 | cut -d ‘]’ -f1 | xargs -t -I@ setpci -H1 -d @ d0.l=1
    setpci -H1 -d 8086:9c31 d0.l=1
    setpci -H1 -d 8086:9c26 d0.l=1
    root@e7440:~#

Leave a Reply

Your email address will not be published. Required fields are marked *