diff options
author | Andiry Xu <andiry.xu@amd.com> | 2012-03-05 04:49:34 -0500 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2012-03-13 12:29:55 -0400 |
commit | b008df60c6369ba0290fa7daa177375407a12e07 (patch) | |
tree | 05a59c4a4d8d624b18ad0844949841f36b241c17 /drivers/usb/host/xhci.c | |
parent | 3fe4fe083d3355537565b2b0a678807513dfa013 (diff) |
xHCI: count free TRBs on transfer ring
In the past, the room_on_ring() check was implemented by walking all over
the ring, which is wasteful and complicated.
Count the number of free TRBs instead. The free TRBs number should be
updated when enqueue/dequeue pointer is updated, or upon the completion
of a set dequeue pointer command.
Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Paul Zimmerman <Paul.Zimmerman@synopsys.com>
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r-- | drivers/usb/host/xhci.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 262400c10075..dec5b2dc298c 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -729,6 +729,7 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) | |||
729 | ring->enq_seg = ring->deq_seg; | 729 | ring->enq_seg = ring->deq_seg; |
730 | ring->enqueue = ring->dequeue; | 730 | ring->enqueue = ring->dequeue; |
731 | 731 | ||
732 | ring->num_trbs_free = ring->num_segs * (TRBS_PER_SEGMENT - 1) - 1; | ||
732 | /* | 733 | /* |
733 | * Ring is now zeroed, so the HW should look for change of ownership | 734 | * Ring is now zeroed, so the HW should look for change of ownership |
734 | * when the cycle bit is set to 1. | 735 | * when the cycle bit is set to 1. |