mmc: sdhci-of-arasan: wakeup genpd when being in suspend
[firefly-linux-kernel-4.4.55.git] / drivers / mmc / host / sdhci-of-arasan.c
index 426750bed6fa3b321d1aa2c166b662ee40f7839e..a345b3b6b1e18e6ad037ddd3490d8e30fe2fa5a5 100644 (file)
@@ -57,21 +57,19 @@ static unsigned int sdhci_arasan_get_timeout_clock(struct sdhci_host *host)
        return freq;
 }
 
-static int sdhci_arasan_enhanced_strobe(struct mmc_host *mmc,
-                                       bool enable)
+static void sdhci_arasan_enhanced_strobe(struct mmc_host *mmc,
+                                        struct mmc_ios *ios)
 {
        u32 vendor;
        struct sdhci_host *host = mmc_priv(mmc);
 
        vendor = readl(host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
-       if (enable)
+       if (ios->enhanced_strobe)
                vendor |= VENDOR_ENHANCED_STROBE;
        else
                vendor &= (~VENDOR_ENHANCED_STROBE);
 
        writel(vendor, host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
-
-       return 0;
 }
 
 static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)
@@ -83,13 +81,19 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)
        if (clock > MMC_HIGH_52_MAX_DTR && (!IS_ERR(sdhci_arasan->phy)))
                ctrl_phy = true;
 
-       if (ctrl_phy)
+       if (ctrl_phy) {
+               spin_unlock_irq(&host->lock);
                phy_power_off(sdhci_arasan->phy);
+               spin_lock_irq(&host->lock);
+       }
 
        sdhci_set_clock(host, clock);
 
-       if (ctrl_phy)
+       if (ctrl_phy) {
+               spin_unlock_irq(&host->lock);
                phy_power_on(sdhci_arasan->phy);
+               spin_lock_irq(&host->lock);
+       }
 }
 
 static struct sdhci_ops sdhci_arasan_ops = {
@@ -269,7 +273,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
                        goto err_phy_power;
                }
 
-               host->mmc_host_ops.prepare_enhanced_strobe =
+               host->mmc_host_ops.hs400_enhanced_strobe =
                                        sdhci_arasan_enhanced_strobe;
        }
 
@@ -277,6 +281,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
        if (ret)
                goto err_add_host;
 
+       device_init_wakeup(&pdev->dev, 1);
+
        return 0;
 
 err_add_host: