Merge branch 'master' of git://git.denx.de/u-boot-usb
This commit is contained in:
commit
7b4f17bf36
18
common/usb.c
18
common/usb.c
|
@ -1064,7 +1064,7 @@ static int usb_prepare_device(struct usb_device *dev, int addr, bool do_read,
|
|||
|
||||
int usb_select_config(struct usb_device *dev)
|
||||
{
|
||||
unsigned char *tmpbuf = 0;
|
||||
unsigned char *tmpbuf = NULL;
|
||||
int err;
|
||||
|
||||
err = get_descriptor_len(dev, USB_DT_DEVICE_SIZE, USB_DT_DEVICE_SIZE);
|
||||
|
@ -1077,6 +1077,14 @@ int usb_select_config(struct usb_device *dev)
|
|||
le16_to_cpus(&dev->descriptor.idProduct);
|
||||
le16_to_cpus(&dev->descriptor.bcdDevice);
|
||||
|
||||
/*
|
||||
* Kingston DT Ultimate 32GB USB 3.0 seems to be extremely sensitive
|
||||
* about this first Get Descriptor request. If there are any other
|
||||
* requests in the first microframe, the stick crashes. Wait about
|
||||
* one microframe duration here (1mS for USB 1.x , 125uS for USB 2.0).
|
||||
*/
|
||||
mdelay(1);
|
||||
|
||||
/* only support for one config for now */
|
||||
err = usb_get_configuration_len(dev, 0);
|
||||
if (err >= 0) {
|
||||
|
@ -1107,6 +1115,14 @@ int usb_select_config(struct usb_device *dev)
|
|||
"len %d, status %lX\n", dev->act_len, dev->status);
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait until the Set Configuration request gets processed by the
|
||||
* device. This is required by at least SanDisk Cruzer Pop USB 2.0
|
||||
* and Kingston DT Ultimate 32GB USB 3.0 on DWC2 OTG controller.
|
||||
*/
|
||||
mdelay(10);
|
||||
|
||||
debug("new device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
|
||||
dev->descriptor.iManufacturer, dev->descriptor.iProduct,
|
||||
dev->descriptor.iSerialNumber);
|
||||
|
|
|
@ -402,6 +402,7 @@ static int usb_scan_port(struct usb_device_scan *usb_scan)
|
|||
free(usb_scan);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
portstatus = le16_to_cpu(portsts->wPortStatus);
|
||||
|
|
|
@ -468,8 +468,10 @@ int dfu_config_entities(char *env, char *interface, char *devstr)
|
|||
s = strsep(&env, ";");
|
||||
ret = dfu_fill_entity(&dfu[i], s, alt_num_cnt, interface,
|
||||
devstr);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
free(dfu);
|
||||
return -1;
|
||||
}
|
||||
|
||||
list_add_tail(&dfu[i].list, &dfu_list);
|
||||
alt_num_cnt++;
|
||||
|
|
|
@ -636,7 +636,7 @@ dfu_prepare_strings(struct f_dfu *f_dfu, int n)
|
|||
|
||||
f_dfu->strings = calloc(sizeof(struct usb_string), n + 1);
|
||||
if (!f_dfu->strings)
|
||||
goto enomem;
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
de = dfu_get_entity(i);
|
||||
|
@ -647,14 +647,6 @@ dfu_prepare_strings(struct f_dfu *f_dfu, int n)
|
|||
f_dfu->strings[i].s = NULL;
|
||||
|
||||
return 0;
|
||||
|
||||
enomem:
|
||||
while (i)
|
||||
f_dfu->strings[--i].s = NULL;
|
||||
|
||||
free(f_dfu->strings);
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static int dfu_prepare_function(struct f_dfu *f_dfu, int n)
|
||||
|
|
|
@ -1088,6 +1088,15 @@ static int dwc2_init_common(struct dwc2_priv *priv)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a 1 second delay here. This gives the host controller
|
||||
* a bit time before the comminucation with the USB devices
|
||||
* is started (the bus is scanned) and fixes the USB detection
|
||||
* problems with some problematic USB keys.
|
||||
*/
|
||||
if (readl(®s->gintsts) & DWC2_GINTSTS_CURMODE_HOST)
|
||||
mdelay(1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ static void usb_oc_config(int index)
|
|||
}
|
||||
|
||||
/**
|
||||
* board_ehci_hcd_init - override usb phy mode
|
||||
* board_usb_phy_mode - override usb phy mode
|
||||
* @port: usb host/otg port
|
||||
*
|
||||
* Target board specific, override usb_phy_mode.
|
||||
|
@ -310,6 +310,7 @@ int ehci_hcd_init(int index, enum usb_init_type init,
|
|||
#endif
|
||||
struct usb_ehci *ehci = (struct usb_ehci *)(USB_BASE_ADDR +
|
||||
(controller_spacing * index));
|
||||
int ret;
|
||||
|
||||
if (index > 3)
|
||||
return -EINVAL;
|
||||
|
@ -317,7 +318,9 @@ int ehci_hcd_init(int index, enum usb_init_type init,
|
|||
mdelay(1);
|
||||
|
||||
/* Do board specific initialization */
|
||||
board_ehci_hcd_init(index);
|
||||
ret = board_ehci_hcd_init(index);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
usb_power_config(index);
|
||||
usb_oc_config(index);
|
||||
|
|
Loading…
Reference in New Issue