From: Philipp Zabel <p.zabel@pengutronix.de>
To: Andrew Jeffery <andrew@aj.id.au>,
Dylan Hung <dylan_hung@aspeedtech.com>,
Rob Herring <robh+dt@kernel.org>, Joel Stanley <joel@jms.id.au>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
pabeni@redhat.com, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org,
netdev <netdev@vger.kernel.org>
Cc: BMC-SW@aspeedtech.com
Subject: Re: [PATCH RESEND v3 2/3] net: mdio: add reset control for Aspeed MDIO
Date: Mon, 11 Apr 2022 11:19:39 +0200 [thread overview]
Message-ID: <8470f6029703a29bd7c384f489da0c7936c44cc7.camel@pengutronix.de> (raw)
In-Reply-To: <667280e7-526d-4002-9dff-389f6b35ac2f@www.fastmail.com>
On Mo, 2022-04-11 at 09:50 +0930, Andrew Jeffery wrote:
>
> On Thu, 7 Apr 2022, at 17:27, Dylan Hung wrote:
> > Add reset assertion/deassertion for Aspeed MDIO. There are 4 MDIO
> > controllers embedded in Aspeed AST2600 SOC and share one reset control
> > register SCU50[3]. To work with old DT blobs which don't have the reset
> > property, devm_reset_control_get_optional_shared is used in this change.
> >
> > Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
> > Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
> > ---
> > drivers/net/mdio/mdio-aspeed.c | 15 ++++++++++++++-
> > 1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c
> > index e2273588c75b..1afb58ccc524 100644
> > --- a/drivers/net/mdio/mdio-aspeed.c
> > +++ b/drivers/net/mdio/mdio-aspeed.c
> > @@ -3,6 +3,7 @@
> >
> > #include <linux/bitfield.h>
> > #include <linux/delay.h>
> > +#include <linux/reset.h>
> > #include <linux/iopoll.h>
> > #include <linux/mdio.h>
> > #include <linux/module.h>
> > @@ -37,6 +38,7 @@
> >
> > struct aspeed_mdio {
> > void __iomem *base;
> > + struct reset_control *reset;
> > };
> >
> > static int aspeed_mdio_read(struct mii_bus *bus, int addr, int regnum)
> > @@ -120,6 +122,12 @@ static int aspeed_mdio_probe(struct platform_device *pdev)
> > if (IS_ERR(ctx->base))
> > return PTR_ERR(ctx->base);
> >
> > + ctx->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
> > + if (IS_ERR(ctx->reset))
> > + return PTR_ERR(ctx->reset);
> > +
> > + reset_control_deassert(ctx->reset);
> > +
> > bus->name = DRV_NAME;
> > snprintf(bus->id, MII_BUS_ID_SIZE, "%s%d", pdev->name, pdev->id);
> > bus->parent = &pdev->dev;
> > @@ -129,6 +137,7 @@ static int aspeed_mdio_probe(struct platform_device *pdev)
> > rc = of_mdiobus_register(bus, pdev->dev.of_node);
> > if (rc) {
> > dev_err(&pdev->dev, "Cannot register MDIO bus!\n");
> > + reset_control_assert(ctx->reset);
> > return rc;
> > }
> >
> > @@ -139,7 +148,11 @@ static int aspeed_mdio_probe(struct platform_device *pdev)
> >
> > static int aspeed_mdio_remove(struct platform_device *pdev)
> > {
> > - mdiobus_unregister(platform_get_drvdata(pdev));
> > + struct mii_bus *bus = (struct mii_bus *)platform_get_drvdata(pdev);
> > + struct aspeed_mdio *ctx = bus->priv;
> > +
> > + reset_control_assert(ctx->reset);
>
> Isn't this unnecessary because you've used the devm_ variant to acquire
> the reset?
No, this is correct. deassert/assert needs to be balanced, and the
reset_control_deassert() call in aspeed_mdio_probe() is not devres
managed.
regards
Philipp
next prev parent reply other threads:[~2022-04-11 9:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 7:57 [PATCH v3 0/3] Add reset deassertion for Aspeed MDIO Dylan Hung
2022-04-07 7:57 ` [PATCH RESEND v3 1/3] dt-bindings: net: add reset property for aspeed, ast2600-mdio binding Dylan Hung
2022-04-11 0:15 ` Andrew Jeffery
2022-04-07 7:57 ` [PATCH RESEND v3 2/3] net: mdio: add reset control for Aspeed MDIO Dylan Hung
2022-04-11 0:20 ` Andrew Jeffery
2022-04-11 9:19 ` Philipp Zabel [this message]
2022-04-07 7:57 ` [PATCH RESEND v3 3/3] ARM: dts: aspeed: add reset properties into MDIO nodes Dylan Hung
2022-04-11 0:20 ` Andrew Jeffery
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=8470f6029703a29bd7c384f489da0c7936c44cc7.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=BMC-SW@aspeedtech.com \
--cc=andrew@aj.id.au \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dylan_hung@aspeedtech.com \
--cc=hkallweit1@gmail.com \
--cc=joel@jms.id.au \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).