dm: usb: sandbox: Reset emulation devices in usb stop()
authorSimon Glass <sjg@chromium.org>
Wed, 25 Mar 2015 18:22:38 +0000 (12:22 -0600)
committerSimon Glass <sjg@chromium.org>
Sat, 18 Apr 2015 17:11:26 +0000 (11:11 -0600)
These devices must have their addresses removed ready for the next USB
bus enumeration. Add this logic to usb_stop().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
drivers/usb/host/usb-uclass.c

index 29ef5d98e25f31462f9597af7ddb70651878a0f4..714bc0e9588fb99899d0c42fe8d5dc9c203baa7e 100644 (file)
@@ -93,6 +93,17 @@ int usb_stop(void)
                        err = ret;
        }
 
+#ifdef CONFIG_SANDBOX
+       struct udevice *dev;
+
+       /* Reset all enulation devices */
+       ret = uclass_get(UCLASS_USB_EMUL, &uc);
+       if (ret)
+               return ret;
+
+       uclass_foreach_dev(dev, uc)
+               usb_emul_reset(dev);
+#endif
        usb_stor_reset();
        usb_hub_reset();
        usb_started = 0;