Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp879779ybl; Wed, 21 Aug 2019 06:59:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+RN3sNETtSFoJIFC+3RuiGgE42rbuQfpCqiQMxTp29Y/clIa4jA4uH/3K24N4PxhlN57J X-Received: by 2002:a62:82cb:: with SMTP id w194mr25507791pfd.181.1566395947217; Wed, 21 Aug 2019 06:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566395947; cv=none; d=google.com; s=arc-20160816; b=DQ6pdyiiKWM9zey9tOHek+Z6XLdQmOG4P5CsPssuFuLHZuAATB3Wvd4dmJWLYvzphW oTAzNejEZ848wIzgkF8M+1ddTcwwTSPDjiSZyZLWuqPn7FK75JRptwfcJiIpXxjZOgep 1S726JmBIFnYjk2PGHRXGGqkCtqadt/sIhYTyJS8nQRoZqj+TQeNbzb1+ZEqS4Yvk4ed +zzx1Hj9OvwpfC0XnL7DCVGsNYOiFgbMoGOz8PjYFSSkTA1Zne8d/p29zDllTh2QiJqe sekKRQ0a7Lei+rJBfB6R6a5dNBogPff/GswthjqvPwPyNj3GTUVrgzyqyGfPbVjevApc 0XJA== 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=zgZ3cXgmF90rrjgDlUxort2Zltwqd55VsDy5BIa6I9g=; b=OLHi+BJZc9A5ZjcLGNsPiBPnCU0NbBEJyqnZSNVmp/nyZh48saxgOCaWwdzzzHoniK c1sLHp80/mPGOL1px89UvLwy7gzvqvBkRrH+D6ny5oQULGDrox4nPv97u/2XWPEwru0J zAOKJDoqPz/ouSSzyGfolSYrW76+gQK3MAbfwWXgKX4Ml38vRKOrA7632itgljK7tnVf HeEc0ypsMvx/72vBwVG+Zka8TH0W0wNPJU4NRvDnPz9FgpYyE62mLJ+kss5hszB/MYNE vyQoM30HPyRpaHUO9//X+JJFgQEGylRoB252eLSCfbLnjyn92PWdE1sNzt9Nn8aBOsHD PAPg== 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 u6si15481803pfm.135.2019.08.21.06.58.51; Wed, 21 Aug 2019 06:59:07 -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 S1729272AbfHUN4j (ORCPT + 99 others); Wed, 21 Aug 2019 09:56:39 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:47614 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728980AbfHUN4j (ORCPT ); Wed, 21 Aug 2019 09:56:39 -0400 X-UUID: 9cc9585e49f24d73ab181afff8416463-20190821 X-UUID: 9cc9585e49f24d73ab181afff8416463-20190821 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 1358701025; Wed, 21 Aug 2019 21:56:31 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 21 Aug 2019 21:56:29 +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:56:27 +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 15/23] iommu/mediatek: Move vld_pa_rng into plat_data Date: Wed, 21 Aug 2019 21:53:18 +0800 Message-ID: <1566395606-7975-16-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 Both mt8173 and mt8183 don't have this vld_pa_rng(valid physical address range) register while mt2712 have. Move it into the plat_data. Signed-off-by: Yong Wu Reviewed-by: Evan Green Reviewed-by: Matthias Brugger --- drivers/iommu/mtk_iommu.c | 3 ++- drivers/iommu/mtk_iommu.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index b43f36a..eaf6a23 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -567,7 +567,7 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) upper_32_bits(data->protect_base); writel_relaxed(regval, data->base + REG_MMU_IVRP_PADDR); - if (data->enable_4GB && data->plat_data->m4u_plat != M4U_MT8173) { + if (data->enable_4GB && data->plat_data->has_vld_pa_rng) { /* * If 4GB mode is enabled, the validate PA range is from * 0x1_0000_0000 to 0x1_ffff_ffff. here record bit[32:30]. @@ -766,6 +766,7 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev) .m4u_plat = M4U_MT2712, .has_4gb_mode = true, .has_bclk = true, + .has_vld_pa_rng = true, .larbid_remap = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, }; diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index 8d3b525..973d6e0 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -38,6 +38,7 @@ struct mtk_iommu_plat_data { /* HW will use the EMI clock if there isn't the "bclk". */ bool has_bclk; + bool has_vld_pa_rng; bool reset_axi; unsigned char larbid_remap[MTK_LARB_NR_MAX]; }; -- 1.9.1