diff mbox

[U-Boot,v2,50/80] dm: usb: sandbox: Reset emulation devices in usb stop()

Message ID 1427307788-7496-51-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass March 25, 2015, 6:22 p.m. UTC
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>
---

Changes in v2: None

 drivers/usb/host/usb-uclass.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Simon Glass April 7, 2015, 7:10 p.m. UTC | #1
On 25 March 2015 at 12:22, Simon Glass <sjg@chromium.org> wrote:
> 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>
> ---
>
> Changes in v2: None
>
>  drivers/usb/host/usb-uclass.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Applied to u-boot-dm/next.
diff mbox

Patch

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 29ef5d9..714bc0e 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -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;