Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1425362ybl; Fri, 23 Aug 2019 20:07:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXQWY0qMwpgD/WGtlc5FaW1jior6Hv82yL5RPH1wuGh2BLrwgn9apWAj2X96N+dNuq0mRQ X-Received: by 2002:a63:e14d:: with SMTP id h13mr6581449pgk.431.1566616039804; Fri, 23 Aug 2019 20:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566616039; cv=none; d=google.com; s=arc-20160816; b=eJiMTx0sxF9gmJG+ow2a8G8PYSw5g9a+0ndT9r4G+hSww85rGHU1GC23u1oYAu8QKX EF6Fpq28sAisMj0vKb7VCvf4TbEenl3bfwAQfTs6SRRsYe/UZd1czKntqyqPYtpen1t1 YEwT34FuoPA4u7IPftthM8XopH8U2eYrp4SR8wrLhXDIJgobwe+rZUOWJkHxN+UCR/7W FXTPeNpKxkauZtbjlpynUMJolj3M0Jby6aqfJTXBzHhP9Bf834DiFP0xnsdT6vAIe8kX 5LlbQf1l6W01z/tznhRkVgBwQNkjce9fCnCz4wH69QIliz8jKDYC3Cj5CiCsNdRp9Vtc yNkg== 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=jxEIX7bmXVoXpZrzSXKub5lCMfuPqyMFP9lTlJNgwfhW2iTupZ6bl66BgvWJzAL0V/ 8egI2YW+RkiFWsHvIidEA4ZpAyZz5epZfXjhM8YOXzmD9KAH5EChMezyZob1TbV/LBke TBu2Tk4FCK2MZsQVx6xarBBbbWypNEs4Nlo/YHLA7IcnTIKOSjQVIP+4W11flpt5iSbB SYpt6CDyLMCvAqb4j5T/BPP1t4dcNFxFCyktaxl4fj0/qdqql421kXW5ST7XGR0vlBlI Vk6OYOA0UVgkKMvRev8m5y/hbuq2h4I5LRBJQuspmDP1LSf8oWUcFd51otNL2iA66YzI 19Vg== 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 g13si3411714pgj.498.2019.08.23.20.07.04; Fri, 23 Aug 2019 20:07:19 -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 S1725924AbfHXDFq (ORCPT + 99 others); Fri, 23 Aug 2019 23:05:46 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:65515 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726982AbfHXDFo (ORCPT ); Fri, 23 Aug 2019 23:05:44 -0400 X-UUID: 36d7e59e6af44fc68f549b6bfe15b9e3-20190824 X-UUID: 36d7e59e6af44fc68f549b6bfe15b9e3-20190824 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 630864807; Sat, 24 Aug 2019 11:04:54 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 24 Aug 2019 11:04:46 +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; Sat, 24 Aug 2019 11:04:45 +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 v11 11/23] iommu/mediatek: Add bclk can be supported optionally Date: Sat, 24 Aug 2019 11:01:56 +0800 Message-ID: <1566615728-26388-12-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1566615728-26388-1-git-send-email-yong.wu@mediatek.com> References: <1566615728-26388-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