]> git.baikalelectronics.ru Git - kernel.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)
commitaa86ccbba23f1ba09d12b66ff69805f6c1925005
treef793d2ac5ed9680242a75fc363f1bee972f82f24
parentd71d25b38fdbd2cc5b35db37d95822c28c345f4c
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