소스 검색

UHCI: increase Resume-Detect-off delay

The UHCI controller in my laptop takes longer to turn off the
Resume-Detect bit than the 4 us allowed by uhci-hcd.  Presumably other
computers will have the same problem.

This patch (as752) increases the maximum delay to 10 us, which should be
plenty, and uses polling to avoid penalizing systems which can turn the
bit off more quickly.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern 19 년 전
부모
커밋
de06a3b842
1개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 3
      drivers/usb/host/uhci-hub.c

+ 9 - 3
drivers/usb/host/uhci-hub.c

@@ -84,6 +84,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
 		unsigned long port_addr)
 		unsigned long port_addr)
 {
 {
 	int status;
 	int status;
+	int i;
 
 
 	if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
 	if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
 		CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
 		CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
@@ -92,9 +93,14 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
 
 
 		/* The controller won't actually turn off the RD bit until
 		/* The controller won't actually turn off the RD bit until
 		 * it has had a chance to send a low-speed EOP sequence,
 		 * it has had a chance to send a low-speed EOP sequence,
-		 * which takes 3 bit times (= 2 microseconds).  We'll delay
-		 * slightly longer for good luck. */
-		udelay(4);
+		 * which is supposed to take 3 bit times (= 2 microseconds).
+		 * Experiments show that some controllers take longer, so
+		 * we'll poll for completion. */
+		for (i = 0; i < 10; ++i) {
+			if (!(inw(port_addr) & USBPORTSC_RD))
+				break;
+			udelay(1);
+		}
 	}
 	}
 	clear_bit(port, &uhci->resuming_ports);
 	clear_bit(port, &uhci->resuming_ports);
 }
 }