mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-29 16:10:58 +00:00
usb: dwc3: ep0: preparation for implementing chained TRB
No functional change. Modified few things so that there are no code duplication while implementing chained TRB. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
This commit is contained in:
parent
526a50f8ec
commit
1f78f8feda
1 changed files with 12 additions and 8 deletions
|
@ -761,7 +761,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
|
||||||
struct usb_request *ur;
|
struct usb_request *ur;
|
||||||
struct dwc3_trb *trb;
|
struct dwc3_trb *trb;
|
||||||
struct dwc3_ep *ep0;
|
struct dwc3_ep *ep0;
|
||||||
u32 transferred;
|
unsigned transfer_size = 0;
|
||||||
|
unsigned maxp;
|
||||||
|
void *buf;
|
||||||
|
u32 transferred = 0;
|
||||||
u32 status;
|
u32 status;
|
||||||
u32 length;
|
u32 length;
|
||||||
u8 epnum;
|
u8 epnum;
|
||||||
|
@ -790,18 +793,19 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
|
||||||
}
|
}
|
||||||
|
|
||||||
ur = &r->request;
|
ur = &r->request;
|
||||||
|
buf = ur->buf;
|
||||||
|
|
||||||
length = trb->size & DWC3_TRB_SIZE_MASK;
|
length = trb->size & DWC3_TRB_SIZE_MASK;
|
||||||
|
|
||||||
if (dwc->ep0_bounced) {
|
maxp = ep0->endpoint.maxpacket;
|
||||||
unsigned transfer_size = ur->length;
|
|
||||||
unsigned maxp = ep0->endpoint.maxpacket;
|
|
||||||
|
|
||||||
transfer_size += (maxp - (transfer_size % maxp));
|
if (dwc->ep0_bounced) {
|
||||||
transferred = min_t(u32, ur->length,
|
transfer_size = roundup((ur->length - transfer_size),
|
||||||
|
maxp);
|
||||||
|
transferred = min_t(u32, ur->length - transferred,
|
||||||
transfer_size - length);
|
transfer_size - length);
|
||||||
dwc3_flush_cache((int)dwc->ep0_bounce, DWC3_EP0_BOUNCE_SIZE);
|
dwc3_flush_cache((int)dwc->ep0_bounce, DWC3_EP0_BOUNCE_SIZE);
|
||||||
memcpy(ur->buf, dwc->ep0_bounce, transferred);
|
memcpy(buf, dwc->ep0_bounce, transferred);
|
||||||
} else {
|
} else {
|
||||||
transferred = ur->length - length;
|
transferred = ur->length - length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue