Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2190631pxb; Mon, 11 Jan 2021 03:29:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuTmTBPvKTdmMY2mMRhAsr8bm+0A7DKv8A6fWHvBB+QhNytRJkqgsneaRc7YgIk3l3M2T7 X-Received: by 2002:a17:906:d8dc:: with SMTP id re28mr10600669ejb.168.1610364551639; Mon, 11 Jan 2021 03:29:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610364551; cv=none; d=google.com; s=arc-20160816; b=G8NN8Wh13thmB5esM09osSlPki7gALa51LkbBU4GWWrdjbPAUqiTcdKCsSLQ9cTrAZ /jYkiPA6K8NZJ8KECnkTjUatwRN6I8WHeU17Qe2I7Ntw5DEkzEYAdpu85+yZCS28T4d7 UTyUj5rdx3KdHfLSXrTb8ckaY3eWD4iDxGtUefGO7rOJHOmccfojmcqdISEGHtHv3KnU VPt8/h2ZWouXaeOtfYM1fyqLwsF+rHEMBxhiL945HSRSQ6kCyO6v2WxAySFJOw0UqmuE FBA4Rapt5ICo5JBY1yG+5wfmARxJJQ88VbeEcr+Tui52YIeXXw2Oe6dvATWiTBnAz8fr T+5g== 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=SQisL89YEleemMlREUtd83c5r2pSoRRV2nLY72VjoQw=; b=bicfd5zHCbne8yHaHRf5iRICI6YvrVUgjlP4SVXY+FBkI1K5xpCYSLz3dqTdKQxD82 kjvdfCC81UTQXmK/SPepJO06o+kTYq9VpCEZBdhuo1ougTO8myJJgY/0V+dj06vmM5ul nE5UnxV5JkxmK5W0HFPwP6mYUFQymNz6DcMEmgKRJC7ClFxsZ/Y4JWmI67BzeykPtsnD JZ2IcVCE81Su6oMdZiSILWx9C6kjXT1sEjCmB/6oFc8ijWb0J3abXBRBFi0CEWQj0fpw XrsNYrrXwK9ecouRk9YwU7I6/NSW6yUk337ec4oCV+8GDfF70Ol41v6tWNopCkGHBemW neyw== 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 bo6si6918619edb.434.2021.01.11.03.28.48; Mon, 11 Jan 2021 03:29:11 -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 S1730055AbhAKLZC (ORCPT + 99 others); Mon, 11 Jan 2021 06:25:02 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:47168 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729779AbhAKLZC (ORCPT ); Mon, 11 Jan 2021 06:25:02 -0500 X-UUID: 056351e682994fc5833b7bacd412e29f-20210111 X-UUID: 056351e682994fc5833b7bacd412e29f-20210111 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 388231511; Mon, 11 Jan 2021 19:24:15 +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; Mon, 11 Jan 2021 19:24:14 +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; Mon, 11 Jan 2021 19:24:13 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v6 32/33] iommu/mediatek: Add mt8192 support Date: Mon, 11 Jan 2021 19:19:13 +0800 Message-ID: <20210111111914.22211-33-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210111111914.22211-1-yong.wu@mediatek.com> References: <20210111111914.22211-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 mt8192 iommu support. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 22 ++++++++++++++++++++++ drivers/iommu/mtk_iommu.h | 1 + 2 files changed, 23 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 084fb4394ffc..0ad14a7604b1 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -177,6 +177,16 @@ static const struct mtk_iommu_iova_region single_domain[] = { {.iova_base = 0, .size = SZ_4G}, }; +static const struct mtk_iommu_iova_region mt8192_multi_dom[] = { + { .iova_base = 0x0, .size = SZ_4G}, /* disp: 0 ~ 4G */ + #if IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) + { .iova_base = SZ_4G, .size = SZ_4G}, /* vdec: 4G ~ 8G */ + { .iova_base = SZ_4G * 2, .size = SZ_4G}, /* CAM/MDP: 8G ~ 12G */ + { .iova_base = 0x240000000ULL, .size = 0x4000000}, /* CCU0 */ + { .iova_base = 0x244000000ULL, .size = 0x4000000}, /* CCU1 */ + #endif +}; + /* * There may be 1 or 2 M4U HWs, But we always expect they are in the same domain * for the performance. @@ -1038,12 +1048,24 @@ static const struct mtk_iommu_plat_data mt8183_data = { .larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}}, }; +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, + .inv_sel_reg = REG_MMU_INV_SEL_GEN2, + .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}, + {0, 14, 16}, {0, 13, 18, 17}}, +}; + static const struct of_device_id mtk_iommu_of_ids[] = { { .compatible = "mediatek,mt2712-m4u", .data = &mt2712_data}, { .compatible = "mediatek,mt6779-m4u", .data = &mt6779_data}, { .compatible = "mediatek,mt8167-m4u", .data = &mt8167_data}, { .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data}, { .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data}, + { .compatible = "mediatek,mt8192-m4u", .data = &mt8192_data}, {} }; diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index 6f2168e3222d..f81fa8862ed0 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -45,6 +45,7 @@ enum mtk_iommu_plat { M4U_MT8167, M4U_MT8173, M4U_MT8183, + M4U_MT8192, }; struct mtk_iommu_iova_region; -- 2.18.0