linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phy: Call bus->reset() after releasing PHYs from reset
@ 2017-05-11 18:24 Florian Fainelli
  2017-05-12  3:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2017-05-11 18:24 UTC (permalink / raw)
  To: netdev; +Cc: rogerq, davem, Florian Fainelli, Andrew Lunn, open list

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 69226896ad63 ("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: 69226896ad63 ("mdio_bus: Issue GPIO RESET to PHYs.")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/mdio_bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index a898e5c4ef1b..8e73f5f36e71 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -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,
@@ -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;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: phy: Call bus->reset() after releasing PHYs from reset
  2017-05-11 18:24 [PATCH net] net: phy: Call bus->reset() after releasing PHYs from reset Florian Fainelli
@ 2017-05-12  3:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-05-12  3:07 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, rogerq, andrew, linux-kernel

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 11 May 2017 11:24:16 -0700

> 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 69226896ad63 ("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: 69226896ad63 ("mdio_bus: Issue GPIO RESET to PHYs.")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks Florian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-12  3:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 18:24 [PATCH net] net: phy: Call bus->reset() after releasing PHYs from reset Florian Fainelli
2017-05-12  3:07 ` David Miller

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).