usb: musb: core: honour initial transceiver state
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 10 Mar 2013 00:48:55 +0000 (02:48 +0200)
committerFelipe Balbi <balbi@ti.com>
Fri, 22 Mar 2013 06:40:48 +0000 (08:40 +0200)
As the usb transceiver driver usually starts first, it should already
have default_a variable set according to ID pin state, so don't
override it. In case default_a was not changed by trasceiver, it will
default to 0 and this code will work as before.

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

index 6bd879257e4cb50fb6ab3f11bb57d08faa38493b..5fbabc0037b4363a5016bf583e4b34883b9ca7af 100644 (file)
@@ -1952,9 +1952,13 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
                musb_write_ulpi_buscontrol(musb->mregs, busctl);
        }
 
-       MUSB_DEV_MODE(musb);
-       musb->xceiv->otg->default_a = 0;
-       musb->xceiv->state = OTG_STATE_B_IDLE;
+       if (musb->xceiv->otg->default_a) {
+               MUSB_HST_MODE(musb);
+               musb->xceiv->state = OTG_STATE_A_IDLE;
+       } else {
+               MUSB_DEV_MODE(musb);
+               musb->xceiv->state = OTG_STATE_B_IDLE;
+       }
 
        status = musb_gadget_setup(musb);