diff options
Diffstat (limited to 'drivers/net/ethernet/broadcom/tg3.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 92 |
1 files changed, 74 insertions, 18 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 728d42ab2a76..c777b9013164 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) | |||
94 | 94 | ||
95 | #define DRV_MODULE_NAME "tg3" | 95 | #define DRV_MODULE_NAME "tg3" |
96 | #define TG3_MAJ_NUM 3 | 96 | #define TG3_MAJ_NUM 3 |
97 | #define TG3_MIN_NUM 131 | 97 | #define TG3_MIN_NUM 132 |
98 | #define DRV_MODULE_VERSION \ | 98 | #define DRV_MODULE_VERSION \ |
99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) | 99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) |
100 | #define DRV_MODULE_RELDATE "April 09, 2013" | 100 | #define DRV_MODULE_RELDATE "May 21, 2013" |
101 | 101 | ||
102 | #define RESET_KIND_SHUTDOWN 0 | 102 | #define RESET_KIND_SHUTDOWN 0 |
103 | #define RESET_KIND_INIT 1 | 103 | #define RESET_KIND_INIT 1 |
@@ -1800,6 +1800,9 @@ static int tg3_poll_fw(struct tg3 *tp) | |||
1800 | int i; | 1800 | int i; |
1801 | u32 val; | 1801 | u32 val; |
1802 | 1802 | ||
1803 | if (tg3_flag(tp, NO_FWARE_REPORTED)) | ||
1804 | return 0; | ||
1805 | |||
1803 | if (tg3_flag(tp, IS_SSB_CORE)) { | 1806 | if (tg3_flag(tp, IS_SSB_CORE)) { |
1804 | /* We don't use firmware. */ | 1807 | /* We don't use firmware. */ |
1805 | return 0; | 1808 | return 0; |
@@ -2957,6 +2960,31 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed) | |||
2957 | return 0; | 2960 | return 0; |
2958 | } | 2961 | } |
2959 | 2962 | ||
2963 | static bool tg3_phy_power_bug(struct tg3 *tp) | ||
2964 | { | ||
2965 | switch (tg3_asic_rev(tp)) { | ||
2966 | case ASIC_REV_5700: | ||
2967 | case ASIC_REV_5704: | ||
2968 | return true; | ||
2969 | case ASIC_REV_5780: | ||
2970 | if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) | ||
2971 | return true; | ||
2972 | return false; | ||
2973 | case ASIC_REV_5717: | ||
2974 | if (!tp->pci_fn) | ||
2975 | return true; | ||
2976 | return false; | ||
2977 | case ASIC_REV_5719: | ||
2978 | case ASIC_REV_5720: | ||
2979 | if ((tp->phy_flags & TG3_PHYFLG_PHY_SERDES) && | ||
2980 | !tp->pci_fn) | ||
2981 | return true; | ||
2982 | return false; | ||
2983 | } | ||
2984 | |||
2985 | return false; | ||
2986 | } | ||
2987 | |||
2960 | static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | 2988 | static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) |
2961 | { | 2989 | { |
2962 | u32 val; | 2990 | u32 val; |
@@ -3016,12 +3044,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | |||
3016 | /* The PHY should not be powered down on some chips because | 3044 | /* The PHY should not be powered down on some chips because |
3017 | * of bugs. | 3045 | * of bugs. |
3018 | */ | 3046 | */ |
3019 | if (tg3_asic_rev(tp) == ASIC_REV_5700 || | 3047 | if (tg3_phy_power_bug(tp)) |
3020 | tg3_asic_rev(tp) == ASIC_REV_5704 || | ||
3021 | (tg3_asic_rev(tp) == ASIC_REV_5780 && | ||
3022 | (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || | ||
3023 | (tg3_asic_rev(tp) == ASIC_REV_5717 && | ||
3024 | !tp->pci_fn)) | ||
3025 | return; | 3048 | return; |
3026 | 3049 | ||
3027 | if (tg3_chip_rev(tp) == CHIPREV_5784_AX || | 3050 | if (tg3_chip_rev(tp) == CHIPREV_5784_AX || |
@@ -7428,6 +7451,20 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) | |||
7428 | return (base > 0xffffdcc0) && (base + len + 8 < base); | 7451 | return (base > 0xffffdcc0) && (base + len + 8 < base); |
7429 | } | 7452 | } |
7430 | 7453 | ||
7454 | /* Test for TSO DMA buffers that cross into regions which are within MSS bytes | ||
7455 | * of any 4GB boundaries: 4G, 8G, etc | ||
7456 | */ | ||
7457 | static inline int tg3_4g_tso_overflow_test(struct tg3 *tp, dma_addr_t mapping, | ||
7458 | u32 len, u32 mss) | ||
7459 | { | ||
7460 | if (tg3_asic_rev(tp) == ASIC_REV_5762 && mss) { | ||
7461 | u32 base = (u32) mapping & 0xffffffff; | ||
7462 | |||
7463 | return ((base + len + (mss & 0x3fff)) < base); | ||
7464 | } | ||
7465 | return 0; | ||
7466 | } | ||
7467 | |||
7431 | /* Test for DMA addresses > 40-bit */ | 7468 | /* Test for DMA addresses > 40-bit */ |
7432 | static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, | 7469 | static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, |
7433 | int len) | 7470 | int len) |
@@ -7464,6 +7501,9 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget, | |||
7464 | if (tg3_4g_overflow_test(map, len)) | 7501 | if (tg3_4g_overflow_test(map, len)) |
7465 | hwbug = true; | 7502 | hwbug = true; |
7466 | 7503 | ||
7504 | if (tg3_4g_tso_overflow_test(tp, map, len, mss)) | ||
7505 | hwbug = true; | ||
7506 | |||
7467 | if (tg3_40bit_overflow_test(tp, map, len)) | 7507 | if (tg3_40bit_overflow_test(tp, map, len)) |
7468 | hwbug = true; | 7508 | hwbug = true; |
7469 | 7509 | ||
@@ -8874,6 +8914,10 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8874 | tg3_halt_cpu(tp, RX_CPU_BASE); | 8914 | tg3_halt_cpu(tp, RX_CPU_BASE); |
8875 | } | 8915 | } |
8876 | 8916 | ||
8917 | err = tg3_poll_fw(tp); | ||
8918 | if (err) | ||
8919 | return err; | ||
8920 | |||
8877 | tw32(GRC_MODE, tp->grc_mode); | 8921 | tw32(GRC_MODE, tp->grc_mode); |
8878 | 8922 | ||
8879 | if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) { | 8923 | if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) { |
@@ -8904,10 +8948,6 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8904 | 8948 | ||
8905 | tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); | 8949 | tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); |
8906 | 8950 | ||
8907 | err = tg3_poll_fw(tp); | ||
8908 | if (err) | ||
8909 | return err; | ||
8910 | |||
8911 | tg3_mdio_start(tp); | 8951 | tg3_mdio_start(tp); |
8912 | 8952 | ||
8913 | if (tg3_flag(tp, PCI_EXPRESS) && | 8953 | if (tg3_flag(tp, PCI_EXPRESS) && |
@@ -9431,6 +9471,14 @@ static void tg3_rss_write_indir_tbl(struct tg3 *tp) | |||
9431 | } | 9471 | } |
9432 | } | 9472 | } |
9433 | 9473 | ||
9474 | static inline u32 tg3_lso_rd_dma_workaround_bit(struct tg3 *tp) | ||
9475 | { | ||
9476 | if (tg3_asic_rev(tp) == ASIC_REV_5719) | ||
9477 | return TG3_LSO_RD_DMA_TX_LENGTH_WA_5719; | ||
9478 | else | ||
9479 | return TG3_LSO_RD_DMA_TX_LENGTH_WA_5720; | ||
9480 | } | ||
9481 | |||
9434 | /* tp->lock is held. */ | 9482 | /* tp->lock is held. */ |
9435 | static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | 9483 | static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) |
9436 | { | 9484 | { |
@@ -10116,16 +10164,17 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | |||
10116 | tw32_f(RDMAC_MODE, rdmac_mode); | 10164 | tw32_f(RDMAC_MODE, rdmac_mode); |
10117 | udelay(40); | 10165 | udelay(40); |
10118 | 10166 | ||
10119 | if (tg3_asic_rev(tp) == ASIC_REV_5719) { | 10167 | if (tg3_asic_rev(tp) == ASIC_REV_5719 || |
10168 | tg3_asic_rev(tp) == ASIC_REV_5720) { | ||
10120 | for (i = 0; i < TG3_NUM_RDMA_CHANNELS; i++) { | 10169 | for (i = 0; i < TG3_NUM_RDMA_CHANNELS; i++) { |
10121 | if (tr32(TG3_RDMA_LENGTH + (i << 2)) > TG3_MAX_MTU(tp)) | 10170 | if (tr32(TG3_RDMA_LENGTH + (i << 2)) > TG3_MAX_MTU(tp)) |
10122 | break; | 10171 | break; |
10123 | } | 10172 | } |
10124 | if (i < TG3_NUM_RDMA_CHANNELS) { | 10173 | if (i < TG3_NUM_RDMA_CHANNELS) { |
10125 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); | 10174 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); |
10126 | val |= TG3_LSO_RD_DMA_TX_LENGTH_WA; | 10175 | val |= tg3_lso_rd_dma_workaround_bit(tp); |
10127 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); | 10176 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); |
10128 | tg3_flag_set(tp, 5719_RDMA_BUG); | 10177 | tg3_flag_set(tp, 5719_5720_RDMA_BUG); |
10129 | } | 10178 | } |
10130 | } | 10179 | } |
10131 | 10180 | ||
@@ -10358,6 +10407,13 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | |||
10358 | */ | 10407 | */ |
10359 | static int tg3_init_hw(struct tg3 *tp, bool reset_phy) | 10408 | static int tg3_init_hw(struct tg3 *tp, bool reset_phy) |
10360 | { | 10409 | { |
10410 | /* Chip may have been just powered on. If so, the boot code may still | ||
10411 | * be running initialization. Wait for it to finish to avoid races in | ||
10412 | * accessing the hardware. | ||
10413 | */ | ||
10414 | tg3_enable_register_access(tp); | ||
10415 | tg3_poll_fw(tp); | ||
10416 | |||
10361 | tg3_switch_clocks(tp); | 10417 | tg3_switch_clocks(tp); |
10362 | 10418 | ||
10363 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 10419 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); |
@@ -10489,15 +10545,15 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp) | |||
10489 | TG3_STAT_ADD32(&sp->tx_ucast_packets, MAC_TX_STATS_UCAST); | 10545 | TG3_STAT_ADD32(&sp->tx_ucast_packets, MAC_TX_STATS_UCAST); |
10490 | TG3_STAT_ADD32(&sp->tx_mcast_packets, MAC_TX_STATS_MCAST); | 10546 | TG3_STAT_ADD32(&sp->tx_mcast_packets, MAC_TX_STATS_MCAST); |
10491 | TG3_STAT_ADD32(&sp->tx_bcast_packets, MAC_TX_STATS_BCAST); | 10547 | TG3_STAT_ADD32(&sp->tx_bcast_packets, MAC_TX_STATS_BCAST); |
10492 | if (unlikely(tg3_flag(tp, 5719_RDMA_BUG) && | 10548 | if (unlikely(tg3_flag(tp, 5719_5720_RDMA_BUG) && |
10493 | (sp->tx_ucast_packets.low + sp->tx_mcast_packets.low + | 10549 | (sp->tx_ucast_packets.low + sp->tx_mcast_packets.low + |
10494 | sp->tx_bcast_packets.low) > TG3_NUM_RDMA_CHANNELS)) { | 10550 | sp->tx_bcast_packets.low) > TG3_NUM_RDMA_CHANNELS)) { |
10495 | u32 val; | 10551 | u32 val; |
10496 | 10552 | ||
10497 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); | 10553 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); |
10498 | val &= ~TG3_LSO_RD_DMA_TX_LENGTH_WA; | 10554 | val &= ~tg3_lso_rd_dma_workaround_bit(tp); |
10499 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); | 10555 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); |
10500 | tg3_flag_clear(tp, 5719_RDMA_BUG); | 10556 | tg3_flag_clear(tp, 5719_5720_RDMA_BUG); |
10501 | } | 10557 | } |
10502 | 10558 | ||
10503 | TG3_STAT_ADD32(&sp->rx_octets, MAC_RX_STATS_OCTETS); | 10559 | TG3_STAT_ADD32(&sp->rx_octets, MAC_RX_STATS_OCTETS); |