usb: phy: phy-mxs-usb: add power down and disable wakeup for .shutdown
authorPeter Chen <peter.chen@freescale.com>
Wed, 24 Dec 2014 05:48:02 +0000 (13:48 +0800)
committerFelipe Balbi <balbi@ti.com>
Mon, 12 Jan 2015 18:13:28 +0000 (12:13 -0600)
When we shut down the PHY, we need to power down all PHY's functions
as well as disable wakeup, it is the opposite operation we do at .init.

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 b9589f6636832ce3255178be31b9a3d46bb6884c..eaf94b036571579dc1d60f425388d6818c05d018 100644 (file)
@@ -293,6 +293,17 @@ static int mxs_phy_init(struct usb_phy *phy)
 static void mxs_phy_shutdown(struct usb_phy *phy)
 {
        struct mxs_phy *mxs_phy = to_mxs_phy(phy);
+       u32 value = BM_USBPHY_CTRL_ENVBUSCHG_WKUP |
+                       BM_USBPHY_CTRL_ENDPDMCHG_WKUP |
+                       BM_USBPHY_CTRL_ENIDCHG_WKUP |
+                       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;
+
+       writel(value, phy->io_priv + HW_USBPHY_CTRL_CLR);
+       writel(0xffffffff, phy->io_priv + HW_USBPHY_PWD);
 
        writel(BM_USBPHY_CTRL_CLKGATE,
               phy->io_priv + HW_USBPHY_CTRL_SET);