aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2007-05-07 03:25:49 -0400
committerDavid S. Miller <davem@davemloft.net>2007-05-07 03:25:49 -0400
commit8ed5d97e5e0be0fb1aebad16f4c464613a0e472d (patch)
tree4088096e3fbc02e671980db1a2f26e1068dec532 /drivers/net/tg3.c
parent15700770ef7c5d12e2f1659d2ddbeb3f658d9f37 (diff)
[TG3]: Add ASPM workaround.
This patch adds workaround to fix performance problems caused by slow PCIE L1->L0 transitions on ICH8 platforms. Changed all magic numbers to constants as suggested by Jeff Garzik. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-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.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 59d6e74a4a5f..630c8a6c9f73 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -3019,6 +3019,16 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
3019 } 3019 }
3020 } 3020 }
3021 3021
3022 if (tp->tg3_flags & TG3_FLAG_ASPM_WORKAROUND) {
3023 u32 val = tr32(PCIE_PWR_MGMT_THRESH);
3024 if (!netif_carrier_ok(tp->dev))
3025 val = (val & ~PCIE_PWR_MGMT_L1_THRESH_MSK) |
3026 tp->pwrmgmt_thresh;
3027 else
3028 val |= PCIE_PWR_MGMT_L1_THRESH_MSK;
3029 tw32(PCIE_PWR_MGMT_THRESH, val);
3030 }
3031
3022 return err; 3032 return err;
3023} 3033}
3024 3034
@@ -10004,6 +10014,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10004 tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; 10014 tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT;
10005 tp->tg3_flags2 |= TG3_FLG2_IS_NIC; 10015 tp->tg3_flags2 |= TG3_FLG2_IS_NIC;
10006 } 10016 }
10017 if (tr32(VCPU_CFGSHDW) & VCPU_CFGSHDW_ASPM_DBNC)
10018 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
10007 return; 10019 return;
10008 } 10020 }
10009 10021
@@ -10131,6 +10143,14 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10131 /* bootcode if bit 18 is set */ 10143 /* bootcode if bit 18 is set */
10132 if (cfg2 & (1 << 18)) 10144 if (cfg2 & (1 << 18))
10133 tp->tg3_flags2 |= TG3_FLG2_SERDES_PREEMPHASIS; 10145 tp->tg3_flags2 |= TG3_FLG2_SERDES_PREEMPHASIS;
10146
10147 if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
10148 u32 cfg3;
10149
10150 tg3_read_mem(tp, NIC_SRAM_DATA_CFG_3, &cfg3);
10151 if (cfg3 & NIC_SRAM_ASPM_DEBOUNCE)
10152 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
10153 }
10134 } 10154 }
10135} 10155}
10136 10156
@@ -10998,6 +11018,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10998 */ 11018 */
10999 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE; 11019 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE;
11000 11020
11021 if (tp->tg3_flags & TG3_FLAG_ASPM_WORKAROUND)
11022 tp->pwrmgmt_thresh = tr32(PCIE_PWR_MGMT_THRESH) &
11023 PCIE_PWR_MGMT_L1_THRESH_MSK;
11024
11001 return err; 11025 return err;
11002} 11026}
11003 11027