usb: musb: core: call musb_platform_set_mode() during probe
authorFelipe Balbi <balbi@ti.com>
Tue, 29 Oct 2013 17:17:17 +0000 (12:17 -0500)
committerFelipe Balbi <balbi@ti.com>
Tue, 26 Nov 2013 16:35:15 +0000 (10:35 -0600)
This will tell glue layer which mode we want port
to be in.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/musb/musb_core.c

index 0a43329569d178de72a5c8ee619e7206c360c51c..377ef9b29c73832aec90b325ebe69d9b41103696 100644 (file)
@@ -1941,17 +1941,26 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
        switch (musb->port_mode) {
        case MUSB_PORT_MODE_HOST:
                status = musb_host_setup(musb, plat->power);
+               if (status < 0)
+                       goto fail3;
+               status = musb_platform_set_mode(musb, MUSB_HOST);
                break;
        case MUSB_PORT_MODE_GADGET:
                status = musb_gadget_setup(musb);
+               if (status < 0)
+                       goto fail3;
+               status = musb_platform_set_mode(musb, MUSB_PERIPHERAL);
                break;
        case MUSB_PORT_MODE_DUAL_ROLE:
                status = musb_host_setup(musb, plat->power);
                if (status < 0)
                        goto fail3;
                status = musb_gadget_setup(musb);
-               if (status)
+               if (status) {
                        musb_host_cleanup(musb);
+                       goto fail3;
+               }
+               status = musb_platform_set_mode(musb, MUSB_OTG);
                break;
        default:
                dev_err(dev, "unsupported port mode %d\n", musb->port_mode);