From db@adsl-69-107-32-110.dsl.pltn13.pacbell.net Sun Aug 14 14:32:40 2005 Date: Sat, 13 Aug 2005 18:44:58 -0700 From: david-b@pacbell.net To: ddstreet@ieee.org Subject: Re: [PATCH 2.6.13-rc5 2/7] ehci: add tt_usecs Cc: greg@kroah.com Message-Id: <20050814014458.A5DDDC1004@adsl-69-107-32-110.dsl.pltn13.pacbell.net> This adds the field tt_usecs to ehci_qh and ehci_iso_stream, and sets it appropriately when setting them up as periodic endpoints. It records the transation translator's think_time (added in last patch) plus the downstream (i.e. low or full speed) bustime of the transfer associated with each interrupt or iso frame, as calculated by usb_calc_bus_time. Signed-off-by: Dan Streetman Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-q.c | 7 +++++++ drivers/usb/host/ehci-sched.c | 4 ++++ drivers/usb/host/ehci.h | 2 ++ 3 files changed, 13 insertions(+) --- gregkh-2.6.orig/drivers/usb/host/ehci-q.c 2005-08-08 09:48:09.000000000 -0700 +++ gregkh-2.6/drivers/usb/host/ehci-q.c 2005-08-15 17:51:30.000000000 -0700 @@ -677,6 +677,9 @@ goto done; } } else { + struct usb_tt *tt = urb->dev->tt; + int think_time; + /* gap is f(FS/LS transfer times) */ qh->gap_uf = 1 + usb_calc_bus_time (urb->dev->speed, is_input, 0, maxp) / (125 * 1000); @@ -690,6 +693,10 @@ qh->c_usecs = HS_USECS (0); } + think_time = tt ? tt->think_time : 0; + qh->tt_usecs = NS_TO_US (think_time + + usb_calc_bus_time (urb->dev->speed, + is_input, 0, max_packet (maxp))); qh->period = urb->interval; } } --- gregkh-2.6.orig/drivers/usb/host/ehci-sched.c 2005-08-08 09:48:09.000000000 -0700 +++ gregkh-2.6/drivers/usb/host/ehci-sched.c 2005-08-15 17:51:30.000000000 -0700 @@ -700,6 +700,7 @@ } else { u32 addr; + int think_time; addr = dev->ttport << 24; if (!ehci_is_TDI(ehci) @@ -709,6 +710,9 @@ addr |= epnum << 8; addr |= dev->devnum; stream->usecs = HS_USECS_ISO (maxp); + think_time = dev->tt ? dev->tt->think_time : 0; + stream->tt_usecs = NS_TO_US (think_time + usb_calc_bus_time ( + dev->speed, is_input, 1, maxp)); if (is_input) { u32 tmp; --- gregkh-2.6.orig/drivers/usb/host/ehci.h 2005-08-08 09:48:09.000000000 -0700 +++ gregkh-2.6/drivers/usb/host/ehci.h 2005-08-15 17:51:30.000000000 -0700 @@ -421,6 +421,7 @@ u8 usecs; /* intr bandwidth */ u8 gap_uf; /* uframes split/csplit gap */ u8 c_usecs; /* ... split completion bw */ + u16 tt_usecs; /* tt downstream bandwidth */ unsigned short period; /* polling interval */ unsigned short start; /* where polling starts */ #define NO_FRAME ((unsigned short)~0) /* pick new start */ @@ -479,6 +480,7 @@ */ u8 interval; u8 usecs, c_usecs; + u16 tt_usecs; u16 maxp; u16 raw_mask; unsigned bandwidth;