aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-04-04 14:47:44 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-04-14 14:12:26 -0400
commit8e32640672bdcb01e0d83f087f09dd65fcbc3275 (patch)
tree8e65907cb076ae5598df469d120a8d4cece16800 /drivers/usb
parent01e89506351b84ac6f39eb70f99c71483768ca60 (diff)
[PATCH] USB: UHCI: don't track suspended ports
Someone recently posted a bug report where it turned out that uhci-hcd was disagreeing with the UHCI controller over whether or not a port was suspended: The driver thought it wasn't and the hardware thought it was. This patch (as665) fixes the problem and simplifies the driver by removing the internal state-tracking completely. Now the driver just asks the hardware whether a port is suspended. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/uhci-hcd.c3
-rw-r--r--drivers/usb/host/uhci-hcd.h1
-rw-r--r--drivers/usb/host/uhci-hub.c18
3 files changed, 10 insertions, 12 deletions
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 3d511690c9b7..c0c4db78b590 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -115,8 +115,7 @@ static void finish_reset(struct uhci_hcd *uhci)
115 for (port = 0; port < uhci->rh_numports; ++port) 115 for (port = 0; port < uhci->rh_numports; ++port)
116 outw(0, uhci->io_addr + USBPORTSC1 + (port * 2)); 116 outw(0, uhci->io_addr + USBPORTSC1 + (port * 2));
117 117
118 uhci->port_c_suspend = uhci->suspended_ports = 118 uhci->port_c_suspend = uhci->resuming_ports = 0;
119 uhci->resuming_ports = 0;
120 uhci->rh_state = UHCI_RH_RESET; 119 uhci->rh_state = UHCI_RH_RESET;
121 uhci->is_stopped = UHCI_IS_STOPPED; 120 uhci->is_stopped = UHCI_IS_STOPPED;
122 uhci_to_hcd(uhci)->state = HC_STATE_HALT; 121 uhci_to_hcd(uhci)->state = HC_STATE_HALT;
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index 4a69c7eb09bd..d5c8f4d92823 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -415,7 +415,6 @@ struct uhci_hcd {
415 415
416 /* Support for port suspend/resume/reset */ 416 /* Support for port suspend/resume/reset */
417 unsigned long port_c_suspend; /* Bit-arrays of ports */ 417 unsigned long port_c_suspend; /* Bit-arrays of ports */
418 unsigned long suspended_ports;
419 unsigned long resuming_ports; 418 unsigned long resuming_ports;
420 unsigned long ports_timeout; /* Time to stop signalling */ 419 unsigned long ports_timeout; /* Time to stop signalling */
421 420
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index 152971d16769..c8451d9578f1 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -85,11 +85,10 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
85{ 85{
86 int status; 86 int status;
87 87
88 if (test_bit(port, &uhci->suspended_ports)) { 88 if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
89 CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD); 89 CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
90 clear_bit(port, &uhci->suspended_ports); 90 if (test_bit(port, &uhci->resuming_ports))
91 clear_bit(port, &uhci->resuming_ports); 91 set_bit(port, &uhci->port_c_suspend);
92 set_bit(port, &uhci->port_c_suspend);
93 92
94 /* The controller won't actually turn off the RD bit until 93 /* The controller won't actually turn off the RD bit until
95 * it has had a chance to send a low-speed EOP sequence, 94 * it has had a chance to send a low-speed EOP sequence,
@@ -97,6 +96,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
97 * slightly longer for good luck. */ 96 * slightly longer for good luck. */
98 udelay(4); 97 udelay(4);
99 } 98 }
99 clear_bit(port, &uhci->resuming_ports);
100} 100}
101 101
102/* Wait for the UHCI controller in HP's iLO2 server management chip. 102/* Wait for the UHCI controller in HP's iLO2 server management chip.
@@ -265,8 +265,6 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
265 wPortChange |= USB_PORT_STAT_C_SUSPEND; 265 wPortChange |= USB_PORT_STAT_C_SUSPEND;
266 lstatus |= 1; 266 lstatus |= 1;
267 } 267 }
268 if (test_bit(port, &uhci->suspended_ports))
269 lstatus |= 2;
270 if (test_bit(port, &uhci->resuming_ports)) 268 if (test_bit(port, &uhci->resuming_ports))
271 lstatus |= 4; 269 lstatus |= 4;
272 270
@@ -309,7 +307,6 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
309 307
310 switch (wValue) { 308 switch (wValue) {
311 case USB_PORT_FEAT_SUSPEND: 309 case USB_PORT_FEAT_SUSPEND:
312 set_bit(port, &uhci->suspended_ports);
313 SET_RH_PORTSTAT(USBPORTSC_SUSP); 310 SET_RH_PORTSTAT(USBPORTSC_SUSP);
314 OK(0); 311 OK(0);
315 case USB_PORT_FEAT_RESET: 312 case USB_PORT_FEAT_RESET:
@@ -343,8 +340,11 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
343 CLR_RH_PORTSTAT(USBPORTSC_PEC); 340 CLR_RH_PORTSTAT(USBPORTSC_PEC);
344 OK(0); 341 OK(0);
345 case USB_PORT_FEAT_SUSPEND: 342 case USB_PORT_FEAT_SUSPEND:
346 if (test_bit(port, &uhci->suspended_ports) && 343 if (!(inw(port_addr) & USBPORTSC_SUSP)) {
347 !test_and_set_bit(port, 344
345 /* Make certain the port isn't suspended */
346 uhci_finish_suspend(uhci, port, port_addr);
347 } else if (!test_and_set_bit(port,
348 &uhci->resuming_ports)) { 348 &uhci->resuming_ports)) {
349 SET_RH_PORTSTAT(USBPORTSC_RD); 349 SET_RH_PORTSTAT(USBPORTSC_RD);
350 350