aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2013-10-11 22:16:21 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-14 14:04:38 -0400
commitb35c5009bbf619d8885b4b3c8b102d09002acfe5 (patch)
tree2c5b2ab13585d39355df7a4776c6d8dc3b4f3529 /drivers/usb/host/ehci.h
parentca1ad0ffcaa6194a05a2612f8afb49179d998256 (diff)
USB: EHCI: create per-TT bandwidth tables
This patch continues the scheduling changes in ehci-hcd by adding a table to store the bandwidth allocation below each TT. This will speed up the scheduling code, as it will no longer need to read through the entire schedule to compute the bandwidth currently in use. Properly speaking, the FS/LS budget calculations should be done in terms of full-speed bytes per microframe, as described in the USB-2 spec. However the driver currently uses microseconds per microframe, and the scheduling code isn't robust enough at this point to change over. For the time being, we leave the calculations as they are. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ehci.h')
-rw-r--r--drivers/usb/host/ehci.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 12504fbded56..e8f41c5e771b 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -61,6 +61,7 @@ struct ehci_stats {
61struct ehci_per_sched { 61struct ehci_per_sched {
62 struct usb_device *udev; /* access to the TT */ 62 struct usb_device *udev; /* access to the TT */
63 struct usb_host_endpoint *ep; 63 struct usb_host_endpoint *ep;
64 struct list_head ps_list; /* node on ehci_tt's ps_list */
64 u16 tt_usecs; /* time on the FS/LS bus */ 65 u16 tt_usecs; /* time on the FS/LS bus */
65 u16 cs_mask; /* C-mask and S-mask bytes */ 66 u16 cs_mask; /* C-mask and S-mask bytes */
66 u16 period; /* actual period in frames */ 67 u16 period; /* actual period in frames */
@@ -256,6 +257,9 @@ struct ehci_hcd { /* one per controller */
256#define EHCI_BANDWIDTH_FRAMES (EHCI_BANDWIDTH_SIZE >> 3) 257#define EHCI_BANDWIDTH_FRAMES (EHCI_BANDWIDTH_SIZE >> 3)
257 u8 bandwidth[EHCI_BANDWIDTH_SIZE]; 258 u8 bandwidth[EHCI_BANDWIDTH_SIZE];
258 /* us allocated per uframe */ 259 /* us allocated per uframe */
260 u8 tt_budget[EHCI_BANDWIDTH_SIZE];
261 /* us budgeted per uframe */
262 struct list_head tt_list;
259 263
260 /* platform-specific data -- must come last */ 264 /* platform-specific data -- must come last */
261 unsigned long priv[0] __aligned(sizeof(s64)); 265 unsigned long priv[0] __aligned(sizeof(s64));
@@ -595,6 +599,35 @@ struct ehci_fstn {
595 599
596/*-------------------------------------------------------------------------*/ 600/*-------------------------------------------------------------------------*/
597 601
602/*
603 * USB-2.0 Specification Sections 11.14 and 11.18
604 * Scheduling and budgeting split transactions using TTs
605 *
606 * A hub can have a single TT for all its ports, or multiple TTs (one for each
607 * port). The bandwidth and budgeting information for the full/low-speed bus
608 * below each TT is self-contained and independent of the other TTs or the
609 * high-speed bus.
610 *
611 * "Bandwidth" refers to the number of microseconds on the FS/LS bus allocated
612 * to an interrupt or isochronous endpoint for each frame. "Budget" refers to
613 * the best-case estimate of the number of full-speed bytes allocated to an
614 * endpoint for each microframe within an allocated frame.
615 *
616 * Removal of an endpoint invalidates a TT's budget. Instead of trying to
617 * keep an up-to-date record, we recompute the budget when it is needed.
618 */
619
620struct ehci_tt {
621 u16 bandwidth[EHCI_BANDWIDTH_FRAMES];
622
623 struct list_head tt_list; /* List of all ehci_tt's */
624 struct list_head ps_list; /* Items using this TT */
625 struct usb_tt *usb_tt;
626 int tt_port; /* TT port number */
627};
628
629/*-------------------------------------------------------------------------*/
630
598/* Prepare the PORTSC wakeup flags during controller suspend/resume */ 631/* Prepare the PORTSC wakeup flags during controller suspend/resume */
599 632
600#define ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup) \ 633#define ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup) \