[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200916204415.1831417-2-f.fainelli@gmail.com>
Date: Wed, 16 Sep 2020 13:44:14 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: netdev@...r.kernel.org
Cc: Florian Fainelli <f.fainelli@...il.com>, andrew@...n.ch,
hkallweit1@...il.com, kuba@...nel.org, davem@...emloft.net
Subject: [PATCH net-next 1/2] net: mdio: mdio-bcm-unimac: Turn on PHY clock before dummy read
The Broadcom internal Gigabit PHYs not only require a dummy read to
clear an incorrect state in their MDIO logic, but they also need their
digital PHY clock to be turned on otherwise they will not respond to any
MDIO transaction.
Turning on that clock must happen shortly before we do the dummy read
otherwise we will never manage to get the correct PHY driver to probe.
Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
---
drivers/net/mdio/mdio-bcm-unimac.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/mdio/mdio-bcm-unimac.c b/drivers/net/mdio/mdio-bcm-unimac.c
index fbd36891ee64..43d389c1648e 100644
--- a/drivers/net/mdio/mdio-bcm-unimac.c
+++ b/drivers/net/mdio/mdio-bcm-unimac.c
@@ -160,6 +160,7 @@ static int unimac_mdio_reset(struct mii_bus *bus)
{
struct device_node *np = bus->dev.of_node;
struct device_node *child;
+ struct clk *clk;
u32 read_mask = 0;
int addr;
@@ -172,6 +173,16 @@ static int unimac_mdio_reset(struct mii_bus *bus)
continue;
read_mask |= 1 << addr;
+
+ /* Some of the internal PHYs on this bus require their
+ * digital clock to be turned on and this must be done
+ * before the dummy BMSR read done right below. Do this
+ * now such that we can successfully identify these
+ * devices during get_phy_id().
+ */
+ clk = of_clk_get(child, 0);
+ if (!IS_ERR(clk))
+ clk_prepare_enable(clk);
}
}
--
2.25.1
Powered by blists - more mailing lists