This will tell glue layer which mode we want port
to be in.

Signed-off-by: Felipe Balbi <ba...@ti.com>
---
 drivers/usb/musb/musb_core.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0a43329..377ef9b 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -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);
-- 
1.8.4.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to