Commit 4217a64e authored by Michael Walle's avatar Michael Walle Committed by David S. Miller
Browse files

net: phy: introduce phydev->port



At the moment, PORT_MII is reported in the ethtool ops. This is odd
because it is an interface between the MAC and the PHY and no external
port. Some network card drivers will overwrite the port to twisted pair
or fiber, though. Even worse, the MDI/MDIX setting is only used by
ethtool if the port is twisted pair.

Set the port to PORT_TP by default because most PHY drivers are copper
ones. If there is fibre support and it is enabled, the PHY driver will
set it to PORT_FIBRE.

This will change reporting PORT_MII to either PORT_TP or PORT_FIBRE;
except for the genphy fallback driver.

Suggested-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarMichael Walle <michael@walle.cc>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e13e4536
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -410,6 +410,8 @@ static int bcm54616s_probe(struct phy_device *phydev)
		 */
		if (!(val & BCM54616S_100FX_MODE))
			phydev->dev_flags |= PHY_BCM_FLAGS_MODE_1000BX;

		phydev->port = PORT_FIBRE;
	}

	return 0;
+3 −0
Original line number Diff line number Diff line
@@ -554,6 +554,9 @@ static int dp83822_probe(struct phy_device *phydev)

	dp83822_of_init(phydev);

	if (dp83822->fx_enabled)
		phydev->port = PORT_FIBRE;

	return 0;
}

+4 −0
Original line number Diff line number Diff line
@@ -855,6 +855,10 @@ static int dp83869_probe(struct phy_device *phydev)
	if (ret)
		return ret;

	if (dp83869->mode == DP83869_RGMII_100_BASE ||
	    dp83869->mode == DP83869_RGMII_1000_BASE)
		phydev->port = PORT_FIBRE;

	return dp83869_config_init(phydev);
}

+1 −0
Original line number Diff line number Diff line
@@ -292,6 +292,7 @@ static int lxt973_probe(struct phy_device *phydev)
		phy_write(phydev, MII_BMCR, val);
		/* Remember that the port is in fiber mode. */
		phydev->priv = lxt973_probe;
		phydev->port = PORT_FIBRE;
	} else {
		phydev->priv = NULL;
	}
+1 −0
Original line number Diff line number Diff line
@@ -1552,6 +1552,7 @@ static int marvell_read_status_page(struct phy_device *phydev, int page)
	phydev->asym_pause = 0;
	phydev->speed = SPEED_UNKNOWN;
	phydev->duplex = DUPLEX_UNKNOWN;
	phydev->port = fiber ? PORT_FIBRE : PORT_TP;

	if (phydev->autoneg == AUTONEG_ENABLE)
		err = marvell_read_status_page_an(phydev, fiber, status);
Loading