usb-xhci: ready the link trb early
The keyboard events being async, need to prepare the link when last but one trb is queued. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
This commit is contained in:
parent
35f9876b6a
commit
ec94b351f6
|
@ -1119,18 +1119,17 @@ static inline struct xhci_seg *xhci_pipe_get_seg(struct usb_pipe *pipe)
|
|||
static inline void *xhci_get_trb(struct xhci_seg *seg)
|
||||
{
|
||||
uint64_t val, enq;
|
||||
uint32_t size;
|
||||
int index;
|
||||
struct xhci_link_trb *link;
|
||||
|
||||
enq = val = seg->enq;
|
||||
val = val + XHCI_TRB_SIZE;
|
||||
size = seg->size * XHCI_TRB_SIZE;
|
||||
/* TRBs being a cyclic buffer, here we cycle back to beginning. */
|
||||
if ((val % size) == 0) {
|
||||
index = (enq - (uint64_t)seg->trbs) / XHCI_TRB_SIZE + 1;
|
||||
dprintf("%s: enq %llx, val %llx %x\n", __func__, enq, val, index);
|
||||
/* TRBs being a cyclic buffer, here we cycle back to beginning. */
|
||||
if (index == (seg->size - 1)) {
|
||||
dprintf("%s: rounding \n", __func__);
|
||||
seg->enq = (uint64_t)seg->trbs;
|
||||
enq = seg->enq;
|
||||
seg->enq = seg->enq + XHCI_TRB_SIZE;
|
||||
val = 0;
|
||||
seg->cycle_state ^= seg->cycle_state;
|
||||
link = (struct xhci_link_trb *) (seg->trbs + seg->size - 1);
|
||||
link->addr = cpu_to_le64(seg->trbs_dma);
|
||||
|
|
Loading…
Reference in New Issue