Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1490847imu; Sat, 8 Dec 2018 00:44:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uckzyv4tIn3DrSLwxtnef1VMx3Gk8rw2lKwWBPsjZCibmWW7qDZp+T5puxOHGdbX40iDrg X-Received: by 2002:a62:848d:: with SMTP id k135mr5150891pfd.47.1544258647419; Sat, 08 Dec 2018 00:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544258647; cv=none; d=google.com; s=arc-20160816; b=O/3tEi6khzAZwWTcX9kEbMBWJAxGsRdtO6lyaKURQi0LndpydUDUyh5jqB/BW+EW8e HkCySkU9XXpBlB76r1MCfVYMgOH0RUdhbn+GFuDZDgUXu920vMMlh4w/BsrhRUO2DjKl KkHTCskCWsqFKtiei0Xptz55+7Wn8PyBh3h4ktD78mVcohUpsHtd1UCNb2DFbnOn8x0m Q0pJORxeqkGvQLNzEzq/pNYpcoEZl/qIZ5vta0L6ChpIEjD84Wg3qqyNXJIUZO1ShJSb 2O9UEcDYad/doO73pau5BY7jd7yDpheqfQnBzgCS3OMkCNFbB77XkmL5kYqm+jrXi/us 1CJw== 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=BZEBYFwEwPvAN8ZuEMlb1K5J9LbtoVemMKl32FPi3Nk=; b=IyMdqk+/fiL93Tz+LARmX51OgwRTB2AE+S4nnkeqSwpDrXdxdE/ewFaADFKS9InaQf YANvgDxnjpArRqHl+tdADrfF+ZbSZdw1CAuhl+W8HJ/jtRVNSUCRBtcN8dRUCjZCwNMz tg5GOEokHYttdfjXSUoYwLgXdRZbo5AzuyYOxr5gZ423ka2zDNIbRYkctIj40vZmp9cw ett8QaUeRut9qJS8Q5iYVFE4OFy9QzwZwD6KTeHiPv9XJ5+Of4XUOb9PzcWU31p9k4jG TzuRIIZ7EY7M6tieKB4lZYejNXWtxuGpgkVpH1PcMPMcT7+K491EzTA0shdv6d6xGv/z dRQA== 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 76si5359672pfw.66.2018.12.08.00.43.52; Sat, 08 Dec 2018 00:44:07 -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 S1726358AbeLHIl6 (ORCPT + 99 others); Sat, 8 Dec 2018 03:41:58 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:63787 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726211AbeLHIl6 (ORCPT ); Sat, 8 Dec 2018 03:41:58 -0500 X-UUID: 295a30747e084767a176675274b82b5f-20181208 X-UUID: 295a30747e084767a176675274b82b5f-20181208 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1859802803; Sat, 08 Dec 2018 16:41:51 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 8 Dec 2018 16:41:50 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 8 Dec 2018 16:41:49 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring CC: Tomasz Figa , Will Deacon , , , , , , , , , , , Nicolas Boichat , Arvind Yadav Subject: [PATCH v4 07/18] iommu/mediatek: Add bclk can be supported optionally Date: Sat, 8 Dec 2018 16:39:20 +0800 Message-ID: <1544258371-4600-8-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1544258371-4600-1-git-send-email-yong.wu@mediatek.com> References: <1544258371-4600-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 8eb110e..eda062a 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -610,9 +610,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); @@ -736,11 +738,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