UPSTREAM: usb: xhci: Set 'Average TRB Length' to 8 for control endpoints

Update the codes to conform with xHCI spec chapter 6.2.3.

Change-Id: I9227754f7f7faf27f90046178526fad4d45e699e
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit fae35857e1c38776854442f59d6b56c17e93fc39)
This commit is contained in:
Bin Meng 2017-09-18 06:40:50 -07:00 committed by Kever Yang
parent dd5c0fa315
commit f018b53dac
2 changed files with 12 additions and 0 deletions

View File

@ -850,6 +850,12 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl,
trb_64 = (uintptr_t)virt_dev->eps[0].ring->first_seg->trbs;
ep0_ctx->deq = cpu_to_le64(trb_64 | virt_dev->eps[0].ring->cycle_state);
/*
* xHCI spec 6.2.3:
* software shall set 'Average TRB Length' to 8 for control endpoints.
*/
ep0_ctx->tx_info = cpu_to_le32(EP_AVG_TRB_LENGTH(8));
/* Steps 7 and 8 were done in xhci_alloc_virt_device() */
xhci_flush_cache((uintptr_t)ep0_ctx, sizeof(struct xhci_ep_ctx));

View File

@ -601,6 +601,12 @@ static int xhci_set_configuration(struct usb_device *udev)
ep_ctx[ep_index]->deq = cpu_to_le64(trb_64 |
virt_dev->eps[ep_index].ring->cycle_state);
/*
* xHCI spec 6.2.3:
* 'Average TRB Length' should be 8 for control endpoints.
*/
if (usb_endpoint_xfer_control(endpt_desc))
avg_trb_len = 8;
ep_ctx[ep_index]->tx_info =
cpu_to_le32(EP_MAX_ESIT_PAYLOAD_LO(max_esit_payload) |
EP_AVG_TRB_LENGTH(avg_trb_len));