Message ID | 20200710143733.30751-1-dmurphy@ti.com |
---|---|
Headers | show |
Series | DP83822 Fiber enablement | expand |
> +#define MII_DP83822_FIBER_ADVERTISE (SUPPORTED_AUI | SUPPORTED_FIBRE | \ > + SUPPORTED_BNC | SUPPORTED_Pause | \ > + SUPPORTED_Asym_Pause | \ > + SUPPORTED_100baseT_Full) > + > + /* Setup fiber advertisement */ > + err = phy_modify_changed(phydev, MII_ADVERTISE, > + ADVERTISE_1000XFULL | > + ADVERTISE_1000XPAUSE | > + ADVERTISE_1000XPSE_ASYM, > + MII_DP83822_FIBER_ADVERTISE); That looks very odd. SUPPORTED_AUI #define has nothing to do with MII_ADVERTISE register. It is not a bit you can read/write in that register. Andrew
> @@ -302,6 +357,48 @@ static int dp83822_config_init(struct phy_device *phydev) > } > } > > + if (dp83822->fx_enabled) { > + err = phy_modify(phydev, MII_DP83822_CTRL_2, > + DP83822_FX_ENABLE, 1); > + if (err < 0) > + return err; > + > + linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, > + phydev->supported); > + linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, > + phydev->advertising); > + > + /* Auto neg is not supported in fiber mode */ > + bmcr = phy_read(phydev, MII_BMCR); > + if (bmcr < 0) > + return bmcr; > + > + if (bmcr & BMCR_ANENABLE) { > + err = phy_modify(phydev, MII_BMCR, BMCR_ANENABLE, 0); > + if (err < 0) > + return err; > + } > + phydev->autoneg = AUTONEG_DISABLE; You should also be removing ETHTOOL_LINK_MODE_Autoneg_BIT from phydev->supported, to make it clear autoneg is not supported. Assuming genphy_read_abilities() cannot figure this out for itself. Andrew
Andrew On 7/11/20 1:54 PM, Andrew Lunn wrote: >> @@ -302,6 +357,48 @@ static int dp83822_config_init(struct phy_device *phydev) >> } >> } >> >> + if (dp83822->fx_enabled) { >> + err = phy_modify(phydev, MII_DP83822_CTRL_2, >> + DP83822_FX_ENABLE, 1); >> + if (err < 0) >> + return err; >> + >> + linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, >> + phydev->supported); >> + linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, >> + phydev->advertising); >> + >> + /* Auto neg is not supported in fiber mode */ >> + bmcr = phy_read(phydev, MII_BMCR); >> + if (bmcr < 0) >> + return bmcr; >> + >> + if (bmcr & BMCR_ANENABLE) { >> + err = phy_modify(phydev, MII_BMCR, BMCR_ANENABLE, 0); >> + if (err < 0) >> + return err; >> + } >> + phydev->autoneg = AUTONEG_DISABLE; > You should also be removing ETHTOOL_LINK_MODE_Autoneg_BIT from > phydev->supported, to make it clear autoneg is not supported. Assuming > genphy_read_abilities() cannot figure this out for itself. In our testing we are finding that it cannot determine that for itself so I will have to clear the bit. Dan
Andrew On 7/11/20 1:45 PM, Andrew Lunn wrote: >> +#define MII_DP83822_FIBER_ADVERTISE (SUPPORTED_AUI | SUPPORTED_FIBRE | \ >> + SUPPORTED_BNC | SUPPORTED_Pause | \ >> + SUPPORTED_Asym_Pause | \ >> + SUPPORTED_100baseT_Full) >> + >> + /* Setup fiber advertisement */ >> + err = phy_modify_changed(phydev, MII_ADVERTISE, >> + ADVERTISE_1000XFULL | >> + ADVERTISE_1000XPAUSE | >> + ADVERTISE_1000XPSE_ASYM, >> + MII_DP83822_FIBER_ADVERTISE); > That looks very odd. SUPPORTED_AUI #define has nothing to do with > MII_ADVERTISE register. It is not a bit you can read/write in that > register. ACK removed the SUPPORTED_AUI. I also going to update the MII_DP83822_FIBER_ADVERTISE defines from SUPPORTED_* to ADVERTISED_* Dan > Andrew