182ad62bf8f1d47e893c9aa639de3567cbd7fecd
[openwrt/staging/luka.git] /
1 From df0c8d911abf6ba97b2c2fc3c5a12769e0b081a3 Mon Sep 17 00:00:00 2001
2 From: Florian Fainelli <f.fainelli@gmail.com>
3 Date: Thu, 11 May 2017 11:24:16 -0700
4 Subject: [PATCH] net: phy: Call bus->reset() after releasing PHYs from reset
5
6 The API convention makes it that a given MDIO bus reset should be able
7 to access PHY devices in its reset() callback and perform additional
8 MDIO accesses in order to bring the bus and PHYs in a working state.
9
10 Commit 69226896ad63 ("mdio_bus: Issue GPIO RESET to PHYs.") broke that
11 contract by first calling bus->reset() and then release all PHYs from
12 reset using their shared GPIO line, so restore the expected
13 functionality here.
14
15 Fixes: 69226896ad63 ("mdio_bus: Issue GPIO RESET to PHYs.")
16 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 ---
19 drivers/net/phy/mdio_bus.c | 6 +++---
20 1 file changed, 3 insertions(+), 3 deletions(-)
21
22 --- a/drivers/net/phy/mdio_bus.c
23 +++ b/drivers/net/phy/mdio_bus.c
24 @@ -330,9 +330,6 @@ int __mdiobus_register(struct mii_bus *b
25
26 mutex_init(&bus->mdio_lock);
27
28 - if (bus->reset)
29 - bus->reset(bus);
30 -
31 /* de-assert bus level PHY GPIO resets */
32 if (bus->num_reset_gpios > 0) {
33 bus->reset_gpiod = devm_kcalloc(&bus->dev,
34 @@ -362,6 +359,9 @@ int __mdiobus_register(struct mii_bus *b
35 }
36 }
37
38 + if (bus->reset)
39 + bus->reset(bus);
40 +
41 for (i = 0; i < PHY_MAX_ADDR; i++) {
42 if ((bus->phy_mask & (1 << i)) == 0) {
43 struct phy_device *phydev;