summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStefano Babic <[email protected]>2016-05-17 17:51:44 +0200
committerStefano Babic <[email protected]>2016-05-17 17:51:44 +0200
commit52b1eaf93d6b55e1467f97b8eefdc2f8b6031c43 (patch)
tree73357539a8382b406c29b1826dc17012f267f2cb /common
parentaaeadd3f7b248aeb1c72c36183ab9c6e77da6ce2 (diff)
parentaeaec0e682f45b9e0c62c522fafea353931f73ed (diff)
Merge branch 'master' of git://git.denx.de/u-boot
Diffstat (limited to 'common')
-rw-r--r--common/fdt_support.c20
-rw-r--r--common/kgdb.c2
-rw-r--r--common/usb.c18
-rw-r--r--common/usb_hub.c3
4 files changed, 34 insertions, 9 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index ced119e70d9..42e5d8a1d2f 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -467,23 +467,31 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)
void fdt_fixup_ethernet(void *fdt)
{
- int node, i, j;
+ int i, j, prop;
char *tmp, *end;
char mac[16];
const char *path;
unsigned char mac_addr[6];
int offset;
- node = fdt_path_offset(fdt, "/aliases");
- if (node < 0)
+ if (fdt_path_offset(fdt, "/aliases") < 0)
return;
- for (offset = fdt_first_property_offset(fdt, node);
- offset > 0;
- offset = fdt_next_property_offset(fdt, offset)) {
+ /* Cycle through all aliases */
+ for (prop = 0; ; prop++) {
const char *name;
int len = strlen("ethernet");
+ /* FDT might have been edited, recompute the offset */
+ offset = fdt_first_property_offset(fdt,
+ fdt_path_offset(fdt, "/aliases"));
+ /* Select property number 'prop' */
+ for (i = 0; i < prop; i++)
+ offset = fdt_next_property_offset(fdt, offset);
+
+ if (offset < 0)
+ break;
+
path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
if (!strncmp(name, "ethernet", len)) {
i = trailing_strtol(name);
diff --git a/common/kgdb.c b/common/kgdb.c
index d357463695f..daf53bed7a9 100644
--- a/common/kgdb.c
+++ b/common/kgdb.c
@@ -326,7 +326,7 @@ handle_exception (struct pt_regs *regs)
return (0);
}
- /* probably should check which exception occured as well */
+ /* probably should check which exception occurred as well */
if (longjmp_on_fault) {
longjmp_on_fault = 0;
kgdb_longjmp(error_jmp_buf, KGDBERR_MEMFAULT);
diff --git a/common/usb.c b/common/usb.c
index 4d0de4d87e8..8d9efe516b7 100644
--- a/common/usb.c
+++ b/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);
diff --git a/common/usb_hub.c b/common/usb_hub.c
index e6a2cdb6f86..0f39c9faf7e 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -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);
@@ -475,7 +476,7 @@ static int usb_scan_port(struct usb_device_scan *usb_scan)
return 0;
/* Otherwise the device will get removed */
- printf("Port %d over-current occured %d times\n", i + 1,
+ printf("Port %d over-current occurred %d times\n", i + 1,
hub->overcurrent_count[i]);
}