diff options
author | Pankaj Bharadiya <pankaj.bharadiya@ti.com> | 2012-09-13 18:01:47 +0530 |
---|---|---|
committer | Vishveshwar Bhat <vishveshwar.bhat@ti.com> | 2012-10-23 12:19:00 +0530 |
commit | 82edf1718d92d408fd040117b3a20ac60ffbd10a (patch) | |
tree | a0cfdff6f33e192fae3eab5f9515aa03703c794e | |
parent | c35de2457b69c78f9b7b3399ed790552465fc04d (diff) | |
download | u-boot-beaglebone-82edf1718d92d408fd040117b3a20ac60ffbd10a.tar.gz |
Remove delay from fastboot and fix file download hang issue.
Endpoint rx count register value will be zero if it is read before
receive packet ready bit (PERI_RXCSR:RXPKTRDY) is set.
Check for the receive packet ready bit (PERI_RXCSR:RXPKTRDY) before
reading endpoint rx count register. Proceed with rx count read and
FIFO read only if RXPKTRDY bit is set.
Signed-off-by: Pankaj Bharadiya <pankaj.bharadiya@ti.com>
-rw-r--r-- | drivers/usb/musb/musb_udc.c | 90 |
1 files changed, 48 insertions, 42 deletions
diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c index 1452fcfcc..37067a73f 100644 --- a/drivers/usb/musb/musb_udc.c +++ b/drivers/usb/musb/musb_udc.c @@ -658,58 +658,64 @@ static void musb_peri_ep0(void) static void musb_peri_rx_ep(unsigned int ep) { - u16 peri_rxcount = readw(&musbr->ep[ep].epN.rxcount); + u16 peri_rxcount; - if (peri_rxcount) { - struct usb_endpoint_instance *endpoint; - u32 length; - u8 *data; - - endpoint = GET_ENDPOINT(udc_device, ep); - if (endpoint && endpoint->rcv_urb) { - struct urb *urb = endpoint->rcv_urb; - unsigned int remaining_space = urb->buffer_length - - urb->actual_length; - - if (remaining_space) { - int urb_bad = 0; /* urb is good */ - - if (peri_rxcount > remaining_space) - length = remaining_space; - else - length = peri_rxcount; - - data = (u8 *) urb->buffer_data; - data += urb->actual_length; - - /* The common musb fifo reader */ - read_fifo(ep, length, data); - - musb_peri_rx_ack(ep); - - /* - * urb's actual_length is updated in - * usbd_rcv_complete - */ - usbd_rcv_complete(endpoint, length, urb_bad); + u8 peri_rxcsr = readw(&musbr->ep[ep].epN.rxcsr); + if ((peri_rxcsr & MUSB_RXCSR_RXPKTRDY)) { + peri_rxcount = readw(&musbr->ep[ep].epN.rxcount); + if (peri_rxcount) { + struct usb_endpoint_instance *endpoint; + u32 length; + u8 *data; + endpoint = GET_ENDPOINT(udc_device, ep); + if (endpoint && endpoint->rcv_urb) { + struct urb *urb = endpoint->rcv_urb; + unsigned int remaining_space = + urb->buffer_length - + urb->actual_length; + + if (remaining_space) { + int urb_bad = 0; /* urb is good */ + + if (peri_rxcount > remaining_space) + length = remaining_space; + else + length = peri_rxcount; + + data = (u8 *) urb->buffer_data; + data += urb->actual_length; + + /* The common musb fifo reader */ + read_fifo(ep, length, data); + + musb_peri_rx_ack(ep); + + /* + * urb's actual_length is updated in + * usbd_rcv_complete + */ + usbd_rcv_complete(endpoint, length, + urb_bad); + + } else { + if (debug_level > 0) + serial_printf("ERROR : %s %d no space " + "in rcv buffer\n", + __PRETTY_FUNCTION__, ep); + } } else { if (debug_level > 0) - serial_printf("ERROR : %s %d no space " - "in rcv buffer\n", + serial_printf("ERROR : %s %d problem with " + "endpoint\n", __PRETTY_FUNCTION__, ep); } + } else { if (debug_level > 0) - serial_printf("ERROR : %s %d problem with " - "endpoint\n", + serial_printf("ERROR : %s %d with nothing to do\n", __PRETTY_FUNCTION__, ep); } - - } else { - if (debug_level > 0) - serial_printf("ERROR : %s %d with nothing to do\n", - __PRETTY_FUNCTION__, ep); } } |