Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4922163pxv; Tue, 29 Jun 2021 20:19:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyus9l2/1dJ/Htk4FdmKND7eucgBvDM4ktKT7UKgLvtOTByDgdhc/OXeDPbfC0sELJSHwq7 X-Received: by 2002:a17:906:f9cc:: with SMTP id lj12mr9988195ejb.426.1625023151681; Tue, 29 Jun 2021 20:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625023151; cv=none; d=google.com; s=arc-20160816; b=aNMWaK4bwBWDvLuJb4kh6IgGLBzhSqfTvvAGFbs9Y3vlNwjKLpsNEcMR4U6G/kDjJy amtimSwWKn0dj2KUG3pBWVjldkjgWMKnETtHDAvgR4t3fQwN/03c8pf/G8F9SIhsapil LUFCA2jwVIzomLgySr+lBjCJFdoODqeV/mDLpc1Ll21/2qlgL2C1tVy5nYseAHafGapU 6r7w0rDDpv/xy9F1oM+4oehztSUDxngW/gqWbf46uCJx/xqiJPEUElRwRMHlVz21efXz WjI0x3/cr39sz23GUOklE9wBr/U9xi+ApbK/HfYOBG5reDcLquDMyxQKsHrZ5S6ig3/m fiow== 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=pXnl3B2FBH+bkwMIUXwdVfIPnYar4BjSRzRfTl0nYI8=; b=mZLvdtMkvyqpmfzwIG02luK2q2MLTlEM31gUZAvlNdg5pCE3dPccrPyIk4eInmlf9x HjvbwCOheZ7wdgZzGYmIAV9Fv/D5OFW8zdo2pHe289BCYKrXdfvJnWSd8/OC9jBB3iuE 8en/JO8ybcddRvZZIclpKTYC2ZlQJBlsCHHp0qC7wmVavwqb09IMk9sw/aWIupmMk0Ne HXtx4tH3U/28SxND1+PJL4Dt7v4m6nbR1NP5EokecCUTtdICwaZdXe+7qgeiBcUwF7l1 +jEGCo8xwB0Cji0MpyLCK041n6ADeMpyVxO2rwbNEtvtV5tLhG8qkdwcOTT2Y8jVKt4D ZJ0g== 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 t15si19995823edd.13.2021.06.29.20.18.44; Tue, 29 Jun 2021 20:19: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 S233083AbhF3Cix (ORCPT + 99 others); Tue, 29 Jun 2021 22:38:53 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:34105 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S233014AbhF3Cis (ORCPT ); Tue, 29 Jun 2021 22:38:48 -0400 X-UUID: a73606a67e2c4e9cab9b268e4cc18145-20210630 X-UUID: a73606a67e2c4e9cab9b268e4cc18145-20210630 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1610515111; Wed, 30 Jun 2021 10:36:17 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Jun 2021 10:36:16 +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:14 +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 07/24] iommu/mediatek: Add flag NON_STD_AXI Date: Wed, 30 Jun 2021 10:34:47 +0800 Message-ID: <20210630023504.18177-8-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 This patch add a new flag NON_STD_AXI, All the previous SoC support this flag. this is a preparing patch for adding infra iommu and apu iommu which don't support this flag. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index a026e2ee4007..7fe9ebd879fe 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -124,6 +124,7 @@ #define IOVA_34_EN BIT(8) #define SHARE_PGTABLE BIT(9) /* 2 HW share pgtable */ #define DCM_DISABLE BIT(10) +#define NOT_STD_AXI_MODE BIT(11) #define MTK_IOMMU_HAS_FLAG(pdata, _x) \ ((((pdata)->flags) & (_x)) == (_x)) @@ -758,7 +759,8 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) regval = 0; } else { regval = readl_relaxed(data->base + REG_MMU_MISC_CTRL); - regval &= ~F_MMU_STANDARD_AXI_MODE_MASK; + if (MTK_IOMMU_HAS_FLAG(data->plat_data, NOT_STD_AXI_MODE)) + regval &= ~F_MMU_STANDARD_AXI_MODE_MASK; if (MTK_IOMMU_HAS_FLAG(data->plat_data, OUT_ORDER_WR_EN)) regval &= ~F_MMU_IN_ORDER_WR_EN_MASK; } @@ -1021,7 +1023,8 @@ static const struct dev_pm_ops mtk_iommu_pm_ops = { static const struct mtk_iommu_plat_data mt2712_data = { .m4u_plat = M4U_MT2712, - .flags = HAS_4GB_MODE | HAS_BCLK | HAS_VLD_PA_RNG | SHARE_PGTABLE, + .flags = HAS_4GB_MODE | HAS_BCLK | HAS_VLD_PA_RNG | SHARE_PGTABLE | + NOT_STD_AXI_MODE, .hw_list = &m4ulist, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, .iova_region = single_domain, @@ -1031,7 +1034,8 @@ static const struct mtk_iommu_plat_data mt2712_data = { static const struct mtk_iommu_plat_data mt6779_data = { .m4u_plat = M4U_MT6779, - .flags = HAS_SUB_COMM | OUT_ORDER_WR_EN | WR_THROT_EN, + .flags = HAS_SUB_COMM | OUT_ORDER_WR_EN | WR_THROT_EN | + NOT_STD_AXI_MODE, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), @@ -1040,7 +1044,7 @@ static const struct mtk_iommu_plat_data mt6779_data = { static const struct mtk_iommu_plat_data mt8167_data = { .m4u_plat = M4U_MT8167, - .flags = RESET_AXI | HAS_LEGACY_IVRP_PADDR, + .flags = RESET_AXI | HAS_LEGACY_IVRP_PADDR | NOT_STD_AXI_MODE, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), @@ -1050,7 +1054,7 @@ static const struct mtk_iommu_plat_data mt8167_data = { static const struct mtk_iommu_plat_data mt8173_data = { .m4u_plat = M4U_MT8173, .flags = HAS_4GB_MODE | HAS_BCLK | RESET_AXI | - HAS_LEGACY_IVRP_PADDR, + HAS_LEGACY_IVRP_PADDR | NOT_STD_AXI_MODE, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), @@ -1069,7 +1073,7 @@ static const struct mtk_iommu_plat_data mt8183_data = { static const struct mtk_iommu_plat_data mt8192_data = { .m4u_plat = M4U_MT8192, .flags = HAS_BCLK | HAS_SUB_COMM | OUT_ORDER_WR_EN | - WR_THROT_EN | IOVA_34_EN, + WR_THROT_EN | IOVA_34_EN | NOT_STD_AXI_MODE, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), -- 2.18.0