net: phy: marvell10g: Add 2.5GBaseT support
Subsystems (5)
v2 cover net: phy: marvell10g: Add 2.5GBaseT support
This series adds the missing bits necessary to fully support 2.5GBaseT in the Marvell Alaska PHYs.
The main points for that support are :
- Making use of the .get_features call, recently introduced by Heiner and Andrew, that allows having a fully populated list of supported modes, including 2500BaseT.
- Configuring the MII to 2500BaseX when establishing a link at 2.5G
- Adding a small quirk to take into account the fact that some PHYs in the family won't report the correct supported abilities
The rest of the series consists of small cosmetic improvements such as using the correct helper to set a linkmode bit and adding macros for the PHY ids.
We also add support for the 88E2110 PHY, which doesn't require the quirk, and support for 2500BaseT in the PPv2 driver, in order to have a fully working setup on the MacchiatoBin board.
Changes since V1 : Fixed formatting issue in patch 01, rebased.
Maxime Chevallier (7):
net: phy: marvell10g: Use get_features to get the PHY abilities
net: phy: marvell10g: Use linkmode_set_bit helper instead of __set_bit
net: phy: marvell10g: Use 2500BASEX when using 2.5GBASET
net: phy: marvell10g: Use a #define for 88X3310 family id
net: phy: marvell10g: Force reading of 2.5/5G
net: mvpp2: Add 2.5GBaseT support
net: phy: marvell10g: add support for the 88x2110 PHY
.../net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 + drivers/net/phy/marvell10g.c | 93 ++++++++++++++++--- include/linux/marvell_phy.h | 2 + 3 files changed, 82 insertions(+), 14 deletions(-)
Signature · 1 line
2.19.2
PATCH v2 1/7 net: phy: marvell10g: Use get_features to get the PHY abilities
The Alaska family of 10G PHYs has more abilities than the ones listed in PHY_10GBIT_FULL_FEATURES, the exact list depending on the model.
Make use of the newly introduced .get_features call to build this list, using genphy_c45_pma_read_abilities to build the list of supported linkmodes, and adding autoneg ability based on what's reported by the AN MMD.
.config_init is still used to validate the interface_mode.
---
V2: Added missing blank line
drivers/net/phy/marvell10g.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/phy/marvell10g.c +8 -3
@@ -233,8 +233,6 @@ static int mv3310_resume(struct phy_device *phydev)static int mv3310_config_init (struct phy_device *phydev) { -int ret, val; -/* Check that the PHY interface type is compatible */ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && phydev->interface != PHY_INTERFACE_MODE_XAUI &&
@@ -242,6 +240,13 @@ static int mv3310_config_init(struct phy_device *phydev) phydev->interface != PHY_INTERFACE_MODE_10GKR) return -ENODEV; +return 0 ; +} + +static int mv3310_get_features (struct phy_device *phydev) +{ +int ret, val; +if (phydev->c45_ids.devices_in_package &MDIO_DEVS_AN ) { val =phy_read_mmd (phydev,MDIO_MMD_AN ,MDIO_STAT1 );if (val <0 )
@@ -416,7 +421,7 @@ static struct phy_driver mv3310_drivers[] = { .phy_id = 0x002b09aa, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "mv88x3310", - .features = PHY_10GBIT_FEATURES, + .get_features = mv3310_get_features, .soft_reset = gen10g_no_soft_reset, .config_init = mv3310_config_init, .probe = mv3310_probe,
Signature · 1 line
2.19.2
Re: [PATCH net-next v2 1/7] net: phy: marvell10g: Use get_features to get the PHY abilities
Quoted 11 lines · Maxime Chevallier
The Alaska family of 10G PHYs has more abilities than the ones listed in
PHY_10GBIT_FULL_FEATURES, the exact list depending on the model.Make use of the newly introduced .get_features call to build this list, using
genphy_c45_pma_read_abilitiesto build the list of supported linkmodes, and adding autoneg ability based on what's reported by the AN MMD..config_init is still used to validate the
interface_mode.Signed-off-by Maxime Chevallier <[email protected]>
Andrew
PATCH v2 2/7 net: phy: marvell10g: Use linkmode_set_bit helper instead of __set_bit
In reply to Maxime ChevallierCosmetic patch making use of helpers dedicated to linkmodes handling.
--- drivers/net/phy/marvell10g.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/marvell10g.c +2 -2
@@ -253,8 +253,8 @@ static int mv3310_get_features(struct phy_device *phydev)return val;if (val &MDIO_AN_STAT1_ABLE ) -__set_bit (ETHTOOL_LINK_MODE_Autoneg_BIT, - phydev->supported); +linkmode_set_bit (ETHTOOL_LINK_MODE_Autoneg_BIT, + phydev->supported); } ret =genphy_c45_pma_read_abilities (phydev);
Signature · 1 line
2.19.2
Re: [PATCH net-next v2 2/7] net: phy: marvell10g: Use linkmode_set_bit helper instead of __set_bit
Quoted 3 lines · Maxime Chevallier
Cosmetic patch making use of helpers dedicated to linkmodes handling.
Signed-off-by Maxime Chevallier <[email protected]>
Andrew
PATCH v2 3/7 net: phy: marvell10g: Use 2500BASEX when using 2.5GBASET
In reply to Maxime ChevallierThe Marvell Alaska family of PHYs supports 2.5GBaseT and 5GBaseT modes, as defined in the 802.3bz specification.
Upon establishing a 2.5GBASET link, the PHY will reconfigure it's MII interface to 2500BASEX.
At 5G, the PHY will reconfigure it's interface to 5GBASE-R, but this mode isn't supported by any MAC for now.
This was tested with :
- The 88X3310, which is on the MacchiatoBin
- The 88E2010, an Alaska PHY that has no fiber interfaces, and is limited to 5G maximum speed.
--- drivers/net/phy/marvell10g.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/net/phy/marvell10g.c +19 -7
@@ -235,6 +235,7 @@ static int mv3310_config_init(struct phy_device *phydev) {/* Check that the PHY interface type is compatible */ if (phydev->interface !=PHY_INTERFACE_MODE_SGMII && + phydev->interface !=PHY_INTERFACE_MODE_2500BASEX && phydev->interface !=PHY_INTERFACE_MODE_XAUI && phydev->interface !=PHY_INTERFACE_MODE_RXAUI && phydev->interface !=PHY_INTERFACE_MODE_10GKR )
@@ -313,18 +314,29 @@ static int mv3310_aneg_done(struct phy_device *phydev)static void mv3310_update_interface (struct phy_device *phydev) {if ((phydev->interface ==PHY_INTERFACE_MODE_SGMII || + phydev->interface ==PHY_INTERFACE_MODE_2500BASEX || phydev->interface ==PHY_INTERFACE_MODE_10GKR ) && phydev->link) {/* The PHY automatically switches its serdes interface (and -* active PHYXS instance) between Cisco SGMII and 10GBase-KR -* modes according to the speed. Florian suggests setting -* phydev->interface to communicate this to the MAC. Only do -* this if we are already in either SGMII or 10GBase-KR mode. +* active PHYXS instance) between Cisco SGMII, 10GBase-KR and +* 2500BaseX modes according to the speed. Florian suggests +* setting phydev->interface to communicate this to the MAC. +* Only do this if we are already in one of the above modes. */ -if (phydev->speed ==SPEED_10000 ) +switch (phydev->speed) { +case SPEED_10000 : phydev->interface =PHY_INTERFACE_MODE_10GKR ; -else if (phydev->speed >=SPEED_10 && - phydev->speed <SPEED_10000 ) +break ; +case SPEED_2500 : + phydev->interface =PHY_INTERFACE_MODE_2500BASEX ; +break ; +case SPEED_1000 : +case SPEED_100 : +case SPEED_10 : phydev->interface =PHY_INTERFACE_MODE_SGMII ; +break ; +default : +break ; + } } }
Signature · 1 line
2.19.2
Re: [PATCH net-next v2 3/7] net: phy: marvell10g: Use 2500BASEX when using 2.5GBASET
Quoted 9 lines · Maxime Chevallier
The Marvell Alaska family of PHYs supports 2.5GBaseT and 5GBaseT modes, as defined in the 802.3bz specification.
Upon establishing a 2.5GBASET link, the PHY will reconfigure it's MII interface to 2500BASEX.
At 5G, the PHY will reconfigure it's interface to 5GBASE-R, but this mode isn't supported by any MAC for now.
Quoted 6 lines
This was tested with :
- The 88X3310, which is on the MacchiatoBin
- The 88E2010, an Alaska PHY that has no fiber interfaces, and is limited to 5G maximum speed.Signed-off-by Maxime Chevallier <[email protected]>
Andrew
PATCH v2 4/7 net: phy: marvell10g: Use a #define for 88X3310 family id
In reply to Maxime ChevallierThe PHY ID corresponding to the 88X3310 is also used for other PHYs in the same family, such as the 88E2010. Use a #define for the PHY id, that ignores the last nibble.
--- drivers/net/phy/marvell10g.c | 4 ++-- include/linux/marvell_phy.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/phy/marvell10g.c +2 -2
@@ -430,7 +430,7 @@ static int mv3310_read_status(struct phy_device *phydev)static struct phy_driver mv3310_drivers[] = { { - .phy_id =0x002b09aa , + .phy_id =MARVELL_PHY_ID_88X3310 , .phy_id_mask =MARVELL_PHY_ID_MASK , .name ="mv88x3310" , .get_features = mv3310_get_features,
@@ -448,7 +448,7 @@ static struct phy_driver mv3310_drivers[] = {module_phy_driver (mv3310_drivers);static struct mdio_device_id __maybe_unused mv3310_tbl[] = { - {0x002b09aa ,MARVELL_PHY_ID_MASK }, + {MARVELL_PHY_ID_88X3310 ,MARVELL_PHY_ID_MASK }, { }, };MODULE_DEVICE_TABLE (mdio, mv3310_tbl);
include/linux/marvell_phy.h +1 -0
@@ -20,6 +20,7 @@#define MARVELL_PHY_ID_88E1540 0x01410eb0#define MARVELL_PHY_ID_88E1545 0x01410ea0#define MARVELL_PHY_ID_88E3016 0x01410e60 +#define MARVELL_PHY_ID_88X3310 0x002b09a0/* The MV88e6390 Ethernet switch contains embedded PHYs. These PHYs do * not have a model ID. So the switch driver traps reads to the ID2
Signature · 1 line
2.19.2
Re: [PATCH net-next v2 4/7] net: phy: marvell10g: Use a #define for 88X3310 family id
Quoted 5 lines · Maxime Chevallier
The PHY ID corresponding to the 88X3310 is also used for other PHYs in the same family, such as the 88E2010. Use a #define for the PHY id, that ignores the last nibble.
Signed-off-by Maxime Chevallier <[email protected]>
Andrew
PATCH v2 5/7 net: phy: marvell10g: Force reading of 2.5/5G
In reply to Maxime ChevallierAs per 802.3bz, if bit 14 of (1.11) "PMA Extended Abilities" indicates whether or not we should read register (1.21) "2.52/5G PMA Extended Abilities", which contains information on the support of 2.5GBASET and 5GBASET.
After testing on several variants of PHYS of this family, it appears that bit 14 in (1.11) isn't always set when it should be.
PHYs 88X3310 (on MacchiatoBin) and 88E2010 do support 2.5G and 5GBASET, but don't have 1.11.14 set. Their register 1.21 is filled with the correct values, indicating 2.5G and 5G support.
PHYs 88E2110 do have their 1.11.14 bit set, as it should.
--- drivers/net/phy/marvell10g.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/net/phy/marvell10g.c +35 -0
@@ -27,6 +27,9 @@#include <linux/marvell_phy.h> #include <linux/phy.h> +#define MV_PHY_ALASKA_NBT_QUIRK_MASK 0xfffffffe +#define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa) +enum {MV_PCS_BASE_T =0x0000 ,MV_PCS_BASE_R =0x1000 ,
@@ -231,6 +234,23 @@ static int mv3310_resume(struct phy_device *phydev)return mv3310_hwmon_config (phydev, true); } +/* Some PHYs in the Alaska family such as the 88X3310 and the 88E2010 +* don't set bit 14 in PMA Extended Abilities (1.11), although they do +* support 2.5GBASET and 5GBASET. For these models, we can still read their +* 2.5G/5G extended abilities register (1.21). We detect these models based on +* the PMA device identifier, with a mask matching models known to have this +* issue +*/ +static bool mv3310_has_pma_ngbaset_quirk (struct phy_device *phydev) +{ +if (!(phydev->c45_ids.devices_in_package &MDIO_DEVS_PMAPMD )) +return false; + +/* Only some revisions of the 88X3310 family PMA seem to be impacted */ +return (phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD ] & +MV_PHY_ALASKA_NBT_QUIRK_MASK ) ==MV_PHY_ALASKA_NBT_QUIRK_REV ; +} +static int mv3310_config_init (struct phy_device *phydev) {/* Check that the PHY interface type is compatible */
@@ -262,6 +282,21 @@ static int mv3310_get_features(struct phy_device *phydev)if (ret)return ret; +if (mv3310_has_pma_ngbaset_quirk (phydev)) { + val =phy_read_mmd (phydev,MDIO_MMD_PMAPMD , +MDIO_PMA_NG_EXTABLE ); +if (val <0 ) +return val; + +linkmode_mod_bit (ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + phydev->supported, + val &MDIO_PMA_NG_EXTABLE_2_5GBT ); + +linkmode_mod_bit (ETHTOOL_LINK_MODE_5000baseT_Full_BIT, + phydev->supported, + val &MDIO_PMA_NG_EXTABLE_5GBT ); + } +return 0 ; }
Signature · 1 line
2.19.2
Re: [PATCH net-next v2 5/7] net: phy: marvell10g: Force reading of 2.5/5G
Quoted 8 lines · Maxime Chevallier
As per 802.3bz, if bit 14 of (1.11) "PMA Extended Abilities" indicates whether or not we should read register (1.21) "2.52/5G PMA Extended Abilities", which contains information on the support of 2.5GBASET and 5GBASET.
After testing on several variants of PHYS of this family, it appears that bit 14 in (1.11) isn't always set when it should be.
Quoted 7 lines
PHYs 88X3310 (on MacchiatoBin) and 88E2010 do support 2.5G and 5GBASET, but don't have 1.11.14 set. Their register 1.21 is filled with the correct values, indicating 2.5G and 5G support.
PHYs 88E2110 do have their 1.11.14 bit set, as it should.
Signed-off-by Maxime Chevallier <[email protected]>
Andrew
PATCH v2 6/7 net: mvpp2: Add 2.5GBaseT support
In reply to Maxime ChevallierThe PPv2 controller is able to support 2.5G speeds, allowing to use 2.5GBASET in conjunction with PHYs that use 2500BASEX as their MII interface when using this mode.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1 -0
@@ -4403,6 +4403,7 @@ static void mvpp2_phylink_validate(struct net_device *dev,case PHY_INTERFACE_MODE_2500BASEX : phylink_set(mask, 1000baseT_Full); phylink_set(mask, 1000baseX_Full); + phylink_set(mask, 2500baseT_Full); phylink_set(mask, 2500baseX_Full);break ;default :
Signature · 1 line
2.19.2
PATCH v2 7/7 net: phy: marvell10g: add support for the 88x2110 PHY
In reply to Maxime ChevallierThis patch adds support for the 88x2110 PHY, which is similar to the already supported 88x3310 PHY without the SFP interface.
It supports 10/100/1000BASET along with 2.5GBASET, 5GBASET and 10GBASET, with the same interface modes that are used by the 3310.
This PHY don't have the same issue as the 88x3310 regarding 2.5/5G abilities, and correctly follows the 802.3bz standard to list the supported abilities.
--- drivers/net/phy/marvell10g.c | 13 +++++++++++++ include/linux/marvell_phy.h | 1 + 2 files changed, 14 insertions(+)
drivers/net/phy/marvell10g.c +13 -0
@@ -478,12 +478,25 @@ static struct phy_driver mv3310_drivers[] = { .aneg_done = mv3310_aneg_done, .read_status = mv3310_read_status, }, + { + .phy_id = MARVELL_PHY_ID_88E2110, + .phy_id_mask = MARVELL_PHY_ID_MASK, + .name = "mv88x2110", + .features = PHY_10GBIT_FEATURES, + .probe = mv3310_probe, + .soft_reset = gen10g_no_soft_reset, + .config_init = mv3310_config_init, + .config_aneg = mv3310_config_aneg, + .aneg_done = mv3310_aneg_done, + .read_status = mv3310_read_status, + }, };module_phy_driver (mv3310_drivers);static struct mdio_device_id __maybe_unused mv3310_tbl[] = { {MARVELL_PHY_ID_88X3310 ,MARVELL_PHY_ID_MASK }, + {MARVELL_PHY_ID_88E2110 ,MARVELL_PHY_ID_MASK }, { }, };MODULE_DEVICE_TABLE (mdio, mv3310_tbl);
include/linux/marvell_phy.h +1 -0
@@ -21,6 +21,7 @@#define MARVELL_PHY_ID_88E1545 0x01410ea0#define MARVELL_PHY_ID_88E3016 0x01410e60#define MARVELL_PHY_ID_88X3310 0x002b09a0 +#define MARVELL_PHY_ID_88E2110 0x002b09b0/* The MV88e6390 Ethernet switch contains embedded PHYs. These PHYs do * not have a model ID. So the switch driver traps reads to the ID2
Signature · 1 line
2.19.2
Re: [PATCH net-next v2 7/7] net: phy: marvell10g: add support for the 88x2110 PHY
Quoted 6 lines · Maxime Chevallier
This patch adds support for the 88x2110 PHY, which is similar to the already supported 88x3310 PHY without the SFP interface.
It supports 10/100/1000BASET along with 2.5GBASET, 5GBASET and 10GBASET, with the same interface modes that are used by the 3310.
Quoted 6 lines
This PHY don't have the same issue as the 88x3310 regarding 2.5/5G abilities, and correctly follows the 802.3bz standard to list the supported abilities.
Signed-off-by Maxime Chevallier <[email protected]>Suggested-by Antoine Tenart <[email protected]>
Andrew
David Miller
maintainerFrom: Maxime Chevallier <[email protected]>
Date: Sat, 23 Feb 2019 00:37:37 +0100
Quoted 18 lines
This series adds the missing bits necessary to fully support 2.5GBaseT in the Marvell Alaska PHYs.
The main points for that support are :
- Making use of the .get_features call, recently introduced by Heiner and Andrew, that allows having a fully populated list of supported modes, including 2500BaseT.
- Configuring the MII to 2500BaseX when establishing a link at 2.5G
- Adding a small quirk to take into account the fact that some PHYs in the family won't report the correct supported abilities
The rest of the series consists of small cosmetic improvements such as using the correct helper to set a linkmode bit and adding macros for the PHY ids.
Quoted 5 lines
We also add support for the 88E2110 PHY, which doesn't require the quirk, and support for 2500BaseT in the PPv2 driver, in order to have a fully working setup on the MacchiatoBin board.
Changes since V1 : Fixed formatting issue in patch 01, rebased.
Series applied, thank you.