diff options
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 72 |
1 files changed, 30 insertions, 42 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 964c09644832..0b5358072172 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,40 +497,33 @@ 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 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); |
501 | tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off); | 501 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); |
502 | tw32_f(TG3PCI_MEM_WIN_DATA, val); | ||
503 | 502 | ||
504 | /* Always leave this as zero. */ | 503 | /* Always leave this as zero. */ |
505 | tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 504 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); |
506 | } else { | ||
507 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); | ||
508 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); | ||
509 | |||
510 | /* Always leave this as zero. */ | ||
511 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); | ||
512 | } | ||
513 | spin_unlock_irqrestore(&tp->indirect_lock, flags); | 505 | spin_unlock_irqrestore(&tp->indirect_lock, flags); |
514 | } | 506 | } |
515 | 507 | ||
508 | static void tg3_write_mem_fast(struct tg3 *tp, u32 off, u32 val) | ||
509 | { | ||
510 | /* If no workaround is needed, write to mem space directly */ | ||
511 | if (tp->write32 != tg3_write_indirect_reg32) | ||
512 | tw32(NIC_SRAM_WIN_BASE + off, val); | ||
513 | else | ||
514 | tg3_write_mem(tp, off, val); | ||
515 | } | ||
516 | |||
516 | static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) | 517 | static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) |
517 | { | 518 | { |
518 | unsigned long flags; | 519 | unsigned long flags; |
519 | 520 | ||
520 | spin_lock_irqsave(&tp->indirect_lock, flags); | 521 | spin_lock_irqsave(&tp->indirect_lock, flags); |
521 | if (tp->write32 != tg3_write_indirect_reg32) { | 522 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); |
522 | tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off); | 523 | pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); |
523 | *val = tr32(TG3PCI_MEM_WIN_DATA); | ||
524 | 524 | ||
525 | /* Always leave this as zero. */ | 525 | /* Always leave this as zero. */ |
526 | tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 526 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); |
527 | } else { | ||
528 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); | ||
529 | pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); | ||
530 | |||
531 | /* Always leave this as zero. */ | ||
532 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); | ||
533 | } | ||
534 | spin_unlock_irqrestore(&tp->indirect_lock, flags); | 527 | spin_unlock_irqrestore(&tp->indirect_lock, flags); |
535 | } | 528 | } |
536 | 529 | ||
@@ -1374,12 +1367,12 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1374 | } | 1367 | } |
1375 | } | 1368 | } |
1376 | 1369 | ||
1377 | tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN); | ||
1378 | |||
1379 | /* Finally, set the new power state. */ | 1370 | /* Finally, set the new power state. */ |
1380 | pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control); | 1371 | pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control); |
1381 | udelay(100); /* Delay after power state change */ | 1372 | udelay(100); /* Delay after power state change */ |
1382 | 1373 | ||
1374 | tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN); | ||
1375 | |||
1383 | return 0; | 1376 | return 0; |
1384 | } | 1377 | } |
1385 | 1378 | ||
@@ -2966,9 +2959,7 @@ static void tg3_tx(struct tg3 *tp) | |||
2966 | struct sk_buff *skb = ri->skb; | 2959 | struct sk_buff *skb = ri->skb; |
2967 | int i; | 2960 | int i; |
2968 | 2961 | ||
2969 | if (unlikely(skb == NULL)) | 2962 | BUG_ON(skb == NULL); |
2970 | BUG(); | ||
2971 | |||
2972 | pci_unmap_single(tp->pdev, | 2963 | pci_unmap_single(tp->pdev, |
2973 | pci_unmap_addr(ri, mapping), | 2964 | pci_unmap_addr(ri, mapping), |
2974 | skb_headlen(skb), | 2965 | skb_headlen(skb), |
@@ -2979,12 +2970,10 @@ static void tg3_tx(struct tg3 *tp) | |||
2979 | sw_idx = NEXT_TX(sw_idx); | 2970 | sw_idx = NEXT_TX(sw_idx); |
2980 | 2971 | ||
2981 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 2972 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
2982 | if (unlikely(sw_idx == hw_idx)) | 2973 | BUG_ON(sw_idx == hw_idx); |
2983 | BUG(); | ||
2984 | 2974 | ||
2985 | ri = &tp->tx_buffers[sw_idx]; | 2975 | ri = &tp->tx_buffers[sw_idx]; |
2986 | if (unlikely(ri->skb != NULL)) | 2976 | BUG_ON(ri->skb != NULL); |
2987 | BUG(); | ||
2988 | 2977 | ||
2989 | pci_unmap_page(tp->pdev, | 2978 | pci_unmap_page(tp->pdev, |
2990 | pci_unmap_addr(ri, mapping), | 2979 | pci_unmap_addr(ri, mapping), |
@@ -4935,9 +4924,8 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset) | |||
4935 | { | 4924 | { |
4936 | int i; | 4925 | int i; |
4937 | 4926 | ||
4938 | if (offset == TX_CPU_BASE && | 4927 | BUG_ON(offset == TX_CPU_BASE && |
4939 | (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) | 4928 | (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)); |
4940 | BUG(); | ||
4941 | 4929 | ||
4942 | if (offset == RX_CPU_BASE) { | 4930 | if (offset == RX_CPU_BASE) { |
4943 | for (i = 0; i < 10000; i++) { | 4931 | for (i = 0; i < 10000; i++) { |
@@ -6547,11 +6535,11 @@ static void tg3_timer(unsigned long __opaque) | |||
6547 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { | 6535 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { |
6548 | u32 val; | 6536 | u32 val; |
6549 | 6537 | ||
6550 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, | 6538 | tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_MBOX, |
6551 | FWCMD_NICDRV_ALIVE2); | 6539 | FWCMD_NICDRV_ALIVE2); |
6552 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); | 6540 | tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); |
6553 | /* 5 seconds timeout */ | 6541 | /* 5 seconds timeout */ |
6554 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); | 6542 | tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); |
6555 | val = tr32(GRC_RX_CPU_EVENT); | 6543 | val = tr32(GRC_RX_CPU_EVENT); |
6556 | val |= (1 << 14); | 6544 | val |= (1 << 14); |
6557 | tw32(GRC_RX_CPU_EVENT, val); | 6545 | tw32(GRC_RX_CPU_EVENT, val); |