diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2013-06-17 13:43:12 -0400 |
---|---|---|
committer | David Brown <davidb@codeaurora.org> | 2013-06-24 16:06:42 -0400 |
commit | 1107b1716bb21912ed9eed156d8c0251a8f3a3fa (patch) | |
tree | b16e49a06c34692d5b54445e6bccb6ce52033239 /drivers/iommu | |
parent | 7f371b98257c32890fe46a7d277053830b633ad9 (diff) |
msm: iommu: Convert to clk_prepare/unprepare
Add calls to clk_prepare and unprepare so that MSM can migrate to
the common clock framework. We never unprepare the clocks until
driver remove because the clocks are enabled and disabled in irq
context. Finer grained power management is possible in the future
via runtime power management techniques.
Cc: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Joerg Roedel <joro@8bytes.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/msm_iommu_dev.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/iommu/msm_iommu_dev.c b/drivers/iommu/msm_iommu_dev.c index 8e8fb079852d..d344f6ab8c12 100644 --- a/drivers/iommu/msm_iommu_dev.c +++ b/drivers/iommu/msm_iommu_dev.c | |||
@@ -160,7 +160,7 @@ static int msm_iommu_probe(struct platform_device *pdev) | |||
160 | goto fail; | 160 | goto fail; |
161 | } | 161 | } |
162 | 162 | ||
163 | ret = clk_enable(iommu_pclk); | 163 | ret = clk_prepare_enable(iommu_pclk); |
164 | if (ret) | 164 | if (ret) |
165 | goto fail_enable; | 165 | goto fail_enable; |
166 | 166 | ||
@@ -170,7 +170,7 @@ static int msm_iommu_probe(struct platform_device *pdev) | |||
170 | if (clk_get_rate(iommu_clk) == 0) | 170 | if (clk_get_rate(iommu_clk) == 0) |
171 | clk_set_min_rate(iommu_clk, 1); | 171 | clk_set_min_rate(iommu_clk, 1); |
172 | 172 | ||
173 | ret = clk_enable(iommu_clk); | 173 | ret = clk_prepare_enable(iommu_clk); |
174 | if (ret) { | 174 | if (ret) { |
175 | clk_put(iommu_clk); | 175 | clk_put(iommu_clk); |
176 | goto fail_pclk; | 176 | goto fail_pclk; |
@@ -261,7 +261,7 @@ fail_clk: | |||
261 | clk_put(iommu_clk); | 261 | clk_put(iommu_clk); |
262 | } | 262 | } |
263 | fail_pclk: | 263 | fail_pclk: |
264 | clk_disable(iommu_pclk); | 264 | clk_disable_unprepare(iommu_pclk); |
265 | fail_enable: | 265 | fail_enable: |
266 | clk_put(iommu_pclk); | 266 | clk_put(iommu_pclk); |
267 | fail: | 267 | fail: |
@@ -275,8 +275,11 @@ static int msm_iommu_remove(struct platform_device *pdev) | |||
275 | 275 | ||
276 | drv = platform_get_drvdata(pdev); | 276 | drv = platform_get_drvdata(pdev); |
277 | if (drv) { | 277 | if (drv) { |
278 | if (drv->clk) | 278 | if (drv->clk) { |
279 | clk_unprepare(drv->clk); | ||
279 | clk_put(drv->clk); | 280 | clk_put(drv->clk); |
281 | } | ||
282 | clk_unprepare(drv->pclk); | ||
280 | clk_put(drv->pclk); | 283 | clk_put(drv->pclk); |
281 | memset(drv, 0, sizeof(*drv)); | 284 | memset(drv, 0, sizeof(*drv)); |
282 | kfree(drv); | 285 | kfree(drv); |
@@ -314,14 +317,14 @@ static int msm_iommu_ctx_probe(struct platform_device *pdev) | |||
314 | INIT_LIST_HEAD(&ctx_drvdata->attached_elm); | 317 | INIT_LIST_HEAD(&ctx_drvdata->attached_elm); |
315 | platform_set_drvdata(pdev, ctx_drvdata); | 318 | platform_set_drvdata(pdev, ctx_drvdata); |
316 | 319 | ||
317 | ret = clk_enable(drvdata->pclk); | 320 | ret = clk_prepare_enable(drvdata->pclk); |
318 | if (ret) | 321 | if (ret) |
319 | goto fail; | 322 | goto fail; |
320 | 323 | ||
321 | if (drvdata->clk) { | 324 | if (drvdata->clk) { |
322 | ret = clk_enable(drvdata->clk); | 325 | ret = clk_prepare_enable(drvdata->clk); |
323 | if (ret) { | 326 | if (ret) { |
324 | clk_disable(drvdata->pclk); | 327 | clk_disable_unprepare(drvdata->pclk); |
325 | goto fail; | 328 | goto fail; |
326 | } | 329 | } |
327 | } | 330 | } |