Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4904357pxv; Tue, 29 Jun 2021 19:42:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3sdY6LpUM0UM1/znEsymKVis0lORK1Kngy33lj8ZanWyON4LlO8XQDJyLjqgX6ed8hZHA X-Received: by 2002:a17:906:9747:: with SMTP id o7mr1594737ejy.14.1625020928369; Tue, 29 Jun 2021 19:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625020928; cv=none; d=google.com; s=arc-20160816; b=cZeab5gImfSz+JYMM+0IBsxfJd5WzA6UP/BESr/yfJPgxnfIb1N22xTgi7+Fts95Rp 6219vIPwX+v6lhZJK/I8CaeIaU91KEBbZuaxdL62wTnxJ2WXq9ZztynU7V6aCthXTUjA M5q7EegWNRPfEEOoH5gI0GowJOshW3QLxb4ivcAy705zXOCE04iLf+Ci9D9bGtAUqq9D cKfmChNeoxsqjdS8nG1bkKn5HwCVTMgLjgs44HHrg9iP7PuW5+/h26Gct/+oFKThE205 y19Dj1wnl2Gn0UfSyi2JpbeMxTAu5hhBIMWIpskbpnjJKibvhVLaV9qJfRPZenPceZlZ yOMA== 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=+t0HyP2omz37H1CicYasMKXy4gm7lmo/7YU1ZuGyqpQ=; b=cVWKvc772fMhZT+reoAyRY1k7rbmISfloN1SLP0mKh0aGxg0iZNhMQGlGVFrqw6i41 jYPOHxsc6ho3nwjm6MqvviCdH8zflp5QPsYurX4jKN9uX1L7cy7VRA6oTxofjgDIzCx5 dl/ZDzn8VEsFK8+aq1J7vaBVmhQpaRCV6gFmhIaSltWit8P9C/R5KAFrDQXGV76n685c PGVYqB1elpnpVergYx5qCVZHHrbWStsgjH1DJ8QJXGQWZqdMwOnLh6Zj+xkjXUU1mUGo vSCtqwrTGwAB4g08UfJGwYu3vt5O4JK/5kgUsSZrWRy54wbJWaOcoq/+2xhHYw4MSvQx W+OA== 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 ig2si11151753ejc.475.2021.06.29.19.41.43; Tue, 29 Jun 2021 19:42:08 -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 S233029AbhF3Ckd (ORCPT + 99 others); Tue, 29 Jun 2021 22:40:33 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:35332 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232684AbhF3Ckc (ORCPT ); Tue, 29 Jun 2021 22:40:32 -0400 X-UUID: 04ffcceb0c0a4197b8728507ead0ebf5-20210630 X-UUID: 04ffcceb0c0a4197b8728507ead0ebf5-20210630 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 1803475303; Wed, 30 Jun 2021 10:38:00 +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:37:59 +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:37:57 +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 20/24] iommu/mediatek: Add bank_nr and bank_enable Date: Wed, 30 Jun 2021 10:35:00 +0800 Message-ID: <20210630023504.18177-21-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 adds two variables in the plat_data: bank_nr: the bank number that this SoC support; bank_enable: list if the banks is enabled. This patch add them for all the current SoC, bank_nr always is 1 and only bank_enable[0] is enabled. it is preparing for supporting multi banks. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 18 ++++++++++++++++++ drivers/iommu/mtk_iommu.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index ed3cf75850ce..042489b8e402 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1116,6 +1116,8 @@ static const struct mtk_iommu_plat_data mt2712_data = { NOT_STD_AXI_MODE | MTK_IOMMU_TYPE_MM, .hw_list = &m4ulist, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .bank_nr = 1, + .bank_enable = {true}, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}}, @@ -1126,6 +1128,8 @@ static const struct mtk_iommu_plat_data mt6779_data = { .flags = HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN | WR_THROT_EN | NOT_STD_AXI_MODE | MTK_IOMMU_TYPE_MM, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .bank_nr = 1, + .bank_enable = {true}, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {5}, {7, 8}, {10}, {9}}, @@ -1136,6 +1140,8 @@ static const struct mtk_iommu_plat_data mt8167_data = { .flags = RESET_AXI | HAS_LEGACY_IVRP_PADDR | NOT_STD_AXI_MODE | MTK_IOMMU_TYPE_MM, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .bank_nr = 1, + .bank_enable = {true}, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}}, /* Linear mapping. */ @@ -1147,6 +1153,8 @@ static const struct mtk_iommu_plat_data mt8173_data = { HAS_LEGACY_IVRP_PADDR | NOT_STD_AXI_MODE | MTK_IOMMU_TYPE_MM, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .bank_nr = 1, + .bank_enable = {true}, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {1}, {2}, {3}, {4}, {5}}, /* Linear mapping. */ @@ -1156,6 +1164,8 @@ static const struct mtk_iommu_plat_data mt8183_data = { .m4u_plat = M4U_MT8183, .flags = RESET_AXI | MTK_IOMMU_TYPE_MM, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, + .bank_nr = 1, + .bank_enable = {true}, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), .larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}}, @@ -1167,6 +1177,8 @@ static const struct mtk_iommu_plat_data mt8192_data = { WR_THROT_EN | IOVA_34_EN | NOT_STD_AXI_MODE | MTK_IOMMU_TYPE_MM, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .bank_nr = 1, + .bank_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), .larbid_remap = {{0}, {1}, {4, 5}, {7}, {2}, {9, 11, 19, 20}, @@ -1178,6 +1190,8 @@ static const struct mtk_iommu_plat_data mt8195_data_infra = { .flags = WR_THROT_EN | DCM_DISABLE | MTK_IOMMU_TYPE_INFRA | IFA_IOMMU_PCIe_SUPPORT, .pericfg_comp_str = "mediatek,mt8195-pericfg_ao", + .bank_nr = 1, + .bank_enable = {true}, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, .iova_region = single_domain, .iova_region_nr = ARRAY_SIZE(single_domain), @@ -1190,6 +1204,8 @@ static const struct mtk_iommu_plat_data mt8195_data_vdo = { MTK_IOMMU_TYPE_MM, .hw_list = &m4ulist, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .bank_nr = 1, + .bank_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), .larbid_remap = {{2, 0}, {21}, {24}, {7}, {19}, {9, 10, 11}, @@ -1203,6 +1219,8 @@ static const struct mtk_iommu_plat_data mt8195_data_vdp = { MTK_IOMMU_TYPE_MM, .hw_list = &m4ulist, .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .bank_nr = 1, + .bank_enable = {true}, .iova_region = mt8192_multi_dom, .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), .larbid_remap = {{1}, {3}, {22, 0, 0, 0, 23}, {8}, diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index 7193278501dd..78d9481d67b5 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -62,6 +62,9 @@ struct mtk_iommu_plat_data { struct list_head *hw_list; unsigned int iova_region_nr; const struct mtk_iommu_iova_region *iova_region; + + u32 bank_nr; + bool bank_enable[MTK_IOMMU_BANK_MAX]; unsigned char larbid_remap[MTK_LARB_COM_MAX][MTK_LARB_SUBCOM_MAX]; }; -- 2.18.0