public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] USB-CDC: called handle_interrupts inside usb_eth_send
@ 2010-08-11 21:40 Stefano Babic
  2010-08-11 22:28 ` Remy Bohmer
  0 siblings, 1 reply; 5+ messages in thread
From: Stefano Babic @ 2010-08-11 21:40 UTC (permalink / raw)
  To: u-boot

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>
---
 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 1481d76..9eb43d7 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1808,6 +1808,8 @@ static int usb_eth_send(struct eth_device* netdev, volatile void* packet, int le
 	struct usb_request	*req = NULL;
 
 	struct eth_dev *dev = &l_ethdev;
+	unsigned long ts;
+	unsigned long timeout = USB_CONNECT_TIMEOUT;
 	dprintf("%s:...\n",__func__);
 
 	req = dev->tx_req;
@@ -1837,9 +1839,15 @@ static int usb_eth_send(struct eth_device* netdev, volatile void* packet, int le
 
 	if (!retval)
 		dprintf("%s: packet queued\n",__func__);
+	ts = get_timer(0);
+	packet_sent=0;
 	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;
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-12 12:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-11 21:40 [U-Boot] [PATCH] USB-CDC: called handle_interrupts inside usb_eth_send Stefano Babic
2010-08-11 22:28 ` Remy Bohmer
2010-08-12  8:44   ` Stefano Babic
2010-08-12  9:52     ` Remy Bohmer
2010-08-12 12:33       ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox