[U-Boot] [PATCH 8/8] dwc2: use the nonblock argument in submit_int_msg

Michal Suchanek msuchanek at suse.de
Mon Jul 1 15:56:45 UTC 2019


An USB 1.1 keybaord connected to dwc2 does not report status until it
changes. With this patch you can enable keyboard by pressing a key while
USB devices are probed. Without a keypress no state is reported an the
probe times out. We don't want to wait for a keypress or timeout while
polling for keypresses so implement the nonblock variant that exits early.

Signed-off-by: Michal Suchanek <msuchanek at suse.de>
---
 drivers/usb/host/dwc2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index 3a44f5b14509..78829d56199c 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -1123,7 +1123,7 @@ int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
 			return -ETIMEDOUT;
 		}
 		ret = _submit_bulk_msg(priv, dev, pipe, buffer, len);
-		if (ret != -EAGAIN)
+		if ((ret != -EAGAIN) || nonblock)
 			return ret;
 	}
 }
@@ -1294,13 +1294,13 @@ static int dwc2_submit_bulk_msg(struct udevice *dev, struct usb_device *udev,
 
 static int dwc2_submit_int_msg(struct udevice *dev, struct usb_device *udev,
 			       unsigned long pipe, void *buffer, int length,
-			       int interval)
+			       int interval, bool nonblock)
 {
 	struct dwc2_priv *priv = dev_get_priv(dev);
 
 	debug("%s: dev='%s', udev=%p\n", __func__, dev->name, udev);
 
-	return _submit_int_msg(priv, udev, pipe, buffer, length, interval);
+	return _submit_int_msg(priv, udev, pipe, buffer, length, interval, nonblock);
 }
 
 static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
-- 
2.21.0



More information about the U-Boot mailing list