MFNetBSD: ohci.c (1.101), ohcivar.h (1.26)
revision 1.101 date: 2001/02/20 15:20:32; author: minoura; Re-initialize some registers after resuming from suspend. Some APM BIOSes do not restore them. Reviewd by augustss.
This commit is contained in:
parent
916f3fce33
commit
dc6d4959c0
@ -958,26 +958,45 @@ ohci_power(int why, void *v)
|
||||
ohci_dumpregs(sc);
|
||||
#endif
|
||||
|
||||
s = splusb();
|
||||
s = splhardusb();
|
||||
switch (why) {
|
||||
case PWR_SUSPEND:
|
||||
case PWR_STANDBY:
|
||||
sc->sc_bus.use_polling++;
|
||||
ctl = OREAD4(sc, OHCI_CONTROL);
|
||||
ctl = (ctl & ~OHCI_HCFS_MASK) | OHCI_HCFS_SUSPEND;
|
||||
ctl = OREAD4(sc, OHCI_CONTROL) & ~OHCI_HCFS_MASK;
|
||||
if (sc->sc_control == 0) {
|
||||
/*
|
||||
* Preserve register values, in case that APM BIOS
|
||||
* does not recover them.
|
||||
*/
|
||||
sc->sc_control = ctl;
|
||||
sc->sc_intre = OREAD4(sc, OHCI_INTERRUPT_ENABLE);
|
||||
}
|
||||
ctl |= OHCI_HCFS_SUSPEND;
|
||||
OWRITE4(sc, OHCI_CONTROL, ctl);
|
||||
usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT);
|
||||
sc->sc_bus.use_polling--;
|
||||
break;
|
||||
case PWR_RESUME:
|
||||
sc->sc_bus.use_polling++;
|
||||
ctl = OREAD4(sc, OHCI_CONTROL);
|
||||
ctl = (ctl & ~OHCI_HCFS_MASK) | OHCI_HCFS_RESUME;
|
||||
/* Some broken BIOSes do not recover these values */
|
||||
OWRITE4(sc, OHCI_HCCA, DMAADDR(&sc->sc_hccadma));
|
||||
OWRITE4(sc, OHCI_CONTROL_HEAD_ED, sc->sc_ctrl_head->physaddr);
|
||||
OWRITE4(sc, OHCI_BULK_HEAD_ED, sc->sc_bulk_head->physaddr);
|
||||
if (sc->sc_intre)
|
||||
OWRITE4(sc, OHCI_INTERRUPT_ENABLE,
|
||||
sc->sc_intre & (OHCI_ALL_INTRS | OHCI_MIE));
|
||||
if (sc->sc_control)
|
||||
ctl = sc->sc_control;
|
||||
else
|
||||
ctl = OREAD4(sc, OHCI_CONTROL);
|
||||
ctl |= OHCI_HCFS_RESUME;
|
||||
OWRITE4(sc, OHCI_CONTROL, ctl);
|
||||
usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY);
|
||||
ctl = (ctl & ~OHCI_HCFS_MASK) | OHCI_HCFS_OPERATIONAL;
|
||||
OWRITE4(sc, OHCI_CONTROL, ctl);
|
||||
usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY);
|
||||
sc->sc_control = sc->sc_intre = 0;
|
||||
sc->sc_bus.use_polling--;
|
||||
break;
|
||||
case PWR_SOFTSUSPEND:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ohcivar.h,v 1.25 2001/01/28 19:01:20 augustss Exp $ */
|
||||
/* $NetBSD: ohcivar.h,v 1.26 2001/02/20 15:20:33 minoura Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
@ -129,6 +129,9 @@ typedef struct ohci_softc {
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
void *sc_powerhook; /* cookie from power hook */
|
||||
void *sc_shutdownhook; /* cookie from shutdown hook */
|
||||
|
||||
u_int32_t sc_control; /* Preserved during suspend/standby */
|
||||
u_int32_t sc_intre;
|
||||
#endif
|
||||
|
||||
u_int sc_overrun_cnt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user