Commit ed1ff5c3 authored by Nithin Sujir's avatar Nithin Sujir Committed by David S. Miller

tg3: Reset the phy to allow modified EEE settings to take effect

When LFA is enabled, we don't reset the phy. But EEE settings changes
don't take effect until the phy is reset. Add a phy reset when we detect
a changed EEE setting.
Signed-off-by: default avatarNithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdad8de4
...@@ -4491,6 +4491,32 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp) ...@@ -4491,6 +4491,32 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp)
return err; return err;
} }
static bool tg3_phy_eee_config_ok(struct tg3 *tp)
{
u32 val;
u32 tgtadv = 0;
u32 advertising = tp->link_config.advertising;
if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP))
return true;
if (tg3_phy_cl45_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, &val))
return false;
val &= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
if (advertising & ADVERTISED_100baseT_Full)
tgtadv |= MDIO_AN_EEE_ADV_100TX;
if (advertising & ADVERTISED_1000baseT_Full)
tgtadv |= MDIO_AN_EEE_ADV_1000T;
if (val != tgtadv)
return false;
return true;
}
static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv) static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv)
{ {
u32 advmsk, tgtadv, advertising; u32 advmsk, tgtadv, advertising;
...@@ -4739,10 +4765,22 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) ...@@ -4739,10 +4765,22 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
tp->link_config.active_duplex = current_duplex; tp->link_config.active_duplex = current_duplex;
if (tp->link_config.autoneg == AUTONEG_ENABLE) { if (tp->link_config.autoneg == AUTONEG_ENABLE) {
bool eee_config_ok = tg3_phy_eee_config_ok(tp);
if ((bmcr & BMCR_ANENABLE) && if ((bmcr & BMCR_ANENABLE) &&
eee_config_ok &&
tg3_phy_copper_an_config_ok(tp, &lcl_adv) && tg3_phy_copper_an_config_ok(tp, &lcl_adv) &&
tg3_phy_copper_fetch_rmtadv(tp, &rmt_adv)) tg3_phy_copper_fetch_rmtadv(tp, &rmt_adv))
current_link_up = 1; current_link_up = 1;
/* EEE settings changes take effect only after a phy
* reset. If we have skipped a reset due to Link Flap
* Avoidance being enabled, do it now.
*/
if (!eee_config_ok &&
(tp->phy_flags & TG3_PHYFLG_KEEP_LINK_ON_PWRDN) &&
!force_reset)
tg3_phy_reset(tp);
} else { } else {
if (!(bmcr & BMCR_ANENABLE) && if (!(bmcr & BMCR_ANENABLE) &&
tp->link_config.speed == current_speed && tp->link_config.speed == current_speed &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment