Skip to content

Commit 357768c

Browse files
fancerdavem330
authored andcommitted
net: stmmac: Add DW XPCS specified via "pcs-handle" support
Recently the DW XPCS DT-bindings have been introduced and the DW XPCS driver has been altered to support the DW XPCS registered as a platform device. In order to have the DW XPCS DT-device accessed from the STMMAC driver let's alter the STMMAC PCS-setup procedure to support the "pcs-handle" property containing the phandle reference to the DW XPCS device DT-node. The respective fwnode will be then passed to the xpcs_create_fwnode() function which in its turn will create the DW XPCS descriptor utilized in the main driver for the PCS-related setups. Signed-off-by: Serge Semin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 351066b commit 357768c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,15 +497,22 @@ int stmmac_mdio_reset(struct mii_bus *bus)
497497

498498
int stmmac_pcs_setup(struct net_device *ndev)
499499
{
500+
struct fwnode_handle *devnode, *pcsnode;
500501
struct dw_xpcs *xpcs = NULL;
501502
struct stmmac_priv *priv;
502503
int addr, mode, ret;
503504

504505
priv = netdev_priv(ndev);
505506
mode = priv->plat->phy_interface;
507+
devnode = priv->plat->port_node;
506508

507509
if (priv->plat->pcs_init) {
508510
ret = priv->plat->pcs_init(priv);
511+
} else if (fwnode_property_present(devnode, "pcs-handle")) {
512+
pcsnode = fwnode_find_reference(devnode, "pcs-handle", 0);
513+
xpcs = xpcs_create_fwnode(pcsnode, mode);
514+
fwnode_handle_put(pcsnode);
515+
ret = PTR_ERR_OR_ZERO(xpcs);
509516
} else if (priv->plat->mdio_bus_data &&
510517
priv->plat->mdio_bus_data->pcs_mask) {
511518
addr = ffs(priv->plat->mdio_bus_data->pcs_mask) - 1;
@@ -515,10 +522,8 @@ int stmmac_pcs_setup(struct net_device *ndev)
515522
return 0;
516523
}
517524

518-
if (ret) {
519-
dev_warn(priv->device, "No xPCS found\n");
520-
return ret;
521-
}
525+
if (ret)
526+
return dev_err_probe(priv->device, ret, "No xPCS found\n");
522527

523528
priv->hw->xpcs = xpcs;
524529

0 commit comments

Comments
 (0)