From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
andrew@lunn.ch, adam.rudzinski@arf.net.pl,
m.felsch@pengutronix.de, hkallweit1@gmail.com,
richard.leitner@skidata.com, zhengdejin5@gmail.com,
devicetree@vger.kernel.org, kernel@pengutronix.de,
kuba@kernel.org, robh+dt@kernel.org
Subject: [PATCH net-next 2/3] net: phy: mdio-bcm-unimac: Enable GPHY resources during bus reset
Date: Wed, 2 Sep 2020 21:39:46 -0700 [thread overview]
Message-ID: <20200903043947.3272453-3-f.fainelli@gmail.com> (raw)
In-Reply-To: <20200903043947.3272453-1-f.fainelli@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2020-09-03 4:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 4:39 [PATCH net-next 0/3] net: phy: Support enabling clocks prior to bus probe Florian Fainelli
2020-09-03 4:39 ` [PATCH net-next 1/3] " Florian Fainelli
2020-09-03 20:39 ` Andrew Lunn
2020-09-03 21:25 ` Andrew Lunn
2020-09-03 21:28 ` Rob Herring
2020-09-03 21:42 ` Andrew Lunn
2020-09-03 21:50 ` Florian Fainelli
2020-09-03 21:43 ` Florian Fainelli
2020-09-03 4:39 ` Florian Fainelli [this message]
2020-09-03 4:39 ` [PATCH net-next 3/3] net: phy: bcm7xxx: request and manage GPHY clock Florian Fainelli
2020-09-04 6:15 ` Marco Felsch
2020-09-04 15:37 ` Florian Fainelli
2020-09-07 7:34 ` Marco Felsch
2020-09-07 19:07 ` Marco Felsch
2020-09-04 6:18 ` Marco Felsch
2020-09-04 15:38 ` Florian Fainelli
2020-09-07 7:37 ` Marco Felsch
2020-09-04 4:04 ` [PATCH net-next 0/3] net: phy: Support enabling clocks prior to bus probe Florian Fainelli
2020-09-04 6:19 ` Adam Rudziński
2020-09-04 13:45 ` Andrew Lunn
2020-09-04 14:00 ` Adam Rudziński
2020-09-04 14:23 ` Andrew Lunn
2020-09-04 17:21 ` Adam Rudziński
2020-09-04 13:58 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200903043947.3272453-3-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=adam.rudzinski@arf.net.pl \
--cc=andrew@lunn.ch \
--cc=devicetree@vger.kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=richard.leitner@skidata.com \
--cc=robh+dt@kernel.org \
--cc=zhengdejin5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).