mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
USB: usb_control_msg wait for driver ISR to set status.
This patch changes usb_control_msg back to the state prior to commit
4886720844
.
The USB driver ISR routine may update the status.
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
This commit is contained in:
parent
6e20e64f5c
commit
84d36b3018
1 changed files with 12 additions and 7 deletions
19
common/usb.c
19
common/usb.c
|
@ -197,16 +197,21 @@ 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);
|
||||
}
|
||||
if (dev->status)
|
||||
return -1;
|
||||
|
||||
return dev->act_len;
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue