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

Simon Glass sjg at chromium.org
Wed Mar 25 19:22:38 CET 2015


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 at chromium.org>
---

Changes in v2: None

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

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;
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list