From: Sascha Hauer <sha@pengutronix.de>
To: "Anže Lešnik" <anze.lesnik@norik.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] drivers: net: fec_imx: Fix system halt after FEC reinit
Date: Tue, 5 Jul 2022 16:00:13 +0200 [thread overview]
Message-ID: <20220705140013.GI5208@pengutronix.de> (raw)
In-Reply-To: <20220705085534.34251-1-anze.lesnik@norik.com>
On Tue, Jul 05, 2022 at 10:55:34AM +0200, Anže Lešnik wrote:
> Fix problem with system hang when trying to re-init ethernet interface
> on i.MX devices. The problem is that RX and TX buffer descriptor address
> registers are only being set in fec_probe(). When fec_halt() is called
> when bringing down the interface, this resets the FEC and values are
> lost. As per documentation, these registers should be reconfigured
> before re-enabling the FEC. Additionally, move fec_init() call from
> probe to open, since the FEC needs to re-initialized after every reset.
>
> Signed-off-by: Anže Lešnik <anze.lesnik@norik.com>
> Link: https://lore.barebox.org/barebox/c51b2c94-61b7-df44-5d4c-025d18c4b24f@norik.com
> ---
> drivers/net/fec_imx.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
This patch fixes the hang problem and is otherwise correct, so:
Applied, thanks
It is not the whole story though. The driver will work with a 100M link,
but not with other link speeds. This is because fec_update_linkspeed()
is not called again when fec_open() is called for the second time.
A possible hotfix is to call fec_update_linkspeed() manually from the
driver. Note it has to be called after FEC_ECNTRL is initialized with a
fixed value in fec_open().
Other drivers will have similar problems and this should be fixed at
framework level, so I hesitate to include the hotfix in barebox. Linux
has phy_start() and phy_stop() to be called by the drivers on
open/close. We should probably do the same.
Sascha
-----------------------8<----------------------------
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 673555a48a..f2ee211992 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -385,6 +385,9 @@ static int fec_open(struct eth_device *edev)
ecr |= 0x100;
writel(ecr, fec->regs + FEC_ECNTRL);
+
+ fec_update_linkspeed(edev);
+
/*
* Enable SmartDMA receive task
*/
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2022-07-05 14:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 8:55 Anže Lešnik
2022-07-05 14:00 ` Sascha Hauer [this message]
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=20220705140013.GI5208@pengutronix.de \
--to=sha@pengutronix.de \
--cc=anze.lesnik@norik.com \
--cc=barebox@lists.infradead.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