Hi,

Florian Fainelli <[email protected]> writes:

> This function just calls into genphy_restart_aneg() to perform an
> autonegotation restart.
>
> +int phy_ethtool_nway_reset(struct net_device *ndev)
> +{
> +     struct phy_device *phydev = ndev->phydev;
> +
> +     if (!phydev)
> +             return -ENODEV;
> +
> +     return genphy_restart_aneg(phydev);
> +}

and then you're using this function as .nway_reset of all netdev drivers
in question.

genphy_restart_aneg() deals directly with MII BMCR register:

int genphy_restart_aneg(struct phy_device *phydev)
{
        int ctl = phy_read(phydev, MII_BMCR);

        if (ctl < 0)
                return ctl;

        ctl |= BMCR_ANENABLE | BMCR_ANRESTART;

        /* Don't isolate the PHY if we're negotiating */
        ctl &= ~BMCR_ISOLATE;

        return phy_write(phydev, MII_BMCR, ctl);
}

Will the above work if the PHY is something special, e.g. a "fixed"
connection, or some kind of fiber trx etc? Normally, the PHY driver
could provide its own config_aneg().
-- 
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland

Reply via email to