Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp11435220imu; Mon, 31 Dec 2018 22:39:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/URyqjo1ahzLl1f22nRptoOJh5vWuG3LWs03rXFBv18lIMja5Nl6mYqTqxK/uZ2dbOUO8eF X-Received: by 2002:a62:1289:: with SMTP id 9mr40886835pfs.102.1546324757231; Mon, 31 Dec 2018 22:39:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546324757; cv=none; d=google.com; s=arc-20160816; b=Nq1bTf5WwKSRgmaF5gin5xcPV7XU5uDK3G8BsG0WuNfXRWfN+b8B8b1M3BmoluMDEM ExyHNAhlEtRERDEUZg9dADKaE2+u6uAptTafgwp6oW/a2WUOS7iQUwM6hoBhNXP4vP4r uGO2MUF+UCyxpigFPk/cfv++91WTI/rGStEtUVFqdjuahv5SUVkvC9DUY1tg6FEVC0UU P8VeWM/OeGO70YkOoBW3iVWRr45sMFtY9IHcbUdo6/XDOaQs83IDEOztp7L9I9SH1iSG MOWExDb94jyhK3Rv9/TPke4SnQqIuBHyXt+3XrCJuljsmnMkXVKjl3DBWF+Pl31tk44M rslA== 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=iK8wfivczMazXJE9in7VKirCZhrZ11Nwqgbdh8UNLHo=; b=X5aTBMsmzEs30Qc1A5lEfuK5fbEs+v8O7VXB/BaLbObaO3wxWZYX2KrUfXT2s8ApKC mfDpgcpwKiivIbSSmvwgmodjuObE3u+h/3vikf+aRmLUc/3GGZw5MKo8YUW7+93JYScp hhCkHdR0liQHhvMf0L4Vfsu7kVrzy7tKoR0HjsaPu2AjCmkzShlXDhyW3MKpvq23sx+x iyhO3uxerK9TYDkolbciVa/7v4wULoZDPFWSx9YKn+pJdgq+0XeCIHBxMa2oQlKAAiOn krsfL4a4NGCam0ozNkgKJwibG0soJx99n7bqmPBt5ItRpeEK7mRk1/dYrYYEwcesFaLl DkpA== 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 n12si32555479pfg.155.2018.12.31.22.38.50; Mon, 31 Dec 2018 22:39:17 -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 S1728266AbfAAD5s (ORCPT + 99 others); Mon, 31 Dec 2018 22:57:48 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:33326 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726686AbfAAD5r (ORCPT ); Mon, 31 Dec 2018 22:57:47 -0500 X-UUID: 57f0eb07b1b040f1887d45746f48ba5b-20190101 X-UUID: 57f0eb07b1b040f1887d45746f48ba5b-20190101 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1580719299; Tue, 01 Jan 2019 11:57:43 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 1 Jan 2019 11:57:42 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 1 Jan 2019 11:57:41 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring CC: Tomasz Figa , Will Deacon , , , , , , , , , , , Nicolas Boichat Subject: [PATCH v5 07/20] iommu/mediatek: Add bclk can be supported optionally Date: Tue, 1 Jan 2019 11:55:39 +0800 Message-ID: <1546314952-15990-8-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1546314952-15990-1-git-send-email-yong.wu@mediatek.com> References: <1546314952-15990-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. 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; 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