mmc: omap: Make it CCF clk API compatible
authorJanusz Krzysztofik <jmkrzyszt@gmail.com>
Sat, 2 Apr 2022 11:20:04 +0000 (13:20 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 26 Apr 2022 12:05:19 +0000 (14:05 +0200)
The driver, OMAP specific, now omits clk_prepare/unprepare() steps, not
supported by OMAP custom implementation of clock API.  However, non-CCF
stubs of those functions exist for use on such platforms until converted
to CCF.

Update the driver to be compatible with CCF implementation of clock API.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Link: https://lore.kernel.org/r/20220402112004.129886-1-jmkrzyszt@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/omap.c

index 5e5af34..57d3928 100644 (file)
@@ -1374,7 +1374,7 @@ static int mmc_omap_probe(struct platform_device *pdev)
        host->iclk = clk_get(&pdev->dev, "ick");
        if (IS_ERR(host->iclk))
                return PTR_ERR(host->iclk);
-       clk_enable(host->iclk);
+       clk_prepare_enable(host->iclk);
 
        host->fclk = clk_get(&pdev->dev, "fck");
        if (IS_ERR(host->fclk)) {
@@ -1382,16 +1382,18 @@ static int mmc_omap_probe(struct platform_device *pdev)
                goto err_free_iclk;
        }
 
+       ret = clk_prepare(host->fclk);
+       if (ret)
+               goto err_put_fclk;
+
        host->dma_tx_burst = -1;
        host->dma_rx_burst = -1;
 
        host->dma_tx = dma_request_chan(&pdev->dev, "tx");
        if (IS_ERR(host->dma_tx)) {
                ret = PTR_ERR(host->dma_tx);
-               if (ret == -EPROBE_DEFER) {
-                       clk_put(host->fclk);
-                       goto err_free_iclk;
-               }
+               if (ret == -EPROBE_DEFER)
+                       goto err_free_fclk;
 
                host->dma_tx = NULL;
                dev_warn(host->dev, "TX DMA channel request failed\n");
@@ -1403,8 +1405,7 @@ static int mmc_omap_probe(struct platform_device *pdev)
                if (ret == -EPROBE_DEFER) {
                        if (host->dma_tx)
                                dma_release_channel(host->dma_tx);
-                       clk_put(host->fclk);
-                       goto err_free_iclk;
+                       goto err_free_fclk;
                }
 
                host->dma_rx = NULL;
@@ -1454,9 +1455,12 @@ err_free_dma:
                dma_release_channel(host->dma_tx);
        if (host->dma_rx)
                dma_release_channel(host->dma_rx);
+err_free_fclk:
+       clk_unprepare(host->fclk);
+err_put_fclk:
        clk_put(host->fclk);
 err_free_iclk:
-       clk_disable(host->iclk);
+       clk_disable_unprepare(host->iclk);
        clk_put(host->iclk);
        return ret;
 }
@@ -1476,8 +1480,9 @@ static int mmc_omap_remove(struct platform_device *pdev)
 
        mmc_omap_fclk_enable(host, 0);
        free_irq(host->irq, host);
+       clk_unprepare(host->fclk);
        clk_put(host->fclk);
-       clk_disable(host->iclk);
+       clk_disable_unprepare(host->iclk);
        clk_put(host->iclk);
 
        if (host->dma_tx)