[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200903043947.3272453-3-f.fainelli@gmail.com>
Date: Wed, 2 Sep 2020 21:39:46 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: netdev@...r.kernel.org
Cc: Florian Fainelli <f.fainelli@...il.com>, andrew@...n.ch,
adam.rudzinski@....net.pl, m.felsch@...gutronix.de,
hkallweit1@...il.com, richard.leitner@...data.com,
zhengdejin5@...il.com, devicetree@...r.kernel.org,
kernel@...gutronix.de, kuba@...nel.org, robh+dt@...nel.org
Subject: [PATCH net-next 2/3] net: phy: mdio-bcm-unimac: Enable GPHY resources during bus reset
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@...il.com>
---
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
Powered by blists - more mailing lists