Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4167306pxb; Tue, 25 Jan 2022 05:01:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+eylKZo1Ty6yh3zsiEeAm4b5rlKfPLq4X8K69lx0cE41uFa6PK1kKUVjjU7HOfGopByg7 X-Received: by 2002:a17:90a:3b05:: with SMTP id d5mr3414794pjc.224.1643115710727; Tue, 25 Jan 2022 05:01:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643115710; cv=none; d=google.com; s=arc-20160816; b=I6hwxPRRIKbkt4lSYcusQ2qCK5UuyzXOdFfvXo/X13Ct1U5kJY20IIoyZ/27kSHLhY TIhY5lYpVrW93qDsZb0K0BHNKK8e91dYTxxnPFjn/i94o9DFwdoa+UJpmWuvP443OX9e I9dHjH3htDUNSWesNhulgCwxy3kAg9ikmnTT3i1p+kF1TGSG3k9jjv2GUIQ2TXM3QJWw IzadIIGZwJTINDa7o1fOD1P3Fmx2wyiQxxdEm8ugHgtq5XBrfxvfFjlLjE7Cib5m0akg rvy1ANq35LGlOfRjunibJ1XM+Lwk3HKQ37oYXNO+g2Xia3zWTO+dJ6UIqfXF4TfeEf4R FLQA== 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=wd2Ldb2Eebt/0CdU7DHcpKvh996lLmf/EjMbKxnT7Ss=; b=0Ni1CbPqD2+oEcShgkK7ieX6fKx1t3dmAh6ILiqu91tmiy8KA+/HTVBhvcz4XfOECy PEsfl3my+vP1UAWfPeLUsbg59gf2jJT5ZiU87EaspK2hGnkOO7WBRb9a5sEibj8i2Zjp OQB+OB8mUIzVCAVYo1DpHu7UXBaLK3FeOGFxU0XKEVAHbe1n0w0NyaBoexatvQZhN8jZ eBoWjKJ8Ss7IfvkM8m8Jgkvt/Cb1yt3KEWFBQEUE/f+5iz+g6vRLhH47AT+fiLt5xwbz 9WkHv2+y0zFEPU8FNT2yY9FVpbnyMqw1KVKuBPdNfK0hE52GKkxjr+djMJWcHayAmLPE UQlA== 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 d17si17282370plg.597.2022.01.25.05.01.36; Tue, 25 Jan 2022 05:01:50 -0800 (PST) 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 S1454981AbiAYJB5 (ORCPT + 99 others); Tue, 25 Jan 2022 04:01:57 -0500 Received: from mailgw01.mediatek.com ([60.244.123.138]:56956 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1453435AbiAYI7C (ORCPT ); Tue, 25 Jan 2022 03:59:02 -0500 X-UUID: 94eb5911ae53466d893aae77746d0333-20220125 X-UUID: 94eb5911ae53466d893aae77746d0333-20220125 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 584497538; Tue, 25 Jan 2022 16:58:25 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Tue, 25 Jan 2022 16:58:24 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 25 Jan 2022 16:58:23 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , "Matthias Brugger" , Will Deacon CC: Robin Murphy , Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , , "AngeloGioacchino Del Regno" , , , , Subject: [PATCH v4 11/35] iommu/mediatek: Add a flag DCM_DISABLE Date: Tue, 25 Jan 2022 16:56:10 +0800 Message-ID: <20220125085634.17972-12-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220125085634.17972-1-yong.wu@mediatek.com> References: <20220125085634.17972-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 Reviewed-by: AngeloGioacchino Del Regno --- 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 4a24977274e3..b2361e8b06d9 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -51,6 +51,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)) @@ -119,6 +121,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