diff options
author | Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com> | 2017-11-29 06:38:00 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-12-12 07:32:44 (GMT) |
commit | 5dbb5b7eab4f77504ea0e7b26a6a91d5690a73fc (patch) | |
tree | 8ed017a1ea795d88d6e86edb0fba3276bdc710b4 | |
parent | edd93f3f18f73189d5cbd9c689539cdec18c6ecc (diff) | |
download | linux-5dbb5b7eab4f77504ea0e7b26a6a91d5690a73fc.tar.xz |
staging: fsl_ppfe/eth: Enable PFE in clause 45 mode
when we opearate in clause 45 mode, we need to call
the function get_phy_device() with its 3rd argument as
"true" and then the resultant phy device needs to be
register with phy layer via phy_device_register()
Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
-rw-r--r-- | drivers/staging/fsl_ppfe/pfe_eth.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/staging/fsl_ppfe/pfe_eth.c b/drivers/staging/fsl_ppfe/pfe_eth.c index b73b2d5..ec4ed09 100644 --- a/drivers/staging/fsl_ppfe/pfe_eth.c +++ b/drivers/staging/fsl_ppfe/pfe_eth.c @@ -923,7 +923,8 @@ static int pfe_eth_mdio_init(struct pfe_eth_priv_s *priv, struct ls1012a_mdio_platform_data *minfo) { struct mii_bus *bus; - int rc; + int rc, ii; + struct phy_device *phydev; netif_info(priv, drv, priv->ndev, "%s\n", __func__); pr_info("%s\n", __func__); @@ -962,6 +963,31 @@ static int pfe_eth_mdio_init(struct pfe_eth_priv_s *priv, } priv->mii_bus = bus; + + /* For clause 45 we need to call get_phy_device() with it's + * 3rd argument as true and then register the phy device + * via phy_device_register() + */ + + if (priv->einfo->mii_config == PHY_INTERFACE_MODE_2500SGMII) { + for (ii = 0; ii < NUM_GEMAC_SUPPORT; ii++) { + phydev = get_phy_device(priv->mii_bus, + priv->einfo->phy_id + ii, true); + if (!phydev || IS_ERR(phydev)) { + rc = -EIO; + netdev_err(priv->ndev, "fail to get device\n"); + goto err1; + } + rc = phy_device_register(phydev); + if (rc) { + phy_device_free(phydev); + netdev_err(priv->ndev, + "phy_device_register() failed\n"); + goto err1; + } + } + } + pfe_eth_mdio_reset(bus); return 0; @@ -1148,7 +1174,7 @@ static void ls1012a_configure_serdes(struct net_device *ndev) int sgmii_2500 = 0; struct mii_bus *bus = priv->mii_bus; - if (priv->einfo->mii_config == PHY_INTERFACE_MODE_SGMII_2500) + if (priv->einfo->mii_config == PHY_INTERFACE_MODE_2500SGMII) sgmii_2500 = 1; netif_info(priv, drv, ndev, "%s\n", __func__); @@ -1197,7 +1223,7 @@ static int pfe_phy_init(struct net_device *ndev) netif_info(priv, drv, ndev, "%s: %s\n", __func__, phy_id); interface = priv->einfo->mii_config; if ((interface == PHY_INTERFACE_MODE_SGMII) || - (interface == PHY_INTERFACE_MODE_SGMII_2500)) { + (interface == PHY_INTERFACE_MODE_2500SGMII)) { /*Configure SGMII PCS */ if (pfe->scfg) { /*Config MDIO from serdes */ |