* [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c
@ 2010-08-14 8:19 Stefano Babic
2010-08-14 12:23 ` Sergei Shtylyov
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Stefano Babic @ 2010-08-14 8:19 UTC (permalink / raw)
To: u-boot
The buffer for the status request must be word aligned
because it is accessed with 32 bit pointer in the
eth_status_complete function.
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
drivers/usb/gadget/ether.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 313f15f..0b4ed18 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -684,7 +684,7 @@ static struct usb_gadget_strings stringtab = {
/*============================================================================*/
static u8 control_req[USB_BUFSIZ];
-static u8 status_req[STATUS_BYTECOUNT];
+static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(32)));
--
1.6.3.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c 2010-08-14 8:19 [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c Stefano Babic @ 2010-08-14 12:23 ` Sergei Shtylyov 2010-08-14 15:44 ` Remy Bohmer 2010-08-15 12:16 ` Stefano Babic 2010-08-14 15:22 ` Remy Bohmer 2010-08-15 12:18 ` [U-Boot] [PATCH V3 " Stefano Babic 2 siblings, 2 replies; 9+ messages in thread From: Sergei Shtylyov @ 2010-08-14 12:23 UTC (permalink / raw) To: u-boot Hello. Stefano Babic wrote: > The buffer for the status request must be word aligned > because it is accessed with 32 bit pointer in the > eth_status_complete function. > Signed-off-by: Stefano Babic <sbabic@denx.de> [...] > diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c > index 313f15f..0b4ed18 100644 > --- a/drivers/usb/gadget/ether.c > +++ b/drivers/usb/gadget/ether.c > @@ -684,7 +684,7 @@ static struct usb_gadget_strings stringtab = { > > /*============================================================================*/ > static u8 control_req[USB_BUFSIZ]; > -static u8 status_req[STATUS_BYTECOUNT]; > +static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(32))); You're aligning to 32 *bytes* -- is that what you meant by "32 bit pointer"? WBR, Sergei ^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c 2010-08-14 12:23 ` Sergei Shtylyov @ 2010-08-14 15:44 ` Remy Bohmer 2010-08-15 12:16 ` Stefano Babic 1 sibling, 0 replies; 9+ messages in thread From: Remy Bohmer @ 2010-08-14 15:44 UTC (permalink / raw) To: u-boot Hi, 2010/8/14 Sergei Shtylyov <sshtylyov@mvista.com>: > Hello. > > Stefano Babic wrote: > >> The buffer for the status request must be word aligned >> because it is accessed with 32 bit pointer in the >> eth_status_complete function. > >> Signed-off-by: Stefano Babic <sbabic@denx.de> > > [...] >> >> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c >> index 313f15f..0b4ed18 100644 >> --- a/drivers/usb/gadget/ether.c >> +++ b/drivers/usb/gadget/ether.c >> @@ -684,7 +684,7 @@ static struct usb_gadget_strings ? ?stringtab = { >> >> ?/*============================================================================*/ >> ?static u8 control_req[USB_BUFSIZ]; >> -static u8 status_req[STATUS_BYTECOUNT]; >> +static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(32))); > > ? You're aligning to 32 *bytes* -- is that what you meant by "32 bit > pointer"? Whoops... Good remark... Overlooked it myself... Unapplied it... Kind regards, Remy ^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c 2010-08-14 12:23 ` Sergei Shtylyov 2010-08-14 15:44 ` Remy Bohmer @ 2010-08-15 12:16 ` Stefano Babic 1 sibling, 0 replies; 9+ messages in thread From: Stefano Babic @ 2010-08-15 12:16 UTC (permalink / raw) To: u-boot Sergei Shtylyov wrote: > Hello. > > Stefano Babic wrote: > >> The buffer for the status request must be word aligned >> because it is accessed with 32 bit pointer in the >> eth_status_complete function. > >> Signed-off-by: Stefano Babic <sbabic@denx.de> > [...] >> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c >> index 313f15f..0b4ed18 100644 >> --- a/drivers/usb/gadget/ether.c >> +++ b/drivers/usb/gadget/ether.c >> @@ -684,7 +684,7 @@ static struct usb_gadget_strings stringtab = { >> >> /*============================================================================*/ >> >> static u8 control_req[USB_BUFSIZ]; >> -static u8 status_req[STATUS_BYTECOUNT]; >> +static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(32))); > > You're aligning to 32 *bytes* -- is that what you meant by "32 bit > pointer"? Oooopsss ! Thanks, I fix it Best regards, Stefano -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de ===================================================================== ^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c 2010-08-14 8:19 [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c Stefano Babic 2010-08-14 12:23 ` Sergei Shtylyov @ 2010-08-14 15:22 ` Remy Bohmer 2010-08-15 12:18 ` [U-Boot] [PATCH V3 " Stefano Babic 2 siblings, 0 replies; 9+ messages in thread From: Remy Bohmer @ 2010-08-14 15:22 UTC (permalink / raw) To: u-boot Hi, 2010/8/14 Stefano Babic <sbabic@denx.de>: > The buffer for the status request must be word aligned > because it is accessed with 32 bit pointer in the > eth_status_complete function. > > Signed-off-by: Stefano Babic <sbabic@denx.de> > --- > ?drivers/usb/gadget/ether.c | ? ?2 +- > ?1 files changed, 1 insertions(+), 1 deletions(-) Applied to u-boot-usb/cdc Thanks. Remy ^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH V3 1/2] USB-CDC: correct wrong alignment in ether.c 2010-08-14 8:19 [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c Stefano Babic 2010-08-14 12:23 ` Sergei Shtylyov 2010-08-14 15:22 ` Remy Bohmer @ 2010-08-15 12:18 ` Stefano Babic 2010-08-15 12:19 ` [U-Boot] [PATCH V3 2/2] USB-CDC: called handle_interrupts inside usb_eth_send Stefano Babic 2010-08-15 16:18 ` [U-Boot] [PATCH V3 1/2] USB-CDC: correct wrong alignment in ether.c Remy Bohmer 2 siblings, 2 replies; 9+ messages in thread From: Stefano Babic @ 2010-08-15 12:18 UTC (permalink / raw) To: u-boot The buffer for the status request must be word aligned because it is accessed with 32 bit pointer in the eth_status_complete function. Signed-off-by: Stefano Babic <sbabic@denx.de> --- drivers/usb/gadget/ether.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index c601d4a..9fc6a36 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -677,7 +677,7 @@ static struct usb_gadget_strings stringtab = { /*============================================================================*/ static u8 control_req[USB_BUFSIZ]; -static u8 status_req[STATUS_BYTECOUNT]; +static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(4))); -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH V3 2/2] USB-CDC: called handle_interrupts inside usb_eth_send 2010-08-15 12:18 ` [U-Boot] [PATCH V3 " Stefano Babic @ 2010-08-15 12:19 ` Stefano Babic 2010-08-15 16:17 ` Remy Bohmer 2010-08-15 16:18 ` [U-Boot] [PATCH V3 1/2] USB-CDC: correct wrong alignment in ether.c Remy Bohmer 1 sibling, 1 reply; 9+ messages in thread From: Stefano Babic @ 2010-08-15 12:19 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 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; -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH V3 2/2] USB-CDC: called handle_interrupts inside usb_eth_send 2010-08-15 12:19 ` [U-Boot] [PATCH V3 2/2] USB-CDC: called handle_interrupts inside usb_eth_send Stefano Babic @ 2010-08-15 16:17 ` Remy Bohmer 0 siblings, 0 replies; 9+ messages in thread From: Remy Bohmer @ 2010-08-15 16:17 UTC (permalink / raw) To: u-boot Hi, 2010/8/15 Stefano Babic <sbabic@denx.de>: > 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(-) Applied to u-boot-usb/cdc Thanks. Remy ^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH V3 1/2] USB-CDC: correct wrong alignment in ether.c 2010-08-15 12:18 ` [U-Boot] [PATCH V3 " Stefano Babic 2010-08-15 12:19 ` [U-Boot] [PATCH V3 2/2] USB-CDC: called handle_interrupts inside usb_eth_send Stefano Babic @ 2010-08-15 16:18 ` Remy Bohmer 1 sibling, 0 replies; 9+ messages in thread From: Remy Bohmer @ 2010-08-15 16:18 UTC (permalink / raw) To: u-boot Hi, 2010/8/15 Stefano Babic <sbabic@denx.de>: > The buffer for the status request must be word aligned > because it is accessed with 32 bit pointer in the > eth_status_complete function. > > Signed-off-by: Stefano Babic <sbabic@denx.de> > --- > ?drivers/usb/gadget/ether.c | ? ?2 +- > ?1 files changed, 1 insertions(+), 1 deletions(-) Applied to u-boot-usb/cdc Thanks. Remy ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-08-15 16:18 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-08-14 8:19 [U-Boot] [PATCH V2 1/2] USB-CDC: correct wrong alignment in ether.c Stefano Babic 2010-08-14 12:23 ` Sergei Shtylyov 2010-08-14 15:44 ` Remy Bohmer 2010-08-15 12:16 ` Stefano Babic 2010-08-14 15:22 ` Remy Bohmer 2010-08-15 12:18 ` [U-Boot] [PATCH V3 " Stefano Babic 2010-08-15 12:19 ` [U-Boot] [PATCH V3 2/2] USB-CDC: called handle_interrupts inside usb_eth_send Stefano Babic 2010-08-15 16:17 ` Remy Bohmer 2010-08-15 16:18 ` [U-Boot] [PATCH V3 1/2] USB-CDC: correct wrong alignment in ether.c Remy Bohmer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox