netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: stmmac: Fix wrapper drivers not detecting PHY
@ 2019-06-14 15:06 Jose Abreu
  2019-06-14 17:23 ` Corentin Labbe
  2019-06-15 20:58 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Jose Abreu @ 2019-06-14 15:06 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: Jose Abreu, Joao Pinto, David S . Miller, Giuseppe Cavallaro,
	Alexandre Torgue

Because of PHYLINK conversion we stopped parsing the phy-handle property
from DT. Unfortunatelly, some wrapper drivers still rely on this phy
node to configure the PHY.

Let's restore the parsing of PHY handle while these wrapper drivers are
not fully converted to PHYLINK.

Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic")
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 4 ++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++-
 include/linux/stmmac.h                                | 1 +
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ad007d8bf9d7..069951590018 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -958,7 +958,7 @@ static int stmmac_init_phy(struct net_device *dev)
 	struct device_node *node;
 	int ret;
 
-	node = priv->plat->phy_node;
+	node = priv->plat->phylink_node;
 
 	if (node) {
 		ret = phylink_of_phy_connect(priv->phylink, node, 0);
@@ -980,7 +980,7 @@ static int stmmac_init_phy(struct net_device *dev)
 
 static int stmmac_phy_setup(struct stmmac_priv *priv)
 {
-	struct device_node *node = priv->plat->phy_node;
+	struct device_node *node = priv->plat->phylink_node;
 	int mode = priv->plat->interface;
 	struct phylink *phylink;
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 898f94aced53..49adda9b0ad8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -381,7 +381,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
 
 	*mac = of_get_mac_address(np);
 	plat->interface = of_get_phy_mode(np);
-	plat->phy_node = np;
+
+	/* Some wrapper drivers still rely on phy_node. Let's save it while
+	 * they are not converted to phylink. */
+	plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
+
+	/* PHYLINK automatically parses the phy-handle property */
+	plat->phylink_node = np;
 
 	/* Get max speed of operation from device tree */
 	if (of_property_read_u32(np, "max-speed", &plat->max_speed))
@@ -577,6 +583,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
 void stmmac_remove_config_dt(struct platform_device *pdev,
 			     struct plat_stmmacenet_data *plat)
 {
+	of_node_put(plat->phy_node);
 	of_node_put(plat->mdio_node);
 }
 #else
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 4335bd771ce5..1250e737f320 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -151,6 +151,7 @@ struct plat_stmmacenet_data {
 	int interface;
 	struct stmmac_mdio_bus_data *mdio_bus_data;
 	struct device_node *phy_node;
+	struct device_node *phylink_node;
 	struct device_node *mdio_node;
 	struct stmmac_dma_cfg *dma_cfg;
 	int clk_csr;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: stmmac: Fix wrapper drivers not detecting PHY
  2019-06-14 15:06 [PATCH net-next] net: stmmac: Fix wrapper drivers not detecting PHY Jose Abreu
@ 2019-06-14 17:23 ` Corentin Labbe
  2019-06-15 20:58 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Corentin Labbe @ 2019-06-14 17:23 UTC (permalink / raw)
  To: Jose Abreu
  Cc: linux-kernel, netdev, Joao Pinto, David S . Miller,
	Giuseppe Cavallaro, Alexandre Torgue

On Fri, Jun 14, 2019 at 05:06:57PM +0200, Jose Abreu wrote:
> Because of PHYLINK conversion we stopped parsing the phy-handle property
> from DT. Unfortunatelly, some wrapper drivers still rely on this phy
> node to configure the PHY.
> 
> Let's restore the parsing of PHY handle while these wrapper drivers are
> not fully converted to PHYLINK.
> 
> Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic")
> Signed-off-by: Jose Abreu <joabreu@synopsys.com>
> Cc: Joao Pinto <jpinto@synopsys.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>

Thanks for the quick fix

Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: stmmac: Fix wrapper drivers not detecting PHY
  2019-06-14 15:06 [PATCH net-next] net: stmmac: Fix wrapper drivers not detecting PHY Jose Abreu
  2019-06-14 17:23 ` Corentin Labbe
@ 2019-06-15 20:58 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-06-15 20:58 UTC (permalink / raw)
  To: Jose.Abreu
  Cc: linux-kernel, netdev, Joao.Pinto, peppe.cavallaro, alexandre.torgue

From: Jose Abreu <Jose.Abreu@synopsys.com>
Date: Fri, 14 Jun 2019 17:06:57 +0200

> Because of PHYLINK conversion we stopped parsing the phy-handle property
> from DT. Unfortunatelly, some wrapper drivers still rely on this phy
> node to configure the PHY.
> 
> Let's restore the parsing of PHY handle while these wrapper drivers are
> not fully converted to PHYLINK.
> 
> Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic")
> Signed-off-by: Jose Abreu <joabreu@synopsys.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-15 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 15:06 [PATCH net-next] net: stmmac: Fix wrapper drivers not detecting PHY Jose Abreu
2019-06-14 17:23 ` Corentin Labbe
2019-06-15 20:58 ` David Miller

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).