usb: phy: mxs: Add auto clock and power setting
authorPeter Chen <peter.chen@freescale.com>
Mon, 24 Feb 2014 02:20:55 +0000 (10:20 +0800)
committerFelipe Balbi <balbi@ti.com>
Wed, 5 Mar 2014 20:40:07 +0000 (14:40 -0600)
The auto setting is used to open related power and clocks
automatically after receiving wakeup signal.

With this feature, the PHY's clock and power can be recovered
correctly from low power mode, it is guaranteed by IC logic.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/phy/phy-mxs-usb.c

index cf58d8ec9901cd4c5f20348853a20eeb1dfa1210..d7adca3738ff52bda42411aa2c8ec84e86235079 100644 (file)
 
 #define BM_USBPHY_CTRL_SFTRST                  BIT(31)
 #define BM_USBPHY_CTRL_CLKGATE                 BIT(30)
+#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS       BIT(26)
+#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE    BIT(25)
+#define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD       BIT(20)
+#define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE       BIT(19)
+#define BM_USBPHY_CTRL_ENAUTO_PWRON_PLL                BIT(18)
 #define BM_USBPHY_CTRL_ENUTMILEVEL3            BIT(15)
 #define BM_USBPHY_CTRL_ENUTMILEVEL2            BIT(14)
 #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT      BIT(1)
@@ -96,9 +101,18 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
        /* Power up the PHY */
        writel(0, base + HW_USBPHY_PWD);
 
-       /* enable FS/LS device */
-       writel(BM_USBPHY_CTRL_ENUTMILEVEL2 |
-              BM_USBPHY_CTRL_ENUTMILEVEL3,
+       /*
+        * USB PHY Ctrl Setting
+        * - Auto clock/power on
+        * - Enable full/low speed support
+        */
+       writel(BM_USBPHY_CTRL_ENAUTOSET_USBCLKS |
+               BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE |
+               BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD |
+               BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE |
+               BM_USBPHY_CTRL_ENAUTO_PWRON_PLL |
+               BM_USBPHY_CTRL_ENUTMILEVEL2 |
+               BM_USBPHY_CTRL_ENUTMILEVEL3,
               base + HW_USBPHY_CTRL_SET);
 
        return 0;