]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/usb/emul/sandbox_hub.c
usb: hub: Change USB hub descriptor to match USB 3.0 hubs
[people/ms/u-boot.git] / drivers / usb / emul / sandbox_hub.c
index baf8bdc857b6452315af9c7efec983dd2a1bc06d..1432858fd594cd3b70ba7b4a4b0ddb9334fd3f35 100644 (file)
@@ -13,7 +13,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /* We only support up to 8 */
-#define SANDBOX_NUM_PORTS      2
+#define SANDBOX_NUM_PORTS      4
 
 struct sandbox_hub_platdata {
        struct usb_dev_platdata plat;
@@ -96,7 +96,12 @@ static struct usb_hub_descriptor hub_desc = {
                                                                1 << 7),
        .bPwrOn2PwrGood         = 2,
        .bHubContrCurrent       = 5,
-       .DeviceRemovable        = {0, 0xff}, /* all ports removeable */
+       {
+               {
+                       /* all ports removeable */
+                       .DeviceRemovable        = {0, 0xff}
+               }
+       }
 #if SANDBOX_NUM_PORTS > 8
 #error "This code sets up an incorrect mask"
 #endif
@@ -156,7 +161,7 @@ static int clrset_post_state(struct udevice *hub, int port, int clear, int set)
                        } else if (clear & USB_PORT_STAT_POWER) {
                                debug("%s: %s: power off, removed, ret=%d\n",
                                      __func__, dev->name, ret);
-                               ret = device_remove(dev);
+                               ret = device_remove(dev, DM_REMOVE_NORMAL);
                                clear |= USB_PORT_STAT_CONNECTION;
                        }
                }
@@ -277,7 +282,7 @@ static int sandbox_child_post_bind(struct udevice *dev)
 {
        struct sandbox_hub_platdata *plat = dev_get_parent_platdata(dev);
 
-       plat->port = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       plat->port = dev_read_u32_default(dev, "reg", -1);
 
        return 0;
 }