diff options
author | Felipe Balbi <balbi@ti.com> | 2012-02-06 04:04:53 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-02-13 09:02:06 -0500 |
commit | f6bafc6a1c9d58f0c234ac5052b9c09b0747348c (patch) | |
tree | df6da3498cc47ea3c1cfe43d7b35cc72969568af /drivers/usb/dwc3/ep0.c | |
parent | 3b637367ae40b6d3c20e30cb0cdd059e67bbf848 (diff) |
usb: dwc3: convert TRBs into bitshifts
this will get rid of a useless memcpy on
IRQ handling, thus improving driver performance.
Tested with OMAP5430 running g_mass_storage on
SuperSpeed and HighSpeed.
Note that we are removing the little endian access
of the TRB and all accesses will be in System endianness,
if there happens to be a system in BE, bit 12 of GSBUSCFG0
should be set so that HW does byte invariant BE accesses
when fetching TRBs.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/ep0.c')
-rw-r--r-- | drivers/usb/dwc3/ep0.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index c20e30c8b695..5a067090f27e 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -76,8 +76,7 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma, | |||
76 | u32 len, u32 type) | 76 | u32 len, u32 type) |
77 | { | 77 | { |
78 | struct dwc3_gadget_ep_cmd_params params; | 78 | struct dwc3_gadget_ep_cmd_params params; |
79 | struct dwc3_trb_hw *trb_hw; | 79 | struct dwc3_trb *trb; |
80 | struct dwc3_trb trb; | ||
81 | struct dwc3_ep *dep; | 80 | struct dwc3_ep *dep; |
82 | 81 | ||
83 | int ret; | 82 | int ret; |
@@ -88,19 +87,17 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma, | |||
88 | return 0; | 87 | return 0; |
89 | } | 88 | } |
90 | 89 | ||
91 | trb_hw = dwc->ep0_trb; | 90 | trb = dwc->ep0_trb; |
92 | memset(&trb, 0, sizeof(trb)); | ||
93 | 91 | ||
94 | trb.trbctl = type; | 92 | trb->bpl = lower_32_bits(buf_dma); |
95 | trb.bplh = buf_dma; | 93 | trb->bph = upper_32_bits(buf_dma); |
96 | trb.length = len; | 94 | trb->size = len; |
95 | trb->ctrl = type; | ||
97 | 96 | ||
98 | trb.hwo = 1; | 97 | trb->ctrl |= (DWC3_TRB_CTRL_HWO |
99 | trb.lst = 1; | 98 | | DWC3_TRB_CTRL_LST |
100 | trb.ioc = 1; | 99 | | DWC3_TRB_CTRL_IOC |
101 | trb.isp_imi = 1; | 100 | | DWC3_TRB_CTRL_ISP_IMI); |
102 | |||
103 | dwc3_trb_to_hw(&trb, trb_hw); | ||
104 | 101 | ||
105 | memset(¶ms, 0, sizeof(params)); | 102 | memset(¶ms, 0, sizeof(params)); |
106 | params.param0 = upper_32_bits(dwc->ep0_trb_addr); | 103 | params.param0 = upper_32_bits(dwc->ep0_trb_addr); |
@@ -544,9 +541,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
544 | { | 541 | { |
545 | struct dwc3_request *r = NULL; | 542 | struct dwc3_request *r = NULL; |
546 | struct usb_request *ur; | 543 | struct usb_request *ur; |
547 | struct dwc3_trb trb; | 544 | struct dwc3_trb *trb; |
548 | struct dwc3_ep *ep0; | 545 | struct dwc3_ep *ep0; |
549 | u32 transferred; | 546 | u32 transferred; |
547 | u32 length; | ||
550 | u8 epnum; | 548 | u8 epnum; |
551 | 549 | ||
552 | epnum = event->endpoint_number; | 550 | epnum = event->endpoint_number; |
@@ -557,16 +555,16 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
557 | r = next_request(&ep0->request_list); | 555 | r = next_request(&ep0->request_list); |
558 | ur = &r->request; | 556 | ur = &r->request; |
559 | 557 | ||
560 | dwc3_trb_to_nat(dwc->ep0_trb, &trb); | 558 | trb = dwc->ep0_trb; |
559 | length = trb->size & DWC3_TRB_SIZE_MASK; | ||
561 | 560 | ||
562 | if (dwc->ep0_bounced) { | 561 | if (dwc->ep0_bounced) { |
563 | |||
564 | transferred = min_t(u32, ur->length, | 562 | transferred = min_t(u32, ur->length, |
565 | ep0->endpoint.maxpacket - trb.length); | 563 | ep0->endpoint.maxpacket - length); |
566 | memcpy(ur->buf, dwc->ep0_bounce, transferred); | 564 | memcpy(ur->buf, dwc->ep0_bounce, transferred); |
567 | dwc->ep0_bounced = false; | 565 | dwc->ep0_bounced = false; |
568 | } else { | 566 | } else { |
569 | transferred = ur->length - trb.length; | 567 | transferred = ur->length - length; |
570 | ur->actual += transferred; | 568 | ur->actual += transferred; |
571 | } | 569 | } |
572 | 570 | ||