Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp528312pxb; Thu, 12 Aug 2021 23:57:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQi1t89PAVf9JRJ28EIabCkY6+tiBq9/LExKSuvd7t2I7sWZbQ2zhpo3cu16hh7Za2mXgk X-Received: by 2002:a92:dac9:: with SMTP id o9mr792232ilq.124.1628837846188; Thu, 12 Aug 2021 23:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628837846; cv=none; d=google.com; s=arc-20160816; b=v3MMxIL5X1ysw+UVXF/RYxXXsHNixATevqjJUtKCB/qKPi6NlM+fcA4m9+T6jWS/VN OAyWldLTQnXlzuNv/CDmMJ7Ovfe3KD0xljWfCbuILmDsMNtf8S0miZpFemKvkWSiva7p h/Ju0WpgfKWAL1ti1Pc+GfAyDYO6qMmRNRd2v+RGjZ0WrWCrn9anmeyf5rDEZpU6YQU9 FXPEeqBdeVvAeY9Wrcuo038eqX5VK1Xqpfrmzstpvd/dt9Apq3Vnd6rvEgY+9Ha9XUUh QX3LSDsDs2pDFiLSZ88GhGTI+JigBiy8JxPViKN8D/2Psmh8QVBJfY2ZvYZlDNDfeh39 HeTw== 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=Q8mRREb/9lZ8wUYBRUrpwuCq28P4ZYeXxqDXALqyqdU=; b=L0kclemnb7yAUBO7JzkRj27zb80JxGPtgJzwuPtth8DCQyyTgaXOelo1e1897XUIgg V9rNP/YWrIXYOa9BtVbPA4qM9b7DusgmSr5BkkNkY6VUzQnB8D6D+fJx0syUa3K5xB2e IyAcJrB2ElzY1EGZu4KnK9buFyaHuUGG6vfz4KxeKCgqrg/55mPq++L+oaF6MeSgs165 l+CFzMqOBjln9hLXA23+3yeqvyouv0/+T26oeQvw/nmCUDsC0hWFU7zcuNsZSuZh3FCn 2kX3yzz3V+LGzE6//Pd+y7+a2e8Wbg22oTqwTVOX5OzRn4VVyMpmDEYK69OvxiwbWe97 wamA== 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 d16si635344ilc.34.2021.08.12.23.57.16; Thu, 12 Aug 2021 23:57:26 -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 S239048AbhHMGzJ (ORCPT + 99 others); Fri, 13 Aug 2021 02:55:09 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:59050 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S239033AbhHMGy6 (ORCPT ); Fri, 13 Aug 2021 02:54:58 -0400 X-UUID: b912c618549547118c663f66b1809865-20210813 X-UUID: b912c618549547118c663f66b1809865-20210813 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1243132031; Fri, 13 Aug 2021 14:54:26 +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; Fri, 13 Aug 2021 14:54:25 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Aug 2021 14:54:24 +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 v2 06/29] iommu/mediatek: Add a flag DCM_DISABLE Date: Fri, 13 Aug 2021 14:53:01 +0800 Message-ID: <20210813065324.29220-7-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210813065324.29220-1-yong.wu@mediatek.com> References: <20210813065324.29220-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 259ff7b90ff3..bd50f3020bc1 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -52,6 +52,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)) @@ -120,6 +122,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)) @@ -733,7 +736,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