]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
dma: xilinx: zynqmp_dma: Enable clocks even when CONFIG_PM is disabled
authorKedareswara rao Appana <appana.durga.rao@xilinx.com>
Mon, 19 Jun 2017 06:15:50 +0000 (11:45 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 15 Mar 2018 13:16:11 +0000 (14:16 +0100)
Currently the clocks are enabled only in the runtime calls.
When CONFIG_PM is disabled the driver does not work as the
Clocks are disabled.

Fix the same by enabling the clocks in probe and disable them in remove.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/dma/xilinx/zynqmp_dma.c

index 8b1b0f1278cfac103371ac7c87d8f0d25104eeda..382a57f500e63f5462ea24f8850037a1f47d7e4b 100644 (file)
@@ -1158,11 +1158,22 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
                return PTR_ERR(zdev->clk_apb);
        }
 
+       ret = clk_prepare_enable(zdev->clk_main);
+       if (ret) {
+               dev_err(&pdev->dev, "Unable to enable main clock.\n");
+               return ret;
+       }
+
+       ret = clk_prepare_enable(zdev->clk_apb);
+       if (ret) {
+               dev_err(&pdev->dev, "Unable to enable apb clock.\n");
+               goto err_disable_clk;
+       }
+
        platform_set_drvdata(pdev, zdev);
        pm_runtime_set_autosuspend_delay(zdev->dev, ZDMA_PM_TIMEOUT);
        pm_runtime_use_autosuspend(zdev->dev);
        pm_runtime_enable(zdev->dev);
-       pm_runtime_get_sync(zdev->dev);
 
        ret = zynqmp_dma_chan_probe(zdev, pdev);
        if (ret) {
@@ -1190,8 +1201,10 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
 
        return 0;
 
+err_disable_clk:
+       clk_disable_unprepare(zdev->clk_main);
 err_disable_pm:
-       pm_runtime_put_sync_suspend(zdev->dev);
+       clk_disable_unprepare(zdev->clk_apb);
        pm_runtime_disable(zdev->dev);
 free_chan_resources:
        zynqmp_dma_chan_remove(zdev->chan);
@@ -1213,6 +1226,8 @@ static int zynqmp_dma_remove(struct platform_device *pdev)
 
        zynqmp_dma_chan_remove(zdev->chan);
        pm_runtime_disable(zdev->dev);
+       clk_disable_unprepare(zdev->clk_apb);
+       clk_disable_unprepare(zdev->clk_main);
 
        return 0;
 }