Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3147119ybi; Mon, 10 Jun 2019 05:21:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUvlJb/vBn/VdckeuDxtjFwLcbdDr9eqRp0UAn7jm8kk5MbAsp9jNRZ7Uzx96ON4eWuf1+ X-Received: by 2002:a17:90a:a10f:: with SMTP id s15mr21429133pjp.30.1560169269022; Mon, 10 Jun 2019 05:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560169269; cv=none; d=google.com; s=arc-20160816; b=hqaNMf8WjuGAN9b2bI+PQWSEBI8x5xuc8MqQ8DLj+k3e3CUeTH4FUjc8ymiBZWoi6T cC7tsBHfpB3ZxFEhHD4O16ZkbvjQfxu8w5hfLWuOWc+nfThmNL4MsBrjYCL+pF9HshCq QpXUHlvgeHh5DAIpJajqQRuB5YGsWWSdTyWwpcaFl00o52AK0vWGSSz/3ncoRSYqvnmU d881SL3EBH/xfm49n2qD07a4wIkOHFwVQgjpU0AS0p9fqDg3sn1wf/m/86jVyG/g2DBl LTuV8qkNrAm0S29j35in4q8dfcKt0koS06OSTJqh5dWiJYIyxjR8CDAd2T1Glzi5Jx6h 4tZQ== 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=7OiW857TDGnVHajP6TDT9SD6NS8HAmtR0bTQPyjDddg=; b=JgjuiChDso6POb+UerxD3U2N7r57zCwtyNLJlpVqnnDkjq/4yhZIKGjsrcemutNpr7 Vcxculr/j+vVkJzxfDzUMNNMsmiPnfRDbk9l3C9CvYNYHts85erNPcgzWXrysgSpa9Bk WUZo00hCALeCJZmjqhX1n2KKq/Ejrj07g4rKrzN2SiZULdfx+JT3xqOaMjPcKGe3DdRy PUfOvOLldwrZmNWw0okq2zPdaBvzVcIqa3+lsPr2UYqJkKMirdRGkiRVZ05fLPj7cwWO Sto1uLX/lHmljjF3z43k+UAGzx6ANi639NlJpiZLVIJvVzrlsH8o0MUwBXIsXXNBROmj wkHQ== 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 cd17si11104976plb.210.2019.06.10.05.20.54; Mon, 10 Jun 2019 05:21:09 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389910AbfFJMT4 (ORCPT + 99 others); Mon, 10 Jun 2019 08:19:56 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:23274 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2389498AbfFJMT4 (ORCPT ); Mon, 10 Jun 2019 08:19:56 -0400 X-UUID: 77674e3864c94afeb5d68687d820a372-20190610 X-UUID: 77674e3864c94afeb5d68687d820a372-20190610 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 944121016; Mon, 10 Jun 2019 20:19:50 +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; Mon, 10 Jun 2019 20:19:50 +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; Mon, 10 Jun 2019 20:19:49 +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 v7 07/21] iommu/mediatek: Add bclk can be supported optionally Date: Mon, 10 Jun 2019 20:17:46 +0800 Message-ID: <1560169080-27134-8-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1560169080-27134-1-git-send-email-yong.wu@mediatek.com> References: <1560169080-27134-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 aff5004..264dda4 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); @@ -741,11 +743,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 d7a001a..63e235e 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -43,6 +43,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