* [U-Boot] [PATCH 1/1] USB: usb_control_msg wait for driver ISR to set status.
@ 2010-02-01 9:58 Daniel Hellstrom
2010-02-01 18:42 ` Remy Bohmer
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Hellstrom @ 2010-02-01 9:58 UTC (permalink / raw)
To: u-boot
This patch changes usb_control_msg back to the state prior to commit
48867208444cb2a82e2af9c3249e90b7ed4a1751.
The USB driver ISR routine may update the status.
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
---
common/usb.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/common/usb.c b/common/usb.c
index eef4b34..f7a5513 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -197,16 +197,19 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
if (timeout == 0)
return (int)size;
- if (dev->status != 0) {
- /*
- * Let's wait a while for the timeout to elapse.
- * It has no real use, but it keeps the interface happy.
- */
- wait_ms(timeout);
- return -1;
+ /* Wait for status to update until timeout expires, USB driver
+ * interrupt handler may set the status when the USB operation has
+ * been completed.
+ */
+ while (timeout--) {
+ if ( !((volatile unsigned long)dev->status & USB_ST_NOT_PROC) )
+ break;
+ wait_ms(1);
}
-
- return dev->act_len;
+ if ( dev->status == 0 )
+ return dev->act_len;
+ else
+ return -1;
}
/*-------------------------------------------------------------------
--
1.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH 1/1] USB: usb_control_msg wait for driver ISR to set status.
2010-02-01 9:58 [U-Boot] [PATCH 1/1] USB: usb_control_msg wait for driver ISR to set status Daniel Hellstrom
@ 2010-02-01 18:42 ` Remy Bohmer
0 siblings, 0 replies; 2+ messages in thread
From: Remy Bohmer @ 2010-02-01 18:42 UTC (permalink / raw)
To: u-boot
Hi Daniel,
2010/2/1 Daniel Hellstrom <daniel@gaisler.com>:
> This patch changes usb_control_msg back to the state prior to commit
> 48867208444cb2a82e2af9c3249e90b7ed4a1751.
>
> The USB driver ISR routine may update the status.
>
> Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
> ---
> ?common/usb.c | ? 21 ++++++++++++---------
> ?1 files changed, 12 insertions(+), 9 deletions(-)
Applied to u-boot-usb after fixing several coding style issues.
Kind regards,
Remy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-01 18:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-01 9:58 [U-Boot] [PATCH 1/1] USB: usb_control_msg wait for driver ISR to set status Daniel Hellstrom
2010-02-01 18:42 ` Remy Bohmer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.