9-portusbehci-reset: every EHCI port reset takes 500 ms
portreset in sys/src/9/port/usbehci.c sets Port Reset in PORTSC
and waits up to 500 ms for the controller to clear it:
for(i = 0; *portscp & Psreset && i < 50; i++)
delay(10);
The controller never clears it. EHCI 1.0 section 2.3.9: software
writes a one to start the bus reset and a zero to end it, and must
keep the bit set long enough for the reset that USB 2.0 requires,
at least 50 ms on a root port (USB 2.0 section 7.1.7.5). So every
reset runs the full 500 ms, prints
ehci ...: port N didn't reset within 500 ms; sts ...
and then works, because the next line clears the bit.
The fix holds the reset for 50 ms and then ends it, as portreset
in usbuhci.c does; the message and its loop variable go. A
controller that clears the bit by itself is not affected.
The pc, kw and omap kernels share this code.
Apply
cd /
ape/patch -p0 < /path/to/9-portusbehci-reset/9-portusbehci-reset.diff
Rebuild
cd /sys/src/9/pc && mk 'CONF=pccpuf' install
Use the kernel directory and CONF you boot.
Verification
Attach a USB 2 device to an EHCI port and boot.
Before: one "didn't reset within 500 ms" line per reset.
After: none, and the device shows up in /dev/usb/ctl as
before.
|