Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1709430 > unrolled thread

[PATCH 5/8] iommu/mediatek: Disable iommu clock when system suspend

Started byYong Wu <yong.wu@mediatek.com>
First post2017-08-11 12:00 +0200
Last post2017-08-11 13:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/8] iommu/mediatek: Disable iommu clock when system suspend Yong Wu <yong.wu@mediatek.com> - 2017-08-11 12:00 +0200
    Re: [PATCH 5/8] iommu/mediatek: Disable iommu clock when system  suspend Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-08-11 13:20 +0200

#1709430 — [PATCH 5/8] iommu/mediatek: Disable iommu clock when system suspend

FromYong Wu <yong.wu@mediatek.com>
Date2017-08-11 12:00 +0200
Subject[PATCH 5/8] iommu/mediatek: Disable iommu clock when system suspend
Message-ID<udeTx-1T8-31@gated-at.bofh.it>
When system suspend, infra power domain may be off, and the iommu's
clock must be disabled when system off, or the iommu's bclk clock maybe
disabled after system resume.

Signed-off-by: Honghui Zhang <honghui.zhang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
 drivers/iommu/mtk_iommu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index e81ed9a..b7c8e52 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -675,6 +675,7 @@ static int __maybe_unused mtk_iommu_suspend(struct device *dev)
 	reg->ctrl_reg = readl_relaxed(base + REG_MMU_CTRL_REG);
 	reg->int_control0 = readl_relaxed(base + REG_MMU_INT_CONTROL0);
 	reg->int_main_control = readl_relaxed(base + REG_MMU_INT_MAIN_CONTROL);
+	clk_disable_unprepare(data->bclk);
 	return 0;
 }
 
@@ -684,6 +685,7 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev)
 	struct mtk_iommu_suspend_reg *reg = &data->reg;
 	void __iomem *base = data->base;
 
+	clk_prepare_enable(data->bclk);
 	writel_relaxed(reg->standard_axi_mode,
 		       base + REG_MMU_STANDARD_AXI_MODE);
 	writel_relaxed(reg->dcm_dis, base + REG_MMU_DCM_DIS);
@@ -699,7 +701,7 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops mtk_iommu_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(mtk_iommu_suspend, mtk_iommu_resume)
+	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_iommu_suspend, mtk_iommu_resume)
 };
 
 static const struct of_device_id mtk_iommu_of_ids[] = {
-- 
1.9.1

[toc] | [next] | [standalone]


#1709466 — Re: [PATCH 5/8] iommu/mediatek: Disable iommu clock when system suspend

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-08-11 13:20 +0200
SubjectRe: [PATCH 5/8] iommu/mediatek: Disable iommu clock when system suspend
Message-ID<udg8W-2Q4-5@gated-at.bofh.it>
In reply to#1709430
Hi Youn,


On Friday 11 August 2017 03:26 PM, Yong Wu wrote:
> When system suspend, infra power domain may be off, and the iommu's
> clock must be disabled when system off, or the iommu's bclk clock maybe
> disabled after system resume.
>
> Signed-off-by: Honghui Zhang <honghui.zhang@mediatek.com>
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> ---
>   drivers/iommu/mtk_iommu.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index e81ed9a..b7c8e52 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -675,6 +675,7 @@ static int __maybe_unused mtk_iommu_suspend(struct device *dev)
>   	reg->ctrl_reg = readl_relaxed(base + REG_MMU_CTRL_REG);
>   	reg->int_control0 = readl_relaxed(base + REG_MMU_INT_CONTROL0);
>   	reg->int_main_control = readl_relaxed(base + REG_MMU_INT_MAIN_CONTROL);
> +	clk_disable_unprepare(data->bclk);
>   	return 0;
>   }
>   
> @@ -684,6 +685,7 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev)
>   	struct mtk_iommu_suspend_reg *reg = &data->reg;
>   	void __iomem *base = data->base;
>   
> +	clk_prepare_enable(data->bclk);
Please handle return value of clk_prepare_enable. It can fail
>   	writel_relaxed(reg->standard_axi_mode,
>   		       base + REG_MMU_STANDARD_AXI_MODE);
>   	writel_relaxed(reg->dcm_dis, base + REG_MMU_DCM_DIS);
> @@ -699,7 +701,7 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev)
>   }
>   
>   static const struct dev_pm_ops mtk_iommu_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(mtk_iommu_suspend, mtk_iommu_resume)
> +	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_iommu_suspend, mtk_iommu_resume)
>   };
>   
>   static const struct of_device_id mtk_iommu_of_ids[] = {
~arvind

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web