From nobody Sun Sep 22 01:55:03 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC4D1C433F5 for ; Wed, 18 May 2022 10:05:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234918AbiERKFU (ORCPT ); Wed, 18 May 2022 06:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234821AbiERKFO (ORCPT ); Wed, 18 May 2022 06:05:14 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FA566F482; Wed, 18 May 2022 03:05:13 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 61ED61F44E08 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652868312; bh=QldET8Tith6XpQTESLUFmBU4bL4nM1vDAby2xnsh/3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKHk/q8oiV3Jx3vURxCYvrr6N5xQTM4Rz6VneBa345wqTTsd7cyy706N9/c1Ef0LL Uo1pcr/J2bfK7IVi5S9JVpE/Nzf6FstsiVPOvRJl4MlMxGL3Ffaak2NLVO+DSIGoEY JuzIue3TVMTOZMsjQrkpI9Klyql3w06eO6Iz1ewjzOf5gReh2QeNyB+tIjoZ01uTu+ RdSzpYgDrgYJ08oMFOboynMNmbYDJas7zfM/stIogyptfG2a+ilzRJAhVi84l5a61K Od5YBOeDWxAzgYZvKUQs10U5B9x8RW2k5FderWzNRBuPsanB3Bl88sZmBErSkoRv4z TMN2KNghaK3dA== From: AngeloGioacchino Del Regno To: yong.wu@mediatek.com Cc: joro@8bytes.org, will@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno Subject: [PATCH v2 1/7] dt-bindings: iommu: mediatek: Add phandles for mediatek infra/pericfg Date: Wed, 18 May 2022 12:04:57 +0200 Message-Id: <20220518100503.37279-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> References: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add properties "mediatek,infracfg" and "mediatek,pericfg" to let the mtk_iommu driver retrieve phandles to the infracfg and pericfg syscon(s) instead of performing a per-soc compatible lookup. Signed-off-by: AngeloGioacchino Del Regno --- .../devicetree/bindings/iommu/mediatek,iommu.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml b/= Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml index 2ae3bbad7f1a..c4af41947593 100644 --- a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml +++ b/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml @@ -101,6 +101,10 @@ properties: items: - const: bclk =20 + mediatek,infracfg: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle to the mediatek infracfg syscon + mediatek,larbs: $ref: /schemas/types.yaml#/definitions/phandle-array minItems: 1 @@ -112,6 +116,10 @@ properties: Refer to bindings/memory-controllers/mediatek,smi-larb.yaml. It must= sort according to the local arbiter index, like larb0, larb1, larb2... =20 + mediatek,pericfg: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle to the mediatek pericfg syscon + '#iommu-cells': const: 1 description: | --=20 2.35.1 From nobody Sun Sep 22 01:55:03 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59332C433EF for ; Wed, 18 May 2022 10:05:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234956AbiERKFu (ORCPT ); Wed, 18 May 2022 06:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234907AbiERKFS (ORCPT ); Wed, 18 May 2022 06:05:18 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF2B6FD31; Wed, 18 May 2022 03:05:17 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 34E7B1F44E09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652868312; bh=A5k1VBFcKvGxrzqgH+3j6bGmcr4uqfHwo1Y08EGhiiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hxNE4pApZ8gh9Nj1TIILgEFkkMYNj8c5ZFBNhdR3LX1qK9xEJqpKrQlj6db7I6LE/ xqZGZOlzU3Usnq6zer2AUyTJ0/mNbdFSwaT3/3KxVzrx6Bgpr/4rtXQsawOtTctRwd TG/32fPPLILxUCMYM+SRCUhzpSO1O/+3Iaj1DHLkw6nJ4n5q3qe0gqGtDzTO8z9ZUB KTVgGh9tupltX8Vl0D3HlJZoTculsbCa0yxgSHoqPdBRlfdJsSOOgT9uxveF5vS/FD fHLEh9xGmPR2HWr2kJJQ3iF+IDYFSfyplWGf8nnHKtzK3f2sc8H3kUKcoTvUEkMII6 6rZry0GnZnZaw== From: AngeloGioacchino Del Regno To: yong.wu@mediatek.com Cc: joro@8bytes.org, will@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno Subject: [PATCH v2 2/7] iommu: mtk_iommu: Lookup phandle to retrieve syscon to infracfg Date: Wed, 18 May 2022 12:04:58 +0200 Message-Id: <20220518100503.37279-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> References: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This driver will get support for more SoCs and the list of infracfg compatibles is expected to grow: in order to prevent getting this situation out of control and see a long list of compatible strings, add support to retrieve a handle to infracfg's regmap through a new "mediatek,infracfg" phandle. In order to keep retrocompatibility with older devicetrees, the old way is kept in place, but also a dev_warn() was added to advertise this change in hope that the user will see it and eventually update the devicetree if this is possible. Signed-off-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 40 +++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 71b2ace74cd6..d16b95e71ded 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1134,22 +1134,34 @@ static int mtk_iommu_probe(struct platform_device *= pdev) data->protect_base =3D ALIGN(virt_to_phys(protect), MTK_PROTECT_PA_ALIGN); =20 if (MTK_IOMMU_HAS_FLAG(data->plat_data, HAS_4GB_MODE)) { - switch (data->plat_data->m4u_plat) { - case M4U_MT2712: - p =3D "mediatek,mt2712-infracfg"; - break; - case M4U_MT8173: - p =3D "mediatek,mt8173-infracfg"; - break; - default: - p =3D NULL; + infracfg =3D syscon_regmap_lookup_by_phandle(dev->of_node, "mediatek,inf= racfg"); + if (IS_ERR(infracfg)) { + dev_info(dev, "Cannot find phandle to mediatek,infracfg:" + " Please update your devicetree.\n"); + /* + * Legacy devicetrees will not specify a phandle to + * mediatek,infracfg: in that case, we use the older + * way to retrieve a syscon to infra. + * + * This is for retrocompatibility purposes only, hence + * no more compatibles shall be added to this. + */ + switch (data->plat_data->m4u_plat) { + case M4U_MT2712: + p =3D "mediatek,mt2712-infracfg"; + break; + case M4U_MT8173: + p =3D "mediatek,mt8173-infracfg"; + break; + default: + p =3D NULL; + } + + infracfg =3D syscon_regmap_lookup_by_compatible(p); + if (IS_ERR(infracfg)) + return PTR_ERR(infracfg); } =20 - infracfg =3D syscon_regmap_lookup_by_compatible(p); - - if (IS_ERR(infracfg)) - return PTR_ERR(infracfg); - ret =3D regmap_read(infracfg, REG_INFRA_MISC, &val); if (ret) return ret; --=20 2.35.1 From nobody Sun Sep 22 01:55:03 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E04EC4332F for ; Wed, 18 May 2022 10:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbiERKFa (ORCPT ); Wed, 18 May 2022 06:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234732AbiERKFQ (ORCPT ); Wed, 18 May 2022 06:05:16 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F247E6F4BB; Wed, 18 May 2022 03:05:14 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 083F11F44E0A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652868313; bh=jzNtgZkb9ZUDqbEgkSmucrQ5hqCWbZHhy8hNzMj2XCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RSm8VlR/wAkXXUyu0gDZ6NPI7QYwM97rHI7JWcFMigO3nQKyH9qCeDUgvPCamrn5x oG9DVcuX80Sl/fAiuJ/ohrcsUYzGxlvInw4de0rzfIySHPIxYKp+m1FxRmvFC+m4rc Ll4gO3qzCVgJO+51BZalQvAykzNrRmpdJd4E+2wX/SOoFpLzG32atEmW0MBGE53SyQ yNKpcvVncG+Lkcz4jHAeexkRmpnHQWRhqNnkgowBszwi1JGwmAqHhqPs4v/szydqbg XRLIBlxUnNLWPn1PtSb+tEo7gHwNTu0qFLJtcCOukae2vIzpiS4UGFIE2g3q9ZbNzr FZNKueUpDMBtA== From: AngeloGioacchino Del Regno To: yong.wu@mediatek.com Cc: joro@8bytes.org, will@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno Subject: [PATCH v2 3/7] iommu: mtk_iommu: Lookup phandle to retrieve syscon to pericfg Date: Wed, 18 May 2022 12:04:59 +0200 Message-Id: <20220518100503.37279-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> References: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On some SoCs (of which only MT8195 is supported at the time of writing), the "R" and "W" (I/O) enable bits for the IOMMUs are in the pericfg_ao register space and not in the IOMMU space: as it happened already with infracfg, it is expected that this list will grow. Instead of specifying pericfg compatibles on a per-SoC basis, following what was done with infracfg, let's lookup the syscon by phandle instead. Also following the previous infracfg change, add a warning for outdated devicetrees, in hope that the user will take action. Signed-off-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d16b95e71ded..090cf6e15f85 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -138,6 +138,8 @@ /* PM and clock always on. e.g. infra iommu */ #define PM_CLK_AO BIT(15) #define IFA_IOMMU_PCIE_SUPPORT BIT(16) +/* IOMMU I/O (r/w) is enabled using PERICFG_IOMMU_1 register */ +#define HAS_PERI_IOMMU1_REG BIT(17) =20 #define MTK_IOMMU_HAS_FLAG_MASK(pdata, _x, mask) \ ((((pdata)->flags) & (mask)) =3D=3D (_x)) @@ -187,7 +189,6 @@ struct mtk_iommu_plat_data { u32 flags; u32 inv_sel_reg; =20 - char *pericfg_comp_str; struct list_head *hw_list; unsigned int iova_region_nr; const struct mtk_iommu_iova_region *iova_region; @@ -1214,14 +1215,19 @@ static int mtk_iommu_probe(struct platform_device *= pdev) goto out_runtime_disable; } } else if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_INFRA) && - data->plat_data->pericfg_comp_str) { - infracfg =3D syscon_regmap_lookup_by_compatible(data->plat_data->pericfg= _comp_str); - if (IS_ERR(infracfg)) { - ret =3D PTR_ERR(infracfg); - goto out_runtime_disable; - } + MTK_IOMMU_HAS_FLAG(data->plat_data, HAS_PERI_IOMMU1_REG)) { + data->pericfg =3D syscon_regmap_lookup_by_phandle(dev->of_node, "mediate= k,pericfg"); + if (IS_ERR(data->pericfg)) { + dev_info(dev, "Cannot find phandle to mediatek,pericfg:" + " Please update your devicetree.\n"); =20 - data->pericfg =3D infracfg; + p =3D "mediatek,mt8195-pericfg_ao"; + data->pericfg =3D syscon_regmap_lookup_by_compatible(p); + if (IS_ERR(data->pericfg)) { + ret =3D PTR_ERR(data->pericfg); + goto out_runtime_disable; + } + } } =20 platform_set_drvdata(pdev, data); @@ -1480,8 +1486,8 @@ static const struct mtk_iommu_plat_data mt8192_data = =3D { static const struct mtk_iommu_plat_data mt8195_data_infra =3D { .m4u_plat =3D M4U_MT8195, .flags =3D WR_THROT_EN | DCM_DISABLE | STD_AXI_MODE | PM_CLK_A= O | - MTK_IOMMU_TYPE_INFRA | IFA_IOMMU_PCIE_SUPPORT, - .pericfg_comp_str =3D "mediatek,mt8195-pericfg_ao", + HAS_PERI_IOMMU1_REG | MTK_IOMMU_TYPE_INFRA | + IFA_IOMMU_PCIE_SUPPORT, .inv_sel_reg =3D REG_MMU_INV_SEL_GEN2, .banks_num =3D 5, .banks_enable =3D {true, false, false, false, true}, --=20 2.35.1 From nobody Sun Sep 22 01:55:03 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1728CC433EF for ; Wed, 18 May 2022 10:05:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234904AbiERKFZ (ORCPT ); Wed, 18 May 2022 06:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234879AbiERKFR (ORCPT ); Wed, 18 May 2022 06:05:17 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB84A6FA2E; Wed, 18 May 2022 03:05:15 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id D048F1F44E0B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652868314; bh=+xTyEZ131wWMOMNxSY33aVPVZoxl3tqtIBcQv4cQtYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1vp+/AwIas/9dOAytAhqaGYFF/9ac9nRiYcMReBB49LkaAcP31lRYdpULf1VS1SF cEjTybeVHaZFAHgwxqh11jciQsrb28ENTeg8dN5Q/7YFOCncRGirCbQGQpDMVg1q0M HUZQZcn6afPA0ez9BITloBRac7pIwBiFAEo02wOsBn+jVRBFzUEeMpFoqM9pCp2llZ osCTplyIdDD0KUAgaGhqpaRNs4n20bmze5pCBC9YDjnGHNsheMqmDzOa3UvAmA6V24 uGMk40rfjHouEFuxGi0ku4uD2F9dygsDLroKK1o6+NPYQxLNQEjvW0dzA4VGw6f0wZ +8Gj0vRtIV0Yw== From: AngeloGioacchino Del Regno To: yong.wu@mediatek.com Cc: joro@8bytes.org, will@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno Subject: [PATCH v2 4/7] arm64: dts: mediatek: mt8173: Add mediatek,infracfg phandle for IOMMU Date: Wed, 18 May 2022 12:05:00 +0200 Message-Id: <20220518100503.37279-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> References: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The IOMMU driver now looks for the "mediatek,infracfg" phandle as a new way to retrieve a syscon to that: even though the old way is retained, it has been deprecated and the driver will write a message in kmsg advertising to use the phandle way instead. For this reason, assign the right phandle to mediatek,infracfg in the iommu node. Signed-off-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts= /mediatek/mt8173.dtsi index 40d7b47fc52e..825a3c670373 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi @@ -588,6 +588,7 @@ iommu: iommu@10205000 { interrupts =3D ; clocks =3D <&infracfg CLK_INFRA_M4U>; clock-names =3D "bclk"; + mediatek,infracfg =3D <&infracfg>; mediatek,larbs =3D <&larb0>, <&larb1>, <&larb2>, <&larb3>, <&larb4>, <&larb5>; #iommu-cells =3D <1>; --=20 2.35.1 From nobody Sun Sep 22 01:55:03 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 138A2C433FE for ; Wed, 18 May 2022 10:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234961AbiERKFp (ORCPT ); Wed, 18 May 2022 06:05:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234905AbiERKFS (ORCPT ); Wed, 18 May 2022 06:05:18 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 665B06FD1E; Wed, 18 May 2022 03:05:16 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id A22551F44E0C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652868315; bh=CgNYAOaieQLCVcum8jYWv0FFa/H0G4zrGj0sGsj1tXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lw4BXx+IXXpqyGnKTcZJ+TzvAy2GKcWKGRMwM8M2YBgjEbsWaAOg4nJ9XTSvoLQFA 86oNbpCfeOTV63tQBrWVgimKhCAoTxh3KCT0ag+K0S8XrIwTV8gpvp1sFjuHlTdU9J LuRN81wM2gzOhkGwOiRMIQip2x3PUN2wQOUldy1dUJEIB7dUCYGGp4nu/T8RU2Xsc+ 2nQSu8PxGF5c1Qw+hQao48aTBDNpH1z/7nh92whr0Y9M6aloXma0tO9zs+B+ZvYtp2 D0GHZaKblsArfMPWeacJF630dsruE4SOeqTh2DaPklTyQBvcGAK7JDQD806SciPc2+ 0Vto/RgYVJiHg== From: AngeloGioacchino Del Regno To: yong.wu@mediatek.com Cc: joro@8bytes.org, will@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno Subject: [PATCH v2 5/7] arm64: dts: mediatek: mt2712e: Add mediatek,infracfg phandle for IOMMU Date: Wed, 18 May 2022 12:05:01 +0200 Message-Id: <20220518100503.37279-6-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> References: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The IOMMU driver now looks for the "mediatek,infracfg" phandle as a new way to retrieve a syscon to that: even though the old way is retained, it has been deprecated and the driver will write a message in kmsg advertising to use the phandle way instead. For this reason, assign the right phandle to mediatek,infracfg in the iommu node. Signed-off-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi b/arch/arm64/boot/dt= s/mediatek/mt2712e.dtsi index 623eb3beabf2..4797537cb368 100644 --- a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi @@ -329,6 +329,7 @@ iommu0: iommu@10205000 { interrupts =3D ; clocks =3D <&infracfg CLK_INFRA_M4U>; clock-names =3D "bclk"; + mediatek,infracfg =3D <&infracfg>; mediatek,larbs =3D <&larb0>, <&larb1>, <&larb2>, <&larb3>, <&larb6>; #iommu-cells =3D <1>; @@ -346,6 +347,7 @@ iommu1: iommu@1020a000 { interrupts =3D ; clocks =3D <&infracfg CLK_INFRA_M4U>; clock-names =3D "bclk"; + mediatek,infracfg =3D <&infracfg>; mediatek,larbs =3D <&larb4>, <&larb5>, <&larb7>; #iommu-cells =3D <1>; }; --=20 2.35.1 From nobody Sun Sep 22 01:55:03 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E304BC433F5 for ; Wed, 18 May 2022 10:05:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234943AbiERKFg (ORCPT ); Wed, 18 May 2022 06:05:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234910AbiERKFS (ORCPT ); Wed, 18 May 2022 06:05:18 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53B216F4BB; Wed, 18 May 2022 03:05:17 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 73E8D1F44E0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652868316; bh=xqId+HG46WeS4vw+PN9qoFt/EVggOMa2jWD4Kmnw1DA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcH2GTIWkCcwoJU3BLHr5f1qUd7wqGQkjJekXU6U9Z4nAbjLOKs/wV5uP2lzrWZ6T OR2k6euZ8hcdFlYR59HkJ9iRL8NjE0ED2ht9+ZqSen4bmw0kgmQXIfUa9RFvk+ucxo sA2oIVPaJd18oEVgvQrvkLC145fNbL734lDh+MSlb+4R7aiMIoDfz9EZGkoXB0v9Dt c0PPEFRq6NcjoTJIRscHV2yuJ7f4uLHw5n6omifVwt2rVo0RpiXsE2FCeO9w8vilJ/ b4Zt5gX7hJ+qtHOCCQ/irB01cBBt1rIQxfBlEmRqp5pOHoIPMAGtLoe+mKVGlm4nhD Y2usH/93JX1Jg== From: AngeloGioacchino Del Regno To: yong.wu@mediatek.com Cc: joro@8bytes.org, will@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno , Rob Herring Subject: [PATCH v2 6/7] dt-bindings: iommu: mediatek: Require mediatek,infracfg for mt2712/8173 Date: Wed, 18 May 2022 12:05:02 +0200 Message-Id: <20220518100503.37279-7-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> References: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Both MT2712 and MT8173 got a mediatek,infracfg phandle: add that to the required properties for these SoCs to deprecate the old way of looking for SoC-specific infracfg compatible in the entire devicetree. Signed-off-by: AngeloGioacchino Del Regno Acked-by: Rob Herring --- .../devicetree/bindings/iommu/mediatek,iommu.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml b/= Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml index c4af41947593..acc2d7e63a9f 100644 --- a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml +++ b/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml @@ -175,6 +175,18 @@ allOf: required: - power-domains =20 + - if: + properties: + compatible: + contains: + enum: + - mediatek,mt2712-m4u + - mediatek,mt8173-m4u + + then: + required: + - mediatek,infracfg + - if: # The IOMMUs don't have larbs. not: properties: --=20 2.35.1 From nobody Sun Sep 22 01:55:03 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0367EC433EF for ; Wed, 18 May 2022 10:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234963AbiERKFz (ORCPT ); Wed, 18 May 2022 06:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234916AbiERKFT (ORCPT ); Wed, 18 May 2022 06:05:19 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 632E9703CE; Wed, 18 May 2022 03:05:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 541381F44E0E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652868317; bh=4U43Hk0oR+7PqSrme9R8NUK5uKhAJqw2cEX5plkCcas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oISrE18fc4v2OSj7weSR5GM4xjVru/lLSV6xAoSfBKZ5F6BfOIJuhtbEZ2K5P3phv YPkg54ufDLgpHUk+spVlQnoW0QNyQMmx3o5tfIhl7sPjLxuUMjirt+6DTD2vfj897L CjE/1xubPJ7W9f3tD4d9BknMRlYxde+xPH2bPhQLgCRFqpXIzAA39HOra8AyMGePfp 6Hx6MKCgWuCaFwsnBBw7WviOisT1smTGVGrmjWOKjv1Cb71nnS/MkYrpmYbJxicHjv FzXp9VlkKFH53Sdv3qRCOMqCcmGvV8ycijBhi38tfiilDVwTRMltr7qPuXT9FAbMR8 Rxi/DboN31xQQ== From: AngeloGioacchino Del Regno To: yong.wu@mediatek.com Cc: joro@8bytes.org, will@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno , Rob Herring Subject: [PATCH v2 7/7] dt-bindings: iommu: mediatek: Require mediatek,pericfg for mt8195-infra Date: Wed, 18 May 2022 12:05:03 +0200 Message-Id: <20220518100503.37279-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> References: <20220518100503.37279-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The MT8195 SoC has IOMMU related registers in the pericfg_ao iospace: require a phandle to that. Signed-off-by: AngeloGioacchino Del Regno Acked-by: Rob Herring --- .../devicetree/bindings/iommu/mediatek,iommu.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml b/= Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml index acc2d7e63a9f..d5e3272a54e8 100644 --- a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml +++ b/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml @@ -187,6 +187,16 @@ allOf: required: - mediatek,infracfg =20 + - if: + properties: + compatible: + contains: + const: mediatek,mt8195-iommu-infra + + then: + required: + - mediatek,pericfg + - if: # The IOMMUs don't have larbs. not: properties: --=20 2.35.1