]> git.baikalelectronics.ru Git - kernel.git/commit
r6040: Restore MDIO clock frequency after MAC reset
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 9 Sep 2021 17:33:28 +0000 (10:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Sep 2021 09:00:08 +0000 (10:00 +0100)
commit54606edbef74643f9e0a5f4e3e9d44a9033dc354
tree50878ce4bfcc80815e3062642562e09bfde5111b
parent5df6da50e87bad6d1edf96ac104a4e04df09a560
r6040: Restore MDIO clock frequency after MAC reset

A number of users have reported that they were not able to get the PHY
to successfully link up, especially after commit 32fa1e80326c ("net:
phy: consider AN_RESTART status when reading link status") where we
stopped reading just BMSR, but we also read BMCR to determine the link
status.

Andrius at NetBSD did a wonderful job at debugging the problem
and found out that the MDIO bus clock frequency would be incorrectly set
back to its default value which would prevent the MDIO bus controller
from reading PHY registers properly. Back when we only read BMSR, if we
read all 1s, we could falsely indicate a link status, though in general
there is a cable plugged in, so this went unnoticed. After a second read
of BMCR was added, a wrong read will lead to the inability to determine
a link UP condition which is when it started to be visibly broken, even
if it was long before that.

The fix consists in restoring the value of the MD_CSR register that was
set prior to the MAC reset.

Link: http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=53494
Fixes: dc92bb04e13f ("r6040: consolidate MAC reset to its own function")
Reported-by: Andrius V <vezhlys@gmail.com>
Reported-by: Darek Strugacz <darek.strugacz@op.pl>
Tested-by: Darek Strugacz <darek.strugacz@op.pl>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rdc/r6040.c