diff options
Diffstat (limited to 'drivers/net/tg3.c')
| -rw-r--r-- | drivers/net/tg3.c | 167 |
1 files changed, 89 insertions, 78 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 9488f49ea569..59d6e74a4a5f 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
| @@ -1300,9 +1300,11 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
| 1300 | msleep(1); | 1300 | msleep(1); |
| 1301 | } | 1301 | } |
| 1302 | } | 1302 | } |
| 1303 | tg3_write_mem(tp, NIC_SRAM_WOL_MBOX, WOL_SIGNATURE | | 1303 | if (tp->tg3_flags & TG3_FLAG_WOL_CAP) |
| 1304 | WOL_DRV_STATE_SHUTDOWN | | 1304 | tg3_write_mem(tp, NIC_SRAM_WOL_MBOX, WOL_SIGNATURE | |
| 1305 | WOL_DRV_WOL | WOL_SET_MAGIC_PKT); | 1305 | WOL_DRV_STATE_SHUTDOWN | |
| 1306 | WOL_DRV_WOL | | ||
| 1307 | WOL_SET_MAGIC_PKT); | ||
| 1306 | 1308 | ||
| 1307 | pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps); | 1309 | pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps); |
| 1308 | 1310 | ||
| @@ -2593,10 +2595,8 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status) | |||
| 2593 | { | 2595 | { |
| 2594 | int current_link_up = 0; | 2596 | int current_link_up = 0; |
| 2595 | 2597 | ||
| 2596 | if (!(mac_status & MAC_STATUS_PCS_SYNCED)) { | 2598 | if (!(mac_status & MAC_STATUS_PCS_SYNCED)) |
| 2597 | tp->tg3_flags &= ~TG3_FLAG_GOT_SERDES_FLOWCTL; | ||
| 2598 | goto out; | 2599 | goto out; |
| 2599 | } | ||
| 2600 | 2600 | ||
| 2601 | if (tp->link_config.autoneg == AUTONEG_ENABLE) { | 2601 | if (tp->link_config.autoneg == AUTONEG_ENABLE) { |
| 2602 | u32 flags; | 2602 | u32 flags; |
| @@ -2614,7 +2614,6 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status) | |||
| 2614 | 2614 | ||
| 2615 | tg3_setup_flow_control(tp, local_adv, remote_adv); | 2615 | tg3_setup_flow_control(tp, local_adv, remote_adv); |
| 2616 | 2616 | ||
| 2617 | tp->tg3_flags |= TG3_FLAG_GOT_SERDES_FLOWCTL; | ||
| 2618 | current_link_up = 1; | 2617 | current_link_up = 1; |
| 2619 | } | 2618 | } |
| 2620 | for (i = 0; i < 30; i++) { | 2619 | for (i = 0; i < 30; i++) { |
| @@ -2637,7 +2636,6 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status) | |||
| 2637 | } else { | 2636 | } else { |
| 2638 | /* Forcing 1000FD link up. */ | 2637 | /* Forcing 1000FD link up. */ |
| 2639 | current_link_up = 1; | 2638 | current_link_up = 1; |
| 2640 | tp->tg3_flags |= TG3_FLAG_GOT_SERDES_FLOWCTL; | ||
| 2641 | 2639 | ||
| 2642 | tw32_f(MAC_MODE, (tp->mac_mode | MAC_MODE_SEND_CONFIGS)); | 2640 | tw32_f(MAC_MODE, (tp->mac_mode | MAC_MODE_SEND_CONFIGS)); |
| 2643 | udelay(40); | 2641 | udelay(40); |
| @@ -3895,8 +3893,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3895 | entry = tp->tx_prod; | 3893 | entry = tp->tx_prod; |
| 3896 | base_flags = 0; | 3894 | base_flags = 0; |
| 3897 | mss = 0; | 3895 | mss = 0; |
| 3898 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && | 3896 | if ((mss = skb_shinfo(skb)->gso_size) != 0) { |
| 3899 | (mss = skb_shinfo(skb)->gso_size) != 0) { | ||
| 3900 | int tcp_opt_len, ip_tcp_len; | 3897 | int tcp_opt_len, ip_tcp_len; |
| 3901 | 3898 | ||
| 3902 | if (skb_header_cloned(skb) && | 3899 | if (skb_header_cloned(skb) && |
| @@ -4053,8 +4050,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
| 4053 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 4050 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
| 4054 | base_flags |= TXD_FLAG_TCPUDP_CSUM; | 4051 | base_flags |= TXD_FLAG_TCPUDP_CSUM; |
| 4055 | mss = 0; | 4052 | mss = 0; |
| 4056 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && | 4053 | if ((mss = skb_shinfo(skb)->gso_size) != 0) { |
| 4057 | (mss = skb_shinfo(skb)->gso_size) != 0) { | ||
| 4058 | struct iphdr *iph; | 4054 | struct iphdr *iph; |
| 4059 | int tcp_opt_len, ip_tcp_len, hdr_len; | 4055 | int tcp_opt_len, ip_tcp_len, hdr_len; |
| 4060 | 4056 | ||
| @@ -5934,7 +5930,7 @@ static int tg3_load_tso_firmware(struct tg3 *tp) | |||
| 5934 | 5930 | ||
| 5935 | 5931 | ||
| 5936 | /* tp->lock is held. */ | 5932 | /* tp->lock is held. */ |
| 5937 | static void __tg3_set_mac_addr(struct tg3 *tp) | 5933 | static void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1) |
| 5938 | { | 5934 | { |
| 5939 | u32 addr_high, addr_low; | 5935 | u32 addr_high, addr_low; |
| 5940 | int i; | 5936 | int i; |
| @@ -5946,6 +5942,8 @@ static void __tg3_set_mac_addr(struct tg3 *tp) | |||
| 5946 | (tp->dev->dev_addr[4] << 8) | | 5942 | (tp->dev->dev_addr[4] << 8) | |
| 5947 | (tp->dev->dev_addr[5] << 0)); | 5943 | (tp->dev->dev_addr[5] << 0)); |
| 5948 | for (i = 0; i < 4; i++) { | 5944 | for (i = 0; i < 4; i++) { |
| 5945 | if (i == 1 && skip_mac_1) | ||
| 5946 | continue; | ||
| 5949 | tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high); | 5947 | tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high); |
| 5950 | tw32(MAC_ADDR_0_LOW + (i * 8), addr_low); | 5948 | tw32(MAC_ADDR_0_LOW + (i * 8), addr_low); |
| 5951 | } | 5949 | } |
| @@ -5972,7 +5970,7 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p) | |||
| 5972 | { | 5970 | { |
| 5973 | struct tg3 *tp = netdev_priv(dev); | 5971 | struct tg3 *tp = netdev_priv(dev); |
| 5974 | struct sockaddr *addr = p; | 5972 | struct sockaddr *addr = p; |
| 5975 | int err = 0; | 5973 | int err = 0, skip_mac_1 = 0; |
| 5976 | 5974 | ||
| 5977 | if (!is_valid_ether_addr(addr->sa_data)) | 5975 | if (!is_valid_ether_addr(addr->sa_data)) |
| 5978 | return -EINVAL; | 5976 | return -EINVAL; |
| @@ -5983,22 +5981,21 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p) | |||
| 5983 | return 0; | 5981 | return 0; |
| 5984 | 5982 | ||
| 5985 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { | 5983 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { |
| 5986 | /* Reset chip so that ASF can re-init any MAC addresses it | 5984 | u32 addr0_high, addr0_low, addr1_high, addr1_low; |
| 5987 | * needs. | ||
| 5988 | */ | ||
| 5989 | tg3_netif_stop(tp); | ||
| 5990 | tg3_full_lock(tp, 1); | ||
| 5991 | 5985 | ||
| 5992 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); | 5986 | addr0_high = tr32(MAC_ADDR_0_HIGH); |
| 5993 | err = tg3_restart_hw(tp, 0); | 5987 | addr0_low = tr32(MAC_ADDR_0_LOW); |
| 5994 | if (!err) | 5988 | addr1_high = tr32(MAC_ADDR_1_HIGH); |
| 5995 | tg3_netif_start(tp); | 5989 | addr1_low = tr32(MAC_ADDR_1_LOW); |
| 5996 | tg3_full_unlock(tp); | 5990 | |
| 5997 | } else { | 5991 | /* Skip MAC addr 1 if ASF is using it. */ |
| 5998 | spin_lock_bh(&tp->lock); | 5992 | if ((addr0_high != addr1_high || addr0_low != addr1_low) && |
| 5999 | __tg3_set_mac_addr(tp); | 5993 | !(addr1_high == 0 && addr1_low == 0)) |
| 6000 | spin_unlock_bh(&tp->lock); | 5994 | skip_mac_1 = 1; |
| 6001 | } | 5995 | } |
| 5996 | spin_lock_bh(&tp->lock); | ||
| 5997 | __tg3_set_mac_addr(tp, skip_mac_1); | ||
| 5998 | spin_unlock_bh(&tp->lock); | ||
| 6002 | 5999 | ||
| 6003 | return err; | 6000 | return err; |
| 6004 | } | 6001 | } |
| @@ -6315,7 +6312,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
| 6315 | tp->rx_jumbo_ptr); | 6312 | tp->rx_jumbo_ptr); |
| 6316 | 6313 | ||
| 6317 | /* Initialize MAC address and backoff seed. */ | 6314 | /* Initialize MAC address and backoff seed. */ |
| 6318 | __tg3_set_mac_addr(tp); | 6315 | __tg3_set_mac_addr(tp, 0); |
| 6319 | 6316 | ||
| 6320 | /* MTU + ethernet header + FCS + optional VLAN tag */ | 6317 | /* MTU + ethernet header + FCS + optional VLAN tag */ |
| 6321 | tw32(MAC_RX_MTU_SIZE, tp->dev->mtu + ETH_HLEN + 8); | 6318 | tw32(MAC_RX_MTU_SIZE, tp->dev->mtu + ETH_HLEN + 8); |
| @@ -6346,8 +6343,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
| 6346 | tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) || | 6343 | tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) || |
| 6347 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)) { | 6344 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)) { |
| 6348 | if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE && | 6345 | if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE && |
| 6349 | (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 || | 6346 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { |
| 6350 | tp->pci_chip_rev_id == CHIPREV_ID_5705_A2)) { | ||
| 6351 | rdmac_mode |= RDMAC_MODE_FIFO_SIZE_128; | 6347 | rdmac_mode |= RDMAC_MODE_FIFO_SIZE_128; |
| 6352 | } else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) && | 6348 | } else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) && |
| 6353 | !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) { | 6349 | !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) { |
| @@ -6457,6 +6453,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
| 6457 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) | 6453 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) |
| 6458 | gpio_mask |= GRC_LCLCTRL_GPIO_UART_SEL; | 6454 | gpio_mask |= GRC_LCLCTRL_GPIO_UART_SEL; |
| 6459 | 6455 | ||
| 6456 | tp->grc_local_ctrl &= ~gpio_mask; | ||
| 6460 | tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask; | 6457 | tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask; |
| 6461 | 6458 | ||
| 6462 | /* GPIO1 must be driven high for eeprom write protect */ | 6459 | /* GPIO1 must be driven high for eeprom write protect */ |
| @@ -7036,11 +7033,7 @@ static int tg3_open(struct net_device *dev) | |||
| 7036 | if (err) | 7033 | if (err) |
| 7037 | return err; | 7034 | return err; |
| 7038 | 7035 | ||
| 7039 | if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && | 7036 | if (tp->tg3_flags & TG3_FLAG_SUPPORT_MSI) { |
| 7040 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_AX) && | ||
| 7041 | (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5750_BX) && | ||
| 7042 | !((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) && | ||
| 7043 | (tp->pdev_peer == tp->pdev))) { | ||
| 7044 | /* All MSI supporting chips should support tagged | 7037 | /* All MSI supporting chips should support tagged |
| 7045 | * status. Assert that this is the case. | 7038 | * status. Assert that this is the case. |
| 7046 | */ | 7039 | */ |
| @@ -7399,9 +7392,7 @@ static int tg3_close(struct net_device *dev) | |||
| 7399 | 7392 | ||
| 7400 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); | 7393 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); |
| 7401 | tg3_free_rings(tp); | 7394 | tg3_free_rings(tp); |
| 7402 | tp->tg3_flags &= | 7395 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; |
| 7403 | ~(TG3_FLAG_INIT_COMPLETE | | ||
| 7404 | TG3_FLAG_GOT_SERDES_FLOWCTL); | ||
| 7405 | 7396 | ||
| 7406 | tg3_full_unlock(tp); | 7397 | tg3_full_unlock(tp); |
| 7407 | 7398 | ||
| @@ -8036,7 +8027,10 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
| 8036 | { | 8027 | { |
| 8037 | struct tg3 *tp = netdev_priv(dev); | 8028 | struct tg3 *tp = netdev_priv(dev); |
| 8038 | 8029 | ||
| 8039 | wol->supported = WAKE_MAGIC; | 8030 | if (tp->tg3_flags & TG3_FLAG_WOL_CAP) |
| 8031 | wol->supported = WAKE_MAGIC; | ||
| 8032 | else | ||
| 8033 | wol->supported = 0; | ||
| 8040 | wol->wolopts = 0; | 8034 | wol->wolopts = 0; |
| 8041 | if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) | 8035 | if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) |
| 8042 | wol->wolopts = WAKE_MAGIC; | 8036 | wol->wolopts = WAKE_MAGIC; |
| @@ -8050,8 +8044,7 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
| 8050 | if (wol->wolopts & ~WAKE_MAGIC) | 8044 | if (wol->wolopts & ~WAKE_MAGIC) |
| 8051 | return -EINVAL; | 8045 | return -EINVAL; |
| 8052 | if ((wol->wolopts & WAKE_MAGIC) && | 8046 | if ((wol->wolopts & WAKE_MAGIC) && |
| 8053 | tp->tg3_flags2 & TG3_FLG2_ANY_SERDES && | 8047 | !(tp->tg3_flags & TG3_FLAG_WOL_CAP)) |
| 8054 | !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP)) | ||
| 8055 | return -EINVAL; | 8048 | return -EINVAL; |
| 8056 | 8049 | ||
| 8057 | spin_lock_bh(&tp->lock); | 8050 | spin_lock_bh(&tp->lock); |
| @@ -9289,7 +9282,7 @@ static void __devinit tg3_get_nvram_size(struct tg3 *tp) | |||
| 9289 | return; | 9282 | return; |
| 9290 | } | 9283 | } |
| 9291 | } | 9284 | } |
| 9292 | tp->nvram_size = 0x20000; | 9285 | tp->nvram_size = 0x80000; |
| 9293 | } | 9286 | } |
| 9294 | 9287 | ||
| 9295 | static void __devinit tg3_get_nvram_info(struct tg3 *tp) | 9288 | static void __devinit tg3_get_nvram_info(struct tg3 *tp) |
| @@ -9408,33 +9401,31 @@ static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp) | |||
| 9408 | 9401 | ||
| 9409 | static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp) | 9402 | static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp) |
| 9410 | { | 9403 | { |
| 9411 | u32 nvcfg1; | 9404 | u32 nvcfg1, protect = 0; |
| 9412 | 9405 | ||
| 9413 | nvcfg1 = tr32(NVRAM_CFG1); | 9406 | nvcfg1 = tr32(NVRAM_CFG1); |
| 9414 | 9407 | ||
| 9415 | /* NVRAM protection for TPM */ | 9408 | /* NVRAM protection for TPM */ |
| 9416 | if (nvcfg1 & (1 << 27)) | 9409 | if (nvcfg1 & (1 << 27)) { |
| 9417 | tp->tg3_flags2 |= TG3_FLG2_PROTECTED_NVRAM; | 9410 | tp->tg3_flags2 |= TG3_FLG2_PROTECTED_NVRAM; |
| 9411 | protect = 1; | ||
| 9412 | } | ||
| 9418 | 9413 | ||
| 9419 | switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) { | 9414 | nvcfg1 &= NVRAM_CFG1_5752VENDOR_MASK; |
| 9420 | case FLASH_5755VENDOR_ATMEL_EEPROM_64KHZ: | 9415 | switch (nvcfg1) { |
| 9421 | case FLASH_5755VENDOR_ATMEL_EEPROM_376KHZ: | ||
| 9422 | tp->nvram_jedecnum = JEDEC_ATMEL; | ||
| 9423 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; | ||
| 9424 | tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE; | ||
| 9425 | |||
| 9426 | nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS; | ||
| 9427 | tw32(NVRAM_CFG1, nvcfg1); | ||
| 9428 | break; | ||
| 9429 | case FLASH_5752VENDOR_ATMEL_FLASH_BUFFERED: | ||
| 9430 | case FLASH_5755VENDOR_ATMEL_FLASH_1: | 9416 | case FLASH_5755VENDOR_ATMEL_FLASH_1: |
| 9431 | case FLASH_5755VENDOR_ATMEL_FLASH_2: | 9417 | case FLASH_5755VENDOR_ATMEL_FLASH_2: |
| 9432 | case FLASH_5755VENDOR_ATMEL_FLASH_3: | 9418 | case FLASH_5755VENDOR_ATMEL_FLASH_3: |
| 9433 | case FLASH_5755VENDOR_ATMEL_FLASH_4: | ||
| 9434 | tp->nvram_jedecnum = JEDEC_ATMEL; | 9419 | tp->nvram_jedecnum = JEDEC_ATMEL; |
| 9435 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; | 9420 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; |
| 9436 | tp->tg3_flags2 |= TG3_FLG2_FLASH; | 9421 | tp->tg3_flags2 |= TG3_FLG2_FLASH; |
| 9437 | tp->nvram_pagesize = 264; | 9422 | tp->nvram_pagesize = 264; |
| 9423 | if (nvcfg1 == FLASH_5755VENDOR_ATMEL_FLASH_1) | ||
| 9424 | tp->nvram_size = (protect ? 0x3e200 : 0x80000); | ||
| 9425 | else if (nvcfg1 == FLASH_5755VENDOR_ATMEL_FLASH_2) | ||
| 9426 | tp->nvram_size = (protect ? 0x1f200 : 0x40000); | ||
| 9427 | else | ||
| 9428 | tp->nvram_size = (protect ? 0x1f200 : 0x20000); | ||
| 9438 | break; | 9429 | break; |
| 9439 | case FLASH_5752VENDOR_ST_M45PE10: | 9430 | case FLASH_5752VENDOR_ST_M45PE10: |
| 9440 | case FLASH_5752VENDOR_ST_M45PE20: | 9431 | case FLASH_5752VENDOR_ST_M45PE20: |
| @@ -9443,6 +9434,12 @@ static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp) | |||
| 9443 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; | 9434 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; |
| 9444 | tp->tg3_flags2 |= TG3_FLG2_FLASH; | 9435 | tp->tg3_flags2 |= TG3_FLG2_FLASH; |
| 9445 | tp->nvram_pagesize = 256; | 9436 | tp->nvram_pagesize = 256; |
| 9437 | if (nvcfg1 == FLASH_5752VENDOR_ST_M45PE10) | ||
| 9438 | tp->nvram_size = (protect ? 0x10000 : 0x20000); | ||
| 9439 | else if (nvcfg1 == FLASH_5752VENDOR_ST_M45PE20) | ||
| 9440 | tp->nvram_size = (protect ? 0x10000 : 0x40000); | ||
| 9441 | else | ||
| 9442 | tp->nvram_size = (protect ? 0x20000 : 0x80000); | ||
| 9446 | break; | 9443 | break; |
| 9447 | } | 9444 | } |
| 9448 | } | 9445 | } |
| @@ -9518,6 +9515,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) | |||
| 9518 | } | 9515 | } |
| 9519 | tg3_enable_nvram_access(tp); | 9516 | tg3_enable_nvram_access(tp); |
| 9520 | 9517 | ||
| 9518 | tp->nvram_size = 0; | ||
| 9519 | |||
| 9521 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) | 9520 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) |
| 9522 | tg3_get_5752_nvram_info(tp); | 9521 | tg3_get_5752_nvram_info(tp); |
| 9523 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) | 9522 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) |
| @@ -9529,7 +9528,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) | |||
| 9529 | else | 9528 | else |
| 9530 | tg3_get_nvram_info(tp); | 9529 | tg3_get_nvram_info(tp); |
| 9531 | 9530 | ||
| 9532 | tg3_get_nvram_size(tp); | 9531 | if (tp->nvram_size == 0) |
| 9532 | tg3_get_nvram_size(tp); | ||
| 9533 | 9533 | ||
| 9534 | tg3_disable_nvram_access(tp); | 9534 | tg3_disable_nvram_access(tp); |
| 9535 | tg3_nvram_unlock(tp); | 9535 | tg3_nvram_unlock(tp); |
| @@ -9996,8 +9996,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
| 9996 | tp->phy_id = PHY_ID_INVALID; | 9996 | tp->phy_id = PHY_ID_INVALID; |
| 9997 | tp->led_ctrl = LED_CTRL_MODE_PHY_1; | 9997 | tp->led_ctrl = LED_CTRL_MODE_PHY_1; |
| 9998 | 9998 | ||
| 9999 | /* Assume an onboard device by default. */ | 9999 | /* Assume an onboard device and WOL capable by default. */ |
| 10000 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 10000 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT | TG3_FLAG_WOL_CAP; |
| 10001 | 10001 | ||
| 10002 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 10002 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
| 10003 | if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) { | 10003 | if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) { |
| @@ -10120,8 +10120,9 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
| 10120 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) | 10120 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) |
| 10121 | tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE; | 10121 | tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE; |
| 10122 | } | 10122 | } |
| 10123 | if (nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL) | 10123 | if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES && |
| 10124 | tp->tg3_flags |= TG3_FLAG_SERDES_WOL_CAP; | 10124 | !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL)) |
| 10125 | tp->tg3_flags &= ~TG3_FLAG_WOL_CAP; | ||
| 10125 | 10126 | ||
| 10126 | if (cfg2 & (1 << 17)) | 10127 | if (cfg2 & (1 << 17)) |
| 10127 | tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING; | 10128 | tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING; |
| @@ -10399,6 +10400,8 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
| 10399 | } | 10400 | } |
| 10400 | } | 10401 | } |
| 10401 | 10402 | ||
| 10403 | static struct pci_dev * __devinit tg3_find_peer(struct tg3 *); | ||
| 10404 | |||
| 10402 | static int __devinit tg3_get_invariants(struct tg3 *tp) | 10405 | static int __devinit tg3_get_invariants(struct tg3 *tp) |
| 10403 | { | 10406 | { |
| 10404 | static struct pci_device_id write_reorder_chipsets[] = { | 10407 | static struct pci_device_id write_reorder_chipsets[] = { |
| @@ -10554,6 +10557,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
| 10554 | tp->pci_hdr_type = (cacheline_sz_reg >> 16) & 0xff; | 10557 | tp->pci_hdr_type = (cacheline_sz_reg >> 16) & 0xff; |
| 10555 | tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff; | 10558 | tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff; |
| 10556 | 10559 | ||
| 10560 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || | ||
| 10561 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) | ||
| 10562 | tp->pdev_peer = tg3_find_peer(tp); | ||
| 10563 | |||
| 10557 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 || | 10564 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 || |
| 10558 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || | 10565 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || |
| 10559 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 10566 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
| @@ -10567,6 +10574,14 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
| 10567 | tp->tg3_flags2 |= TG3_FLG2_5705_PLUS; | 10574 | tp->tg3_flags2 |= TG3_FLG2_5705_PLUS; |
| 10568 | 10575 | ||
| 10569 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { | 10576 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { |
| 10577 | tp->tg3_flags |= TG3_FLAG_SUPPORT_MSI; | ||
| 10578 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_AX || | ||
| 10579 | GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_BX || | ||
| 10580 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714 && | ||
| 10581 | tp->pci_chip_rev_id <= CHIPREV_ID_5714_A2 && | ||
| 10582 | tp->pdev_peer == tp->pdev)) | ||
| 10583 | tp->tg3_flags &= ~TG3_FLAG_SUPPORT_MSI; | ||
| 10584 | |||
| 10570 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 10585 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
| 10571 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 || | 10586 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 || |
| 10572 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 10587 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
| @@ -10668,17 +10683,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
| 10668 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5700_BX) | 10683 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5700_BX) |
| 10669 | tp->tg3_flags |= TG3_FLAG_TXD_MBOX_HWBUG; | 10684 | tp->tg3_flags |= TG3_FLAG_TXD_MBOX_HWBUG; |
| 10670 | 10685 | ||
| 10671 | /* Back to back register writes can cause problems on this chip, | ||
| 10672 | * the workaround is to read back all reg writes except those to | ||
| 10673 | * mailbox regs. See tg3_write_indirect_reg32(). | ||
| 10674 | * | ||
| 10675 | * PCI Express 5750_A0 rev chips need this workaround too. | ||
| 10676 | */ | ||
| 10677 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 || | ||
| 10678 | ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && | ||
| 10679 | tp->pci_chip_rev_id == CHIPREV_ID_5750_A0)) | ||
| 10680 | tp->tg3_flags |= TG3_FLAG_5701_REG_WRITE_BUG; | ||
| 10681 | |||
| 10682 | if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0) | 10686 | if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0) |
| 10683 | tp->tg3_flags |= TG3_FLAG_PCI_HIGH_SPEED; | 10687 | tp->tg3_flags |= TG3_FLAG_PCI_HIGH_SPEED; |
| 10684 | if ((pci_state_reg & PCISTATE_BUS_32BIT) != 0) | 10688 | if ((pci_state_reg & PCISTATE_BUS_32BIT) != 0) |
| @@ -10702,8 +10706,19 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
| 10702 | /* Various workaround register access methods */ | 10706 | /* Various workaround register access methods */ |
| 10703 | if (tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) | 10707 | if (tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) |
| 10704 | tp->write32 = tg3_write_indirect_reg32; | 10708 | tp->write32 = tg3_write_indirect_reg32; |
| 10705 | else if (tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) | 10709 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 || |
| 10710 | ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && | ||
| 10711 | tp->pci_chip_rev_id == CHIPREV_ID_5750_A0)) { | ||
| 10712 | /* | ||
| 10713 | * Back to back register writes can cause problems on these | ||
| 10714 | * chips, the workaround is to read back all reg writes | ||
| 10715 | * except those to mailbox regs. | ||
| 10716 | * | ||
| 10717 | * See tg3_write_indirect_reg32(). | ||
| 10718 | */ | ||
| 10706 | tp->write32 = tg3_write_flush_reg32; | 10719 | tp->write32 = tg3_write_flush_reg32; |
| 10720 | } | ||
| 10721 | |||
| 10707 | 10722 | ||
| 10708 | if ((tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) || | 10723 | if ((tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) || |
| 10709 | (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)) { | 10724 | (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)) { |
| @@ -11892,10 +11907,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
| 11892 | tp->rx_pending = 63; | 11907 | tp->rx_pending = 63; |
| 11893 | } | 11908 | } |
| 11894 | 11909 | ||
| 11895 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || | ||
| 11896 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) | ||
| 11897 | tp->pdev_peer = tg3_find_peer(tp); | ||
| 11898 | |||
| 11899 | err = tg3_get_device_address(tp); | 11910 | err = tg3_get_device_address(tp); |
| 11900 | if (err) { | 11911 | if (err) { |
| 11901 | printk(KERN_ERR PFX "Could not obtain valid ethernet address, " | 11912 | printk(KERN_ERR PFX "Could not obtain valid ethernet address, " |
