All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Dylan Hung <dylan_hung@aspeedtech.com>,
	robh+dt@kernel.org, joel@jms.id.au, andrew@aj.id.au,
	andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	davem@davemloft.net, 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@vger.kernel.org
Cc: BMC-SW@aspeedtech.com, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] net: mdio: add reset deassertion for Aspeed MDIO
Date: Mon, 21 Mar 2022 09:14:38 +0100	[thread overview]
Message-ID: <84f2c72ced35506522ea3a6be72879d1699f885b.camel@pengutronix.de> (raw)
In-Reply-To: <20220321070131.23363-2-dylan_hung@aspeedtech.com>

Hi Dylan,

On Mo, 2022-03-21 at 15:01 +0800, Dylan Hung wrote:
> Add reset deassertion for Aspeed MDIO.  There are 4 MDIO controllers
> embedded in Aspeed AST2600 SOC and share one reset control register
> SCU50[3]. So devm_reset_control_get_shared is used in this change.
> 
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/net/mdio/mdio-aspeed.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-
> aspeed.c
> index e2273588c75b..8ac262a12d13 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_shared(&pdev->dev, NULL);

The device tree bindings should have a required reset control property
documented before this is added.

> +       if (IS_ERR(ctx->reset))
> +               return PTR_ERR(ctx->reset);
> +
> +       reset_control_deassert(ctx->reset);
> +

This is missing a corresponding reset_control_assert() in
aspeed_mdio_remove() and in the error path of of_mdiobus_register().
That would allow to assert the reset line again after all MDIO
controllers are unbound.

regards
Philipp

WARNING: multiple messages have this Message-ID (diff)
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Dylan Hung <dylan_hung@aspeedtech.com>,
	robh+dt@kernel.org, joel@jms.id.au,  andrew@aj.id.au,
	andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	 davem@davemloft.net, 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@vger.kernel.org
Cc: BMC-SW@aspeedtech.com, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] net: mdio: add reset deassertion for Aspeed MDIO
Date: Mon, 21 Mar 2022 09:14:38 +0100	[thread overview]
Message-ID: <84f2c72ced35506522ea3a6be72879d1699f885b.camel@pengutronix.de> (raw)
In-Reply-To: <20220321070131.23363-2-dylan_hung@aspeedtech.com>

Hi Dylan,

On Mo, 2022-03-21 at 15:01 +0800, Dylan Hung wrote:
> Add reset deassertion for Aspeed MDIO.  There are 4 MDIO controllers
> embedded in Aspeed AST2600 SOC and share one reset control register
> SCU50[3]. So devm_reset_control_get_shared is used in this change.
> 
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/net/mdio/mdio-aspeed.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-
> aspeed.c
> index e2273588c75b..8ac262a12d13 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_shared(&pdev->dev, NULL);

The device tree bindings should have a required reset control property
documented before this is added.

> +       if (IS_ERR(ctx->reset))
> +               return PTR_ERR(ctx->reset);
> +
> +       reset_control_deassert(ctx->reset);
> +

This is missing a corresponding reset_control_assert() in
aspeed_mdio_remove() and in the error path of of_mdiobus_register().
That would allow to assert the reset line again after all MDIO
controllers are unbound.

regards
Philipp

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-03-21  8:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21  7:01 [PATCH 0/2] Add reset deassertion for Aspeed MDIO Dylan Hung
2022-03-21  7:01 ` Dylan Hung
2022-03-21  7:01 ` [PATCH 1/2] net: mdio: add " Dylan Hung
2022-03-21  7:01   ` Dylan Hung
2022-03-21  8:14   ` Philipp Zabel [this message]
2022-03-21  8:14     ` Philipp Zabel
2022-03-21  8:20     ` Dylan Hung
2022-03-21  8:20       ` Dylan Hung
2022-03-21  7:01 ` [PATCH 2/2] ARM: dts: aspeed: add reset properties into MDIO nodes Dylan Hung
2022-03-21  7:01   ` Dylan Hung
2022-03-21 12:10 ` [PATCH 0/2] Add reset deassertion for Aspeed MDIO Andrew Lunn
2022-03-21 12:10   ` Andrew Lunn
2022-03-22  9:10   ` Dylan Hung
2022-03-22  9:10     ` Dylan Hung
2022-03-22 12:17     ` Andrew Lunn
2022-03-22 12:17       ` Andrew Lunn

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=84f2c72ced35506522ea3a6be72879d1699f885b.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 \
    --cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.