Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4928808pxv; Tue, 29 Jun 2021 20:32:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt8JKuXfA7bmTdNg+jFUWZ+rlBiqYptFgmsMojB3qHDSTjPKpmGzGlh+yN8cdCx+UUHgXk X-Received: by 2002:a50:fb14:: with SMTP id d20mr43744968edq.187.1625023953930; Tue, 29 Jun 2021 20:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625023953; cv=none; d=google.com; s=arc-20160816; b=dsad/ep2PQbNQz+SlZ0B2NpqW1jhGAWi9Re8GQlHwasdjgTbnwvTG97OMWZTes5nk9 stInWxlRIy+EEJ4+AfW0iyqfC2OLMQRNJTSN1oIty5uml8K+4ql0PgzUu18/rGzJlVy6 cvL/PAZ8lPQpDRKaXWtRrOOngBOwM5g0X679brq6XGgf/gpZ4q+My6s0MuLE4J5zCnDu JAuLruNTkTQRmEhXSBneMNsY5/CyZsSPtF8+s27pVAigNpTMM/V+myEYW4ObFT9Nouak OohDZSwPXLzPcQ2iaeASGwH87AumbidUR2r+Vkv/gv5wBp9ElHxEZ4Jiy2ruVJsHSaQr XvWw== 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=tzKi9qRz0uRrJksanbr9DsA68vxjuTrl6SGYGeGZa0k=; b=u75j1G8wT75O7yCVrdJXV68VwP6jwFwww+hRy9xqYOZwSk/29NmlK6/s6rslZbV/ob cMrQF6pGexmJ00Dela1Yru+JPligcE0H45ydbIAE5id9YpU4Y/IZVTd56+n6qPw23eqQ IooURCOBuNhEaQb0GgRph9upZvr0E+l+SRg+hNa2HbOZNdhTRs2xlznXigfYvwCMVraF C/gG/pjjejCcGjCscpyQg6P7cRVnPK0M6SEsxZq0Tv+WJakeO1qSbe7L/ZEyvb2aw9RT rydvcsc9HpqQVMv791s3SCrT39wlE56WPjKD6LXB/2WHzruZvrKqbdDvOXr8J/QW7oOF ADpA== 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 e11si20415956eds.276.2021.06.29.20.32.09; Tue, 29 Jun 2021 20:32:33 -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 S233298AbhF3Cjx (ORCPT + 99 others); Tue, 29 Jun 2021 22:39:53 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:34871 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232745AbhF3Cjv (ORCPT ); Tue, 29 Jun 2021 22:39:51 -0400 X-UUID: 1cd5d294c24f45bd8bfdbb530b2f1a36-20210630 X-UUID: 1cd5d294c24f45bd8bfdbb530b2f1a36-20210630 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 690753351; Wed, 30 Jun 2021 10:37:21 +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:19 +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:18 +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 15/24] iommu/mediatek: Add mt8195 support Date: Wed, 30 Jun 2021 10:34:55 +0800 Message-ID: <20210630023504.18177-16-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 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 33303243771b..5e046587eef4 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1152,6 +1152,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_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_vdp = { + .m4u_plat = M4U_MT8195, + .flags = 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}, @@ -1159,6 +1198,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_vdp}, {} }; diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index cdc241a51c2f..d9425807e980 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