Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp584920pxb; Fri, 13 Aug 2021 01:34:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgaG/+jGQl9pWFTF0U26aVTnNb0R9xEAWRc5tJSxSsepxdy2oAsbpBa51k4Ek2Ik2OoCaj X-Received: by 2002:a92:a04c:: with SMTP id b12mr1020342ilm.80.1628843679779; Fri, 13 Aug 2021 01:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628843679; cv=none; d=google.com; s=arc-20160816; b=JFdKc1gS2A2u+NkfnP2dbYZF/84bK32G5MD13tdAy3QlJbQVYeTv9SpRfCDKKhwtDD eSoqD6umTLikCz94ktup/4Q8vENnCQ9JwMqeNG50HX6gZQGMOb8uohfv+VnovutlEw6v afBcDFy+ObgqR3G6US0AhNuc43YvI+QLRxnyVpuWtbAEPnr2amzrEdQJtM8Oyv3Ac6Bm d9KImIrsKnlyl+adrD6NF9i/W0xuiRjW4bRTSuDMn96Ng45TDFvpd/vU+XpscnPIi9Ys /oy64bSE/ct3ctlKwEd8b1fHTI8HR27IpFRKqFsRWBIOmCRzJ0MXAR3NxvTdMoEDYiLi 0YFw== 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=IhxviQNlskQ/+ailWNlGDpaPSWKpZYoySFiM3UGe8GM=; b=fcPMSvo7X0wGToXoN2/bG5/7avRLeFvUJOMxFvAm/tf201jLLPlFLKQp7U7a/EY1IB OMZiCUwY+CGy7d28hhyOAeaVkCaTxZtj+z4iyPQKp7FQ3zpgE5jSPUbvpvr0RH7xyBhZ KZvMlmBoXIDO6ko0kt23Jj7EnHt+a7YqmZPxK7JU4ekGeT2+kqxJSQKYwRMAQi8ZX1kK CWGucNkiPby9VQ+ng6x+88JVxW6ffXYJTigzc+hZA2/gXWGTu6aoHElmPpOMGmk7UQ+H h+jOmP7XuVaNoy9KxdA+pNo9rNVUs0AzXHWqM9FfjJTK+PScaFBecn+U5ANDAuLeOxjy F4YQ== 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 c15si946771ilh.56.2021.08.13.01.34.28; Fri, 13 Aug 2021 01:34:39 -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 S239043AbhHMGzK (ORCPT + 99 others); Fri, 13 Aug 2021 02:55:10 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:36078 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S238810AbhHMGzD (ORCPT ); Fri, 13 Aug 2021 02:55:03 -0400 X-UUID: bcc07c054d81495e8274260409a9a235-20210813 X-UUID: bcc07c054d81495e8274260409a9a235-20210813 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 13452952; Fri, 13 Aug 2021 14:54:35 +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; Fri, 13 Aug 2021 14:54:33 +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:32 +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 07/29] iommu/mediatek: Add a flag NON_STD_AXI Date: Fri, 13 Aug 2021 14:53:02 +0800 Message-ID: <20210813065324.29220-8-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 Add a new flag NON_STD_AXI, All the previous SoC support this flag. Prepare for adding infra and apu iommu which don't support this. 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 bd50f3020bc1..175065b76509 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -123,6 +123,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)) @@ -753,7 +754,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; } @@ -1016,7 +1018,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, @@ -1026,7 +1029,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), @@ -1035,7 +1039,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), @@ -1045,7 +1049,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), @@ -1064,7 +1068,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