aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c94
1 files changed, 48 insertions, 46 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 964c09644832..73e271e59c6a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -69,8 +69,8 @@
69 69
70#define DRV_MODULE_NAME "tg3" 70#define DRV_MODULE_NAME "tg3"
71#define PFX DRV_MODULE_NAME ": " 71#define PFX DRV_MODULE_NAME ": "
72#define DRV_MODULE_VERSION "3.55" 72#define DRV_MODULE_VERSION "3.56"
73#define DRV_MODULE_RELDATE "Mar 27, 2006" 73#define DRV_MODULE_RELDATE "Apr 1, 2006"
74 74
75#define TG3_DEF_MAC_MODE 0 75#define TG3_DEF_MAC_MODE 0
76#define TG3_DEF_RX_MODE 0 76#define TG3_DEF_RX_MODE 0
@@ -497,18 +497,18 @@ static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
497 unsigned long flags; 497 unsigned long flags;
498 498
499 spin_lock_irqsave(&tp->indirect_lock, flags); 499 spin_lock_irqsave(&tp->indirect_lock, flags);
500 if (tp->write32 != tg3_write_indirect_reg32) { 500 if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) {
501 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off);
502 tw32_f(TG3PCI_MEM_WIN_DATA, val);
503
504 /* Always leave this as zero. */
505 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0);
506 } else {
507 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); 501 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
508 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); 502 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
509 503
510 /* Always leave this as zero. */ 504 /* Always leave this as zero. */
511 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 505 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
506 } else {
507 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off);
508 tw32_f(TG3PCI_MEM_WIN_DATA, val);
509
510 /* Always leave this as zero. */
511 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0);
512 } 512 }
513 spin_unlock_irqrestore(&tp->indirect_lock, flags); 513 spin_unlock_irqrestore(&tp->indirect_lock, flags);
514} 514}
@@ -518,18 +518,18 @@ static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
518 unsigned long flags; 518 unsigned long flags;
519 519
520 spin_lock_irqsave(&tp->indirect_lock, flags); 520 spin_lock_irqsave(&tp->indirect_lock, flags);
521 if (tp->write32 != tg3_write_indirect_reg32) { 521 if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) {
522 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off);
523 *val = tr32(TG3PCI_MEM_WIN_DATA);
524
525 /* Always leave this as zero. */
526 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0);
527 } else {
528 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); 522 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
529 pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); 523 pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
530 524
531 /* Always leave this as zero. */ 525 /* Always leave this as zero. */
532 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 526 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
527 } else {
528 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off);
529 *val = tr32(TG3PCI_MEM_WIN_DATA);
530
531 /* Always leave this as zero. */
532 tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0);
533 } 533 }
534 spin_unlock_irqrestore(&tp->indirect_lock, flags); 534 spin_unlock_irqrestore(&tp->indirect_lock, flags);
535} 535}
@@ -2966,9 +2966,7 @@ static void tg3_tx(struct tg3 *tp)
2966 struct sk_buff *skb = ri->skb; 2966 struct sk_buff *skb = ri->skb;
2967 int i; 2967 int i;
2968 2968
2969 if (unlikely(skb == NULL)) 2969 BUG_ON(skb == NULL);
2970 BUG();
2971
2972 pci_unmap_single(tp->pdev, 2970 pci_unmap_single(tp->pdev,
2973 pci_unmap_addr(ri, mapping), 2971 pci_unmap_addr(ri, mapping),
2974 skb_headlen(skb), 2972 skb_headlen(skb),
@@ -2979,12 +2977,10 @@ static void tg3_tx(struct tg3 *tp)
2979 sw_idx = NEXT_TX(sw_idx); 2977 sw_idx = NEXT_TX(sw_idx);
2980 2978
2981 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 2979 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
2982 if (unlikely(sw_idx == hw_idx)) 2980 BUG_ON(sw_idx == hw_idx);
2983 BUG();
2984 2981
2985 ri = &tp->tx_buffers[sw_idx]; 2982 ri = &tp->tx_buffers[sw_idx];
2986 if (unlikely(ri->skb != NULL)) 2983 BUG_ON(ri->skb != NULL);
2987 BUG();
2988 2984
2989 pci_unmap_page(tp->pdev, 2985 pci_unmap_page(tp->pdev,
2990 pci_unmap_addr(ri, mapping), 2986 pci_unmap_addr(ri, mapping),
@@ -4935,9 +4931,8 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset)
4935{ 4931{
4936 int i; 4932 int i;
4937 4933
4938 if (offset == TX_CPU_BASE && 4934 BUG_ON(offset == TX_CPU_BASE &&
4939 (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) 4935 (tp->tg3_flags2 & TG3_FLG2_5705_PLUS));
4940 BUG();
4941 4936
4942 if (offset == RX_CPU_BASE) { 4937 if (offset == RX_CPU_BASE) {
4943 for (i = 0; i < 10000; i++) { 4938 for (i = 0; i < 10000; i++) {
@@ -5840,10 +5835,14 @@ static int tg3_reset_hw(struct tg3 *tp)
5840 GRC_MODE_NO_TX_PHDR_CSUM | 5835 GRC_MODE_NO_TX_PHDR_CSUM |
5841 GRC_MODE_NO_RX_PHDR_CSUM); 5836 GRC_MODE_NO_RX_PHDR_CSUM);
5842 tp->grc_mode |= GRC_MODE_HOST_SENDBDS; 5837 tp->grc_mode |= GRC_MODE_HOST_SENDBDS;
5843 if (tp->tg3_flags & TG3_FLAG_NO_TX_PSEUDO_CSUM) 5838
5844 tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM; 5839 /* Pseudo-header checksum is done by hardware logic and not
5845 if (tp->tg3_flags & TG3_FLAG_NO_RX_PSEUDO_CSUM) 5840 * the offload processers, so make the chip do the pseudo-
5846 tp->grc_mode |= GRC_MODE_NO_RX_PHDR_CSUM; 5841 * header checksums on receive. For transmit it is more
5842 * convenient to do the pseudo-header checksum in software
5843 * as Linux does that on transmit for us in all cases.
5844 */
5845 tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM;
5847 5846
5848 tw32(GRC_MODE, 5847 tw32(GRC_MODE,
5849 tp->grc_mode | 5848 tp->grc_mode |
@@ -8046,9 +8045,13 @@ static int tg3_test_nvram(struct tg3 *tp)
8046 for (i = 0; i < size; i++) 8045 for (i = 0; i < size; i++)
8047 csum8 += buf8[i]; 8046 csum8 += buf8[i];
8048 8047
8049 if (csum8 == 0) 8048 if (csum8 == 0) {
8050 return 0; 8049 err = 0;
8051 return -EIO; 8050 goto out;
8051 }
8052
8053 err = -EIO;
8054 goto out;
8052 } 8055 }
8053 8056
8054 /* Bootstrap checksum at offset 0x10 */ 8057 /* Bootstrap checksum at offset 0x10 */
@@ -9543,8 +9546,11 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
9543 tp->led_ctrl = LED_CTRL_MODE_PHY_1; 9546 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
9544 9547
9545 /* Do not even try poking around in here on Sun parts. */ 9548 /* Do not even try poking around in here on Sun parts. */
9546 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) 9549 if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
9550 /* All SUN chips are built-in LOMs. */
9551 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
9547 return; 9552 return;
9553 }
9548 9554
9549 tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); 9555 tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val);
9550 if (val == NIC_SRAM_DATA_SIG_MAGIC) { 9556 if (val == NIC_SRAM_DATA_SIG_MAGIC) {
@@ -9642,9 +9648,7 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
9642 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) 9648 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
9643 tp->led_ctrl = LED_CTRL_MODE_PHY_2; 9649 tp->led_ctrl = LED_CTRL_MODE_PHY_2;
9644 9650
9645 if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700) && 9651 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP)
9646 (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) &&
9647 (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP))
9648 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; 9652 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
9649 9653
9650 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { 9654 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) {
@@ -10269,6 +10273,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10269 pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd); 10273 pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd);
10270 } 10274 }
10271 10275
10276 if (tp->write32 == tg3_write_indirect_reg32 ||
10277 ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
10278 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
10279 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) ||
10280 (tp->tg3_flags2 & TG3_FLG2_SUN_570X))
10281 tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG;
10282
10272 /* Get eeprom hw config before calling tg3_set_power_state(). 10283 /* Get eeprom hw config before calling tg3_set_power_state().
10273 * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be 10284 * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be
10274 * determined before calling tg3_set_power_state() so that 10285 * determined before calling tg3_set_power_state() so that
@@ -10311,15 +10322,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10311 if (tp->pci_chip_rev_id == CHIPREV_ID_5700_B0) 10322 if (tp->pci_chip_rev_id == CHIPREV_ID_5700_B0)
10312 tp->tg3_flags |= TG3_FLAG_BROKEN_CHECKSUMS; 10323 tp->tg3_flags |= TG3_FLAG_BROKEN_CHECKSUMS;
10313 10324
10314 /* Pseudo-header checksum is done by hardware logic and not
10315 * the offload processers, so make the chip do the pseudo-
10316 * header checksums on receive. For transmit it is more
10317 * convenient to do the pseudo-header checksum in software
10318 * as Linux does that on transmit for us in all cases.
10319 */
10320 tp->tg3_flags |= TG3_FLAG_NO_TX_PSEUDO_CSUM;
10321 tp->tg3_flags &= ~TG3_FLAG_NO_RX_PSEUDO_CSUM;
10322
10323 /* Derive initial jumbo mode from MTU assigned in 10325 /* Derive initial jumbo mode from MTU assigned in
10324 * ether_setup() via the alloc_etherdev() call 10326 * ether_setup() via the alloc_etherdev() call
10325 */ 10327 */