Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1246260imj; Sun, 17 Feb 2019 01:13:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IZwyKwRYCKCupR7wz+Mqz7yG/i0Z/Cc9LX/jG8mpuhwimMObjvW/JNwjf7kx41AmtmAIBeF X-Received: by 2002:a17:902:fa2:: with SMTP id 31mr19348378plz.75.1550394805379; Sun, 17 Feb 2019 01:13:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550394805; cv=none; d=google.com; s=arc-20160816; b=M8jLX3ECakviHJTb7Cxf4VSIsUYtj9SrEqY2dZIf8YQ12kSvENI59PFM8s1ezcQqBL Ka+gQPgo71vmmucfUA0Vte5n9opxQ44uy+aWzQCggyfm0dhsVlMsFGuec+ZjrLOmFexl wrflzZsNSgt3RZ0PUKhr0CvGMSck23+z5bR8Dvc+4ecFdNvbLfHzuVZUQXVj4/805iQY bzamCkjevD+kN+x8w9xGt8t0Pg6r/e67oW+Lna6h77TMlz6gVcfHSbA0U6x9ZGNusXPc EFgYga/RE5c9ElFyto8jGN6MvKxXfYjwP/v5KRVsx0RnJD9NKePfI7o8wGWGpjQz3kTx Fbqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ZffZhPwKn8sifVeaqWfPzxULQzIPiKFAqLd6AruxiQI=; b=hjtK4e/+Ky2u67Y6kb+1Ku4+jR3Dp7pavNIRVzMY8ROqWQm5d7hp0Q7OMOCZqOnBfi Z+gdJ30O4mfGiBtaHRRgHJLrAbJbOhIB94etXd/GjtM9UK9UPCFtunJzjkhntYOSt8HC ikrCK6e6SXhMmWsJzpJtLa7ngFFGmOf02u1ehAKMuR9zYzju3crd5GUvCQDwYznJEC8w Lid3rxP8S1K/oRMiaJYm0G2YeUXgeimKuw90aJZweiDYmaLeTpY0wovpW8YU1OzQAfLi QoBs+SlcmKcInMkPUBmuO4lRGvybDeIKdCnyZUraKqkR2q+ZyNDAmyyj6e4eQY6h/HTd 7TRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si10298668pfd.29.2019.02.17.01.13.09; Sun, 17 Feb 2019 01:13:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727281AbfBQJHl (ORCPT + 99 others); Sun, 17 Feb 2019 04:07:41 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:30843 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727136AbfBQJHk (ORCPT ); Sun, 17 Feb 2019 04:07:40 -0500 X-UUID: ddc36f4c254b4c8c859f1d93a25b1ca8-20190217 X-UUID: ddc36f4c254b4c8c859f1d93a25b1ca8-20190217 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 650234478; Sun, 17 Feb 2019 17:07:35 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 17 Feb 2019 17:07:34 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sun, 17 Feb 2019 17:07:33 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring CC: Evan Green , Tomasz Figa , Will Deacon , , , , , , , , , , Nicolas Boichat , , Matthias Kaehlcke Subject: [PATCH v6 07/22] iommu/mediatek: Add bclk can be supported optionally Date: Sun, 17 Feb 2019 17:04:45 +0800 Message-ID: <1550394300-17420-8-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1550394300-17420-1-git-send-email-yong.wu@mediatek.com> References: <1550394300-17420-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In some SoCs, M4U doesn't have its "bclk", it will use the EMI clock instead which has always been enabled when entering kernel. Currently mt2712 and mt8173 have this bclk while mt8183 doesn't. This also is a preparing patch for mt8183. Signed-off-by: Yong Wu Reviewed-by: Evan Green --- 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 b2d517c..685f5d5 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -611,9 +611,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); @@ -737,11 +739,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; bool has_4gb_mode; + + /* HW will use the EMI clock if there isn't the "bclk". */ + bool has_bclk; }; struct mtk_iommu_domain; -- 1.9.1