]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/usb/musb/musb_virthub.c
Merge remote-tracking branch 'usb-gadget/next'
[karo-tx-linux.git] / drivers / usb / musb / musb_virthub.c
index d1d6b83aabca61df43dffccf57ccbe7687cbe399..9af6bba5eac964bb7195e78815b22bc1958c6c3c 100644 (file)
@@ -220,6 +220,23 @@ int musb_hub_status_data(struct usb_hcd *hcd, char *buf)
        return retval;
 }
 
+static int musb_has_gadget(struct musb *musb)
+{
+       /*
+        * In host-only mode we start a connection right away. In OTG mode
+        * we have to wait until we loaded a gadget. We don't really need a
+        * gadget if we operate as a host but we should not start a session
+        * as a device without a gadget or else we explode.
+        */
+#ifdef CONFIG_USB_MUSB_HOST
+       return 1;
+#else
+       if (musb->port_mode == MUSB_PORT_MODE_HOST)
+               return 1;
+       return musb->g.dev.driver != NULL;
+#endif
+}
+
 int musb_hub_control(
        struct usb_hcd  *hcd,
        u16             typeReq,
@@ -362,7 +379,7 @@ int musb_hub_control(
                         * initialization logic, e.g. for OTG, or change any
                         * logic relating to VBUS power-up.
                         */
-                       if (!hcd->self.is_b_host)
+                       if (!hcd->self.is_b_host && musb_has_gadget(musb))
                                musb_start(musb);
                        break;
                case USB_PORT_FEAT_RESET: