diff options
author | iedowse <iedowse@FreeBSD.org> | 2004-11-03 01:52:50 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2004-11-03 01:52:50 +0000 |
commit | cb7e4340514c332ef2b3ac808a06bb5470be16eb (patch) | |
tree | d9d339fddbadd971663de538f170ee9d422eda06 /sys/dev/usb/usb_subr.c | |
parent | 595a6f02e81be5272954071e994ea142beab3319 (diff) | |
download | FreeBSD-src-cb7e4340514c332ef2b3ac808a06bb5470be16eb.zip FreeBSD-src-cb7e4340514c332ef2b3ac808a06bb5470be16eb.tar.gz |
Merge recent USB2/EHCI related changes from NetBSD:
o Reduce the interrupt delay to 2 microframes.
o Follow the spec more closely when updating the overlay qTD in the QH.
o No need to generate an interrupt at the data part of a control
transfer, it's generated by the status transfer.
o Make sure to update the data toggle on short transfers.
o Turn the printf about needing toggle update into a DPRINTF.
o Keep track of what high speed port (if any) a device belongs to
so we can set the transaction translator fields for the transfer.
o Verbosely refuse to open low/full speed pipes that depend on
unimplemented split transaction support.
o Fix various typos in comments.
Obtained from: NetBSD
Diffstat (limited to 'sys/dev/usb/usb_subr.c')
-rw-r--r-- | sys/dev/usb/usb_subr.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 905a86c..fa21645 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1046,13 +1046,14 @@ usbd_status usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth, int speed, int port, struct usbd_port *up) { - usbd_device_handle dev; + usbd_device_handle dev, adev; struct usbd_device *hub; usb_device_descriptor_t *dd; usb_port_status_t ps; usbd_status err; int addr; int i; + int p; DPRINTF(("usbd_new_device bus=%p port=%d depth=%d speed=%d\n", bus, port, depth, speed)); @@ -1086,11 +1087,27 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth, dev->depth = depth; dev->powersrc = up; dev->myhub = up->parent; - for (hub = up->parent; + + up->device = dev; + + /* Locate port on upstream high speed hub */ + for (adev = dev, hub = up->parent; hub != NULL && hub->speed != USB_SPEED_HIGH; - hub = hub->myhub) + adev = hub, hub = hub->myhub) ; - dev->myhighhub = hub; + if (hub) { + for (p = 0; p < hub->hub->hubdesc.bNbrPorts; p++) { + if (hub->hub->ports[p].device == adev) { + dev->myhsport = &hub->hub->ports[p]; + goto found; + } + } + panic("usbd_new_device: cannot find HS port\n"); + found: + DPRINTFN(1,("usbd_new_device: high speed port %d\n", p)); + } else { + dev->myhsport = NULL; + } dev->speed = speed; dev->langid = USBD_NOLANG; dev->cookie.cookie = ++usb_cookie_no; @@ -1103,8 +1120,6 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth, return (err); } - up->device = dev; - /* Set the address. Do this early; some devices need that. */ /* Try a few times in case the device is slow (i.e. outside specs.) */ DPRINTFN(5,("usbd_new_device: setting device address=%d\n", addr)); @@ -1228,8 +1243,8 @@ usbd_remove_device(usbd_device_handle dev, struct usbd_port *up) if (dev->default_pipe != NULL) usbd_kill_pipe(dev->default_pipe); - up->device = 0; - dev->bus->devices[dev->address] = 0; + up->device = NULL; + dev->bus->devices[dev->address] = NULL; free(dev, M_USB); } |