diff options
author | Stefano Babic <sbabic@denx.de> | 2010-08-15 14:19:00 +0200 |
---|---|---|
committer | Remy Bohmer <linux@bohmer.net> | 2010-09-20 21:57:17 +0200 |
commit | a170f2c7973728f2e9e1b66214b0c14062c78398 (patch) | |
tree | 84b9b6352be3c01adf2da029b7eaa150bae6bb3d /drivers/usb/gadget | |
parent | 80460772197ea33d9e0023b1c359f5916a760fa1 (diff) | |
download | u-boot-imx-a170f2c7973728f2e9e1b66214b0c14062c78398.zip u-boot-imx-a170f2c7973728f2e9e1b66214b0c14062c78398.tar.gz u-boot-imx-a170f2c7973728f2e9e1b66214b0c14062c78398.tar.bz2 |
USB-CDC: called handle_interrupts inside usb_eth_send
The patch removes an endless loop in the usb_eth_send
if the tx_complete is not called before going
in the loop. The driver interrupt routine is called
allowing the driver to check if the TX is completed.
Signed-off-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/ether.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 9fc6a36..2965299 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1801,6 +1801,8 @@ static int usb_eth_send(struct eth_device* netdev, volatile void* packet, int le int retval; struct usb_request *req = NULL; struct eth_dev *dev = &l_ethdev; + unsigned long ts; + unsigned long timeout = USB_CONNECT_TIMEOUT; debug("%s:...\n", __func__); @@ -1826,6 +1828,8 @@ static int usb_eth_send(struct eth_device* netdev, volatile void* packet, int le ? ((dev->tx_qlen % qmult) != 0) : 0; #endif dev->tx_qlen=1; + ts = get_timer(0); + packet_sent = 0; retval = usb_ep_queue (dev->in_ep, req, GFP_ATOMIC); @@ -1833,7 +1837,11 @@ static int usb_eth_send(struct eth_device* netdev, volatile void* packet, int le debug("%s: packet queued\n", __func__); while(!packet_sent) { - packet_sent=0; + if (get_timer(ts) > timeout) { + printf("timeout sending packets to usb ethernet\n"); + return -1; + } + usb_gadget_handle_interrupts(); } return 0; |