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.c107
1 files changed, 73 insertions, 34 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 201be425643a..46a3f86125be 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
68 68
69#define DRV_MODULE_NAME "tg3" 69#define DRV_MODULE_NAME "tg3"
70#define PFX DRV_MODULE_NAME ": " 70#define PFX DRV_MODULE_NAME ": "
71#define DRV_MODULE_VERSION "3.98" 71#define DRV_MODULE_VERSION "3.99"
72#define DRV_MODULE_RELDATE "February 25, 2009" 72#define DRV_MODULE_RELDATE "April 20, 2009"
73 73
74#define TG3_DEF_MAC_MODE 0 74#define TG3_DEF_MAC_MODE 0
75#define TG3_DEF_RX_MODE 0 75#define TG3_DEF_RX_MODE 0
@@ -1950,7 +1950,8 @@ static void tg3_frob_aux_power(struct tg3 *tp)
1950 GRC_LCLCTRL_GPIO_OUTPUT0 | 1950 GRC_LCLCTRL_GPIO_OUTPUT0 |
1951 GRC_LCLCTRL_GPIO_OUTPUT1), 1951 GRC_LCLCTRL_GPIO_OUTPUT1),
1952 100); 1952 100);
1953 } else if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) { 1953 } else if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761 ||
1954 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5761S) {
1954 /* The 5761 non-e device swaps GPIO 0 and GPIO 2. */ 1955 /* The 5761 non-e device swaps GPIO 0 and GPIO 2. */
1955 u32 grc_local_ctrl = GRC_LCLCTRL_GPIO_OE0 | 1956 u32 grc_local_ctrl = GRC_LCLCTRL_GPIO_OE0 |
1956 GRC_LCLCTRL_GPIO_OE1 | 1957 GRC_LCLCTRL_GPIO_OE1 |
@@ -2455,8 +2456,6 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2455 } 2456 }
2456 } 2457 }
2457 2458
2458 __tg3_set_mac_addr(tp, 0);
2459
2460 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 2459 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
2461 u32 val; 2460 u32 val;
2462 2461
@@ -4656,6 +4655,7 @@ static int tg3_poll(struct napi_struct *napi, int budget)
4656 * so we must read it before checking for more work. 4655 * so we must read it before checking for more work.
4657 */ 4656 */
4658 tp->last_tag = sblk->status_tag; 4657 tp->last_tag = sblk->status_tag;
4658 tp->last_irq_tag = tp->last_tag;
4659 rmb(); 4659 rmb();
4660 } else 4660 } else
4661 sblk->status &= ~SD_STATUS_UPDATED; 4661 sblk->status &= ~SD_STATUS_UPDATED;
@@ -4811,7 +4811,7 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
4811 * Reading the PCI State register will confirm whether the 4811 * Reading the PCI State register will confirm whether the
4812 * interrupt is ours and will flush the status block. 4812 * interrupt is ours and will flush the status block.
4813 */ 4813 */
4814 if (unlikely(sblk->status_tag == tp->last_tag)) { 4814 if (unlikely(sblk->status_tag == tp->last_irq_tag)) {
4815 if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) || 4815 if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) ||
4816 (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { 4816 (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
4817 handled = 0; 4817 handled = 0;
@@ -4831,18 +4831,22 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
4831 * excessive spurious interrupts can be worse in some cases. 4831 * excessive spurious interrupts can be worse in some cases.
4832 */ 4832 */
4833 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); 4833 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
4834
4835 /*
4836 * In a shared interrupt configuration, sometimes other devices'
4837 * interrupts will scream. We record the current status tag here
4838 * so that the above check can report that the screaming interrupts
4839 * are unhandled. Eventually they will be silenced.
4840 */
4841 tp->last_irq_tag = sblk->status_tag;
4842
4834 if (tg3_irq_sync(tp)) 4843 if (tg3_irq_sync(tp))
4835 goto out; 4844 goto out;
4836 if (napi_schedule_prep(&tp->napi)) { 4845
4837 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); 4846 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
4838 /* Update last_tag to mark that this status has been 4847
4839 * seen. Because interrupt may be shared, we may be 4848 napi_schedule(&tp->napi);
4840 * racing with tg3_poll(), so only update last_tag 4849
4841 * if tg3_poll() is not scheduled.
4842 */
4843 tp->last_tag = sblk->status_tag;
4844 __napi_schedule(&tp->napi);
4845 }
4846out: 4850out:
4847 return IRQ_RETVAL(handled); 4851 return IRQ_RETVAL(handled);
4848} 4852}
@@ -5017,7 +5021,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
5017 /* New SKB is guaranteed to be linear. */ 5021 /* New SKB is guaranteed to be linear. */
5018 entry = *start; 5022 entry = *start;
5019 ret = skb_dma_map(&tp->pdev->dev, new_skb, DMA_TO_DEVICE); 5023 ret = skb_dma_map(&tp->pdev->dev, new_skb, DMA_TO_DEVICE);
5020 new_addr = skb_shinfo(new_skb)->dma_maps[0]; 5024 new_addr = skb_shinfo(new_skb)->dma_head;
5021 5025
5022 /* Make sure new skb does not cross any 4G boundaries. 5026 /* Make sure new skb does not cross any 4G boundaries.
5023 * Drop the packet if it does. 5027 * Drop the packet if it does.
@@ -5151,7 +5155,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5151 5155
5152 sp = skb_shinfo(skb); 5156 sp = skb_shinfo(skb);
5153 5157
5154 mapping = sp->dma_maps[0]; 5158 mapping = sp->dma_head;
5155 5159
5156 tp->tx_buffers[entry].skb = skb; 5160 tp->tx_buffers[entry].skb = skb;
5157 5161
@@ -5169,7 +5173,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5169 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 5173 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
5170 5174
5171 len = frag->size; 5175 len = frag->size;
5172 mapping = sp->dma_maps[i + 1]; 5176 mapping = sp->dma_maps[i];
5173 tp->tx_buffers[entry].skb = NULL; 5177 tp->tx_buffers[entry].skb = NULL;
5174 5178
5175 tg3_set_txd(tp, entry, mapping, len, 5179 tg3_set_txd(tp, entry, mapping, len,
@@ -5190,9 +5194,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5190 } 5194 }
5191 5195
5192out_unlock: 5196out_unlock:
5193 mmiowb(); 5197 mmiowb();
5194
5195 dev->trans_start = jiffies;
5196 5198
5197 return NETDEV_TX_OK; 5199 return NETDEV_TX_OK;
5198} 5200}
@@ -5329,7 +5331,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
5329 5331
5330 sp = skb_shinfo(skb); 5332 sp = skb_shinfo(skb);
5331 5333
5332 mapping = sp->dma_maps[0]; 5334 mapping = sp->dma_head;
5333 5335
5334 tp->tx_buffers[entry].skb = skb; 5336 tp->tx_buffers[entry].skb = skb;
5335 5337
@@ -5354,7 +5356,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
5354 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 5356 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
5355 5357
5356 len = frag->size; 5358 len = frag->size;
5357 mapping = sp->dma_maps[i + 1]; 5359 mapping = sp->dma_maps[i];
5358 5360
5359 tp->tx_buffers[entry].skb = NULL; 5361 tp->tx_buffers[entry].skb = NULL;
5360 5362
@@ -5403,9 +5405,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
5403 } 5405 }
5404 5406
5405out_unlock: 5407out_unlock:
5406 mmiowb(); 5408 mmiowb();
5407
5408 dev->trans_start = jiffies;
5409 5409
5410 return NETDEV_TX_OK; 5410 return NETDEV_TX_OK;
5411} 5411}
@@ -6156,6 +6156,7 @@ static int tg3_chip_reset(struct tg3 *tp)
6156 tp->hw_status->status_tag = 0; 6156 tp->hw_status->status_tag = 0;
6157 } 6157 }
6158 tp->last_tag = 0; 6158 tp->last_tag = 0;
6159 tp->last_irq_tag = 0;
6159 smp_mb(); 6160 smp_mb();
6160 synchronize_irq(tp->pdev->irq); 6161 synchronize_irq(tp->pdev->irq);
6161 6162
@@ -6350,6 +6351,8 @@ static int tg3_halt(struct tg3 *tp, int kind, int silent)
6350 tg3_abort_hw(tp, silent); 6351 tg3_abort_hw(tp, silent);
6351 err = tg3_chip_reset(tp); 6352 err = tg3_chip_reset(tp);
6352 6353
6354 __tg3_set_mac_addr(tp, 0);
6355
6353 tg3_write_sig_legacy(tp, kind); 6356 tg3_write_sig_legacy(tp, kind);
6354 tg3_write_sig_post_reset(tp, kind); 6357 tg3_write_sig_post_reset(tp, kind);
6355 6358
@@ -6711,6 +6714,13 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6711 tw32(TG3_CPMU_HST_ACC, val); 6714 tw32(TG3_CPMU_HST_ACC, val);
6712 } 6715 }
6713 6716
6717 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) {
6718 val = tr32(PCIE_PWR_MGMT_THRESH) & ~PCIE_PWR_MGMT_L1_THRESH_MSK;
6719 val |= PCIE_PWR_MGMT_EXT_ASPM_TMR_EN |
6720 PCIE_PWR_MGMT_L1_THRESH_4MS;
6721 tw32(PCIE_PWR_MGMT_THRESH, val);
6722 }
6723
6714 /* This works around an issue with Athlon chipsets on 6724 /* This works around an issue with Athlon chipsets on
6715 * B3 tigon3 silicon. This bit has no effect on any 6725 * B3 tigon3 silicon. This bit has no effect on any
6716 * other revision. But do not set this on PCI Express 6726 * other revision. But do not set this on PCI Express
@@ -7138,7 +7148,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7138 udelay(100); 7148 udelay(100);
7139 7149
7140 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); 7150 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0);
7141 tp->last_tag = 0;
7142 7151
7143 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 7152 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
7144 tw32_f(DMAC_MODE, DMAC_MODE_ENABLE); 7153 tw32_f(DMAC_MODE, DMAC_MODE_ENABLE);
@@ -8539,6 +8548,9 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8539 u32 i, offset, len, b_offset, b_count; 8548 u32 i, offset, len, b_offset, b_count;
8540 __be32 val; 8549 __be32 val;
8541 8550
8551 if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM)
8552 return -EINVAL;
8553
8542 if (tp->link_config.phy_is_low_power) 8554 if (tp->link_config.phy_is_low_power)
8543 return -EAGAIN; 8555 return -EAGAIN;
8544 8556
@@ -8604,7 +8616,8 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8604 if (tp->link_config.phy_is_low_power) 8616 if (tp->link_config.phy_is_low_power)
8605 return -EAGAIN; 8617 return -EAGAIN;
8606 8618
8607 if (eeprom->magic != TG3_EEPROM_MAGIC) 8619 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
8620 eeprom->magic != TG3_EEPROM_MAGIC)
8608 return -EINVAL; 8621 return -EINVAL;
8609 8622
8610 offset = eeprom->offset; 8623 offset = eeprom->offset;
@@ -9201,6 +9214,9 @@ static int tg3_test_nvram(struct tg3 *tp)
9201 __be32 *buf; 9214 __be32 *buf;
9202 int i, j, k, err = 0, size; 9215 int i, j, k, err = 0, size;
9203 9216
9217 if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM)
9218 return 0;
9219
9204 if (tg3_nvram_read(tp, 0, &magic) != 0) 9220 if (tg3_nvram_read(tp, 0, &magic) != 0)
9205 return -EIO; 9221 return -EIO;
9206 9222
@@ -10183,7 +10199,8 @@ static void __devinit tg3_get_nvram_size(struct tg3 *tp)
10183{ 10199{
10184 u32 val; 10200 u32 val;
10185 10201
10186 if (tg3_nvram_read(tp, 0, &val) != 0) 10202 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
10203 tg3_nvram_read(tp, 0, &val) != 0)
10187 return; 10204 return;
10188 10205
10189 /* Selfboot format */ 10206 /* Selfboot format */
@@ -10565,6 +10582,7 @@ static void __devinit tg3_get_57780_nvram_info(struct tg3 *tp)
10565 } 10582 }
10566 break; 10583 break;
10567 default: 10584 default:
10585 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM;
10568 return; 10586 return;
10569 } 10587 }
10570 10588
@@ -11365,7 +11383,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
11365 unsigned int i; 11383 unsigned int i;
11366 u32 magic; 11384 u32 magic;
11367 11385
11368 if (tg3_nvram_read(tp, 0x0, &magic)) 11386 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
11387 tg3_nvram_read(tp, 0x0, &magic))
11369 goto out_not_found; 11388 goto out_not_found;
11370 11389
11371 if (magic == TG3_EEPROM_MAGIC) { 11390 if (magic == TG3_EEPROM_MAGIC) {
@@ -11457,6 +11476,15 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
11457out_not_found: 11476out_not_found:
11458 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) 11477 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
11459 strcpy(tp->board_part_number, "BCM95906"); 11478 strcpy(tp->board_part_number, "BCM95906");
11479 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 &&
11480 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57780)
11481 strcpy(tp->board_part_number, "BCM57780");
11482 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 &&
11483 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57760)
11484 strcpy(tp->board_part_number, "BCM57760");
11485 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 &&
11486 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57790)
11487 strcpy(tp->board_part_number, "BCM57790");
11460 else 11488 else
11461 strcpy(tp->board_part_number, "none"); 11489 strcpy(tp->board_part_number, "none");
11462} 11490}
@@ -11667,6 +11695,14 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
11667{ 11695{
11668 u32 val; 11696 u32 val;
11669 11697
11698 if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) {
11699 tp->fw_ver[0] = 's';
11700 tp->fw_ver[1] = 'b';
11701 tp->fw_ver[2] = '\0';
11702
11703 return;
11704 }
11705
11670 if (tg3_nvram_read(tp, 0, &val)) 11706 if (tg3_nvram_read(tp, 0, &val))
11671 return; 11707 return;
11672 11708
@@ -11952,7 +11988,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11952 tp->tg3_flags2 &= ~TG3_FLG2_HW_TSO_2; 11988 tp->tg3_flags2 &= ~TG3_FLG2_HW_TSO_2;
11953 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || 11989 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
11954 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || 11990 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
11955 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) 11991 tp->pci_chip_rev_id == CHIPREV_ID_57780_A0 ||
11992 tp->pci_chip_rev_id == CHIPREV_ID_57780_A1)
11956 tp->tg3_flags3 |= TG3_FLG3_CLKREQ_BUG; 11993 tp->tg3_flags3 |= TG3_FLG3_CLKREQ_BUG;
11957 } 11994 }
11958 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) { 11995 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) {
@@ -12144,7 +12181,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12144 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) 12181 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
12145 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; 12182 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL;
12146 12183
12147 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) { 12184 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761 ||
12185 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5761S) {
12148 /* Turn off the debug UART. */ 12186 /* Turn off the debug UART. */
12149 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; 12187 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL;
12150 if (tp->tg3_flags2 & TG3_FLG2_IS_NIC) 12188 if (tp->tg3_flags2 & TG3_FLG2_IS_NIC)
@@ -12454,7 +12492,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
12454 } 12492 }
12455 if (!addr_ok) { 12493 if (!addr_ok) {
12456 /* Next, try NVRAM. */ 12494 /* Next, try NVRAM. */
12457 if (!tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && 12495 if (!(tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) &&
12496 !tg3_nvram_read_be32(tp, mac_offset + 0, &hi) &&
12458 !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { 12497 !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) {
12459 memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2); 12498 memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2);
12460 memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo)); 12499 memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo));