Merge branch 'master' of git://git.denx.de/u-boot-usb

This commit is contained in:
Wolfgang Denk 2010-04-09 21:42:18 +02:00
commit 2aa4c57a10
4 changed files with 32 additions and 26 deletions

View file

@ -387,7 +387,7 @@ int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
dev = simple_strtoul(boot_device, &ep, 16); dev = simple_strtoul(boot_device, &ep, 16);
stor_dev = usb_stor_get_dev(dev); stor_dev = usb_stor_get_dev(dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN) { if (stor_dev == NULL || stor_dev->type == DEV_TYPE_UNKNOWN) {
printf("\n** Device %d not available\n", dev); printf("\n** Device %d not available\n", dev);
return 1; return 1;
} }
@ -595,8 +595,10 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (strncmp(argv[1], "part", 4) == 0) { if (strncmp(argv[1], "part", 4) == 0) {
int devno, ok = 0; int devno, ok = 0;
if (argc == 2) { if (argc == 2) {
for (devno = 0; devno < USB_MAX_STOR_DEV; ++devno) { for (devno = 0; ; ++devno) {
stor_dev = usb_stor_get_dev(devno); stor_dev = usb_stor_get_dev(devno);
if (stor_dev == NULL)
break;
if (stor_dev->type != DEV_TYPE_UNKNOWN) { if (stor_dev->type != DEV_TYPE_UNKNOWN) {
ok++; ok++;
if (devno) if (devno)
@ -608,7 +610,8 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
} else { } else {
devno = simple_strtoul(argv[2], NULL, 16); devno = simple_strtoul(argv[2], NULL, 16);
stor_dev = usb_stor_get_dev(devno); stor_dev = usb_stor_get_dev(devno);
if (stor_dev->type != DEV_TYPE_UNKNOWN) { if (stor_dev != NULL &&
stor_dev->type != DEV_TYPE_UNKNOWN) {
ok++; ok++;
debug("print_part of %x\n", devno); debug("print_part of %x\n", devno);
print_part(stor_dev); print_part(stor_dev);
@ -668,12 +671,12 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (argc == 3) { if (argc == 3) {
int dev = (int)simple_strtoul(argv[2], NULL, 10); int dev = (int)simple_strtoul(argv[2], NULL, 10);
printf("\nUSB device %d: ", dev); printf("\nUSB device %d: ", dev);
if (dev >= USB_MAX_STOR_DEV) { stor_dev = usb_stor_get_dev(dev);
if (stor_dev == NULL) {
printf("unknown device\n"); printf("unknown device\n");
return 1; return 1;
} }
printf("\n Device %d: ", dev); printf("\n Device %d: ", dev);
stor_dev = usb_stor_get_dev(dev);
dev_print(stor_dev); dev_print(stor_dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN) if (stor_dev->type == DEV_TYPE_UNKNOWN)
return 1; return 1;

View file

@ -175,7 +175,7 @@ void uhci_show_temp_int_td(void);
block_dev_desc_t *usb_stor_get_dev(int index) block_dev_desc_t *usb_stor_get_dev(int index)
{ {
return (index < USB_MAX_STOR_DEV) ? &usb_dev_desc[index] : NULL; return (index < usb_max_devs) ? &usb_dev_desc[index] : NULL;
} }
@ -244,7 +244,7 @@ int usb_stor_scan(int mode)
* get info and fill it in * get info and fill it in
*/ */
if (usb_stor_get_info(dev, &usb_stor[usb_max_devs], if (usb_stor_get_info(dev, &usb_stor[usb_max_devs],
&usb_dev_desc[usb_max_devs])) &usb_dev_desc[usb_max_devs]) == 1)
usb_max_devs++; usb_max_devs++;
} }
/* if storage device */ /* if storage device */
@ -888,7 +888,7 @@ static int usb_inquiry(ccb *srb, struct us_data *ss)
USB_STOR_PRINTF("inquiry returns %d\n", i); USB_STOR_PRINTF("inquiry returns %d\n", i);
if (i == 0) if (i == 0)
break; break;
} while (retry--); } while (--retry);
if (!retry) { if (!retry) {
printf("error in inquiry\n"); printf("error in inquiry\n");

View file

@ -55,14 +55,14 @@ static struct descriptor {
{ {
0x12, /* bLength */ 0x12, /* bLength */
1, /* bDescriptorType: UDESC_DEVICE */ 1, /* bDescriptorType: UDESC_DEVICE */
0x0002, /* bcdUSB: v2.0 */ cpu_to_le16(0x0200), /* bcdUSB: v2.0 */
9, /* bDeviceClass: UDCLASS_HUB */ 9, /* bDeviceClass: UDCLASS_HUB */
0, /* bDeviceSubClass: UDSUBCLASS_HUB */ 0, /* bDeviceSubClass: UDSUBCLASS_HUB */
1, /* bDeviceProtocol: UDPROTO_HSHUBSTT */ 1, /* bDeviceProtocol: UDPROTO_HSHUBSTT */
64, /* bMaxPacketSize: 64 bytes */ 64, /* bMaxPacketSize: 64 bytes */
0x0000, /* idVendor */ 0x0000, /* idVendor */
0x0000, /* idProduct */ 0x0000, /* idProduct */
0x0001, /* bcdDevice */ cpu_to_le16(0x0100), /* bcdDevice */
1, /* iManufacturer */ 1, /* iManufacturer */
2, /* iProduct */ 2, /* iProduct */
0, /* iSerialNumber */ 0, /* iSerialNumber */
@ -536,7 +536,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
uint32_t reg; uint32_t reg;
uint32_t *status_reg; uint32_t *status_reg;
if (le16_to_cpu(req->index) >= CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) { if (le16_to_cpu(req->index) > CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) {
printf("The request port(%d) is not configured\n", printf("The request port(%d) is not configured\n",
le16_to_cpu(req->index) - 1); le16_to_cpu(req->index) - 1);
return -1; return -1;
@ -630,19 +630,8 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
tmpbuf[0] |= USB_PORT_STAT_SUSPEND; tmpbuf[0] |= USB_PORT_STAT_SUSPEND;
if (reg & EHCI_PS_OCA) if (reg & EHCI_PS_OCA)
tmpbuf[0] |= USB_PORT_STAT_OVERCURRENT; tmpbuf[0] |= USB_PORT_STAT_OVERCURRENT;
if (reg & EHCI_PS_PR && if (reg & EHCI_PS_PR)
(portreset & (1 << le16_to_cpu(req->index)))) {
int ret;
/* force reset to complete */
reg = reg & ~(EHCI_PS_PR | EHCI_PS_CLEAR);
ehci_writel(status_reg, reg);
ret = handshake(status_reg, EHCI_PS_PR, 0, 2 * 1000);
if (!ret)
tmpbuf[0] |= USB_PORT_STAT_RESET; tmpbuf[0] |= USB_PORT_STAT_RESET;
else
printf("port(%d) reset error\n",
le16_to_cpu(req->index) - 1);
}
if (reg & EHCI_PS_PP) if (reg & EHCI_PS_PP)
tmpbuf[1] |= USB_PORT_STAT_POWER >> 8; tmpbuf[1] |= USB_PORT_STAT_POWER >> 8;
@ -699,6 +688,8 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
ehci_writel(status_reg, reg); ehci_writel(status_reg, reg);
break; break;
} else { } else {
int ret;
reg |= EHCI_PS_PR; reg |= EHCI_PS_PR;
reg &= ~EHCI_PS_PE; reg &= ~EHCI_PS_PE;
ehci_writel(status_reg, reg); ehci_writel(status_reg, reg);
@ -710,8 +701,19 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
wait_ms(50); wait_ms(50);
/* terminate the reset */ /* terminate the reset */
ehci_writel(status_reg, reg & ~EHCI_PS_PR); ehci_writel(status_reg, reg & ~EHCI_PS_PR);
wait_ms(2); /*
portreset |= 1 << le16_to_cpu(req->index); * A host controller must terminate the reset
* and stabilize the state of the port within
* 2 milliseconds
*/
ret = handshake(status_reg, EHCI_PS_PR, 0,
2 * 1000);
if (!ret)
portreset |=
1 << le16_to_cpu(req->index);
else
printf("port(%d) reset error\n",
le16_to_cpu(req->index) - 1);
} }
break; break;
default: default:

View file

@ -28,6 +28,7 @@
#ifdef CONFIG_PCI_EHCI_DEVICE #ifdef CONFIG_PCI_EHCI_DEVICE
static struct pci_device_id ehci_pci_ids[] = { static struct pci_device_id ehci_pci_ids[] = {
/* Please add supported PCI EHCI controller ids here */ /* Please add supported PCI EHCI controller ids here */
{0x1033, 0x00E0},
{0, 0} {0, 0}
}; };
#endif #endif