projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ARM: zynq: Do not select options if SPL is not enabled
[oweals/u-boot.git]
/
common
/
usb_hub.c
diff --git
a/common/usb_hub.c
b/common/usb_hub.c
index c9be530d0bfab29d87e042ce72d00d982bff55c1..e1de813adf82225ab4f7204088a698eeb782b0e4 100644
(file)
--- a/
common/usb_hub.c
+++ b/
common/usb_hub.c
@@
-26,10
+26,14
@@
#include <command.h>
#include <dm.h>
#include <errno.h>
#include <command.h>
#include <dm.h>
#include <errno.h>
+#include <memalign.h>
#include <asm/processor.h>
#include <asm/unaligned.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
#include <asm/processor.h>
#include <asm/unaligned.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
+#ifdef CONFIG_SANDBOX
+#include <asm/state.h>
+#endif
#include <asm/unaligned.h>
#include <dm/root.h>
#include <asm/unaligned.h>
#include <dm/root.h>
@@
-79,7
+83,7
@@
static int usb_get_hub_status(struct usb_device *dev, void *data)
data, sizeof(struct usb_hub_status), USB_CNTL_TIMEOUT);
}
data, sizeof(struct usb_hub_status), USB_CNTL_TIMEOUT);
}
-
static
int usb_get_port_status(struct usb_device *dev, int port, void *data)
+int usb_get_port_status(struct usb_device *dev, int port, void *data)
{
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port,
{
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port,
@@
-157,7
+161,7
@@
static inline char *portspeed(int portstatus)
int legacy_hub_port_reset(struct usb_device *dev, int port,
unsigned short *portstat)
{
int legacy_hub_port_reset(struct usb_device *dev, int port,
unsigned short *portstat)
{
- int tries;
+ int
err,
tries;
ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
unsigned short portstatus, portchange;
ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
unsigned short portstatus, portchange;
@@
-168,8
+172,10
@@
int legacy_hub_port_reset(struct usb_device *dev, int port,
debug("%s: resetting port %d...\n", __func__, port + 1);
#endif
for (tries = 0; tries < MAX_TRIES; tries++) {
debug("%s: resetting port %d...\n", __func__, port + 1);
#endif
for (tries = 0; tries < MAX_TRIES; tries++) {
+ err = usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET);
+ if (err < 0)
+ return err;
- usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET);
mdelay(200);
if (usb_get_port_status(dev, port + 1, portsts) < 0) {
mdelay(200);
if (usb_get_port_status(dev, port + 1, portsts) < 0) {
@@
-227,7
+233,7
@@
int legacy_hub_port_reset(struct usb_device *dev, int port,
#ifdef CONFIG_DM_USB
int hub_port_reset(struct udevice *dev, int port, unsigned short *portstat)
{
#ifdef CONFIG_DM_USB
int hub_port_reset(struct udevice *dev, int port, unsigned short *portstat)
{
- struct usb_device *udev = dev_get_parent
data
(dev);
+ struct usb_device *udev = dev_get_parent
_priv
(dev);
return legacy_hub_port_reset(udev, port, portstat);
}
return legacy_hub_port_reset(udev, port, portstat);
}
@@
-269,7
+275,8
@@
int usb_hub_port_connect_change(struct usb_device *dev, int port)
/* Reset the port */
ret = legacy_hub_port_reset(dev, port, &portstatus);
if (ret < 0) {
/* Reset the port */
ret = legacy_hub_port_reset(dev, port, &portstatus);
if (ret < 0) {
- printf("cannot reset port %i!?\n", port + 1);
+ if (ret != -ENXIO)
+ printf("cannot reset port %i!?\n", port + 1);
return ret;
}
return ret;
}
@@
-462,7
+469,12
@@
static int usb_hub_configure(struct usb_device *dev)
unsigned short portstatus, portchange;
int ret;
ulong start = get_timer(0);
unsigned short portstatus, portchange;
int ret;
ulong start = get_timer(0);
+ uint delay = CONFIG_SYS_HZ;
+#ifdef CONFIG_SANDBOX
+ if (state_get_skip_delays())
+ delay = 0;
+#endif
#ifdef CONFIG_DM_USB
debug("\n\nScanning '%s' port %d\n", dev->dev->name, i + 1);
#else
#ifdef CONFIG_DM_USB
debug("\n\nScanning '%s' port %d\n", dev->dev->name, i + 1);
#else
@@
-486,11
+498,15
@@
static int usb_hub_configure(struct usb_device *dev)
portstatus = le16_to_cpu(portsts->wPortStatus);
portchange = le16_to_cpu(portsts->wPortChange);
portstatus = le16_to_cpu(portsts->wPortStatus);
portchange = le16_to_cpu(portsts->wPortChange);
- if ((portchange & USB_PORT_STAT_C_CONNECTION) ==
- (portstatus & USB_PORT_STAT_CONNECTION))
+ /* No connection change happened, wait a bit more. */
+ if (!(portchange & USB_PORT_STAT_C_CONNECTION))
+ continue;
+
+ /* Test if the connection came up, and if so, exit. */
+ if (portstatus & USB_PORT_STAT_CONNECTION)
break;
break;
- } while (get_timer(start) <
CONFIG_SYS_HZ * 10
);
+ } while (get_timer(start) <
delay
);
if (ret < 0)
continue;
if (ret < 0)
continue;
@@
-602,7
+618,7
@@
int usb_hub_probe(struct usb_device *dev, int ifnum)
#ifdef CONFIG_DM_USB
int usb_hub_scan(struct udevice *hub)
{
#ifdef CONFIG_DM_USB
int usb_hub_scan(struct udevice *hub)
{
- struct usb_device *udev = dev_get_parent
data
(hub);
+ struct usb_device *udev = dev_get_parent
_priv
(hub);
return usb_hub_configure(udev);
}
return usb_hub_configure(udev);
}
@@
-649,6
+665,6
@@
static const struct usb_device_id hub_id_table[] = {
{ } /* Terminating entry */
};
{ } /* Terminating entry */
};
-USB_DEVICE(usb_generic_hub, hub_id_table);
+U
_BOOT_U
SB_DEVICE(usb_generic_hub, hub_id_table);
#endif
#endif