]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00258491-2 msl-mx6: usb: put PHY to be out of low power explicitly
authorPeter Chen <peter.chen@freescale.com>
Tue, 16 Apr 2013 01:47:15 +0000 (09:47 +0800)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:14:00 +0000 (14:14 +0200)
We have wrong understanding that reset controller will put PHY
to be out of low power automatically, but in fact, it is not.
So, we should put PHY to be out of low power explicitly if the
portsc.phcd = 1 before we need to access controller's register.
Some register writing will hang system (eg,PERIODICLISTBASE),
some reading will not get the correct value (eg, otgsc).

Signed-off-by: Peter Chen <peter.chen@freescale.com>
arch/arm/mach-mx6/usb_dr.c
arch/arm/mach-mx6/usb_h1.c

index 3a51f96cedd34207ff3063a5658dfbf125d01c9a..31f8230165bcb4a7bdafed8dfeb5f422861e9d5a 100644 (file)
@@ -99,6 +99,16 @@ static int usb_phy_enable(struct fsl_usb2_platform_data *pdata)
        UOG_USBCMD |= UCMD_RESET;
        while ((UOG_USBCMD) & (UCMD_RESET))
                ;
+
+       /*
+        * If the controller reset does not put the PHY be out of
+        * low power mode, do it manually.
+        */
+       if (UOG_PORTSC1 & PORTSC_PHCD) {
+               UOG_PORTSC1 &= ~PORTSC_PHCD;
+               mdelay(1);
+       }
+
        /* Reset USBPHY module */
        phy_ctrl = phy_reg + HW_USBPHY_CTRL;
        tmp = __raw_readl(phy_ctrl);
index c665f640bcb24ea754fc23184c135297adf89191..d14b537891d6d517cf59823495091a0fab85fc4a 100644 (file)
@@ -111,6 +111,16 @@ static int usb_phy_enable(struct fsl_usb2_platform_data *pdata)
        UH1_USBCMD |= UCMD_RESET;
        while ((UH1_USBCMD) & (UCMD_RESET))
                ;
+
+       /*
+        * If the controller reset does not put the PHY be out of
+        * low power mode, do it manually.
+        */
+       if (UH1_PORTSC1 & PORTSC_PHCD) {
+               UH1_PORTSC1 &= ~PORTSC_PHCD;
+               mdelay(1);
+       }
+
        /* Reset USBPHY module */
        phy_ctrl = phy_reg + HW_USBPHY_CTRL;
        tmp = __raw_readl(phy_ctrl);