# How to force loading order of ehci and uhci [solved]

## javeree

I thought I posted this yesterday, but can't find back my post today, so reposting. Sorry if this is in error.

I am currently running 2.6.24-tuxonice-r9 with no problems, but would like to upgrade to linux-2.6.27-gentoo-r8 or linux-2.6.29-gentoo-r5 (both have the same problem described below).

I created new kernels with make oldconfig starting from the working tuxonice kernel. The kernels boot, and most basic functions seem to work, apart from to obvious problems. One is with my saa7134 card (that I'll ask about later). The other one is with usb. In my dmesg I see errors as follows:

 *Quote:*   

> usb 2-1: new full speed USB device using uhci_hcd and address 2
> 
> usb 2-1: device descriptor read/64, error -71
> 
> usb 2-1: device descriptor read/64, error -71
> ...

 

from google I found out this may be because uhci_hcd is loaded before ehci_hcd (dmesg confirms thios order of loading). The question is: 

1. why is the order wrong in the gentoo kernels and not in the tuxonice kernel

2. how can I force the correct order of loading these drivers ?

For information: below the output of the 2.6.29 kernel: cat .config | grep -v 'is not set'

 *Quote:*   

> 
> 
> #
> 
> # Automatically generated make config: don't edit
> ...

 Last edited by javeree on Sat Jun 27, 2009 12:39 pm; edited 1 time in total

----------

## depontius

Don't take this as authorititave, because there may be other things at work here, but...

I had a similar situation, when adding a Hauppauge HVR-1600 to a machine that already had a PixelPro card installed and configured on MythTV.  The /dev/videoX devices would be enumerated based on which driver loaded first, but I wanted to keep the bttv driver loading first to keep the PixelPro as /dev/video0.  So I blacklisted the cx18 driver for the Hauppauge card and allowed the bttv driver to load.  Then in local.start I manually loaded cx18.

Again, I don't know if the same case would work for you.  You might need to write another initscript to manually load the later USB driver, just so you can position it in the start sequence exactly where you need it.

----------

## sera

Here is explained what you need to do:

udev guide: udev loads modules in an unpredictable order

----------

## javeree

First of all, my statement that the ehci/uhci modules were loaded in the correct order in my stable kernel doesn't seem to be true. It's only that it now consistently fails in the newer kernels. And now I finaly know why my card reader failed every now and then. I thought it was a hardware issue...

I also found out the issue is a fundamental problem with the drivers: If uhci is loaded first, it initialized ALL usb ports as usb.1 when ehci is loaded later, it finds the ports already occupied by the uhci driver, and can't change the behaviour to usb.2. 

a solution like having the kernel 'load ehci first' if there is any usb2 port doesn't help, because it could eg be possible to have only usb1 cards in a pc, so only uhci gets loaded. Later on, someone inserts a pcmcia card with usb2 ports. There is no way the kernel could have foreseen this.

Probably the fundamental solution would be some unified usb driver that upon detection of any usb bus first tries usb2, and then falls back to usb1

The workaround I have applied now is in modprobe.conf, where I've added lines

 *Quote:*   

> 
> 
> install uhci_hcd /sbin/modprobe ehci_hcd; /sbin/modprobe --ignore-install uhci_hcd
> 
> install ohci_hcd /sbin/modprobe ehci_hcd; /sbin/modprobe --ignore-install ohci_hcd

 

This does the trick for me

----------

