MLK-11685-2 sdhci-esdhc-imx: use bus freq in runtime pm
authorDong Aisheng <b29396@freescale.com>
Mon, 11 Nov 2013 06:53:58 +0000 (14:53 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:50 +0000 (14:48 -0500)
Request BUS_FREQ_HIGH when bus is busy and then release BUS_FREQ_HIGH
when bus becomes idle.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 64994f7115573c9ede53b51536b2c15f7cf0112a)
Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Conflicts:
drivers/mmc/host/sdhci-esdhc-imx.c

drivers/mmc/host/sdhci-esdhc-imx.c

index a773d04..9b77078 100644 (file)
@@ -11,6 +11,7 @@
  * the Free Software Foundation; either version 2 of the License.
  */
 
+#include <linux/busfreq-imx.h>
 #include <linux/io.h>
 #include <linux/delay.h>
 #include <linux/err.h>
@@ -1244,6 +1245,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 
        pltfm_host->clk = imx_data->clk_per;
        pltfm_host->clock = clk_get_rate(pltfm_host->clk);
+
+       request_bus_freq(BUS_FREQ_HIGH);
+
        clk_prepare_enable(imx_data->clk_per);
        clk_prepare_enable(imx_data->clk_ipg);
        clk_prepare_enable(imx_data->clk_ahb);
@@ -1311,6 +1315,7 @@ disable_clk:
        clk_disable_unprepare(imx_data->clk_per);
        clk_disable_unprepare(imx_data->clk_ipg);
        clk_disable_unprepare(imx_data->clk_ahb);
+       release_bus_freq(BUS_FREQ_HIGH);
 free_sdhci:
        sdhci_pltfm_free(pdev);
        return err;
@@ -1373,6 +1378,8 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev)
        }
        clk_disable_unprepare(imx_data->clk_ahb);
 
+       release_bus_freq(BUS_FREQ_HIGH);
+
        return ret;
 }
 
@@ -1382,6 +1389,8 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
        struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
+       request_bus_freq(BUS_FREQ_HIGH);
+
        if (!sdhci_sdio_irq_enabled(host)) {
                clk_prepare_enable(imx_data->clk_per);
                clk_prepare_enable(imx_data->clk_ipg);