Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp502413pxb; Thu, 23 Sep 2021 05:04:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuV1JFDBlm0KEcdi94CLDWheN7vDem0sW5/hhkGqC4hpslA6k2HKqxuOoHuTSjSgucwH+J X-Received: by 2002:a17:906:bce5:: with SMTP id op5mr4609931ejb.59.1632398651065; Thu, 23 Sep 2021 05:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632398651; cv=none; d=google.com; s=arc-20160816; b=sGsZJ/qWbrwFknLLJBkazrTQw1ORqNglMY998k2NMOTXMnvA7Aei0aS70hkvSYZmXr hkLTIGOlIAiZQRCbPW4Mc1bo6stLS1aTqI1picJpF+X0UqDMywGXDwvV0wcPR/55W1DV ta4izgQJfxGMFEQ063SgI3MVM2HySAPlUhyCh4eULGh6Iz41jexVG4rz7RWxkXui2tiX uTE03tkEB/T6V6HAMYIEAE/Lh5SZcx0sf9srz875cnxuB5OZOq6pMCRKy9ArTHSVq76l BUzM0hPUhVo1Cjglmik/w04CapgYyAuRYIQMVuhUQjjsXYv5yftkoj8f+g1LXPixBOVZ ybAQ== 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=LAyUxcyToSCYeZU3pjFjxXiJu065+lGScUcDb8M9RGo=; b=QAfAPq2X/V2QMCNsCxKwYE/5jO7IO+GSgqlt55Or+VmCXBW2EUYB7EVgFknZfNRRLA hpGxff+4t6V+NVpvRKHCLuKTrB3nN1YWOgKZQaVEffIALGOY5DaiiiPj56pCLfryU6X9 nXoi9uf2dH7i8hC5oGu2L7lFbKx2sUevOaNwQHvlsNqaPbhH0/DXO+JvjnpOswze9DU2 cFM1rdW8IBEMrURADfL2M+iR3Zuk61kraBjHNVEfd7n4IHJ1OJA+cDAdc9OIBbtBDaZ2 cEJMlP5bJh039UbnURKk+DRe/xhH7ykbYqY+5qNEW4Kyn3DGLH1cbJorVG6T4Z7eCs+Q YKcw== 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 f16si7150993edf.169.2021.09.23.05.03.40; Thu, 23 Sep 2021 05:04:11 -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 S240757AbhIWMBm (ORCPT + 99 others); Thu, 23 Sep 2021 08:01:42 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:49206 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S240760AbhIWMBi (ORCPT ); Thu, 23 Sep 2021 08:01:38 -0400 X-UUID: a091ec003b2f48c58465015fe50087f8-20210923 X-UUID: a091ec003b2f48c58465015fe50087f8-20210923 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2123898657; Thu, 23 Sep 2021 20:00:02 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Sep 2021 20:00:00 +0800 Received: from localhost.localdomain (10.17.3.154) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Sep 2021 19:59:59 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , Subject: [PATCH v3 07/33] iommu/mediatek: Add a flag DCM_DISABLE Date: Thu, 23 Sep 2021 19:58:14 +0800 Message-ID: <20210923115840.17813-8-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210923115840.17813-1-yong.wu@mediatek.com> References: <20210923115840.17813-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 00d9ae3dc88a..4e1b01fd58b0 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)) @@ -722,7 +725,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