summaryrefslogtreecommitdiff
path: root/sys/dev/usb/ehci.c
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2005-03-13 02:54:05 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2005-03-13 02:54:05 +0000
commit8c99b398138993b55eb5ecb7fd935e8315be1a12 (patch)
treeb89bccbb6b5267d4fed6dc98657bda69c14377a2 /sys/dev/usb/ehci.c
parent7d158c4e4058c60a5af4a4a03f0054b0381d62b4 (diff)
Merge support for USB1 devices located beyond USB2 hubs, mostly from netbsd.
Supports bulk, control and interrupt pipes, letting USB1 keyboards and most network interfaces work when connected to a USB2 hub. ok dlg@
Diffstat (limited to 'sys/dev/usb/ehci.c')
-rw-r--r--sys/dev/usb/ehci.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 349ca7a8fee..0e7e86a552b 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci.c,v 1.44 2005/03/13 02:32:57 pascoe Exp $ */
+/* $OpenBSD: ehci.c,v 1.45 2005/03/13 02:54:04 pascoe Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
@@ -1336,6 +1336,7 @@ ehci_open(usbd_pipe_handle pipe)
usbd_status err;
int s;
int ival, speed, naks;
+ int hshubaddr, hshubport;
DPRINTFN(1, ("ehci_open: pipe=%p, addr=%d, endpt=%d (%d)\n",
pipe, addr, ed->bEndpointAddress, sc->sc_addr));
@@ -1343,6 +1344,14 @@ ehci_open(usbd_pipe_handle pipe)
if (sc->sc_dying)
return (USBD_IOERROR);
+ if (dev->myhsport) {
+ hshubaddr = dev->myhsport->parent->address;
+ hshubport = dev->myhsport->portno;
+ } else {
+ hshubaddr = 0;
+ hshubport = 0;
+ }
+
epipe->nexttoggle = 0;
if (addr == sc->sc_addr) {
@@ -1366,6 +1375,15 @@ ehci_open(usbd_pipe_handle pipe)
case USB_SPEED_HIGH: speed = EHCI_QH_SPEED_HIGH; break;
default: panic("ehci_open: bad device speed %d", dev->speed);
}
+ if (speed != EHCI_QH_SPEED_HIGH && xfertype == UE_ISOCHRONOUS) {
+ printf("%s: *** WARNING: opening low/full speed isochronous "
+ "device, this does not work yet.\n",
+ USBDEVNAME(sc->sc_bus.bdev));
+ DPRINTFN(1,("ehci_open: hshubaddr=%d hshubport=%d\n",
+ hshubaddr, hshubport));
+ return (USBD_INVAL);
+ }
+
naks = 8; /* XXX */
sqh = ehci_alloc_sqh(sc);
if (sqh == NULL)
@@ -1383,7 +1401,9 @@ ehci_open(usbd_pipe_handle pipe)
);
sqh->qh.qh_endphub = htole32(
EHCI_QH_SET_MULT(1) |
- /* XXX TT stuff */
+ EHCI_QH_SET_HUBA(hshubaddr) |
+ EHCI_QH_SET_PORT(hshubport) |
+ EHCI_QH_SET_CMASK(0x1c) | /* XXX */
EHCI_QH_SET_SMASK(xfertype == UE_INTERRUPT ? 0x01 : 0)
);
sqh->qh.qh_curqtd = EHCI_NULL;