Re: [PATCH v5 07/20] iommu/mediatek: Add bclk can be supported optionally

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:57 PM Yong Wu  wrote:
>
> In some SoCs, M4U doesn't have its "bclk", it will use the EMI
> clock instead which has always been enabled when entering kernel.
>
> This also is a preparing patch for mt8183.
>
> Signed-off-by: Yong Wu 

Reviewed-by: Evan Green 
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH v5 07/20] iommu/mediatek: Add bclk can be supported optionally

2018-12-31 Thread Yong Wu
In some SoCs, M4U doesn't have its "bclk", it will use the EMI
clock instead which has always been enabled when entering kernel.

This also is a preparing patch for mt8183.

Signed-off-by: Yong Wu 
---
 drivers/iommu/mtk_iommu.c | 10 +++---
 drivers/iommu/mtk_iommu.h |  3 +++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index ae1aa5a..847082c 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -613,9 +613,11 @@ static int mtk_iommu_probe(struct platform_device *pdev)
if (data->irq < 0)
return data->irq;
 
-   data->bclk = devm_clk_get(dev, "bclk");
-   if (IS_ERR(data->bclk))
-   return PTR_ERR(data->bclk);
+   if (data->plat_data->has_bclk) {
+   data->bclk = devm_clk_get(dev, "bclk");
+   if (IS_ERR(data->bclk))
+   return PTR_ERR(data->bclk);
+   }
 
larb_nr = of_count_phandle_with_args(dev->of_node,
 "mediatek,larbs", NULL);
@@ -739,11 +741,13 @@ static int __maybe_unused mtk_iommu_resume(struct device 
*dev)
 static const struct mtk_iommu_plat_data mt2712_data = {
.m4u_plat = M4U_MT2712,
.has_4gb_mode = true,
+   .has_bclk = true,
 };
 
 static const struct mtk_iommu_plat_data mt8173_data = {
.m4u_plat = M4U_MT8173,
.has_4gb_mode = true,
+   .has_bclk = true,
 };
 
 static const struct of_device_id mtk_iommu_of_ids[] = {
diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h
index 5890e55..b8749ac 100644
--- a/drivers/iommu/mtk_iommu.h
+++ b/drivers/iommu/mtk_iommu.h
@@ -44,6 +44,9 @@ enum mtk_iommu_plat {
 struct mtk_iommu_plat_data {
enum mtk_iommu_plat m4u_plat;
boolhas_4gb_mode;
+
+   /* HW will use the EMI clock if there isn't the "bclk". */
+   boolhas_bclk;
 };
 
 struct mtk_iommu_domain;
-- 
1.9.1

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu