Subject: ohci.c and global power
To: None <current-users@NetBSD.org>
From: None <dan@pod51.demon.co.uk>
List: current-users
Date: 03/02/2004 14:34:10
I've had a problem using a philips USB 2.0 chip which I think is a universal problem with the ohci driver.

I was getting interrupts before control had left ohci_init because the chip doesn't seem to support per port power control (I say seem to because the root hub descriptor says it does, but poking the registers doesn't affect the power status). Thus it's quite possible to receive an interrupt as soon as the power is turned on, resulting in ohci_intr being called before the softc has been fully initialised. Specifically a RHSC event was occuring, calling the callout_reset function using sc->sc_tmo_rhsc which hadn't yet been initialised.

Moving the hub power control to be the last thing in ohci_init seems to solve the problem (i.e. moving it just a few lines further down). This would seem to be a reasonable thing in general for power control which isn't on a per-port basis. Does this sound reasonable?

Dan Ellis