Skip to content

Commit 4838a54

Browse files
joabreudavem330
authored andcommitted
net: stmmac: Fix wrapper drivers not detecting PHY
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. Fixes: 7437127 ("net: stmmac: Convert to phylink and remove phylib logic") Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com> 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> Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 91d0a48 commit 4838a54

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ static int stmmac_init_phy(struct net_device *dev)
958958
struct device_node *node;
959959
int ret;
960960

961-
node = priv->plat->phy_node;
961+
node = priv->plat->phylink_node;
962962

963963
if (node) {
964964
ret = phylink_of_phy_connect(priv->phylink, node, 0);
@@ -980,7 +980,7 @@ static int stmmac_init_phy(struct net_device *dev)
980980

981981
static int stmmac_phy_setup(struct stmmac_priv *priv)
982982
{
983-
struct device_node *node = priv->plat->phy_node;
983+
struct device_node *node = priv->plat->phylink_node;
984984
int mode = priv->plat->interface;
985985
struct phylink *phylink;
986986

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
381381

382382
*mac = of_get_mac_address(np);
383383
plat->interface = of_get_phy_mode(np);
384-
plat->phy_node = np;
384+
385+
/* Some wrapper drivers still rely on phy_node. Let's save it while
386+
* they are not converted to phylink. */
387+
plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
388+
389+
/* PHYLINK automatically parses the phy-handle property */
390+
plat->phylink_node = np;
385391

386392
/* Get max speed of operation from device tree */
387393
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)
577583
void stmmac_remove_config_dt(struct platform_device *pdev,
578584
struct plat_stmmacenet_data *plat)
579585
{
586+
of_node_put(plat->phy_node);
580587
of_node_put(plat->mdio_node);
581588
}
582589
#else

include/linux/stmmac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ struct plat_stmmacenet_data {
151151
int interface;
152152
struct stmmac_mdio_bus_data *mdio_bus_data;
153153
struct device_node *phy_node;
154+
struct device_node *phylink_node;
154155
struct device_node *mdio_node;
155156
struct stmmac_dma_cfg *dma_cfg;
156157
int clk_csr;

0 commit comments

Comments
 (0)