Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb remember the data toggle bit per (bulk) endpoint...
details: https://anonhg.NetBSD.org/src/rev/5fa6185dffd1
branches: trunk
changeset: 765456:5fa6185dffd1
user: drochner <drochner%NetBSD.org@localhost>
date: Fri May 27 17:19:18 2011 +0000
description:
remember the data toggle bit per (bulk) endpoint rather than per
pipe, as required by the spec
This helps in cases where pipes are opened/closed without reconfiguring
the device in between, eg with the ugen driver.
only for UHCI/EHCI, don't have an OHCI to test
diffstat:
sys/dev/usb/ehci.c | 9 ++++++---
sys/dev/usb/uhci.c | 9 ++++++---
sys/dev/usb/usb_subr.c | 8 ++++++--
sys/dev/usb/usbdivar.h | 3 ++-
4 files changed, 20 insertions(+), 9 deletions(-)
diffs (129 lines):
diff -r bd2cf24e38ba -r 5fa6185dffd1 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Fri May 27 17:12:47 2011 +0000
+++ b/sys/dev/usb/ehci.c Fri May 27 17:19:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.174 2011/04/20 09:32:43 drochner Exp $ */
+/* $NetBSD: ehci.c,v 1.175 2011/05/27 17:19:18 drochner Exp $ */
/*
* Copyright (c) 2004-2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.174 2011/04/20 09:32:43 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.175 2011/05/27 17:19:18 drochner Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -1567,7 +1567,8 @@
if (sc->sc_dying)
return (USBD_IOERROR);
- epipe->nexttoggle = 0;
+ /* toggle state needed for bulk endpoints */
+ epipe->nexttoggle = pipe->endpoint->datatoggle;
if (addr == sc->sc_addr) {
switch (ed->bEndpointAddress) {
@@ -3569,8 +3570,10 @@
ehci_device_bulk_close(usbd_pipe_handle pipe)
{
ehci_softc_t *sc = pipe->device->bus->hci_private;
+ struct ehci_pipe *epipe = (struct ehci_pipe *)pipe;
DPRINTF(("ehci_device_bulk_close: pipe=%p\n", pipe));
+ pipe->endpoint->datatoggle = epipe->nexttoggle;
ehci_close_pipe(pipe, sc->sc_async_head);
}
diff -r bd2cf24e38ba -r 5fa6185dffd1 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Fri May 27 17:12:47 2011 +0000
+++ b/sys/dev/usb/uhci.c Fri May 27 17:19:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.235 2010/11/13 13:52:12 uebayasi Exp $ */
+/* $NetBSD: uhci.c,v 1.236 2011/05/27 17:19:18 drochner Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
/*
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.235 2010/11/13 13:52:12 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.236 2011/05/27 17:19:18 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2175,6 +2175,8 @@
uhci_softc_t *sc = dev->bus->hci_private;
uhci_free_sqh(sc, upipe->u.bulk.sqh);
+
+ pipe->endpoint->datatoggle = upipe->nexttoggle;
}
usbd_status
@@ -3183,7 +3185,8 @@
ed->bEndpointAddress, sc->sc_addr));
upipe->aborting = 0;
- upipe->nexttoggle = 0;
+ /* toggle state needed for bulk endpoints */
+ upipe->nexttoggle = pipe->endpoint->datatoggle;
if (pipe->device->address == sc->sc_addr) {
switch (ed->bEndpointAddress) {
diff -r bd2cf24e38ba -r 5fa6185dffd1 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Fri May 27 17:12:47 2011 +0000
+++ b/sys/dev/usb/usb_subr.c Fri May 27 17:19:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.178 2011/03/20 17:38:11 tsutsui Exp $ */
+/* $NetBSD: usb_subr.c,v 1.179 2011/05/27 17:19:18 drochner Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.178 2011/03/20 17:38:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.179 2011/05/27 17:19:18 drochner Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usbverbose.h"
@@ -495,6 +495,7 @@
}
}
ifc->endpoints[endpt].refcnt = 0;
+ ifc->endpoints[endpt].datatoggle = 0;
p += ed->bLength;
}
#undef ed
@@ -1105,6 +1106,9 @@
USETW(dev->def_ep_desc.wMaxPacketSize, 64);
dev->def_ep_desc.bInterval = 0;
+ /* doesn't matter, just don't let it uninitialized */
+ dev->def_ep.datatoggle = 0;
+
dev->quirks = &usbd_no_quirk;
dev->address = USB_START_ADDR;
dev->ddesc.bMaxPacketSize = 0;
diff -r bd2cf24e38ba -r 5fa6185dffd1 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Fri May 27 17:12:47 2011 +0000
+++ b/sys/dev/usb/usbdivar.h Fri May 27 17:19:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.92 2010/12/20 18:49:12 phx Exp $ */
+/* $NetBSD: usbdivar.h,v 1.93 2011/05/27 17:19:18 drochner Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
/*
@@ -46,6 +46,7 @@
struct usbd_endpoint {
usb_endpoint_descriptor_t *edesc;
int refcnt;
+ int datatoggle;
};
struct usbd_bus_methods {
Home |
Main Index |
Thread Index |
Old Index