]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00161598 [MX6]OTG driver: load fail issue
authormake shi <b15407@freescale.com>
Tue, 8 Nov 2011 06:54:28 +0000 (14:54 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:25 +0000 (08:33 +0200)
[MX6] OTG load fail when remove all usb module

Signed-off-by: make shi <b15407@freescale.com>
arch/arm/mach-mx6/usb_dr.c

index f498d6e94cc2c5784fc4f686af234afddf7f8b71..de84a4ded23b788ce5be6d909e77cde9aa921e99 100644 (file)
@@ -141,12 +141,12 @@ static int usbotg_init_ext(struct platform_device *pdev)
        if (!otg_used) {
                usbotg_internal_phy_clock_gate(true);
                usb_phy_enable(pdev->dev.platform_data);
-               otg_used++;
                /*after the phy reset,can not read the readingvalue for id/vbus at
                * the register of otgsc ,cannot  read at once ,need delay 3 ms
                */
                mdelay(3);
        }
+       otg_used++;
 
        return ret;
 }
@@ -457,8 +457,9 @@ void __init mx6_usb_dr_init(void)
 #endif
        /* register wakeup device */
        pdev_wakeup = imx6q_add_fsl_usb2_otg_wakeup(&dr_wakeup_config);
-       ((struct fsl_usb2_platform_data *)(pdev->dev.platform_data))->wakeup_pdata =
-               (struct fsl_usb2_wakeup_platform_data *)(pdev_wakeup->dev.platform_data);
+       if (pdev != NULL)
+               ((struct fsl_usb2_platform_data *)(pdev->dev.platform_data))->wakeup_pdata =
+                       (struct fsl_usb2_wakeup_platform_data *)(pdev_wakeup->dev.platform_data);
 
        /* Some phy and power's special controls for otg
         * 1. The external charger detector needs to be disabled