Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp503503pxb; Thu, 23 Sep 2021 05:05:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7UgZ0SUXY5gjfvFA6wMh/0fqZsBb72X2UC5fowHFpkppKnfEN+6Agwt3VHnJ2C2NSHe61 X-Received: by 2002:a17:906:af91:: with SMTP id mj17mr4662127ejb.266.1632398717933; Thu, 23 Sep 2021 05:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632398717; cv=none; d=google.com; s=arc-20160816; b=PHdT0yrbM/MR7LVMyVV/u7UK93HLSIvbOY6E2ZRHMD/ffRbyRsXuQWxk3jAFqVBRss LTKPXaDZ/jc96VHFqiUVkJCQ/rgkRnqixhCL6UjW8z77ssIgnP4qp7SCaSZsZWvC9PL7 bJlqx5SxHkfBDMNCOzrTUjPRteENmCt3ga1OQnHccB7UcsRml4P73gRXte/C8XjEZuWm SWrRiMSwrvOjsBl15tAisu+JyE5XmjKL0oQDy7lB05DHj9nvPG/2+HSJj+zt6AKeiAfP HpIY3LBAYAWb6k602DVKvaruLKeH50ZctaPYtLURyOf0mu9OGZCRR3YR6RK7eJruCchU ukQw== 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=5uCfVl6UZZW2ljnMorefgJtjvto9RCNYxBCQ32SPFO4=; b=KRhxEOACV6POtE9SidMU5ka1M7H1y0HHW9ZzjO7NkqTc/hJsva6vXU5oTq63hPIFkh jTz9vKNgZMaZRBvExEP6+xxXQZc+bp437qHm+S6VM4ozJdjTiVS1X/dh+9Njq6BvFJV8 ueRe+oTKG2591tQSmtAF2cPVzkbWTeN15GNgrpQKdALXFZeyW83aaYywU22OhoN8+eQ9 81XvDFj/aumPbYDJThGWC+0URviArvdo0K8JY5l6C8nv4mN4WewWurLGS21PhFDMHr06 YjjePDb86wvLYkhs235Krc2ntDfEuEqR4pXvBdBTuvZt3glAcpHkhLnwiVgrMp4BGCKi ebBw== 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 n19si5613999ejr.250.2021.09.23.05.04.52; Thu, 23 Sep 2021 05:05:17 -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 S240909AbhIWMET (ORCPT + 99 others); Thu, 23 Sep 2021 08:04:19 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:55382 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S240931AbhIWMEM (ORCPT ); Thu, 23 Sep 2021 08:04:12 -0400 X-UUID: a1d86a87986649dcb797edf5fc6fa559-20210923 X-UUID: a1d86a87986649dcb797edf5fc6fa559-20210923 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 164158591; Thu, 23 Sep 2021 20:02:39 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Sep 2021 20:02:38 +0800 Received: from localhost.localdomain (10.17.3.154) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Sep 2021 20:02:37 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , Subject: [PATCH v3 23/33] iommu/mediatek: Add mt8195 support Date: Thu, 23 Sep 2021 19:58:30 +0800 Message-ID: <20210923115840.17813-24-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210923115840.17813-1-yong.wu@mediatek.com> References: <20210923115840.17813-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 3f1fd8036345..df823ee3541a 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1163,6 +1163,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}, @@ -1170,6 +1209,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 d83c79bf800a..a9dc79c5a724 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