The UniMAC MDIO bus controller allows the interfacing with various internal Broadcom STB Gigabit PHYs which do require two things: - they require that a digital clock be enabled for their MDIO interface to work at all - they require that at least one MDIO transaction goes through their interface to respond correctly to subsequent MDIO reads Because of these constraints, we need to have the bus driver's reset callback to call of_mdiobus_device_enable_resources() in order for clocks to be enabled prior to doing the dummy BMSR read. Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx> --- drivers/net/mdio/mdio-bcm-unimac.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/mdio/mdio-bcm-unimac.c b/drivers/net/mdio/mdio-bcm-unimac.c index fbd36891ee64..c8fed16c1f27 100644 --- a/drivers/net/mdio/mdio-bcm-unimac.c +++ b/drivers/net/mdio/mdio-bcm-unimac.c @@ -10,6 +10,7 @@ #include <linux/platform_device.h> #include <linux/sched.h> #include <linux/module.h> +#include <linux/of_mdio.h> #include <linux/io.h> #include <linux/delay.h> #include <linux/clk.h> @@ -162,6 +163,7 @@ static int unimac_mdio_reset(struct mii_bus *bus) struct device_node *child; u32 read_mask = 0; int addr; + int rc; if (!np) { read_mask = ~bus->phy_mask; @@ -172,6 +174,14 @@ static int unimac_mdio_reset(struct mii_bus *bus) continue; read_mask |= 1 << addr; + + /* Enable resources such as clocks *right now* for the + * workaround on the next line to be effective. + */ + rc = of_mdiobus_device_enable_resources(bus, child, + addr); + if (rc) + return rc; } } -- 2.25.1