]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: musb: core: properly setup the HW before registering it to the USB core
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 17 Jul 2014 10:56:12 +0000 (12:56 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 27 Aug 2014 08:44:19 +0000 (10:44 +0200)
Without this patch overriding the USBOTG_ID pin by setting the iddig
bit in the USB_MODE register doesn't work because it obviously is done
too late to be recognized correctly.

drivers/usb/musb/musb_core.c

index 980bf7f49c95bf79fdffbe01e574602eebd1a4cf..41034b431989cafd77231f5946dfd9a026c5c6a6 100644 (file)
@@ -1987,18 +1987,21 @@ 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);
+               status = musb_platform_set_mode(musb, MUSB_HOST);
                if (status < 0)
                        goto fail3;
-               status = musb_platform_set_mode(musb, MUSB_HOST);
+               status = musb_host_setup(musb, plat->power);
                break;
        case MUSB_PORT_MODE_GADGET:
-               status = musb_gadget_setup(musb);
+               status = musb_platform_set_mode(musb, MUSB_PERIPHERAL);
                if (status < 0)
                        goto fail3;
-               status = musb_platform_set_mode(musb, MUSB_PERIPHERAL);
+               status = musb_gadget_setup(musb);
                break;
        case MUSB_PORT_MODE_DUAL_ROLE:
+               status = musb_platform_set_mode(musb, MUSB_OTG);
+               if (status < 0)
+                       goto fail3;
                status = musb_host_setup(musb, plat->power);
                if (status < 0)
                        goto fail3;
@@ -2007,7 +2010,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
                        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);