Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp529121pxb; Thu, 12 Aug 2021 23:58:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjFMOl0wQk1D1hXYIwzRRMDsLie2JwcYyNcsGu5iPoEmFOsJ4x/PIfrGja1VHs67+cHsVL X-Received: by 2002:a5d:898f:: with SMTP id m15mr940297iol.188.1628837933540; Thu, 12 Aug 2021 23:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628837933; cv=none; d=google.com; s=arc-20160816; b=1LwVmyZlXoijUMuVUbaIbeU6fqc2UZdun6Ifd3wxydRBUTwSDr2k4gf3OEuZabsbnx lWlm5twSqxj0CAD2i/PzzmG7WXqK72ZPss4vGZcx9SQZNeeI2vMaoNNn6jd21LU8WEju axTt3q+Hk6WKeztW7JY2ijkl3YqEjOJOAhG32cDZx8P/ay0WnIKCZaJHW/QS4XvFOT8g u2dpNtgNhyQUMzokoII7yTg5Ygx6wFwLax44s8k6Ga6FQ7n+NHnp9mnUAKMzybLy6ZOh VM3brtakfasYOY1cHdn0xh4PdDORXbgLoWSarLfvnJhRAgANwLFeXt257zV3WGMuvi1t EGLQ== 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=4Y/9u4Q3y4odMHvaFlOOaWC9bosnYqUMVKGqz+viLHc=; b=yvqXcPYOuWba1XUWp7ShUE3hvQCS00LCJS1N3gJPKwyCH7sYofqZf3oFeaBYoSXoXu xJVhC+YgjXScLGM1Gp7au4sHqety3nRcYiiOZFqHxPoXX1n7OkorwJoabN8GhlKK3Aub iDA7RFW+AnKtWzC0NGgJRcaP4+vAkpdHMKQnC0K//ads8xKNhsBWCwGRuR4qjLIraohb JgJLGKaQpUlWOibDjoBPVCvG0tF6NobR0PY4tg10ZyJEK85iAnLVg0aon18y6rHGTjrt Bg8o9P/PA8hGXEA/Buf0YP4VQchX1gBQS+STWZ4e6rqcb3xsoR6l/s3NOsG98z3V4Swl Ngpg== 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 g11si582538ilq.74.2021.08.12.23.58.43; Thu, 12 Aug 2021 23:58:53 -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 S238986AbhHMG4n (ORCPT + 99 others); Fri, 13 Aug 2021 02:56:43 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:38768 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S238869AbhHMG4l (ORCPT ); Fri, 13 Aug 2021 02:56:41 -0400 X-UUID: 1691ceafd79f4bf59a68f1d66e8be64c-20210813 X-UUID: 1691ceafd79f4bf59a68f1d66e8be64c-20210813 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 656944775; Fri, 13 Aug 2021 14:56:10 +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:56:08 +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:56:07 +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 19/29] iommu/mediatek: Add mt8195 support Date: Fri, 13 Aug 2021 14:53:14 +0800 Message-ID: <20210813065324.29220-20-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 mt8195 has 3 IOMMU, containing 2 MM IOMMUs, one is for vdo, the other is for vpp. and 1 INFRA IOMMU. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 42 +++++++++++++++++++++++++++++++++++++++ drivers/iommu/mtk_iommu.h | 1 + 2 files changed, 43 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index b7a31f3a1bcf..d7eec20f0476 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1168,6 +1168,45 @@ static const struct mtk_iommu_plat_data mt8192_data = { {0, 14, 16}, {0, 13, 18, 17}}, }; +static const struct mtk_iommu_plat_data mt8195_data_infra = { + .m4u_plat = M4U_MT8195, + .flags = WR_THROT_EN | DCM_DISABLE | + MTK_IOMMU_TYPE_INFRA | IFA_IOMMU_PCIe_SUPPORT, + .pericfg_comp_str = "mediatek,mt8195-pericfg_ao", + .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .iova_region = single_domain, + .iova_region_nr = ARRAY_SIZE(single_domain), +}; + +static const struct mtk_iommu_plat_data mt8195_data_vdo = { + .m4u_plat = M4U_MT8195, + .flags = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN | + WR_THROT_EN | NOT_STD_AXI_MODE | IOVA_34_EN | + SHARE_PGTABLE | MTK_IOMMU_TYPE_MM, + .hw_list = &m4ulist, + .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .iova_region = mt8192_multi_dom, + .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .larbid_remap = {{2, 0}, {21}, {24}, {7}, {19}, {9, 10, 11}, + {13, 17, 15/* 17b */, 25}, {5}}, +}; + +static const struct mtk_iommu_plat_data mt8195_data_vpp = { + .m4u_plat = M4U_MT8195, + .flags = HAS_BCLK | HAS_SUB_COMM_3BITS | OUT_ORDER_WR_EN | + WR_THROT_EN | NOT_STD_AXI_MODE | IOVA_34_EN | + SHARE_PGTABLE | MTK_IOMMU_TYPE_MM, + .hw_list = &m4ulist, + .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .iova_region = mt8192_multi_dom, + .iova_region_nr = ARRAY_SIZE(mt8192_multi_dom), + .larbid_remap = {{1}, {3}, {22, 0, 0, 0, 23}, {8}, + {20}, {12}, + /* 16: 16a; 29: 16b; 30: CCUtop0; 31: CCUtop1 */ + {14, 16, 29, 26, 30, 31, 18}, + {4, 0, 0, 0, 6}}, +}; + static const struct of_device_id mtk_iommu_of_ids[] = { { .compatible = "mediatek,mt2712-m4u", .data = &mt2712_data}, { .compatible = "mediatek,mt6779-m4u", .data = &mt6779_data}, @@ -1175,6 +1214,9 @@ static const struct of_device_id mtk_iommu_of_ids[] = { { .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data}, { .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data}, { .compatible = "mediatek,mt8192-m4u", .data = &mt8192_data}, + { .compatible = "mediatek,mt8195-iommu-infra", .data = &mt8195_data_infra}, + { .compatible = "mediatek,mt8195-iommu-vdo", .data = &mt8195_data_vdo}, + { .compatible = "mediatek,mt8195-iommu-vpp", .data = &mt8195_data_vpp}, {} }; diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index 676d306af046..e7ede1123624 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -46,6 +46,7 @@ enum mtk_iommu_plat { M4U_MT8173, M4U_MT8183, M4U_MT8192, + M4U_MT8195, }; struct mtk_iommu_iova_region; -- 2.18.0