Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4175284pxb; Tue, 25 Jan 2022 05:10:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXuUcFzIXNGGFQDBNEK7yaujonYLRrIGwoITlWy0mTf/lZypL7lI8xHcKBuhmkaoniDWI/ X-Received: by 2002:a17:906:9750:: with SMTP id o16mr15979044ejy.410.1643116202124; Tue, 25 Jan 2022 05:10:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643116202; cv=none; d=google.com; s=arc-20160816; b=ePwIntg/nUmp45w5QfVsAajLX3HRe7rO/vMrQzdt/Yi4+HxU/suM+qUFx0UVDPLPPp lFCEwf9/z6664flj91r3azX+O6urR5Voq+TtCxbEJAsAMrPdbmnWBQR7aM2+4uQMgjFu SmcXojJ3pC3oAmnOqjLxklD1RwJOBpg6B5HNX1+xRfSyHqJshEY2lkIEO5fTd/yMjCbg MCzrHMRfK06xjtyUuJz68Dz1SgyRB/IPikRcZk+KOthTTYAf3uB4ZyAA2MqohQTI44TZ K6ajeeKLeVIScWIuKOnT5WwzB8ZrsptYs7JAhTYU9Urrn/EOa2pyn9tc3fqAYDN8Tl0i 8yxQ== 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=y8TyiQtf27tZLb+XdIkEgl1q8EAJ46Q0xsgnyj8B5RA=; b=Js12jd1fyFe/zGi/4pk3wOtJL1/VWpy3joYqGGS6yTNdoxJb3puGUOdveamKTfQF/R 7d58QtgHuLEYS7R5to6C/dZxZJ+uEpov/kp5DyvS9P9jc/ZGTgFG1B3wPuDqFWSDx3RY HhtmkgUIguA+sStWVhb/qS0VA0LhseBXBWZYFChdBsAtdrNiL4cQracBqI8x5K46w7B5 UZkNN81eNzMixftQVAq1qFS3ohMNzw2e+wZDiHL27ifgVyd5JfEBsZepOb0BPCb8DEH3 nk9L+GhLe+Yo7QXr1recszjonLyrapxzS8OuMmrQwAAhODz39oG1CNZKRMaFeD+zXW3e WBdQ== 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 c18si11611245ede.178.2022.01.25.05.09.33; Tue, 25 Jan 2022 05:10:02 -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 S1456619AbiAYJMM (ORCPT + 99 others); Tue, 25 Jan 2022 04:12:12 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:35742 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1454411AbiAYI73 (ORCPT ); Tue, 25 Jan 2022 03:59:29 -0500 X-UUID: 6358bb44623246568ed8d93cf5150926-20220125 X-UUID: 6358bb44623246568ed8d93cf5150926-20220125 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1464556462; Tue, 25 Jan 2022 16:58:34 +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:32 +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:30 +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 12/35] iommu/mediatek: Add a flag NON_STD_AXI Date: Tue, 25 Jan 2022 16:56:11 +0800 Message-ID: <20220125085634.17972-13-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 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 Reviewed-by: AngeloGioacchino Del Regno --- 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 b2361e8b06d9..80d8333797fd 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -122,6 +122,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; } @@ -1022,7 +1024,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, @@ -1032,7 +1035,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), @@ -1041,7 +1045,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), @@ -1051,7 +1055,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), @@ -1070,7 +1074,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