Commit 357768c7 authored by Serge Semin's avatar Serge Semin Committed by David S. Miller

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: default avatarSerge Semin <fancer.lancer@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 351066ba
...@@ -497,15 +497,22 @@ int stmmac_mdio_reset(struct mii_bus *bus) ...@@ -497,15 +497,22 @@ int stmmac_mdio_reset(struct mii_bus *bus)
int stmmac_pcs_setup(struct net_device *ndev) int stmmac_pcs_setup(struct net_device *ndev)
{ {
struct fwnode_handle *devnode, *pcsnode;
struct dw_xpcs *xpcs = NULL; struct dw_xpcs *xpcs = NULL;
struct stmmac_priv *priv; struct stmmac_priv *priv;
int addr, mode, ret; int addr, mode, ret;
priv = netdev_priv(ndev); priv = netdev_priv(ndev);
mode = priv->plat->phy_interface; mode = priv->plat->phy_interface;
devnode = priv->plat->port_node;
if (priv->plat->pcs_init) { if (priv->plat->pcs_init) {
ret = priv->plat->pcs_init(priv); ret = priv->plat->pcs_init(priv);
} else if (fwnode_property_present(devnode, "pcs-handle")) {
pcsnode = fwnode_find_reference(devnode, "pcs-handle", 0);
xpcs = xpcs_create_fwnode(pcsnode, mode);
fwnode_handle_put(pcsnode);
ret = PTR_ERR_OR_ZERO(xpcs);
} else if (priv->plat->mdio_bus_data && } else if (priv->plat->mdio_bus_data &&
priv->plat->mdio_bus_data->pcs_mask) { priv->plat->mdio_bus_data->pcs_mask) {
addr = ffs(priv->plat->mdio_bus_data->pcs_mask) - 1; addr = ffs(priv->plat->mdio_bus_data->pcs_mask) - 1;
...@@ -515,10 +522,8 @@ int stmmac_pcs_setup(struct net_device *ndev) ...@@ -515,10 +522,8 @@ int stmmac_pcs_setup(struct net_device *ndev)
return 0; return 0;
} }
if (ret) { if (ret)
dev_warn(priv->device, "No xPCS found\n"); return dev_err_probe(priv->device, ret, "No xPCS found\n");
return ret;
}
priv->hw->xpcs = xpcs; priv->hw->xpcs = xpcs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment