Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4902433pxv; Tue, 29 Jun 2021 19:37:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB84VYnsdtZ9Se4eRbCHqR+5rRXESmZeP5ED4QmJpPATgFiCKyc6uGvyFjsO+2gcjyG2X0 X-Received: by 2002:a05:6402:40c2:: with SMTP id z2mr20545768edb.134.1625020677818; Tue, 29 Jun 2021 19:37:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625020677; cv=none; d=google.com; s=arc-20160816; b=WVD35RDP0WO2RMItc6TgAA3eYH2y2cBep+1aLm5/i7HYE6NKqJm4Tpjar4j1nxGlxw pHdpj7NG5HCgi6XKWsNhZbFV26XR9epYN6y6nhFldkM9b5azYLLo9zj8IIz8XPravLm0 Ma7ac3XBQMIrkw8guloUBOoYkx2UE68Wp3m5x5fh3pWY63PqON6c/i37AllX17/Maun8 BiNA+vdJ+eIE5whwPkNTZ8WaecUylOPNofKsu3cduP34kczHY+cB/AEq/Ovg4q9wxQkH BnDgVj/ebwbIS+UvuUFz/iFtRb7nYVOlwDY0FKsH1c7Zdx4o0xKo0xXwJnSo5slpL5CF sJDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=7NFcnZ2+CjDdk2s5BaHtgh7uAZ68aiIaNDECEn2vsKg=; b=rA5sOddN8iAvVwRe8QSE4CVOQBnIXL4egW0ddlSuZWf92HOd/ZmDn3FE73P+Nu7MwR uE4oc+wvmOexw41QBFqgSqPyu8DAqORXlss7iAegzBRRPXBod7hQCvdRppqE/xsKa5i6 TIZ+AFfPwTZsSUwXdww6qD4E8rEEecoWmXVbZBUgnXglSdgTCg4QmrCbk0glax+3rpbH 5esFIcPtsvs76PFVDV8unP+gjoVhnGVbA7NmX7kBCXivNHUWA000PL0b/EfLwFlv1/cy LTLfqwaxmbojx+Pk3IkMOKuY1Re55H+d0zT/I7/37aB9fErzKnitomDTlcwBcfM+wvc0 BKeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id ee5si303146edb.157.2021.06.29.19.37.34; Tue, 29 Jun 2021 19:37:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232892AbhF3Cij (ORCPT + 99 others); Tue, 29 Jun 2021 22:38:39 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:34009 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232902AbhF3Cij (ORCPT ); Tue, 29 Jun 2021 22:38:39 -0400 X-UUID: f5d9e4f537ee485085e145749a4ad061-20210630 X-UUID: f5d9e4f537ee485085e145749a4ad061-20210630 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1988125775; Wed, 30 Jun 2021 10:36:09 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Jun 2021 10:36:07 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 30 Jun 2021 10:36:06 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH 06/24] iommu/mediatek: Add a flag DCM_DISABLE Date: Wed, 30 Jun 2021 10:34:46 +0800 Message-ID: <20210630023504.18177-7-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210630023504.18177-1-yong.wu@mediatek.com> References: <20210630023504.18177-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the infra iommu, we should disable DCM. add a new flag for this. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 78b35e187c78..a026e2ee4007 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -53,6 +53,8 @@ #define F_MMU_STANDARD_AXI_MODE_MASK (BIT(3) | BIT(19)) #define REG_MMU_DCM_DIS 0x050 +#define F_MMU_DCM BIT(8) + #define REG_MMU_WR_LEN_CTRL 0x054 #define F_MMU_WR_THROT_DIS_MASK (BIT(5) | BIT(21)) @@ -121,6 +123,7 @@ #define HAS_LEGACY_IVRP_PADDR BIT(7) #define IOVA_34_EN BIT(8) #define SHARE_PGTABLE BIT(9) /* 2 HW share pgtable */ +#define DCM_DISABLE BIT(10) #define MTK_IOMMU_HAS_FLAG(pdata, _x) \ ((((pdata)->flags) & (_x)) == (_x)) @@ -738,7 +741,11 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) regval = F_MMU_VLD_PA_RNG(7, 4); writel_relaxed(regval, data->base + REG_MMU_VLD_PA_RNG); } - writel_relaxed(0, data->base + REG_MMU_DCM_DIS); + if (MTK_IOMMU_HAS_FLAG(data->plat_data, DCM_DISABLE)) + writel_relaxed(F_MMU_DCM, data->base + REG_MMU_DCM_DIS); + else + writel_relaxed(0, data->base + REG_MMU_DCM_DIS); + if (MTK_IOMMU_HAS_FLAG(data->plat_data, WR_THROT_EN)) { /* write command throttling mode */ regval = readl_relaxed(data->base + REG_MMU_WR_LEN_CTRL); -- 2.18.0