* [PATCH] net: fec_imx: skip fec_halt if the FEC wasn't started
@ 2019-02-01 13:02 Lucas Stach
2019-02-01 13:31 ` Sam Ravnborg
0 siblings, 1 reply; 3+ messages in thread
From: Lucas Stach @ 2019-02-01 13:02 UTC (permalink / raw)
To: barebox
If the FEC driver is enabled, but the ethernet device was never
opened due to booting from another source the wait for graceful
transmit stop will always fail. This introduces an unnecessary
boot delay and prints a distracting warning.
As there is no point in trying to shut down the FEC if it was
never started, just skip all of fec_halt in that case.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
drivers/net/fec_imx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 4823b08340c6..36505c529c84 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -395,6 +395,9 @@ static void fec_halt(struct eth_device *dev)
struct fec_priv *fec = (struct fec_priv *)dev->priv;
uint32_t reg;
+ if (!(readl(fec->regs + FEC_ECNTRL) & FEC_ECNTRL_ETHER_EN))
+ return;
+
/* issue graceful stop command to the FEC transmitter if necessary */
writel(readl(fec->regs + FEC_X_CNTRL) | FEC_ECNTRL_RESET,
fec->regs + FEC_X_CNTRL);
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: fec_imx: skip fec_halt if the FEC wasn't started
2019-02-01 13:02 [PATCH] net: fec_imx: skip fec_halt if the FEC wasn't started Lucas Stach
@ 2019-02-01 13:31 ` Sam Ravnborg
2019-02-05 11:48 ` Sascha Hauer
0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2019-02-01 13:31 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
Hi Lucas.
On Fri, Feb 01, 2019 at 02:02:41PM +0100, Lucas Stach wrote:
> If the FEC driver is enabled, but the ethernet device was never
> opened due to booting from another source the wait for graceful
> transmit stop will always fail. This introduces an unnecessary
> boot delay and prints a distracting warning.
>
> As there is no point in trying to shut down the FEC if it was
> never started, just skip all of fec_halt in that case.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/net/fec_imx.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 4823b08340c6..36505c529c84 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -395,6 +395,9 @@ static void fec_halt(struct eth_device *dev)
> struct fec_priv *fec = (struct fec_priv *)dev->priv;
> uint32_t reg;
>
> + if (!(readl(fec->regs + FEC_ECNTRL) & FEC_ECNTRL_ETHER_EN))
> + return;
> +
It would be nice with a small comment in the code that explain why
it is OK to return here, so one does not have to go digging in git
to find out why.
Sam
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: fec_imx: skip fec_halt if the FEC wasn't started
2019-02-01 13:31 ` Sam Ravnborg
@ 2019-02-05 11:48 ` Sascha Hauer
0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2019-02-05 11:48 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: barebox
On Fri, Feb 01, 2019 at 02:31:08PM +0100, Sam Ravnborg wrote:
> Hi Lucas.
>
> On Fri, Feb 01, 2019 at 02:02:41PM +0100, Lucas Stach wrote:
> > If the FEC driver is enabled, but the ethernet device was never
> > opened due to booting from another source the wait for graceful
> > transmit stop will always fail. This introduces an unnecessary
> > boot delay and prints a distracting warning.
> >
> > As there is no point in trying to shut down the FEC if it was
> > never started, just skip all of fec_halt in that case.
> >
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> > drivers/net/fec_imx.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> > index 4823b08340c6..36505c529c84 100644
> > --- a/drivers/net/fec_imx.c
> > +++ b/drivers/net/fec_imx.c
> > @@ -395,6 +395,9 @@ static void fec_halt(struct eth_device *dev)
> > struct fec_priv *fec = (struct fec_priv *)dev->priv;
> > uint32_t reg;
> >
> > + if (!(readl(fec->regs + FEC_ECNTRL) & FEC_ECNTRL_ETHER_EN))
> > + return;
> > +
> It would be nice with a small comment in the code that explain why
> it is OK to return here, so one does not have to go digging in git
> to find out why.
Added such a comment and applied.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-05 11:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-01 13:02 [PATCH] net: fec_imx: skip fec_halt if the FEC wasn't started Lucas Stach
2019-02-01 13:31 ` Sam Ravnborg
2019-02-05 11:48 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox