linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Badel <laurentbadel@eaton.com>
To: Fugang Duan <fugang.duan@nxp.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: Laurent Badel <laurentbadel@eaton.com>
Subject: [PATCH v2 net 0/1] net: fec: Fix temporary RMII clock reset on link up
Date: Mon, 25 Jan 2021 11:07:44 +0100	[thread overview]
Message-ID: <20210125100745.5090-1-laurentbadel@eaton.com> (raw)

v2: fixed a compilation warning 

The FEC drivers performs a "hardware reset" of the MAC module when the
link is reported to be up. This causes a short glitch in the RMII clock 
due to the hardware reset clearing the receive control register which 
controls the MII mode. It seems that some link partners do not tolerate 
this glitch, and invalidate the link, which leads to a never-ending loop
of negotiation-link up-link down events. 

This was observed with the iMX28 Soc and LAN8720/LAN8742 PHYs, with two 
Intel adapters I218-LM and X722-DA2 as link partners, though a number of
other link partners do not seem to mind the clock glitch. Changing the 
hardware reset to a software reset (clearing bit 1 of the ECR register) 
cured the issue.

Attempts to optimize fec_restart() in order to minimize the duration of 
the glitch were unsuccessful. Furthermore manually producing the glitch by
setting MII mode and then back to RMII in two consecutive instructions, 
resulting in a clock glitch <10us in duration, was enough to cause the 
partner to invalidate the link. This strongly suggests that the root cause
of the link being dropped is indeed the change in clock frequency.

In an effort to minimize changes to driver, the patch proposes to use 
soft reset only for tested SoCs (iMX28) and only if the link is up. This 
preserves hardware reset in other situations, which might be required for
proper setup of the MAC.


Laurent Badel (1):
  net: fec: Fix temporary RMII clock reset on link up

 drivers/net/ethernet/freescale/fec.h      | 5 +++++
 drivers/net/ethernet/freescale/fec_main.c | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.17.1



-----------------------------
Eaton Industries Manufacturing GmbH ~ Registered place of business: Route de la Longeraie 7, 1110, Morges, Switzerland 

-----------------------------


             reply	other threads:[~2021-01-25 10:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 10:07 Laurent Badel [this message]
2021-01-25 10:07 ` [PATCH v2 net 1/1] net: fec: Fix temporary RMII clock reset on link up Laurent Badel
2021-01-27  2:25   ` Jakub Kicinski
2021-01-27 10:24     ` [EXTERNAL] " Badel, Laurent

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=20210125100745.5090-1-laurentbadel@eaton.com \
    --to=laurentbadel@eaton.com \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=fugang.duan@nxp.com \
    --cc=kuba@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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 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).