]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
net: phy: consolidate PHY reset in phy_init_hw()
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 6 Dec 2013 21:01:34 +0000 (13:01 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Dec 2013 01:38:59 +0000 (20:38 -0500)
commit87aa9f9c61ad56d505641681812e92ad976f8608
treef793d2ac5ed9680242a75fc363f1bee972f82f24
parent06d87cec73d883690f690e72da498e7f0334f9bc
net: phy: consolidate PHY reset in phy_init_hw()

There are quite a lot of drivers touching a PHY device MII_BMCR
register to reset the PHY without taking care of:

1) ensuring that BMCR_RESET is cleared after a given timeout
2) the PHY state machine resuming to the proper state and re-applying
potentially changed settings such as auto-negotiation

Introduce phy_poll_reset() which will take care of polling the MII_BMCR
for the BMCR_RESET bit to be cleared after a given timeout or return a
timeout error code.

In order to make sure the PHY is in a correct state, phy_init_hw() first
issues a software reset through MII_BMCR and then applies any fixups.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/phy.txt
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c