aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/net/tg3.c24
-rw-r--r--drivers/net/tg3.h10
2 files changed, 34 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
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index dcdfc084966c..4d334cf5a243 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1150,6 +1150,9 @@
1150#define VCPU_STATUS_INIT_DONE 0x04000000 1150#define VCPU_STATUS_INIT_DONE 0x04000000
1151#define VCPU_STATUS_DRV_RESET 0x08000000 1151#define VCPU_STATUS_DRV_RESET 0x08000000
1152 1152
1153#define VCPU_CFGSHDW 0x00005104
1154#define VCPU_CFGSHDW_ASPM_DBNC 0x00001000
1155
1153/* Mailboxes */ 1156/* Mailboxes */
1154#define GRCMBOX_BASE 0x00005600 1157#define GRCMBOX_BASE 0x00005600
1155#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */ 1158#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */
@@ -1507,6 +1510,8 @@
1507#define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000 1510#define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000
1508#define PCIE_TRANS_CFG_LOM 0x00000020 1511#define PCIE_TRANS_CFG_LOM 0x00000020
1509 1512
1513#define PCIE_PWR_MGMT_THRESH 0x00007d28
1514#define PCIE_PWR_MGMT_L1_THRESH_MSK 0x0000ff00
1510 1515
1511#define TG3_EEPROM_MAGIC 0x669955aa 1516#define TG3_EEPROM_MAGIC 0x669955aa
1512#define TG3_EEPROM_MAGIC_FW 0xa5000000 1517#define TG3_EEPROM_MAGIC_FW 0xa5000000
@@ -1593,6 +1598,9 @@
1593#define SHASTA_EXT_LED_MAC 0x00010000 1598#define SHASTA_EXT_LED_MAC 0x00010000
1594#define SHASTA_EXT_LED_COMBO 0x00018000 1599#define SHASTA_EXT_LED_COMBO 0x00018000
1595 1600
1601#define NIC_SRAM_DATA_CFG_3 0x00000d3c
1602#define NIC_SRAM_ASPM_DEBOUNCE 0x00000002
1603
1596#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000 1604#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000
1597 1605
1598#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000 1606#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000
@@ -2200,6 +2208,7 @@ struct tg3 {
2200#define TG3_FLAG_USE_LINKCHG_REG 0x00000008 2208#define TG3_FLAG_USE_LINKCHG_REG 0x00000008
2201#define TG3_FLAG_USE_MI_INTERRUPT 0x00000010 2209#define TG3_FLAG_USE_MI_INTERRUPT 0x00000010
2202#define TG3_FLAG_ENABLE_ASF 0x00000020 2210#define TG3_FLAG_ENABLE_ASF 0x00000020
2211#define TG3_FLAG_ASPM_WORKAROUND 0x00000040
2203#define TG3_FLAG_POLL_SERDES 0x00000080 2212#define TG3_FLAG_POLL_SERDES 0x00000080
2204#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100 2213#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100
2205#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200 2214#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200
@@ -2288,6 +2297,7 @@ struct tg3 {
2288 u32 grc_local_ctrl; 2297 u32 grc_local_ctrl;
2289 u32 dma_rwctrl; 2298 u32 dma_rwctrl;
2290 u32 coalesce_mode; 2299 u32 coalesce_mode;
2300 u32 pwrmgmt_thresh;
2291 2301
2292 /* PCI block */ 2302 /* PCI block */
2293 u16 pci_chip_rev_id; 2303 u16 pci_chip_rev_id;