diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-05-19 08:12:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-19 18:00:00 -0400 |
commit | b0c5943f1ca4df6c1c451ef6be5287a161d29a9d (patch) | |
tree | 61502760b9cb0334e96528765b61a32a96bf5a5f | |
parent | 108a6c1655f184c9abb7b5917838a8fb204361f5 (diff) |
tg3: Fix EEE interoperability workaround
Commit 21a00ab270f95d32e502d92f166dd75c518d3c5f, entitled
"tg3: Fix EEE interoperability issue", added an EEE interoperability
fix. We found that the fix doesn't work if applied too early though.
This patch delays the fix until right before allowing LPI assertion.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/tg3.c | 41 | ||||
-rw-r--r-- | drivers/net/tg3.h | 2 |
2 files changed, 22 insertions, 21 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 6c53e2c4aa7c..695dab274d1e 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -1822,22 +1822,9 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) | |||
1822 | tg3_phy_cl45_read(tp, MDIO_MMD_AN, | 1822 | tg3_phy_cl45_read(tp, MDIO_MMD_AN, |
1823 | TG3_CL45_D7_EEERES_STAT, &val); | 1823 | TG3_CL45_D7_EEERES_STAT, &val); |
1824 | 1824 | ||
1825 | switch (val) { | 1825 | if (val == TG3_CL45_D7_EEERES_STAT_LP_1000T || |
1826 | case TG3_CL45_D7_EEERES_STAT_LP_1000T: | 1826 | val == TG3_CL45_D7_EEERES_STAT_LP_100TX) |
1827 | switch (GET_ASIC_REV(tp->pci_chip_rev_id)) { | ||
1828 | case ASIC_REV_5717: | ||
1829 | case ASIC_REV_5719: | ||
1830 | case ASIC_REV_57765: | ||
1831 | if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { | ||
1832 | tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, | ||
1833 | 0x0000); | ||
1834 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | ||
1835 | } | ||
1836 | } | ||
1837 | /* Fallthrough */ | ||
1838 | case TG3_CL45_D7_EEERES_STAT_LP_100TX: | ||
1839 | tp->setlpicnt = 2; | 1827 | tp->setlpicnt = 2; |
1840 | } | ||
1841 | } | 1828 | } |
1842 | 1829 | ||
1843 | if (!tp->setlpicnt) { | 1830 | if (!tp->setlpicnt) { |
@@ -1846,6 +1833,23 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) | |||
1846 | } | 1833 | } |
1847 | } | 1834 | } |
1848 | 1835 | ||
1836 | static void tg3_phy_eee_enable(struct tg3 *tp) | ||
1837 | { | ||
1838 | u32 val; | ||
1839 | |||
1840 | if (tp->link_config.active_speed == SPEED_1000 && | ||
1841 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || | ||
1842 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || | ||
1843 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) && | ||
1844 | !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { | ||
1845 | tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0003); | ||
1846 | TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); | ||
1847 | } | ||
1848 | |||
1849 | val = tr32(TG3_CPMU_EEE_MODE); | ||
1850 | tw32(TG3_CPMU_EEE_MODE, val | TG3_CPMU_EEEMD_LPI_ENABLE); | ||
1851 | } | ||
1852 | |||
1849 | static int tg3_wait_macro_done(struct tg3 *tp) | 1853 | static int tg3_wait_macro_done(struct tg3 *tp) |
1850 | { | 1854 | { |
1851 | int limit = 100; | 1855 | int limit = 100; |
@@ -8844,11 +8848,8 @@ static void tg3_timer(unsigned long __opaque) | |||
8844 | if (tg3_flag(tp, 5705_PLUS)) | 8848 | if (tg3_flag(tp, 5705_PLUS)) |
8845 | tg3_periodic_fetch_stats(tp); | 8849 | tg3_periodic_fetch_stats(tp); |
8846 | 8850 | ||
8847 | if (tp->setlpicnt && !--tp->setlpicnt) { | 8851 | if (tp->setlpicnt && !--tp->setlpicnt) |
8848 | u32 val = tr32(TG3_CPMU_EEE_MODE); | 8852 | tg3_phy_eee_enable(tp); |
8849 | tw32(TG3_CPMU_EEE_MODE, | ||
8850 | val | TG3_CPMU_EEEMD_LPI_ENABLE); | ||
8851 | } | ||
8852 | 8853 | ||
8853 | if (tg3_flag(tp, USE_LINKCHG_REG)) { | 8854 | if (tg3_flag(tp, USE_LINKCHG_REG)) { |
8854 | u32 mac_stat; | 8855 | u32 mac_stat; |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 330959b9cfbc..83f45bf0a08e 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2186,7 +2186,7 @@ | |||
2186 | #define MII_TG3_DSP_TAP26_OPCSINPT 0x0004 | 2186 | #define MII_TG3_DSP_TAP26_OPCSINPT 0x0004 |
2187 | #define MII_TG3_DSP_AADJ1CH0 0x001f | 2187 | #define MII_TG3_DSP_AADJ1CH0 0x001f |
2188 | #define MII_TG3_DSP_CH34TP2 0x4022 | 2188 | #define MII_TG3_DSP_CH34TP2 0x4022 |
2189 | #define MII_TG3_DSP_CH34TP2_HIBW01 0x0010 | 2189 | #define MII_TG3_DSP_CH34TP2_HIBW01 0x017b |
2190 | #define MII_TG3_DSP_AADJ1CH3 0x601f | 2190 | #define MII_TG3_DSP_AADJ1CH3 0x601f |
2191 | #define MII_TG3_DSP_AADJ1CH3_ADCCKADJ 0x0002 | 2191 | #define MII_TG3_DSP_AADJ1CH3_ADCCKADJ 0x0002 |
2192 | #define MII_TG3_DSP_EXP1_INT_STAT 0x0f01 | 2192 | #define MII_TG3_DSP_EXP1_INT_STAT 0x0f01 |