devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jacky Chou <jacky_chou@aspeedtech.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs
Date: Mon, 9 Dec 2024 16:49:46 +0000	[thread overview]
Message-ID: <20241209164946.GA2455@kernel.org> (raw)
In-Reply-To: <20241205072048.1397570-4-jacky_chou@aspeedtech.com>

On Thu, Dec 05, 2024 at 03:20:44PM +0800, Jacky Chou wrote:
> Toggle the SCU reset before hardware initialization.
> 
> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> ---
>  drivers/net/ethernet/faraday/ftgmac100.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 17ec35e75a65..96c1eee547c4 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -9,6 +9,7 @@
>  #define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
>  
>  #include <linux/clk.h>
> +#include <linux/reset.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/etherdevice.h>
>  #include <linux/ethtool.h>
> @@ -98,6 +99,7 @@ struct ftgmac100 {
>  	struct work_struct reset_task;
>  	struct mii_bus *mii_bus;
>  	struct clk *clk;
> +	struct reset_control *rst;
>  
>  	/* AST2500/AST2600 RMII ref clock gate */
>  	struct clk *rclk;
> @@ -1979,6 +1981,22 @@ static int ftgmac100_probe(struct platform_device *pdev)
>  				  priv->base + FTGMAC100_OFFSET_TM);
>  	}
>  
> +	priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
> +	if (IS_ERR(priv->rst))
> +		goto err_register_netdev;

Hi Jacky,

The goto on the line above will result in this function returning err.
However, it seems that err is set to 0 here.
And perhaps it should be set to PTR_ERR(priv->rst).

Flagged by Smatch.

> +
> +	err = reset_control_assert(priv->rst);
> +	if (err) {
> +		dev_err(priv->dev, "Failed to reset mac (%d)\n", err);
> +		goto err_register_netdev;
> +	}
> +	usleep_range(10000, 20000);
> +	err = reset_control_deassert(priv->rst);
> +	if (err) {
> +		dev_err(priv->dev, "Failed to deassert mac reset (%d)\n", err);
> +		goto err_register_netdev;
> +	}
> +
>  	/* Default ring sizes */
>  	priv->rx_q_entries = priv->new_rx_q_entries = DEF_RX_QUEUE_ENTRIES;
>  	priv->tx_q_entries = priv->new_tx_q_entries = DEF_TX_QUEUE_ENTRIES;
> -- 
> 2.25.1
> 
> 

  reply	other threads:[~2024-12-09 16:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-05  7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
2024-12-05  7:20 ` [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700 Jacky Chou
2024-12-05  8:17   ` Rob Herring (Arm)
2024-12-06  1:52     ` 回覆: " Jacky Chou
2024-12-05  9:23   ` Krzysztof Kozlowski
2024-12-06  1:57     ` 回覆: " Jacky Chou
2024-12-05  9:24   ` Krzysztof Kozlowski
2024-12-05  7:20 ` [PATCH net-next v4 2/7] net: faraday: Add ARM64 in FTGMAC100 " Jacky Chou
2024-12-05  7:20 ` [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs Jacky Chou
2024-12-09 16:49   ` Simon Horman [this message]
2024-12-11  3:06     ` 回覆: " Jacky Chou
2024-12-05  7:20 ` [PATCH net-next v4 4/7] net: ftgmac100: Add support for AST2700 Jacky Chou
2024-12-05  7:20 ` [PATCH net-next v4 5/7] net: ftgmac100: add pin strap configuration " Jacky Chou
2024-12-05  7:20 ` [PATCH net-next v4 6/7] net: ftgmac100: Add 64-bit DMA support " Jacky Chou
2024-12-05  7:20 ` [PATCH net-next v4 7/7] net: ftgmac100: remove extra newline symbols Jacky Chou

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=20241209164946.GA2455@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=jacky_chou@aspeedtech.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=robh@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).