net: phy: marvell10g: Fix Multi-G advertisement to only advertise 10G [Linux 5.0]

net: phy: marvell10g: Fix Multi-G advertisement to only advertise 10G [Linux 5.0]

This Linux kernel change "net: phy: marvell10g: Fix Multi-G advertisement to only advertise 10G" is included in the Linux 5.0 release. This change is authored by Maxime Chevallier <maxime.chevallier [at] bootlin.com> on Thu Feb 21 17:54:11 2019 +0100. The commit for this change in Linux stable tree is 61a65d3 (patch).

net: phy: marvell10g: Fix Multi-G advertisement to only advertise 10G

Some Marvell Alaska PHYs support 2.5G, 5G and 10G BaseT links. Their
default behaviour is to advertise all of these modes, but at the moment,
only 10GBaseT is supported. To prevent link partners from establishing
link at that speed, clear these modes upon configuring aneg parameters.

Fixes: 20b2af32ff3f ("net: phy: add Marvell Alaska X 88X3310 10Gigabit PHY support")
Signed-off-by: Maxime Chevallier <[email protected]>
Reported-by: Russell King <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/phy/marvell10g.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 82ab6ed..6bac602 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -26,6 +26,8 @@
 #include <linux/marvell_phy.h>
 #include <linux/phy.h>

+#define MDIO_AN_10GBT_CTRL_ADV_NBT_MASK    0x01e0
+
 enum {
    MV_PCS_BASE_T       = 0x0000,
    MV_PCS_BASE_R       = 0x1000,
@@ -386,8 +388,10 @@ static int mv3310_config_aneg(struct phy_device *phydev)
    else
        reg = 0;

+   /* Make sure we clear unsupported 2.5G/5G advertising */
    ret = mv3310_modify(phydev, MDIO_MMD_AN, MDIO_AN_10GBT_CTRL,
-               MDIO_AN_10GBT_CTRL_ADV10G, reg);
+               MDIO_AN_10GBT_CTRL_ADV10G |
+               MDIO_AN_10GBT_CTRL_ADV_NBT_MASK, reg);
    if (ret < 0)
        return ret;
    if (ret > 0)

Leave a Reply

Your email address will not be published. Required fields are marked *