net: phy: marvell10g: Add PHY loopback support for 88E2110 PHY
Subsystems (4)
PATCH 1/1 net: phy: marvell10g: Add PHY loopback support for 88E2110 PHY
From: Tan Tee Min <[email protected]>
Add support for PHY loopback for the Marvell 88E2110 PHY.
This allow user to perform selftest using ethtool.
--- drivers/net/phy/marvell10g.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/phy/marvell10g.c +12 -0
@@ -89,6 +89,8 @@ enum {MV_V2_TEMP_CTRL_DISABLE =0xc000 ,MV_V2_TEMP =0xf08c ,MV_V2_TEMP_UNKNOWN =0x9600 ,/* unknown function */ + + MV_LOOPBACK = BIT(14), /* Loopback (88E2110 only) */ }; struct mv3310_priv {
@@ -765,6 +767,15 @@ static int mv3310_set_tunable(struct phy_device *phydev, } } +static int mv3310_loopback (struct phy_device *phydev,bool enable) +{ +if (phydev->drv->phy_id !=MARVELL_PHY_ID_88E2110 ) +return -EOPNOTSUPP ; + +return phy_modify_mmd (phydev,MDIO_MMD_PCS ,MV_PCS_BASE_T , +MV_LOOPBACK , enable ?MV_LOOPBACK :0 ); +} +static struct phy_driver mv3310_drivers[] = { { .phy_id =MARVELL_PHY_ID_88X3310 ,
@@ -796,6 +807,7 @@ static struct phy_driver mv3310_drivers[] = { .get_tunable = mv3310_get_tunable, .set_tunable = mv3310_set_tunable, .remove = mv3310_remove, + .set_loopback = mv3310_loopback, }, };
Signature · 1 line
2.25.1
Heiner Kallweit
maintainerQuoted 17 lines · Wong Vee Khee
From: Tan Tee Min <[email protected]>
Add support for PHY loopback for the Marvell 88E2110 PHY.
This allow user to perform selftest using ethtool.
Signed-off-by Tan Tee Min <[email protected]>Signed-off-by Wong Vee Khee <[email protected]>--- drivers/net/phy/marvell10g.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/net/phy/marvell10g.c +0
-0
drivers/net/phy/marvell10g.c enum { · line 93
Quoted 5 lines
drivers/net/phy/marvell10g.c +2
-0@@ -89,6 +89,8 @@ enum {MV_V2_TEMP_CTRL_DISABLE =0xc000 ,MV_V2_TEMP =0xf08c ,MV_V2_TEMP_UNKNOWN =0x9600 ,/* unknown function */ + + MV_LOOPBACK = BIT(14), /* Loopback (88E2110 only) */
Why do you state 88E2110 only?
This is the standard PCS loopback bit as described in clause 45.2.3.1.2 It's defined already as MDIO_PCS_CTRL1_LOOPBACK.
E.g. the 88x3310 spec also describes this bit.
drivers/net/phy/marvell10g.c static int mv3310_set_tunable(struct phy_device *phydev, · line 773
Quoted 11 lines
drivers/net/phy/marvell10g.c +4
-0};struct mv3310_priv {@@ -765,6 +767,15 @@ static int mv3310_set_tunable(struct phy_device *phydev, } } +static int mv3310_loopback (struct phy_device *phydev,bool enable) +{ +if (phydev->drv->phy_id !=MARVELL_PHY_ID_88E2110 ) +return -EOPNOTSUPP ;
If you use the function in the 2110 PHY driver only, then why this check? And why name it 3310 if it can be used with 2110 only?
This function uses c45 standard functionality only, therefore it should go to generic code (similar to genphy_loopback for c22).
Quoted 17 lines
drivers/net/phy/marvell10g.c +6
-0+ +return phy_modify_mmd (phydev,MDIO_MMD_PCS ,MV_PCS_BASE_T , +MV_LOOPBACK , enable ?MV_LOOPBACK :0 ); +} +static struct phy_driver mv3310_drivers[] = { { .phy_id =MARVELL_PHY_ID_88X3310 ,@@ -796,6 +807,7 @@ static struct phy_driver mv3310_drivers[] = { .get_tunable = mv3310_get_tunable, .set_tunable = mv3310_set_tunable, .remove = mv3310_remove, + .set_loopback = mv3310_loopback, }, };