From mboxrd@z Thu Jan 1 00:00:00 1970 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 03C37C433EF for ; Thu, 28 Apr 2022 05:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243075AbiD1Fhk (ORCPT ); Thu, 28 Apr 2022 01:37:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbiD1Fhj (ORCPT ); Thu, 28 Apr 2022 01:37:39 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5457656753; Wed, 27 Apr 2022 22:34:26 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id k27so4234555edk.4; Wed, 27 Apr 2022 22:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XBSM19WHQrA/ZYWGbJg75BNh3CcfAodaxAUNqq255NU=; b=plM7dwWhPQ3jZth62O5SXqLdvRYEn6LJLnS3SMhG1knXt6I4K6PCNUPn/2U4RXzJEK /SaMHSqP+YKIfABjIGivVyyZqTVUJ0c+qgHonmvt6ey8B8Hvj+bvxKjmMtfLkykMPVI4 QJabxuuaZskVSwthx9T7QEIarzSu46DwLY+0vv1lX1vjswWCp1yXwdkOx4uolexbFo1e 9O5L4mZsrRsUgiqouHlw41R0nlcJAzcMcnW6G2vz52BWuKlLhZziycMXmWIWYFpH27QB 59cU6+Oaz2XenKYd3FdRR4kzqchxMpCk/8r7eqvEGZx6OYWPnQxXX7oxHXmI6K8uWSFs o3Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XBSM19WHQrA/ZYWGbJg75BNh3CcfAodaxAUNqq255NU=; b=rH2vVckBsdCDxJ4sXni9/E2OQtt47laUHiZPtzKE+SUMq7S0UN0cHv6GAqqcbMoJ8D 1E/xAzjju4oX36taMjYfULteuSNGzy1gQMwCWksE8zF7f1HVxoQ9lZBmVl/sFiz95Zth 6fQnGJp2iGK5X/i7w5jA0xO35BbYU+xqhCaSLr3iV5oIvJVIsavQCO3g2M01xaHmt3FS uqWQ1HbrSkeou4O9iNH4UdhwPUCJ05PJeH3cGs2Q863lsooBR2Zn9iA0iXiyLYQxtY14 lzMLqFRJP48jIQnI31fgOaLcH92ua0xHGdMHbs+9azuxDe9STEAV9zqXVj4C1h+lJUYb U7SQ== X-Gm-Message-State: AOAM532aBEg6PZBGRxiabV0Jb2Y0imA/wijSc4zCAWm050sFu95PJa8j GDQkprmYZ48fcF03CatG5DU= X-Google-Smtp-Source: ABdhPJxuFhdJ38I6OmBPpApX2mQq7HJRP4HXdI9BJ7CWtg4F08MfhnU+6wRqgvj5ZOzfkTlg3smYQw== X-Received: by 2002:a50:e696:0:b0:419:998d:5feb with SMTP id z22-20020a50e696000000b00419998d5febmr34607475edm.122.1651124064815; Wed, 27 Apr 2022 22:34:24 -0700 (PDT) Received: from jernej-laptop.localnet (89-212-118-115.static.t-2.net. [89.212.118.115]) by smtp.gmail.com with ESMTPSA id j27-20020a170906255b00b006f379c4323bsm6303285ejb.60.2022.04.27.22.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 22:34:24 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Joerg Roedel , Will Deacon , iommu@lists.linux-foundation.org, Samuel Holland Cc: Heiko Stuebner , Palmer Dabbelt , linux-riscv@lists.infradead.org, Samuel Holland , Chen-Yu Tsai , Krzysztof Kozlowski , Maxime Ripard , Philipp Zabel , Rob Herring , 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 Message-ID: <2857429.VdNmn5OnKV@jernej-laptop> In-Reply-To: <20220428010401.11323-3-samuel@sholland.org> References: <20220428010401.11323-1-samuel@sholland.org> <20220428010401.11323-3-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Dne =C4=8Detrtek, 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. >=20 > 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. >=20 > Signed-off-by: Samuel Holland Reviewed-by: Jernej Skrabec Best regards, Jernej > --- >=20 > drivers/iommu/sun50i-iommu.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) >=20 > 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 *=20 PT_ENTRY_SIZE) >=20 > +struct sun50i_iommu_variant { > + bool has_reset; > +}; > + > struct sun50i_iommu { > struct iommu_device iommu; >=20 > @@ -905,9 +909,14 @@ static irqreturn_t sun50i_iommu_irq(int irq, void > *dev_id) >=20 > static int sun50i_iommu_probe(struct platform_device *pdev) > { > + const struct sun50i_iommu_variant *variant; > struct sun50i_iommu *iommu; > int ret, irq; >=20 > + variant =3D of_device_get_match_data(&pdev->dev); > + if (!variant) > + return -EINVAL; > + > iommu =3D 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; > } >=20 > - iommu->reset =3D devm_reset_control_get(&pdev->dev, NULL); > + if (variant->has_reset) > + iommu->reset =3D 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 =3D PTR_ERR(iommu->reset); > @@ -987,8 +997,12 @@ static int sun50i_iommu_probe(struct platform_device > *pdev) return ret; > } >=20 > +static const struct sun50i_iommu_variant sun50i_h6_iommu =3D { > + .has_reset =3D true, > +}; > + > static const struct of_device_id sun50i_iommu_dt[] =3D { > - { .compatible =3D "allwinner,sun50i-h6-iommu", }, > + { .compatible =3D "allwinner,sun50i-h6-iommu", .data =3D=20 &sun50i_h6_iommu }, > { /* sentinel */ }, > }; > MODULE_DEVICE_TABLE(of, sun50i_iommu_dt);