[U-Boot] MPC5121 EHCI - USB Mass Storage Devices sometimes fail
Damien Dusha
d.dusha at gmail.com
Mon May 24 08:45:01 CEST 2010
Dear all,
I am attempting to integrate USB support for Freescale's MPC5121e
processor. It's based on Francesco Rendine's EHCI patch which was submitted
to the mailing list some time ago [1], though I have done some small
modifications to it, in-line with Wolfgang's review comments some time ago.
Our hardware is a board loosely based on the ADS5121 (we have a ADS5121
available somewhere in the back of a cupboard if a reference platform is
preferred).
USB mass storage devices work flawlessly under Linux on our board, but
u-boot often has problems with some USB sticks. Some sticks, such as a 4GB
Lexar (05dc:a768 Lexar Media, Inc.) work in U-Boot all of the time, whereas
a Toshiba (0930:6545 Toshiba Corp. Kingston DataTraveler 2.0 Stick (4GB) /
PNY Attache 4GB Stick), works roughly 50% of the time - about half the time
it will be started correctly and the other half will fail. This result is
repeatable over multiple (more than a half a dozen) sticks of each type.
However, when testing with a Sheeva Plug on the latest Denx Git tree, the
USB sticks work flawlessly - including the problematic Toshiba sticks. Our
port of U-Boot is a little older (August 2009), but we've backported all USB
changes from the latest Git tree, so effectively they're using the same USB
code (with the exception of ehci-fsl vs ehci-kirkwood, of course)
The offending USB sticks have problems is in usb_storage.c. In particular,
they repeatably fail at the following location (forgive the somewhat
intrusive instrumentation):
int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
block_dev_desc_t *dev_desc)
{
<snip>
//***********************************************************
// NOTE: usb_inquiry returns OK, but the next USB transaction fails
//***********************************************************
if (usb_inquiry(pccb, ss))
return -1;
perq = usb_stor_buf[0];
modi = usb_stor_buf[1];
if ((perq & 0x1f) == 0x1f) {
/* skip unknown devices */
return 0;
}
if ((modi&0x80) == 0x80) {
/* drive is removable */
dev_desc->removable = 1;
}
memcpy(&dev_desc->vendor[0], &usb_stor_buf[8], 8);
memcpy(&dev_desc->product[0], &usb_stor_buf[16], 16);
memcpy(&dev_desc->revision[0], &usb_stor_buf[32], 4);
dev_desc->vendor[8] = 0;
dev_desc->product[16] = 0;
dev_desc->revision[4] = 0;
#ifdef CONFIG_USB_BIN_FIXUP
usb_bin_fixup(dev->descriptor, (uchar *)dev_desc->vendor,
(uchar *)dev_desc->product);
#endif /* CONFIG_USB_BIN_FIXUP */
printf("ISO Vers %X, Response Data %X\n", usb_stor_buf[2],
usb_stor_buf[3]);
printf("[usb_stor_get_info] about to - usb_test_unit_ready\n", dev);
if (usb_test_unit_ready(pccb, ss)) {
printf("Device NOT ready\n"
" Request Sense returned %02X %02X %02X\n",
pccb->sense_buf[2], pccb->sense_buf[12],
pccb->sense_buf[13]);
if (dev_desc->removable == 1) {
dev_desc->type = perq;
return 1;
}
return 0;
}
<snip>
In this instance, the Toshiba sticks are of the BBB type, but other BBB
sticks behave fine.
Are there any suggestions as to what the problem might be? What other
information can I provide that would be of use to debug the problem?
Best regards,
Damien Dusha.
[1] http://lists.denx.de/pipermail/u-boot/2009-June/055021.html
More information about the U-Boot
mailing list