summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2012-11-21 16:25:55 +0100
committerPatrick Georgi <patrick@georgi-clan.de>2012-11-23 18:18:14 +0100
commitef88e102bb4895753c8ba67e01ee26fdfe3fa712 (patch)
tree51bf21480206f38c18c69a41889019411468aed0
parent86c686a76e7565b26355a9937fe397e23536512c (diff)
libpayload: More compliant error recovery in USB MSC
If an endpoint gets stalled by an MSC device, after successful transmission of a command (CBW), we should still ask for the status (CSW). Otherwise, the driver and the device get desynchronized on the command tags. Change-Id: I53167f22c43b3a237cb4539b3affe37799378b93 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/1900 Reviewed-by: Patrick Georgi <patrick@georgi-clan.de> Tested-by: build bot (Jenkins)
-rw-r--r--payloads/libpayload/drivers/usb/usbmsc.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/payloads/libpayload/drivers/usb/usbmsc.c b/payloads/libpayload/drivers/usb/usbmsc.c
index 5cfb3c63cb..7e8b360758 100644
--- a/payloads/libpayload/drivers/usb/usbmsc.c
+++ b/payloads/libpayload/drivers/usb/usbmsc.c
@@ -227,16 +227,12 @@ execute_command (usbdev_t *dev, cbw_direction dir, const u8 *cb, int cblen,
if (buflen > 0) {
if (dir == cbw_direction_data_in) {
if (dev->controller->
- bulk (MSC_INST (dev)->bulk_in, buflen, buf, 0)) {
+ bulk (MSC_INST (dev)->bulk_in, buflen, buf, 0))
clear_stall (MSC_INST (dev)->bulk_in);
- return MSC_COMMAND_FAIL;
- }
} else {
if (dev->controller->
- bulk (MSC_INST (dev)->bulk_out, buflen, buf, 0)) {
+ bulk (MSC_INST (dev)->bulk_out, buflen, buf, 0))
clear_stall (MSC_INST (dev)->bulk_out);
- return MSC_COMMAND_FAIL;
- }
}
}
int ret = get_csw (MSC_INST (dev)->bulk_in, &csw);