Subject: Re: USB problem after updating from 4.99.11 -> 4.99.16
To: None <john@johnrshannon.com>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: current-users
Date: 04/12/2007 23:24:46
This is a multipart MIME message.

--==_Exmh_43405095381480
Content-Type: text/plain; charset=us-ascii


john@johnrshannon.com said:
> uhub1: port 2, set config at addr 2 failed
> uhub1: device problem, disabling port 2 

Unfortunately that error message doesn't tell at which
stage of the USB device initialisation the problem occured.
It might be necessary to use some USB_DEBUG to find out more.
I don't immediately suspect one of my recent changes to the
USB code to be a cause of your problem, perhaps some subtle
timing change, don't know.
Does your mouse attach if you plug it in after boot?
There is also an obvious bug in the uhci port reset code
where it does not clear a suspend condition on enable,
but this has always been there, and nothing in the NetBSD
usb code suspends a usb port yet. You might try the appended
patch anyway.

best regards
Matthias



--==_Exmh_43405095381480
Content-Type: text/plain ; name="u"; charset=us-ascii
Content-Description: u
Content-Disposition: attachment; filename="u"

#
# old_revision [066dc4124a502cd64a34e2bf6b378ac623e680af]
#
# patch "sys/dev/usb/uhci.c"
#  from [d319aa726a9f9f0d96d2b5c30ce0d04be295de7b]
#    to [42fd5941ae6e07d2c137be5bd5a9d2cf07c8ab84]
#
============================================================
--- sys/dev/usb/uhci.c	d319aa726a9f9f0d96d2b5c30ce0d04be295de7b
+++ sys/dev/usb/uhci.c	42fd5941ae6e07d2c137be5bd5a9d2cf07c8ab84
@@ -3103,7 +3103,7 @@ uhci_portreset(uhci_softc_t *sc, int ind
 		    index, UREAD2(sc, port)));
 
 	x = URWMASK(UREAD2(sc, port));
-	UWRITE2(sc, port, x & ~UHCI_PORTSC_PR);
+	UWRITE2(sc, port, x & ~(UHCI_PORTSC_PR | UHCI_PORTSC_SUSP));
 
 	delay(100);
 
@@ -3355,7 +3355,11 @@ uhci_root_ctrl_start(usbd_xfer_handle xf
 			break;
 		case UHF_PORT_SUSPEND:
 			x = URWMASK(UREAD2(sc, port));
+			if (!(x & UHCI_PORTSC_SUSP)) /* not suspended */
+				break;
 			UWRITE2(sc, port, x & ~UHCI_PORTSC_SUSP);
+			/* see USB2 spec ch. 7.1.7.7 */
+			delay(20000);
 			break;
 		case UHF_PORT_RESET:
 			x = URWMASK(UREAD2(sc, port));

--==_Exmh_43405095381480--