Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4901893pxv; Tue, 29 Jun 2021 19:37:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze/8ANriZ1fge/8oAgh7oYw/D6ebI8hLWhRyU+7tb/MVXzX4kdRdfOPnT+KgnOYO/C4uWb X-Received: by 2002:a05:6402:51c9:: with SMTP id r9mr12855653edd.326.1625020627894; Tue, 29 Jun 2021 19:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625020627; cv=none; d=google.com; s=arc-20160816; b=V5NwJjSfQ1dQN/XodcASs+xcpYf9RQnYxQe7Y6OLzOh9tBLWogSH1AkgVq6XnH/6AB 9HKyr3cNW57HDz4aj8MMbF1AyARqerbnQ6NgMMJZZX1m/cIKqKmlYcnV1XQrkxEFus3R wBiqvveax9tR+qSz4bVUZgRAunDEjyQ8lDZBn2TDTOf86IyT+5NXE8X9GPP1Ui658H1a zngFoTXhvPmnCwo7knduorgvpLM0gTgKhiEpIfqV4MSzekU806GmxRtI/zU+1+3f5HwD Lw3dU4QP0HDy4c1yMLWU3V4AgijMGBQ/iXe88SEvVMMV33Gcsn+m1O/uthxR8GzDi2A3 PueA== 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=a/chjy392PRLYf18e+OqW9HkWcVK8XcklU4rhe7K/Zo=; b=F4IxrtwgML3D06jeMqnuaU+uXbiCylHDpzs6UFQ/9WFiWm06wjTBtx4d9SJGrHxPv7 TKMS/UWC31Ks8+2P1lw1p2+BoUFOm2TnwcUE+hZnXQUuSWzO7V+6gpih38qe1XNWbRLx /5iJeUMO5aJnp08h9V/PCFzxFSPZDd1XDmJX7MUFqZnBwxYJGxg9LBMoQ3Na7qYnfqpV fzwuUbd/qCmvFVi3FdECZ4ep5PEMFK0o37b5UkWA245YSMozlzFWS+yACQGyAM7NtbQt PwqIW2CT7jqg8Vsf5UCywLSWEDhvVpvG/cKq+/Yw3AAiHbmDrmkEjSLfLvke0kegi1iH 4VNQ== 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 do19si1549115ejc.513.2021.06.29.19.36.45; Tue, 29 Jun 2021 19:37:07 -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 S232684AbhF3CiN (ORCPT + 99 others); Tue, 29 Jun 2021 22:38:13 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:33572 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232009AbhF3CiI (ORCPT ); Tue, 29 Jun 2021 22:38:08 -0400 X-UUID: bb68e647902745cc82e25a7cd7b47ca0-20210630 X-UUID: bb68e647902745cc82e25a7cd7b47ca0-20210630 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 337488588; Wed, 30 Jun 2021 10:35:37 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Jun 2021 10:35:36 +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:35:34 +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 02/24] dt-bindings: mediatek: mt8195: Add binding for infra IOMMU Date: Wed, 30 Jun 2021 10:34:42 +0800 Message-ID: <20210630023504.18177-3-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 In mt8195, we have a new IOMMU that is for INFRA IOMMU. its masters mainly are PCIe and USB. Different with MM IOMMU, all these masters connect with IOMMU directly, there is no mediatek,larbs property for infra IOMMU. Another thing is about PCIe ports. currently the function "of_iommu_configure_dev_id" only support the id number is 1, But our PCIe have two ports, one is for reading and the other is for writing. see more about the PCIe patch in this patchset. Thus, I only list the reading id here and add the other id in our driver. Signed-off-by: Yong Wu --- .../bindings/iommu/mediatek,iommu.yaml | 14 +++++++++++++- .../dt-bindings/memory/mt8195-memory-port.h | 18 ++++++++++++++++++ include/dt-bindings/memory/mtk-memory-port.h | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml b/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml index 9b04630158c8..6f3ff631c06b 100644 --- a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml +++ b/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml @@ -79,6 +79,7 @@ properties: - mediatek,mt8192-m4u # generation two - mediatek,mt8195-iommu-vdo # generation two - mediatek,mt8195-iommu-vpp # generation two + - mediatek,mt8195-iommu-infra # generation two - description: mt7623 generation one items: @@ -129,7 +130,6 @@ required: - compatible - reg - interrupts - - mediatek,larbs - '#iommu-cells' allOf: @@ -161,6 +161,18 @@ allOf: required: - power-domains + - if: + not: + properties: + compatible: + items: + enum: + - mediatek,mt8195-iommu-infra + + then: + required: + - mediatek,larbs + additionalProperties: false examples: diff --git a/include/dt-bindings/memory/mt8195-memory-port.h b/include/dt-bindings/memory/mt8195-memory-port.h index 783bcae8cdea..67afad848725 100644 --- a/include/dt-bindings/memory/mt8195-memory-port.h +++ b/include/dt-bindings/memory/mt8195-memory-port.h @@ -387,4 +387,22 @@ #define M4U_PORT_L28_CAM_DRZS4NO_R1 MTK_M4U_ID(28, 5) #define M4U_PORT_L28_CAM_TNCSO_R1 MTK_M4U_ID(28, 6) +/* infra iommu ports */ +/* PCIe1: read: BIT16; write BIT17. */ +#define M4U_PORT_INFRA_PCIE1 MTK_IFAIOMMU_PERI_ID(16) +/* PCIe0: read: BIT18; write BIT19. */ +#define M4U_PORT_INFRA_PCIE0 MTK_IFAIOMMU_PERI_ID(18) +#define M4U_PORT_INFRA_SSUSB_P3_R MTK_IFAIOMMU_PERI_ID(20) +#define M4U_PORT_INFRA_SSUSB_P3_W MTK_IFAIOMMU_PERI_ID(21) +#define M4U_PORT_INFRA_SSUSB_P2_R MTK_IFAIOMMU_PERI_ID(22) +#define M4U_PORT_INFRA_SSUSB_P2_W MTK_IFAIOMMU_PERI_ID(23) +#define M4U_PORT_INFRA_SSUSB_P1_1_R MTK_IFAIOMMU_PERI_ID(24) +#define M4U_PORT_INFRA_SSUSB_P1_1_W MTK_IFAIOMMU_PERI_ID(25) +#define M4U_PORT_INFRA_SSUSB_P1_0_R MTK_IFAIOMMU_PERI_ID(26) +#define M4U_PORT_INFRA_SSUSB_P1_0_W MTK_IFAIOMMU_PERI_ID(27) +#define M4U_PORT_INFRA_SSUSB2_R MTK_IFAIOMMU_PERI_ID(28) +#define M4U_PORT_INFRA_SSUSB2_W MTK_IFAIOMMU_PERI_ID(29) +#define M4U_PORT_INFRA_SSUSB_R MTK_IFAIOMMU_PERI_ID(30) +#define M4U_PORT_INFRA_SSUSB_W MTK_IFAIOMMU_PERI_ID(31) + #endif diff --git a/include/dt-bindings/memory/mtk-memory-port.h b/include/dt-bindings/memory/mtk-memory-port.h index 7d64103209af..2f68a0511a25 100644 --- a/include/dt-bindings/memory/mtk-memory-port.h +++ b/include/dt-bindings/memory/mtk-memory-port.h @@ -12,4 +12,6 @@ #define MTK_M4U_TO_LARB(id) (((id) >> 5) & 0x1f) #define MTK_M4U_TO_PORT(id) ((id) & 0x1f) +#define MTK_IFAIOMMU_PERI_ID(port) MTK_M4U_ID(0, port) + #endif -- 2.18.0