diff options
author | Christopher Pascoe <pascoe@cvs.openbsd.org> | 2006-05-31 06:18:10 +0000 |
---|---|---|
committer | Christopher Pascoe <pascoe@cvs.openbsd.org> | 2006-05-31 06:18:10 +0000 |
commit | be8822770de6bb641c77d3f517bbf21f1367b51e (patch) | |
tree | 268c3490529fc55fcbbb9ca2f3484d673d4cd896 /sys/dev/usb/ohci.c | |
parent | da51c4853286e94d057b950343040e002f1f24e4 (diff) |
Save and restore the data toggle value when a pipe to an endpoint
is closed and then reopened. This may be necessary now that
we no longer clear endpoint stalls every time a pipe is opened.
Previously we could assume an initial toggle value of zero because
a clear-stall operation resets the device's toggle state.
Derived from work in FreeBSD.
This is most likely to affect devices like printers, which open
pipes for short periods of time and close them again.
ok dlg@
Diffstat (limited to 'sys/dev/usb/ohci.c')
-rw-r--r-- | sys/dev/usb/ohci.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 6af9669043f..fbcc074bf6a 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ohci.c,v 1.71 2006/05/29 03:49:22 pascoe Exp $ */ +/* $OpenBSD: ohci.c,v 1.72 2006/05/31 06:18:09 pascoe Exp $ */ /* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ @@ -2047,7 +2047,9 @@ ohci_open(usbd_pipe_handle pipe) OHCI_ED_SET_EN(UE_GET_ADDR(ed->bEndpointAddress)) | (dev->speed == USB_SPEED_LOW ? OHCI_ED_SPEED : 0) | fmt | OHCI_ED_SET_MAXP(UGETW(ed->wMaxPacketSize))); - sed->ed.ed_headp = sed->ed.ed_tailp = htole32(tdphys); + sed->ed.ed_headp = htole32(tdphys | + (pipe->endpoint->savedtoggle ? OHCI_TOGGLECARRY : 0)); + sed->ed.ed_tailp = htole32(tdphys); switch (xfertype) { case UE_CONTROL: @@ -2133,6 +2135,8 @@ ohci_close_pipe(usbd_pipe_handle pipe, ohci_soft_ed_t *head) /* Make sure the host controller is not touching this ED */ usb_delay_ms(&sc->sc_bus, 1); splx(s); + pipe->endpoint->savedtoggle = + (le32toh(sed->ed.ed_headp) & OHCI_TOGGLECARRY) ? 1 : 0; ohci_free_sed(sc, opipe->sed); } |