From: "Jernej Škrabec" <jernej.skrabec@gmail.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
iommu@lists.linux-foundation.org,
Samuel Holland <samuel@sholland.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org,
Samuel Holland <samuel@sholland.org>,
Chen-Yu Tsai <wens@csie.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Maxime Ripard <mripard@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 2/5] iommu/sun50i: Support variants without an external reset
Date: Thu, 28 Apr 2022 07:34:22 +0200 [thread overview]
Message-ID: <2857429.VdNmn5OnKV@jernej-laptop> (raw)
In-Reply-To: <20220428010401.11323-3-samuel@sholland.org>
Dne četrtek, 28. april 2022 ob 03:03:57 CEST je Samuel Holland napisal(a):
> The IOMMU in the Allwinner D1 SoC does not have an external reset line.
>
> Only attempt to get the reset on hardware variants which should have one
> according to the binding. And switch from the deprecated function to the
> explicit "exclusive" variant.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
>
> drivers/iommu/sun50i-iommu.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
> index c54ab477b8fd..ec07b60016d3 100644
> --- a/drivers/iommu/sun50i-iommu.c
> +++ b/drivers/iommu/sun50i-iommu.c
> @@ -92,6 +92,10 @@
> #define NUM_PT_ENTRIES 256
> #define PT_SIZE (NUM_PT_ENTRIES *
PT_ENTRY_SIZE)
>
> +struct sun50i_iommu_variant {
> + bool has_reset;
> +};
> +
> struct sun50i_iommu {
> struct iommu_device iommu;
>
> @@ -905,9 +909,14 @@ static irqreturn_t sun50i_iommu_irq(int irq, void
> *dev_id)
>
> static int sun50i_iommu_probe(struct platform_device *pdev)
> {
> + const struct sun50i_iommu_variant *variant;
> struct sun50i_iommu *iommu;
> int ret, irq;
>
> + variant = of_device_get_match_data(&pdev->dev);
> + if (!variant)
> + return -EINVAL;
> +
> iommu = devm_kzalloc(&pdev->dev, sizeof(*iommu), GFP_KERNEL);
> if (!iommu)
> return -ENOMEM;
> @@ -947,7 +956,8 @@ static int sun50i_iommu_probe(struct platform_device
> *pdev) goto err_free_group;
> }
>
> - iommu->reset = devm_reset_control_get(&pdev->dev, NULL);
> + if (variant->has_reset)
> + iommu->reset = devm_reset_control_get_exclusive(&pdev-
>dev, NULL);
> if (IS_ERR(iommu->reset)) {
> dev_err(&pdev->dev, "Couldn't get our reset line.\n");
> ret = PTR_ERR(iommu->reset);
> @@ -987,8 +997,12 @@ static int sun50i_iommu_probe(struct platform_device
> *pdev) return ret;
> }
>
> +static const struct sun50i_iommu_variant sun50i_h6_iommu = {
> + .has_reset = true,
> +};
> +
> static const struct of_device_id sun50i_iommu_dt[] = {
> - { .compatible = "allwinner,sun50i-h6-iommu", },
> + { .compatible = "allwinner,sun50i-h6-iommu", .data =
&sun50i_h6_iommu },
> { /* sentinel */ },
> };
> MODULE_DEVICE_TABLE(of, sun50i_iommu_dt);
next prev parent reply other threads:[~2022-04-28 5:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 1:03 [PATCH 0/5] iommu/sun50i: Allwinner D1 support Samuel Holland
2022-04-28 1:03 ` [PATCH 1/5] dt-bindings: iommu: sun50i: Add compatible for Allwinner D1 Samuel Holland
2022-04-28 7:19 ` Krzysztof Kozlowski
2022-04-28 1:03 ` [PATCH 2/5] iommu/sun50i: Support variants without an external reset Samuel Holland
2022-04-28 5:34 ` Jernej Škrabec [this message]
2022-04-28 7:43 ` Philipp Zabel
2022-04-28 1:03 ` [PATCH 3/5] iommu/sun50i: Ensure bypass is disabled Samuel Holland
2022-04-28 5:43 ` Jernej Škrabec
2022-04-28 1:03 ` [PATCH 4/5] iommu/sun50i: Add support for the D1 variant Samuel Holland
2022-04-28 5:34 ` Jernej Škrabec
2022-04-28 1:04 ` [PATCH 5/5] iommu/sun50i: Ensure the IOMMU can be used for DMA Samuel Holland
2022-04-28 5:35 ` Jernej Škrabec
2022-04-28 11:12 ` Robin Murphy
2022-04-28 5:45 ` [PATCH 0/5] iommu/sun50i: Allwinner D1 support Jernej Škrabec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2857429.VdNmn5OnKV@jernej-laptop \
--to=jernej.skrabec@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=robh+dt@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox