@@ -60,6 +60,11 @@
/* Vitesse Extended Page Access Register */
#define MII_VSC82X4_EXT_PAGE_ACCESS 0x1f
+/* VSC73XX PHY_BYPASS_CTRL register*/
+#define MII_VSC73XX_PHY_BYPASS_CTRL MII_DCOUNTER
+#define MII_PBC_FORCED_SPEED_AUTO_MDIX_DIS BIT(7)
+#define MII_VSC73XX_PBC_AUTO_NP_EXCHANGE_DIS BIT(1)
+
/* Vitesse VSC8601 Extended PHY Control Register 1 */
#define MII_VSC8601_EPHY_CTL 0x17
#define MII_VSC8601_EPHY_CTL_RGMII_SKEW (1 << 8)
@@ -239,12 +244,20 @@ static int vsc739x_config_init(struct phy_device *phydev)
static int vsc73xx_config_aneg(struct phy_device *phydev)
{
- /* The VSC73xx switches does not like to be instructed to
- * do autonegotiation in any way, it prefers that you just go
- * with the power-on/reset defaults. Writing some registers will
- * just make autonegotiation permanently fail.
- */
- return 0;
+ int ret;
+
+ /* Enable Auto MDI-X in forced 10/100 mode */
+ if (phydev->autoneg != AUTONEG_ENABLE && phydev->speed <= SPEED_100) {
+ ret = genphy_setup_forced(phydev);
+
+ if (ret < 0) /* error */
+ return ret;
+
+ return phy_clear_bits(phydev, MII_VSC73XX_PHY_BYPASS_CTRL,
+ MII_PBC_FORCED_SPEED_AUTO_MDIX_DIS);
+ }
+
+ return genphy_config_aneg(phydev);
}
/* This adds a skew for both TX and RX clocks, so the skew should only be
When the vsc73xx mdio bus work properly, the generic autonegotiation configuration works well. Vsc73xx have auto MDI-X disabled by default in forced mode. This commit enables it. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> --- drivers/net/phy/vitesse.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)