PERFORCE change 155095 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Sun Dec 21 13:02:00 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=155095
Change 155095 by hselasky at hselasky_laptop001 on 2008/12/21 21:01:16
Some more suspend and resume fixes.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#21 edit
.. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#16 edit
.. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.h#7 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#23 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#21 (text+ko) ====
@@ -3239,15 +3239,15 @@
* complicated if
*/
EOWRITE4(sc, port, v | EHCI_PS_FPR);
+ }
+ /* wait 20ms for resume sequence to complete */
+ if (use_polling) {
+ /* polling */
+ DELAY(20 * 1000);
+ } else {
+ usb2_pause_mtx(&sc->sc_bus.bus_mtx, 20);
+ }
- /* wait 20ms for resume sequence to complete */
- if (use_polling) {
- /* polling */
- DELAY(20 * 1000);
- } else {
- usb2_pause_mtx(&sc->sc_bus.bus_mtx, 20);
- }
- }
EOWRITE4(sc, port, v & ~(EHCI_PS_SUSP |
EHCI_PS_FPR | (3 << 10) /* High Speed */ ));
==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#16 (text+ko) ====
@@ -2722,8 +2722,7 @@
break;
case UHF_PORT_SUSPEND:
x = URWMASK(UREAD2(sc, port));
- /* clear suspend and resume detect */
- UWRITE2(sc, port, x & ~(UHCI_PORTSC_SUSP | UHCI_PORTSC_RD));
+ UWRITE2(sc, port, x & ~(UHCI_PORTSC_SUSP));
break;
case UHF_PORT_RESET:
x = URWMASK(UREAD2(sc, port));
@@ -2746,7 +2745,7 @@
std->err = USB_ERR_NORMAL_COMPLETION;
goto done;
case UHF_C_PORT_SUSPEND:
- /* nop */
+ sc->sc_isresumed &= ~(1 << index);
break;
case UHF_PORT_CONNECTION:
case UHF_PORT_OVER_CURRENT:
@@ -2808,12 +2807,33 @@
change |= UPS_C_OVERCURRENT_INDICATOR;
if (x & UHCI_PORTSC_LSDA)
status |= UPS_LOW_SPEED;
- if ((x & UHCI_PORTSC_PE) && (x & UHCI_PORTSC_RD))
- change |= UPS_C_SUSPEND;
- else if (x & UHCI_PORTSC_SUSP)
+ if ((x & UHCI_PORTSC_PE) && (x & UHCI_PORTSC_RD)) {
+ /* need to do a write back */
+ UWRITE2(sc, port, URWMASK(x));
+
+ /* wait 20ms for resume sequence to complete */
+ if (use_polling) {
+ /* polling */
+ DELAY(20 * 1000);
+ } else {
+ usb2_pause_mtx(&sc->sc_bus.bus_mtx, 20);
+ }
+
+ /* clear suspend and resume detect */
+ UWRITE2(sc, port, URWMASK(x) & ~(UHCI_PORTSC_RD |
+ UHCI_PORTSC_SUSP));
+
+ /* wait a little bit */
+ usb2_pause_mtx(&sc->sc_bus.bus_mtx, 2);
+
+ sc->sc_isresumed |= (1 << index);
+
+ } else if (x & UHCI_PORTSC_SUSP) {
status |= UPS_SUSPEND;
-
+ }
status |= UPS_PORT_POWER;
+ if (sc->sc_isresumed & (1 << index))
+ change |= UPS_C_SUSPEND;
if (sc->sc_isreset)
change |= UPS_C_PORT_RESET;
USETW(sc->sc_hub_desc.ps.wPortStatus, status);
==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.h#7 (text+ko) ====
@@ -301,6 +301,7 @@
uint8_t sc_addr; /* device address */
uint8_t sc_conf; /* device configuration */
uint8_t sc_isreset; /* bits set if a root hub is reset */
+ uint8_t sc_isresumed; /* bits set if a port was resumed */
uint8_t sc_saved_sof;
uint8_t sc_hub_idata[1];
==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#23 (text+ko) ====
@@ -1704,7 +1704,8 @@
&Giant, UF_DEVICE_REMOTE_WAKEUP);
if (err) {
DPRINTFN(0, "Clearing device "
- "remote wakeup failed!\n");
+ "remote wakeup failed: %s!\n",
+ usb2_errstr(err));
}
}
return;
More information about the p4-projects
mailing list