Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp878063ybl; Wed, 21 Aug 2019 06:57:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhvPbuhImyYebVIIRcq93ziJ1ANl32w66QktXywp18NMfBDL/GV2oHgZc2yhcv2UepNRGD X-Received: by 2002:aa7:8611:: with SMTP id p17mr36044562pfn.41.1566395848517; Wed, 21 Aug 2019 06:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566395848; cv=none; d=google.com; s=arc-20160816; b=ggCZtk2pRZdcyiSO1PE98t+CCefLq/5hF+N9+r/TolfUDArA9VWhLrw6Y8dNRsLgA9 xv1Hp9rv20MtnX8xVxvqyeoXH6nAK6eQSmKssxwmcXbjgzpoYH1daQOT6MUCv8E/Ai6P GkWm9DxpEMJ7vlX0SiX7QrhZrmIZzTBmsNJCKl0xf3xlH2GUAsw5Rl9IpWLFaA477iKY /5IjImrtDXAyvODPM06AFEDELhHjJmS0mtJHaUrSb/gyQs3j8m4yPfxyW4h9CkJByL5Y x61l03bD8VZ0g0sdHvJ/+eyREXqxfR1zEoYbOYr6Rxfh0+60s/H1KdqHyCgDCce8ztuQ L9wA== 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=fLJA6UxAQP+37EBRSb3vpsIt3kd9uFUY9GvlQEPgers=; b=u5CtT1+W0eeYVw76Cif8BYykmAixP6HAFxlqjK/cd8pVMelSktHnAte9UCoBuzLTmn Fcq7/vWoR1e4Za0NCInnAwkpwRgjA/vTVBSZWcQgIv+EUkabss91Am8g1sfQpGMcGA5I ah21yp2l/9oDQghdmmRTkIkIBDs3uXnI+t1sm2113xZskz0VcFjaRCusRSb9KndXZC0p FcpPmAyCIEDp8qbnq+N81Y3vSr4LqI3ddpiFo61m/AwKVJvzkSfxqCtEF+MemLAXVZVp jiAXnzL+A/x/1argioxJPjCFL6NW6l00/VuCE5Z436vi6BOanrJ3eYOIjHVLHRddUrUP ZO9Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si13388170pgj.349.2019.08.21.06.57.12; Wed, 21 Aug 2019 06:57:28 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729166AbfHUN4D (ORCPT + 99 others); Wed, 21 Aug 2019 09:56:03 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:22027 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728763AbfHUN4D (ORCPT ); Wed, 21 Aug 2019 09:56:03 -0400 X-UUID: fd51e92947374b17bc9ddd4fc68242d4-20190821 X-UUID: fd51e92947374b17bc9ddd4fc68242d4-20190821 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 1649357061; Wed, 21 Aug 2019 21:55:53 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 21 Aug 2019 21:55:50 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 21 Aug 2019 21:55:49 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Robin Murphy , Will Deacon CC: Rob Herring , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Matthias Kaehlcke , , , Subject: [PATCH v10 11/23] iommu/mediatek: Add bclk can be supported optionally Date: Wed, 21 Aug 2019 21:53:14 +0800 Message-ID: <1566395606-7975-12-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1566395606-7975-1-git-send-email-yong.wu@mediatek.com> References: <1566395606-7975-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 Reviewed-by: Matthias Brugger --- 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 b5a40a4..4df3cb4 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -633,9 +633,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); @@ -763,11 +765,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 c281c01..821172b 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -35,6 +35,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