Skip to content

Commit

Permalink
net: phy: Call bus->reset() after releasing PHYs from reset
Browse files Browse the repository at this point in the history
The API convention makes it that a given MDIO bus reset should be able
to access PHY devices in its reset() callback and perform additional
MDIO accesses in order to bring the bus and PHYs in a working state.

Commit 6922689 ("mdio_bus: Issue GPIO RESET to PHYs.") broke that
contract by first calling bus->reset() and then release all PHYs from
reset using their shared GPIO line, so restore the expected
functionality here.

Fixes: 6922689 ("mdio_bus: Issue GPIO RESET to PHYs.")
Signed-off-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ffainelli authored and davem330 committed May 12, 2017
1 parent 6832a33 commit df0c8d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,6 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)

mutex_init(&bus->mdio_lock);

if (bus->reset)
bus->reset(bus);

/* de-assert bus level PHY GPIO resets */
if (bus->num_reset_gpios > 0) {
bus->reset_gpiod = devm_kcalloc(&bus->dev,
Expand Down Expand Up @@ -396,6 +393,9 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
}
}

if (bus->reset)
bus->reset(bus);

for (i = 0; i < PHY_MAX_ADDR; i++) {
if ((bus->phy_mask & (1 << i)) == 0) {
struct phy_device *phydev;
Expand Down

0 comments on commit df0c8d9

Please sign in to comment.