diff options
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 89 |
1 files changed, 66 insertions, 23 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 201be425643a..eb65e25989f3 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 | } | ||
4846 | out: | 4850 | out: |
4847 | return IRQ_RETVAL(handled); | 4851 | return IRQ_RETVAL(handled); |
4848 | } | 4852 | } |
@@ -6156,6 +6160,7 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
6156 | tp->hw_status->status_tag = 0; | 6160 | tp->hw_status->status_tag = 0; |
6157 | } | 6161 | } |
6158 | tp->last_tag = 0; | 6162 | tp->last_tag = 0; |
6163 | tp->last_irq_tag = 0; | ||
6159 | smp_mb(); | 6164 | smp_mb(); |
6160 | synchronize_irq(tp->pdev->irq); | 6165 | synchronize_irq(tp->pdev->irq); |
6161 | 6166 | ||
@@ -6350,6 +6355,8 @@ static int tg3_halt(struct tg3 *tp, int kind, int silent) | |||
6350 | tg3_abort_hw(tp, silent); | 6355 | tg3_abort_hw(tp, silent); |
6351 | err = tg3_chip_reset(tp); | 6356 | err = tg3_chip_reset(tp); |
6352 | 6357 | ||
6358 | __tg3_set_mac_addr(tp, 0); | ||
6359 | |||
6353 | tg3_write_sig_legacy(tp, kind); | 6360 | tg3_write_sig_legacy(tp, kind); |
6354 | tg3_write_sig_post_reset(tp, kind); | 6361 | tg3_write_sig_post_reset(tp, kind); |
6355 | 6362 | ||
@@ -6711,6 +6718,13 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6711 | tw32(TG3_CPMU_HST_ACC, val); | 6718 | tw32(TG3_CPMU_HST_ACC, val); |
6712 | } | 6719 | } |
6713 | 6720 | ||
6721 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) { | ||
6722 | val = tr32(PCIE_PWR_MGMT_THRESH) & ~PCIE_PWR_MGMT_L1_THRESH_MSK; | ||
6723 | val |= PCIE_PWR_MGMT_EXT_ASPM_TMR_EN | | ||
6724 | PCIE_PWR_MGMT_L1_THRESH_4MS; | ||
6725 | tw32(PCIE_PWR_MGMT_THRESH, val); | ||
6726 | } | ||
6727 | |||
6714 | /* This works around an issue with Athlon chipsets on | 6728 | /* This works around an issue with Athlon chipsets on |
6715 | * B3 tigon3 silicon. This bit has no effect on any | 6729 | * B3 tigon3 silicon. This bit has no effect on any |
6716 | * other revision. But do not set this on PCI Express | 6730 | * other revision. But do not set this on PCI Express |
@@ -7138,7 +7152,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
7138 | udelay(100); | 7152 | udelay(100); |
7139 | 7153 | ||
7140 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); | 7154 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0); |
7141 | tp->last_tag = 0; | ||
7142 | 7155 | ||
7143 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | 7156 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { |
7144 | tw32_f(DMAC_MODE, DMAC_MODE_ENABLE); | 7157 | tw32_f(DMAC_MODE, DMAC_MODE_ENABLE); |
@@ -8539,6 +8552,9 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8539 | u32 i, offset, len, b_offset, b_count; | 8552 | u32 i, offset, len, b_offset, b_count; |
8540 | __be32 val; | 8553 | __be32 val; |
8541 | 8554 | ||
8555 | if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) | ||
8556 | return -EINVAL; | ||
8557 | |||
8542 | if (tp->link_config.phy_is_low_power) | 8558 | if (tp->link_config.phy_is_low_power) |
8543 | return -EAGAIN; | 8559 | return -EAGAIN; |
8544 | 8560 | ||
@@ -8604,7 +8620,8 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8604 | if (tp->link_config.phy_is_low_power) | 8620 | if (tp->link_config.phy_is_low_power) |
8605 | return -EAGAIN; | 8621 | return -EAGAIN; |
8606 | 8622 | ||
8607 | if (eeprom->magic != TG3_EEPROM_MAGIC) | 8623 | if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || |
8624 | eeprom->magic != TG3_EEPROM_MAGIC) | ||
8608 | return -EINVAL; | 8625 | return -EINVAL; |
8609 | 8626 | ||
8610 | offset = eeprom->offset; | 8627 | offset = eeprom->offset; |
@@ -9201,6 +9218,9 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
9201 | __be32 *buf; | 9218 | __be32 *buf; |
9202 | int i, j, k, err = 0, size; | 9219 | int i, j, k, err = 0, size; |
9203 | 9220 | ||
9221 | if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) | ||
9222 | return 0; | ||
9223 | |||
9204 | if (tg3_nvram_read(tp, 0, &magic) != 0) | 9224 | if (tg3_nvram_read(tp, 0, &magic) != 0) |
9205 | return -EIO; | 9225 | return -EIO; |
9206 | 9226 | ||
@@ -10183,7 +10203,8 @@ static void __devinit tg3_get_nvram_size(struct tg3 *tp) | |||
10183 | { | 10203 | { |
10184 | u32 val; | 10204 | u32 val; |
10185 | 10205 | ||
10186 | if (tg3_nvram_read(tp, 0, &val) != 0) | 10206 | if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || |
10207 | tg3_nvram_read(tp, 0, &val) != 0) | ||
10187 | return; | 10208 | return; |
10188 | 10209 | ||
10189 | /* Selfboot format */ | 10210 | /* Selfboot format */ |
@@ -10565,6 +10586,7 @@ static void __devinit tg3_get_57780_nvram_info(struct tg3 *tp) | |||
10565 | } | 10586 | } |
10566 | break; | 10587 | break; |
10567 | default: | 10588 | default: |
10589 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM; | ||
10568 | return; | 10590 | return; |
10569 | } | 10591 | } |
10570 | 10592 | ||
@@ -11365,7 +11387,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
11365 | unsigned int i; | 11387 | unsigned int i; |
11366 | u32 magic; | 11388 | u32 magic; |
11367 | 11389 | ||
11368 | if (tg3_nvram_read(tp, 0x0, &magic)) | 11390 | if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || |
11391 | tg3_nvram_read(tp, 0x0, &magic)) | ||
11369 | goto out_not_found; | 11392 | goto out_not_found; |
11370 | 11393 | ||
11371 | if (magic == TG3_EEPROM_MAGIC) { | 11394 | if (magic == TG3_EEPROM_MAGIC) { |
@@ -11457,6 +11480,15 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
11457 | out_not_found: | 11480 | out_not_found: |
11458 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 11481 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) |
11459 | strcpy(tp->board_part_number, "BCM95906"); | 11482 | strcpy(tp->board_part_number, "BCM95906"); |
11483 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 && | ||
11484 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57780) | ||
11485 | strcpy(tp->board_part_number, "BCM57780"); | ||
11486 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 && | ||
11487 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57760) | ||
11488 | strcpy(tp->board_part_number, "BCM57760"); | ||
11489 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 && | ||
11490 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57790) | ||
11491 | strcpy(tp->board_part_number, "BCM57790"); | ||
11460 | else | 11492 | else |
11461 | strcpy(tp->board_part_number, "none"); | 11493 | strcpy(tp->board_part_number, "none"); |
11462 | } | 11494 | } |
@@ -11667,6 +11699,14 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
11667 | { | 11699 | { |
11668 | u32 val; | 11700 | u32 val; |
11669 | 11701 | ||
11702 | if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) { | ||
11703 | tp->fw_ver[0] = 's'; | ||
11704 | tp->fw_ver[1] = 'b'; | ||
11705 | tp->fw_ver[2] = '\0'; | ||
11706 | |||
11707 | return; | ||
11708 | } | ||
11709 | |||
11670 | if (tg3_nvram_read(tp, 0, &val)) | 11710 | if (tg3_nvram_read(tp, 0, &val)) |
11671 | return; | 11711 | return; |
11672 | 11712 | ||
@@ -11952,7 +11992,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
11952 | tp->tg3_flags2 &= ~TG3_FLG2_HW_TSO_2; | 11992 | tp->tg3_flags2 &= ~TG3_FLG2_HW_TSO_2; |
11953 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || | 11993 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || |
11954 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || | 11994 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || |
11955 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) | 11995 | tp->pci_chip_rev_id == CHIPREV_ID_57780_A0 || |
11996 | tp->pci_chip_rev_id == CHIPREV_ID_57780_A1) | ||
11956 | tp->tg3_flags3 |= TG3_FLG3_CLKREQ_BUG; | 11997 | tp->tg3_flags3 |= TG3_FLG3_CLKREQ_BUG; |
11957 | } | 11998 | } |
11958 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) { | 11999 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) { |
@@ -12144,7 +12185,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
12144 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) | 12185 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) |
12145 | tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; | 12186 | tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; |
12146 | 12187 | ||
12147 | if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) { | 12188 | if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761 || |
12189 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5761S) { | ||
12148 | /* Turn off the debug UART. */ | 12190 | /* Turn off the debug UART. */ |
12149 | tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; | 12191 | tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; |
12150 | if (tp->tg3_flags2 & TG3_FLG2_IS_NIC) | 12192 | if (tp->tg3_flags2 & TG3_FLG2_IS_NIC) |
@@ -12454,7 +12496,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
12454 | } | 12496 | } |
12455 | if (!addr_ok) { | 12497 | if (!addr_ok) { |
12456 | /* Next, try NVRAM. */ | 12498 | /* Next, try NVRAM. */ |
12457 | if (!tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && | 12499 | if (!(tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) && |
12500 | !tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && | ||
12458 | !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { | 12501 | !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { |
12459 | memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2); | 12502 | memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2); |
12460 | memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo)); | 12503 | memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo)); |