diff options
author | John Youn <johnyoun@synopsys.com> | 2009-07-27 15:05:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-28 17:31:13 -0400 |
commit | d115b04818e57bdbc7ccde4d0660b15e33013dc8 (patch) | |
tree | 48b699c9b81fb0570d03009f353225faad238c64 /drivers/usb/host/xhci-ring.c | |
parent | 28c2d2efb48dec2f0b050affae6d5787d6449e47 (diff) |
USB: xhci: Support for 64-byte contexts
Adds support for controllers that use 64-byte contexts. The following context
data structures are affected by this: Device, Input, Input Control, Endpoint,
and Slot. To accommodate the use of either 32 or 64-byte contexts, a Device or
Input context can only be accessed through functions which look-up and return
pointers to their contained contexts.
Signed-off-by: John Youn <johnyoun@synopsys.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/xhci-ring.c')
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 0903e98989ec..ea31753c3137 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -362,6 +362,7 @@ static void find_new_dequeue_state(struct xhci_hcd *xhci, | |||
362 | struct xhci_virt_device *dev = xhci->devs[slot_id]; | 362 | struct xhci_virt_device *dev = xhci->devs[slot_id]; |
363 | struct xhci_ring *ep_ring = dev->ep_rings[ep_index]; | 363 | struct xhci_ring *ep_ring = dev->ep_rings[ep_index]; |
364 | struct xhci_generic_trb *trb; | 364 | struct xhci_generic_trb *trb; |
365 | struct xhci_ep_ctx *ep_ctx; | ||
365 | 366 | ||
366 | state->new_cycle_state = 0; | 367 | state->new_cycle_state = 0; |
367 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, | 368 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, |
@@ -370,7 +371,8 @@ static void find_new_dequeue_state(struct xhci_hcd *xhci, | |||
370 | if (!state->new_deq_seg) | 371 | if (!state->new_deq_seg) |
371 | BUG(); | 372 | BUG(); |
372 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ | 373 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ |
373 | state->new_cycle_state = 0x1 & dev->out_ctx->ep[ep_index].deq; | 374 | ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); |
375 | state->new_cycle_state = 0x1 & ep_ctx->deq; | ||
374 | 376 | ||
375 | state->new_deq_ptr = cur_td->last_trb; | 377 | state->new_deq_ptr = cur_td->last_trb; |
376 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, | 378 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, |
@@ -570,11 +572,15 @@ static void handle_set_deq_completion(struct xhci_hcd *xhci, | |||
570 | unsigned int ep_index; | 572 | unsigned int ep_index; |
571 | struct xhci_ring *ep_ring; | 573 | struct xhci_ring *ep_ring; |
572 | struct xhci_virt_device *dev; | 574 | struct xhci_virt_device *dev; |
575 | struct xhci_ep_ctx *ep_ctx; | ||
576 | struct xhci_slot_ctx *slot_ctx; | ||
573 | 577 | ||
574 | slot_id = TRB_TO_SLOT_ID(trb->generic.field[3]); | 578 | slot_id = TRB_TO_SLOT_ID(trb->generic.field[3]); |
575 | ep_index = TRB_TO_EP_INDEX(trb->generic.field[3]); | 579 | ep_index = TRB_TO_EP_INDEX(trb->generic.field[3]); |
576 | dev = xhci->devs[slot_id]; | 580 | dev = xhci->devs[slot_id]; |
577 | ep_ring = dev->ep_rings[ep_index]; | 581 | ep_ring = dev->ep_rings[ep_index]; |
582 | ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); | ||
583 | slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx); | ||
578 | 584 | ||
579 | if (GET_COMP_CODE(event->status) != COMP_SUCCESS) { | 585 | if (GET_COMP_CODE(event->status) != COMP_SUCCESS) { |
580 | unsigned int ep_state; | 586 | unsigned int ep_state; |
@@ -588,9 +594,9 @@ static void handle_set_deq_completion(struct xhci_hcd *xhci, | |||
588 | case COMP_CTX_STATE: | 594 | case COMP_CTX_STATE: |
589 | xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed due " | 595 | xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed due " |
590 | "to incorrect slot or ep state.\n"); | 596 | "to incorrect slot or ep state.\n"); |
591 | ep_state = dev->out_ctx->ep[ep_index].ep_info; | 597 | ep_state = ep_ctx->ep_info; |
592 | ep_state &= EP_STATE_MASK; | 598 | ep_state &= EP_STATE_MASK; |
593 | slot_state = dev->out_ctx->slot.dev_state; | 599 | slot_state = slot_ctx->dev_state; |
594 | slot_state = GET_SLOT_STATE(slot_state); | 600 | slot_state = GET_SLOT_STATE(slot_state); |
595 | xhci_dbg(xhci, "Slot state = %u, EP state = %u\n", | 601 | xhci_dbg(xhci, "Slot state = %u, EP state = %u\n", |
596 | slot_state, ep_state); | 602 | slot_state, ep_state); |
@@ -613,7 +619,7 @@ static void handle_set_deq_completion(struct xhci_hcd *xhci, | |||
613 | */ | 619 | */ |
614 | } else { | 620 | } else { |
615 | xhci_dbg(xhci, "Successful Set TR Deq Ptr cmd, deq = @%08llx\n", | 621 | xhci_dbg(xhci, "Successful Set TR Deq Ptr cmd, deq = @%08llx\n", |
616 | dev->out_ctx->ep[ep_index].deq); | 622 | ep_ctx->deq); |
617 | } | 623 | } |
618 | 624 | ||
619 | ep_ring->state &= ~SET_DEQ_PENDING; | 625 | ep_ring->state &= ~SET_DEQ_PENDING; |
@@ -795,6 +801,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
795 | union xhci_trb *event_trb; | 801 | union xhci_trb *event_trb; |
796 | struct urb *urb = 0; | 802 | struct urb *urb = 0; |
797 | int status = -EINPROGRESS; | 803 | int status = -EINPROGRESS; |
804 | struct xhci_ep_ctx *ep_ctx; | ||
798 | 805 | ||
799 | xhci_dbg(xhci, "In %s\n", __func__); | 806 | xhci_dbg(xhci, "In %s\n", __func__); |
800 | xdev = xhci->devs[TRB_TO_SLOT_ID(event->flags)]; | 807 | xdev = xhci->devs[TRB_TO_SLOT_ID(event->flags)]; |
@@ -807,7 +814,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
807 | ep_index = TRB_TO_EP_ID(event->flags) - 1; | 814 | ep_index = TRB_TO_EP_ID(event->flags) - 1; |
808 | xhci_dbg(xhci, "%s - ep index = %d\n", __func__, ep_index); | 815 | xhci_dbg(xhci, "%s - ep index = %d\n", __func__, ep_index); |
809 | ep_ring = xdev->ep_rings[ep_index]; | 816 | ep_ring = xdev->ep_rings[ep_index]; |
810 | if (!ep_ring || (xdev->out_ctx->ep[ep_index].ep_info & EP_STATE_MASK) == EP_STATE_DISABLED) { | 817 | ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index); |
818 | if (!ep_ring || (ep_ctx->ep_info & EP_STATE_MASK) == EP_STATE_DISABLED) { | ||
811 | xhci_err(xhci, "ERROR Transfer event pointed to disabled endpoint\n"); | 819 | xhci_err(xhci, "ERROR Transfer event pointed to disabled endpoint\n"); |
812 | return -ENODEV; | 820 | return -ENODEV; |
813 | } | 821 | } |
@@ -1193,9 +1201,9 @@ static int prepare_transfer(struct xhci_hcd *xhci, | |||
1193 | gfp_t mem_flags) | 1201 | gfp_t mem_flags) |
1194 | { | 1202 | { |
1195 | int ret; | 1203 | int ret; |
1196 | 1204 | struct xhci_ep_ctx *ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index); | |
1197 | ret = prepare_ring(xhci, xdev->ep_rings[ep_index], | 1205 | ret = prepare_ring(xhci, xdev->ep_rings[ep_index], |
1198 | xdev->out_ctx->ep[ep_index].ep_info & EP_STATE_MASK, | 1206 | ep_ctx->ep_info & EP_STATE_MASK, |
1199 | num_trbs, mem_flags); | 1207 | num_trbs, mem_flags); |
1200 | if (ret) | 1208 | if (ret) |
1201 | return ret; | 1209 | return ret; |