Skip to content
Snippets Groups Projects
Commit 813f74ea authored by Bin Meng's avatar Bin Meng Committed by Marek Vasut
Browse files

usb: sandbox: Initialize root hub's device speed to high speed


At present 'usb tree' shows that the root hub on the Sandbox USB
controller is at full speed. But its device descriptor says it's
USB 2.0, so let's report it as a high speed device.

Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
parent 8d36c687
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
struct sandbox_usb_ctrl {
int rootdev;
};
static void usbmon_trace(struct udevice *bus, ulong pipe, static void usbmon_trace(struct udevice *bus, ulong pipe,
struct devrequest *setup, struct udevice *emul) struct devrequest *setup, struct udevice *emul)
{ {
...@@ -40,6 +44,7 @@ static int sandbox_submit_control(struct udevice *bus, ...@@ -40,6 +44,7 @@ static int sandbox_submit_control(struct udevice *bus,
void *buffer, int length, void *buffer, int length,
struct devrequest *setup) struct devrequest *setup)
{ {
struct sandbox_usb_ctrl *ctrl = dev_get_priv(bus);
struct udevice *emul; struct udevice *emul;
int ret; int ret;
...@@ -49,6 +54,14 @@ static int sandbox_submit_control(struct udevice *bus, ...@@ -49,6 +54,14 @@ static int sandbox_submit_control(struct udevice *bus,
usbmon_trace(bus, pipe, setup, emul); usbmon_trace(bus, pipe, setup, emul);
if (ret) if (ret)
return ret; return ret;
if (usb_pipedevice(pipe) == ctrl->rootdev) {
if (setup->request == USB_REQ_SET_ADDRESS) {
debug("%s: Set root hub's USB address\n", __func__);
ctrl->rootdev = le16_to_cpu(setup->value);
}
}
ret = usb_emul_control(emul, udev, pipe, buffer, length, setup); ret = usb_emul_control(emul, udev, pipe, buffer, length, setup);
if (ret < 0) { if (ret < 0) {
debug("ret=%d\n", ret); debug("ret=%d\n", ret);
...@@ -107,6 +120,16 @@ static int sandbox_submit_int(struct udevice *bus, struct usb_device *udev, ...@@ -107,6 +120,16 @@ static int sandbox_submit_int(struct udevice *bus, struct usb_device *udev,
static int sandbox_alloc_device(struct udevice *dev, struct usb_device *udev) static int sandbox_alloc_device(struct udevice *dev, struct usb_device *udev)
{ {
struct sandbox_usb_ctrl *ctrl = dev_get_priv(dev);
/*
* Root hub will be the first device to be initailized.
* If this device is a root hub, initialize its device speed
* to high speed as we are a USB 2.0 controller.
*/
if (ctrl->rootdev == 0)
udev->speed = USB_SPEED_HIGH;
return 0; return 0;
} }
...@@ -133,4 +156,5 @@ U_BOOT_DRIVER(usb_sandbox) = { ...@@ -133,4 +156,5 @@ U_BOOT_DRIVER(usb_sandbox) = {
.of_match = sandbox_usb_ids, .of_match = sandbox_usb_ids,
.probe = sandbox_usb_probe, .probe = sandbox_usb_probe,
.ops = &sandbox_usb_ops, .ops = &sandbox_usb_ops,
.priv_auto_alloc_size = sizeof(struct sandbox_usb_ctrl),
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment