aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-01-25 10:58:54 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-25 22:38:19 -0500
commitab78904608bd6e421b81420e4d2f7d5bae9d4660 (patch)
treea0a6029c86b8c5a37b50afea5eff95f78f7902c9 /drivers/net/tg3.c
parentaba49f2421d5287692aee961ab4ce2981fdf4939 (diff)
tg3: Disable EEE during loopback tests
EEE interferes with the hardware's ability to loop a packet back to the host. This patch disables the feature for the duration of the test. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f52466d2ece3..c333481deb1f 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -11013,14 +11013,19 @@ out:
11013static int tg3_test_loopback(struct tg3 *tp) 11013static int tg3_test_loopback(struct tg3 *tp)
11014{ 11014{
11015 int err = 0; 11015 int err = 0;
11016 u32 cpmuctrl = 0; 11016 u32 eee_cap, cpmuctrl = 0;
11017 11017
11018 if (!netif_running(tp->dev)) 11018 if (!netif_running(tp->dev))
11019 return TG3_LOOPBACK_FAILED; 11019 return TG3_LOOPBACK_FAILED;
11020 11020
11021 eee_cap = tp->phy_flags & TG3_PHYFLG_EEE_CAP;
11022 tp->phy_flags &= ~TG3_PHYFLG_EEE_CAP;
11023
11021 err = tg3_reset_hw(tp, 1); 11024 err = tg3_reset_hw(tp, 1);
11022 if (err) 11025 if (err) {
11023 return TG3_LOOPBACK_FAILED; 11026 err = TG3_LOOPBACK_FAILED;
11027 goto done;
11028 }
11024 11029
11025 /* Turn off gphy autopowerdown. */ 11030 /* Turn off gphy autopowerdown. */
11026 if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD) 11031 if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
@@ -11040,8 +11045,10 @@ static int tg3_test_loopback(struct tg3 *tp)
11040 udelay(10); 11045 udelay(10);
11041 } 11046 }
11042 11047
11043 if (status != CPMU_MUTEX_GNT_DRIVER) 11048 if (status != CPMU_MUTEX_GNT_DRIVER) {
11044 return TG3_LOOPBACK_FAILED; 11049 err = TG3_LOOPBACK_FAILED;
11050 goto done;
11051 }
11045 11052
11046 /* Turn off link-based power management. */ 11053 /* Turn off link-based power management. */
11047 cpmuctrl = tr32(TG3_CPMU_CTRL); 11054 cpmuctrl = tr32(TG3_CPMU_CTRL);
@@ -11070,6 +11077,9 @@ static int tg3_test_loopback(struct tg3 *tp)
11070 if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD) 11077 if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
11071 tg3_phy_toggle_apd(tp, true); 11078 tg3_phy_toggle_apd(tp, true);
11072 11079
11080done:
11081 tp->phy_flags |= eee_cap;
11082
11073 return err; 11083 return err;
11074} 11084}
11075 11085