From nobody Sat Sep 21 23:37:02 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 2AE1EC43334 for ; Thu, 16 Jun 2022 11:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376703AbiFPLI6 (ORCPT ); Thu, 16 Jun 2022 07:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376706AbiFPLIo (ORCPT ); Thu, 16 Jun 2022 07:08:44 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81C615E149; Thu, 16 Jun 2022 04:08:41 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 47FA5660174C; Thu, 16 Jun 2022 12:08:39 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655377720; bh=JcxQv5eisp72VR6ziotoygEYFijE1my8ajQHmQfSnPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mrjA6BFXLCa8xCLLpLd9AqjCPd6qOqYEKdO+mTDGdMfaHWX5mg16VaFTdEIEsSTH1 vwvoVikh7KrO4nZFSt/XyXab153cG31FWduHrHgwa30Ndn1G+DrXWM4iorI2dwMhP8 UeoPt6PCCmp3iiE1U51ypgOJoQCti9a+JF7PFXajrUgFI8SDGwRgkEefWrkOFqVAu7 QNu57zAjyf2b2g8bwpJ25r//++44tOWt3rIVDdqyE7wx1K0LLHB4+z4FVT1YZ9eoqU 5qrKykUIQG4Ro/3s0IQv19xqjL2DjV5ItBZ6r9zgP4y4G5i6OqwnqaN951bnTWXvBU BPqXbOJvvbviQ== 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, miles.chen@mediatek.com, AngeloGioacchino Del Regno Subject: [PATCH v4 1/5] dt-bindings: iommu: mediatek: Add mediatek,infracfg phandle Date: Thu, 16 Jun 2022 13:08:26 +0200 Message-Id: <20220616110830.26037-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220616110830.26037-1-angelogioacchino.delregno@collabora.com> References: <20220616110830.26037-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 property "mediatek,infracfg" to let the mtk_iommu driver retrieve a phandle to the infracfg syscon instead of performing a per-soc compatible lookup in the entire devicetree and set it as a required property for MT2712 and MT8173. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Matthias Brugger --- .../bindings/iommu/mediatek,iommu.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml b/= Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml index 2ae3bbad7f1a..fee0241b5098 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 @@ -167,6 +171,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: @@ -191,6 +207,7 @@ examples: 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 Sat Sep 21 23:37:02 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 CF070C433EF for ; Thu, 16 Jun 2022 11:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376721AbiFPLIt (ORCPT ); Thu, 16 Jun 2022 07:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376694AbiFPLIm (ORCPT ); Thu, 16 Jun 2022 07:08:42 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E375E154; Thu, 16 Jun 2022 04:08:42 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 2A82A660174D; Thu, 16 Jun 2022 12:08:40 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655377720; bh=94gH2gUEYPX6/Noy/gMRuNjFYY6o39PnCyXJBIau2C8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eygmmvWy1Vbyms9Do7ARLYP4hY6Tznk5iZvIhrwkcz2/4XEnK2WoSvB5ft4IE8bez YKIcumRX4GtNrOg27pQL1KbTsAMmwW0Mc1n1ypAgbhcVRP7cl3skjtxzbV4jfHL3pe phab5z2a6d24IDfGybinrBO5kZh5cghqvkIxiimpvCn0cQ8RTt/gRyf3JWFc6xRAWr MZfRn7uNP+iBtK4GGHGztrBmv8IAqv1JILTs9ZJgti/4zhH7HTUvQ5JfhVukIF4UYq CjQBnXvvvLPkOTTNvnDUA0wiCJ5o15FhrqSIggMBnt0UBmfvW8Tf/QOZIWTXjE2uEZ dURz+RCT8uItw== 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, miles.chen@mediatek.com, AngeloGioacchino Del Regno Subject: [PATCH v4 2/5] iommu/mediatek: Lookup phandle to retrieve syscon to infracfg Date: Thu, 16 Jun 2022 13:08:27 +0200 Message-Id: <20220616110830.26037-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220616110830.26037-1-angelogioacchino.delregno@collabora.com> References: <20220616110830.26037-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. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Miles Chen Reviewed-by: Yong Wu Reviewed-by: Matthias Brugger --- drivers/iommu/mtk_iommu.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index bb9dd92c9898..90685946fcbe 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1140,22 +1140,32 @@ 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)) { + /* + * 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 Sat Sep 21 23:37:02 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 2171DC433EF for ; Thu, 16 Jun 2022 11:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376656AbiFPLI5 (ORCPT ); Thu, 16 Jun 2022 07:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376703AbiFPLIo (ORCPT ); Thu, 16 Jun 2022 07:08:44 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD6AD5E14F; Thu, 16 Jun 2022 04:08:42 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 08A03660174E; Thu, 16 Jun 2022 12:08:40 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655377721; bh=ExJFlSnUtgqqgVmFJCi6/ptIBr5RYYqDfWGyXotjCbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RXEjEtpHAuMBQKe5gfWQGtmSNlD6gU+b7hdIry9297HGhwn5YooUHBG2yRCZdmtvN KVrP4gC4T2jCpizYjXwJRp9DXL34TmHawMEuQuZYswoBW9ktKj0mfu+Mp+edlj24XP jMOb/PvQaX3MlY68P8FJAvonkKtJZrrDlil51vFOSkNibTcYJb/Cs+nftAdkt3GJuL f4Rvky/KQG6q/AXlKsPGGfjSu60jclmAD9leX/e2bCvB+10okof/toZY6gy1czucgN 511nYB1ZxTW/fScUgQJCvjr31IeKxLHzvEXGS7iinMv2usS4i5qlydxGH07SD32CQ4 TXfMr1sDckAQQ== 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, miles.chen@mediatek.com, AngeloGioacchino Del Regno Subject: [PATCH v4 3/5] arm64: dts: mediatek: mt8173: Add mediatek,infracfg phandle for IOMMU Date: Thu, 16 Jun 2022 13:08:28 +0200 Message-Id: <20220616110830.26037-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220616110830.26037-1-angelogioacchino.delregno@collabora.com> References: <20220616110830.26037-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 Reviewed-by: Miles Chen --- 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 e14b6e68c4df..b6f65c688f02 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi @@ -581,6 +581,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 Sat Sep 21 23:37:02 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 B8481CCA47A for ; Thu, 16 Jun 2022 11:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbiFPLIx (ORCPT ); Thu, 16 Jun 2022 07:08:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376707AbiFPLIo (ORCPT ); Thu, 16 Jun 2022 07:08:44 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C02C75E154; Thu, 16 Jun 2022 04:08:43 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id DB10C6601755; Thu, 16 Jun 2022 12:08:41 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655377722; bh=bxI13qYR6i+Qbu3k0FjubHCH9lucInKe+lBf6R85H4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SU7bp+YuqjQvSEWyPZ80x4Ek4Eb2q/aHXqf5vRtCA1X8e7bqnvd0aaNVjf3eYR6D/ b22pDjD7cpHquZu/ko2QgcHmr8y+jLM98NKj973KxJg8mCbgwcxdF0cgo+szu6eseV e+RziHxVQaZ8Ds8Ja1WH1wijmVTf/43nMGwtGlxKeq4xYWW7yAE6/8LQ864y8xj1Hc FFZFdirB4hUmB3T/ztjUrFL6MaXMImQBul7ohbKRiScy8hvrwZuFSodpNjQQdhMzTO CZJQ5cnK+sX1WnhHMdXvSP/rEsPn6XScmlammVvFedur2hX9OsDXKrAOnh4qaawl++ IoYi7THqnsQLg== 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, miles.chen@mediatek.com, AngeloGioacchino Del Regno Subject: [PATCH v4 4/5] arm64: dts: mediatek: mt2712e: Add mediatek,infracfg phandle for IOMMU Date: Thu, 16 Jun 2022 13:08:29 +0200 Message-Id: <20220616110830.26037-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220616110830.26037-1-angelogioacchino.delregno@collabora.com> References: <20220616110830.26037-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 Reviewed-by: Miles Chen --- 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 Sat Sep 21 23:37:02 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 138AAC43334 for ; Thu, 16 Jun 2022 11:09:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376736AbiFPLJB (ORCPT ); Thu, 16 Jun 2022 07:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376717AbiFPLIp (ORCPT ); Thu, 16 Jun 2022 07:08:45 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B065E159; Thu, 16 Jun 2022 04:08:44 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id BB0C66601756; Thu, 16 Jun 2022 12:08:42 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655377723; bh=Ym8V4C7cqusZmnKUp44mYzfUNnjhU5hnhfnX8Zm9pqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NmtPN0WvcM9Ve1t1pov1LUxFbiFgFsHXn7r1U0/dBzpD2ev+nNt/AsBREsxoLTnvg 1MXrkjTKKJ2o3BdglJrC/B/r0wtT7q/Bd1JOTv4SG0kt9axG22fWfGU61cHQUDFq8G sGjjCszu4KJdE/J7JzQ5U7AP45Msq8+2TkLltrtmxCq2CPMnRIMMDCGxZZhvAIbgFL wusIWrO6ZpaBFJOSF6Du39eqV3BaWwFAPhGtE3zlRKZHppx0Qy2rh6BvZ+aXB+DvyO 0NXS43OHcFjvEcxekxmHDZwzuA/EpVcnhbEyBSPSDcEnjVvkMn9TpG8mtQelh9vn0T svphRSs2SqIIg== 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, miles.chen@mediatek.com, AngeloGioacchino Del Regno Subject: [PATCH v4 5/5] iommu/mediatek: Cleanup pericfg lookup flow Date: Thu, 16 Jun 2022 13:08:30 +0200 Message-Id: <20220616110830.26037-6-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220616110830.26037-1-angelogioacchino.delregno@collabora.com> References: <20220616110830.26037-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" Since only the INFRA type IOMMU needs to modify register(s) in the pericfg iospace, it's safe to drop the pericfg_comp_str NULL check; also, directly assign the regmap handle to data->pericfg instead of to the infracfg variable to improve code readability. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Matthias Brugger --- drivers/iommu/mtk_iommu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 90685946fcbe..b2ae84046249 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -1217,15 +1217,13 @@ static int mtk_iommu_probe(struct platform_device *= pdev) dev_err(dev, "mm dts parse fail(%d).", ret); 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); + } else if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_INFRA)) { + p =3D data->plat_data->pericfg_comp_str; + data->pericfg =3D syscon_regmap_lookup_by_compatible(p); + if (IS_ERR(data->pericfg)) { + ret =3D PTR_ERR(data->pericfg); goto out_runtime_disable; } - - data->pericfg =3D infracfg; } =20 platform_set_drvdata(pdev, data); --=20 2.35.1