From: Simon Horman <horms@kernel.org>
To: "Csókás, Bence" <csokas.bence@prolan.hu>
Cc: Jakub Kicinski <kuba@kernel.org>,
Laurent Badel <laurentbadel@eaton.com>,
imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Wei Fang <wei.fang@nxp.com>,
Shenwei Wang <shenwei.wang@nxp.com>,
Clark Wang <xiaoning.wang@nxp.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH] net: fec: Refactor MAC reset to function
Date: Tue, 21 Jan 2025 15:19:36 +0000 [thread overview]
Message-ID: <20250121151936.GF324367@kernel.org> (raw)
In-Reply-To: <20250121103857.12007-3-csokas.bence@prolan.hu>
On Tue, Jan 21, 2025 at 11:38:58AM +0100, Csókás, Bence wrote:
> The core is reset both in `fec_restart()`
> (called on link-up) and `fec_stop()`
> (going to sleep, driver remove etc.).
> These two functions had their separate
> implementations, which was at first only
> a register write and a `udelay()` (and
> the accompanying block comment).
> However, since then we got soft-reset
> (MAC disable) and Wake-on-LAN support,
> which meant that these implementations
> diverged, often causing bugs. For instance,
> as of now, `fec_stop()` does not check for
> `FEC_QUIRK_NO_HARD_RESET`. To eliminate
> this bug-source, refactor implementation
> to a common function.
>
> Fixes: c730ab423bfa ("net: fec: Fix temporary RMII clock reset on link up")
> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
> ---
>
> Notes:
> Recommended options for this patch:
> `--color-moved --color-moved-ws=allow-indentation-change`
>
> drivers/net/ethernet/freescale/fec_main.c | 50 +++++++++++------------
> 1 file changed, 23 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 68725506a095..850ef3de74ec 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1064,6 +1064,27 @@ static void fec_enet_enable_ring(struct net_device *ndev)
> }
> }
>
> +/* Whack a reset. We should wait for this.
> + * For i.MX6SX SOC, enet use AXI bus, we use disable MAC
> + * instead of reset MAC itself.
> + */
> +static void fec_ctrl_reset(struct fec_enet_private *fep, bool wol)
> +{
> + if (!wol || !(fep->wol_flag & FEC_WOL_FLAG_SLEEP_ON)) {
> + if (fep->quirks & FEC_QUIRK_HAS_MULTI_QUEUES ||
> + ((fep->quirks & FEC_QUIRK_NO_HARD_RESET) && fep->link)) {
> + writel(0, fep->hwp + FEC_ECNTRL);
> + } else {
> + writel(FEC_ECR_RESET, fep->hwp + FEC_ECNTRL);
> + udelay(10);
> + }
> + } else {
> + val = readl(fep->hwp + FEC_ECNTRL);
> + val |= (FEC_ECR_MAGICEN | FEC_ECR_SLEEP);
> + writel(val, fep->hwp + FEC_ECNTRL);
Hi Bence,
It seems that this does not compile because val is not declared in this scope.
> + }
> +}
> +
> /*
> * This function is called to start or restart the FEC during a link
> * change, transmit timeout, or to reconfigure the FEC. The network
Please observe the rule regarding not posting updated patches within 24h
when preparing v2.
--
pw-bot: changes-requested
next prev parent reply other threads:[~2025-01-21 15:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 10:38 [PATCH] net: fec: Refactor MAC reset to function Csókás, Bence
2025-01-21 14:10 ` Michal Swiatkowski
2025-01-21 14:36 ` Ahmad Fatoum
2025-01-21 15:19 ` Simon Horman [this message]
2025-01-21 15:51 ` Csókás Bence
2025-01-21 18:07 ` Jakub Kicinski
2025-01-21 16:09 ` [EXTERNAL] " Badel, Laurent
2025-01-21 20:41 ` Csókás Bence
2025-01-22 15:22 ` Badel, Laurent
2025-01-21 17:28 ` Andrew Lunn
2025-01-22 2:50 ` Wei Fang
-- strict thread matches above, loose matches on Subject: below --
2025-01-22 16:39 Csókás, Bence
2025-01-22 19:47 ` Jacob Keller
2025-01-23 1:24 ` Wei Fang
2025-02-04 9:36 Csókás, Bence
2025-02-05 13:28 ` Simon Horman
2025-02-05 13:48 ` Simon Horman
2025-02-06 13:02 ` Csókás Bence
2025-02-06 18:32 ` Simon Horman
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=20250121151936.GF324367@kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=csokas.bence@prolan.hu \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=imx@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=laurentbadel@eaton.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shenwei.wang@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.com \
/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.