From: Vladimir Oltean Date: Sun, 29 Mar 2020 21:01:34 +0000 (+0300) Subject: net: phy: mscc: configure in-band auto-negotiation for VSC8514 X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~46 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=51433f05002274ee09632f293a6972c86dc03194;p=linux.git net: phy: mscc: configure in-band auto-negotiation for VSC8514 Add the in-band configuration knob for the VSC8514 quad PHY. Tested with QSGMII in-band AN both on and off on NXP LS1028A-RDB and T1040-RDB. Signed-off-by: Vladimir Oltean --- diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h index c2023f93c0b2..8091f79afe78 100644 --- a/drivers/net/phy/mscc/mscc.h +++ b/drivers/net/phy/mscc/mscc.h @@ -191,6 +191,8 @@ enum rgmii_clock_delay { #define MSCC_PHY_EXTENDED_INT_MS_EGR BIT(9) /* Extended Page 3 Registers */ +#define MSCC_PHY_SERDES_PCS_CTRL 16 +#define MSCC_PHY_SERDES_ANEG BIT(7) #define MSCC_PHY_SERDES_TX_VALID_CNT 21 #define MSCC_PHY_SERDES_TX_CRC_ERR_CNT 22 #define MSCC_PHY_SERDES_RX_VALID_CNT 28 diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c index 41a410124437..c5ce79537e20 100644 --- a/drivers/net/phy/mscc/mscc_main.c +++ b/drivers/net/phy/mscc/mscc_main.c @@ -2076,6 +2076,18 @@ static int vsc85xx_read_status(struct phy_device *phydev) return genphy_read_status(phydev); } +static int vsc8514_config_inband_aneg(struct phy_device *phydev, bool enabled) +{ + int reg_val = 0; + + if (enabled) + reg_val = MSCC_PHY_SERDES_ANEG; + + return phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_3, + MSCC_PHY_SERDES_PCS_CTRL, MSCC_PHY_SERDES_ANEG, + reg_val); +} + static int vsc8514_probe(struct phy_device *phydev) { struct vsc8531_private *vsc8531; @@ -2267,6 +2279,7 @@ static struct phy_driver vsc85xx_driver[] = { .phy_id_mask = 0xfffffff0, .soft_reset = &genphy_soft_reset, .config_init = &vsc8514_config_init, + .config_inband_aneg = vsc8514_config_inband_aneg, .config_aneg = &vsc85xx_config_aneg, .read_status = &vsc85xx_read_status, .ack_interrupt = &vsc85xx_ack_interrupt,