|
@@ -11013,14 +11013,19 @@ out:
|
|
|
static int tg3_test_loopback(struct tg3 *tp)
|
|
|
{
|
|
|
int err = 0;
|
|
|
- u32 cpmuctrl = 0;
|
|
|
+ u32 eee_cap, cpmuctrl = 0;
|
|
|
|
|
|
if (!netif_running(tp->dev))
|
|
|
return TG3_LOOPBACK_FAILED;
|
|
|
|
|
|
+ eee_cap = tp->phy_flags & TG3_PHYFLG_EEE_CAP;
|
|
|
+ tp->phy_flags &= ~TG3_PHYFLG_EEE_CAP;
|
|
|
+
|
|
|
err = tg3_reset_hw(tp, 1);
|
|
|
- if (err)
|
|
|
- return TG3_LOOPBACK_FAILED;
|
|
|
+ if (err) {
|
|
|
+ err = TG3_LOOPBACK_FAILED;
|
|
|
+ goto done;
|
|
|
+ }
|
|
|
|
|
|
/* Turn off gphy autopowerdown. */
|
|
|
if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
|
|
@@ -11040,8 +11045,10 @@ static int tg3_test_loopback(struct tg3 *tp)
|
|
|
udelay(10);
|
|
|
}
|
|
|
|
|
|
- if (status != CPMU_MUTEX_GNT_DRIVER)
|
|
|
- return TG3_LOOPBACK_FAILED;
|
|
|
+ if (status != CPMU_MUTEX_GNT_DRIVER) {
|
|
|
+ err = TG3_LOOPBACK_FAILED;
|
|
|
+ goto done;
|
|
|
+ }
|
|
|
|
|
|
/* Turn off link-based power management. */
|
|
|
cpmuctrl = tr32(TG3_CPMU_CTRL);
|
|
@@ -11070,6 +11077,9 @@ static int tg3_test_loopback(struct tg3 *tp)
|
|
|
if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
|
|
|
tg3_phy_toggle_apd(tp, true);
|
|
|
|
|
|
+done:
|
|
|
+ tp->phy_flags |= eee_cap;
|
|
|
+
|
|
|
return err;
|
|
|
}
|
|
|
|