aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-04-03 11:07:29 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-03 11:07:29 -0400
commitefc33ce197e4b6aaddf1eb2ba6293f51daf3c283 (patch)
tree9eaceed3c855d5cbc91c2fc247bdcceafbf28cdf /drivers/net/ethernet/broadcom
parent993884f6a26c6547fa3875f9d3fabdc4250d8da6 (diff)
parent690a863ff03d9a29ace2b752b8f802fba78a842f (diff)
Merge branch 'for-linus' into for-next
Back-merge for cleaning up usb-audio code the recent commit modified, and further UAC2 autoclock patches.
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c6
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c81
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h7
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h3
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c22
7 files changed, 111 insertions, 15 deletions
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 639049d7e92d..da5f4397f87c 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -301,12 +301,16 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
301 bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n", 301 bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
302 ring->start); 302 ring->start);
303 } else { 303 } else {
304 /* Omit CRC. */
305 len -= ETH_FCS_LEN;
306
304 new_skb = netdev_alloc_skb_ip_align(bgmac->net_dev, len); 307 new_skb = netdev_alloc_skb_ip_align(bgmac->net_dev, len);
305 if (new_skb) { 308 if (new_skb) {
306 skb_put(new_skb, len); 309 skb_put(new_skb, len);
307 skb_copy_from_linear_data_offset(skb, BGMAC_RX_FRAME_OFFSET, 310 skb_copy_from_linear_data_offset(skb, BGMAC_RX_FRAME_OFFSET,
308 new_skb->data, 311 new_skb->data,
309 len); 312 len);
313 skb_checksum_none_assert(skb);
310 new_skb->protocol = 314 new_skb->protocol =
311 eth_type_trans(new_skb, bgmac->net_dev); 315 eth_type_trans(new_skb, bgmac->net_dev);
312 netif_receive_skb(new_skb); 316 netif_receive_skb(new_skb);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index ecac04a3687c..4046f97378c2 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2760,6 +2760,7 @@ load_error2:
2760 bp->port.pmf = 0; 2760 bp->port.pmf = 0;
2761load_error1: 2761load_error1:
2762 bnx2x_napi_disable(bp); 2762 bnx2x_napi_disable(bp);
2763 bnx2x_del_all_napi(bp);
2763 2764
2764 /* clear pf_load status, as it was already set */ 2765 /* clear pf_load status, as it was already set */
2765 if (IS_PF(bp)) 2766 if (IS_PF(bp))
@@ -3142,7 +3143,7 @@ static inline __le16 bnx2x_csum_fix(unsigned char *t_header, u16 csum, s8 fix)
3142 tsum = ~csum_fold(csum_add((__force __wsum) csum, 3143 tsum = ~csum_fold(csum_add((__force __wsum) csum,
3143 csum_partial(t_header, -fix, 0))); 3144 csum_partial(t_header, -fix, 0)));
3144 3145
3145 return bswab16(csum); 3146 return bswab16(tsum);
3146} 3147}
3147 3148
3148static inline u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb) 3149static inline u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 9a674b14b403..edfa67adf2f9 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -281,6 +281,8 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
281 cmd->lp_advertising |= ADVERTISED_2500baseX_Full; 281 cmd->lp_advertising |= ADVERTISED_2500baseX_Full;
282 if (status & LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE) 282 if (status & LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE)
283 cmd->lp_advertising |= ADVERTISED_10000baseT_Full; 283 cmd->lp_advertising |= ADVERTISED_10000baseT_Full;
284 if (status & LINK_STATUS_LINK_PARTNER_20GXFD_CAPABLE)
285 cmd->lp_advertising |= ADVERTISED_20000baseKR2_Full;
284 } 286 }
285 287
286 cmd->maxtxpkt = 0; 288 cmd->maxtxpkt = 0;
@@ -463,6 +465,10 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
463 ADVERTISED_10000baseKR_Full)) 465 ADVERTISED_10000baseKR_Full))
464 bp->link_params.speed_cap_mask[cfg_idx] |= 466 bp->link_params.speed_cap_mask[cfg_idx] |=
465 PORT_HW_CFG_SPEED_CAPABILITY_D0_10G; 467 PORT_HW_CFG_SPEED_CAPABILITY_D0_10G;
468
469 if (cmd->advertising & ADVERTISED_20000baseKR2_Full)
470 bp->link_params.speed_cap_mask[cfg_idx] |=
471 PORT_HW_CFG_SPEED_CAPABILITY_D0_20G;
466 } 472 }
467 } else { /* forced speed */ 473 } else { /* forced speed */
468 /* advertise the requested speed and duplex if supported */ 474 /* advertise the requested speed and duplex if supported */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 1663e0b6b5a0..77ebae0ac64a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -8647,7 +8647,9 @@ void bnx2x_handle_module_detect_int(struct link_params *params)
8647 MDIO_WC_DEVAD, 8647 MDIO_WC_DEVAD,
8648 MDIO_WC_REG_DIGITAL5_MISC6, 8648 MDIO_WC_REG_DIGITAL5_MISC6,
8649 &rx_tx_in_reset); 8649 &rx_tx_in_reset);
8650 if (!rx_tx_in_reset) { 8650 if ((!rx_tx_in_reset) &&
8651 (params->link_flags &
8652 PHY_INITIALIZED)) {
8651 bnx2x_warpcore_reset_lane(bp, phy, 1); 8653 bnx2x_warpcore_reset_lane(bp, phy, 1);
8652 bnx2x_warpcore_config_sfi(phy, params); 8654 bnx2x_warpcore_config_sfi(phy, params);
8653 bnx2x_warpcore_reset_lane(bp, phy, 0); 8655 bnx2x_warpcore_reset_lane(bp, phy, 0);
@@ -10422,6 +10424,28 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy,
10422 MDIO_PMA_DEVAD, 10424 MDIO_PMA_DEVAD,
10423 MDIO_PMA_REG_8481_LED1_MASK, 10425 MDIO_PMA_REG_8481_LED1_MASK,
10424 0x0); 10426 0x0);
10427 if (phy->type ==
10428 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834) {
10429 /* Disable MI_INT interrupt before setting LED4
10430 * source to constant off.
10431 */
10432 if (REG_RD(bp, NIG_REG_MASK_INTERRUPT_PORT0 +
10433 params->port*4) &
10434 NIG_MASK_MI_INT) {
10435 params->link_flags |=
10436 LINK_FLAGS_INT_DISABLED;
10437
10438 bnx2x_bits_dis(
10439 bp,
10440 NIG_REG_MASK_INTERRUPT_PORT0 +
10441 params->port*4,
10442 NIG_MASK_MI_INT);
10443 }
10444 bnx2x_cl45_write(bp, phy,
10445 MDIO_PMA_DEVAD,
10446 MDIO_PMA_REG_8481_SIGNAL_MASK,
10447 0x0);
10448 }
10425 } 10449 }
10426 break; 10450 break;
10427 case LED_MODE_ON: 10451 case LED_MODE_ON:
@@ -10468,6 +10492,28 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy,
10468 MDIO_PMA_DEVAD, 10492 MDIO_PMA_DEVAD,
10469 MDIO_PMA_REG_8481_LED1_MASK, 10493 MDIO_PMA_REG_8481_LED1_MASK,
10470 0x20); 10494 0x20);
10495 if (phy->type ==
10496 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834) {
10497 /* Disable MI_INT interrupt before setting LED4
10498 * source to constant on.
10499 */
10500 if (REG_RD(bp, NIG_REG_MASK_INTERRUPT_PORT0 +
10501 params->port*4) &
10502 NIG_MASK_MI_INT) {
10503 params->link_flags |=
10504 LINK_FLAGS_INT_DISABLED;
10505
10506 bnx2x_bits_dis(
10507 bp,
10508 NIG_REG_MASK_INTERRUPT_PORT0 +
10509 params->port*4,
10510 NIG_MASK_MI_INT);
10511 }
10512 bnx2x_cl45_write(bp, phy,
10513 MDIO_PMA_DEVAD,
10514 MDIO_PMA_REG_8481_SIGNAL_MASK,
10515 0x20);
10516 }
10471 } 10517 }
10472 break; 10518 break;
10473 10519
@@ -10532,6 +10578,22 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy,
10532 MDIO_PMA_DEVAD, 10578 MDIO_PMA_DEVAD,
10533 MDIO_PMA_REG_8481_LINK_SIGNAL, 10579 MDIO_PMA_REG_8481_LINK_SIGNAL,
10534 val); 10580 val);
10581 if (phy->type ==
10582 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834) {
10583 /* Restore LED4 source to external link,
10584 * and re-enable interrupts.
10585 */
10586 bnx2x_cl45_write(bp, phy,
10587 MDIO_PMA_DEVAD,
10588 MDIO_PMA_REG_8481_SIGNAL_MASK,
10589 0x40);
10590 if (params->link_flags &
10591 LINK_FLAGS_INT_DISABLED) {
10592 bnx2x_link_int_enable(params);
10593 params->link_flags &=
10594 ~LINK_FLAGS_INT_DISABLED;
10595 }
10596 }
10535 } 10597 }
10536 break; 10598 break;
10537 } 10599 }
@@ -11791,6 +11853,8 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port,
11791 phy->media_type = ETH_PHY_KR; 11853 phy->media_type = ETH_PHY_KR;
11792 phy->flags |= FLAGS_WC_DUAL_MODE; 11854 phy->flags |= FLAGS_WC_DUAL_MODE;
11793 phy->supported &= (SUPPORTED_20000baseKR2_Full | 11855 phy->supported &= (SUPPORTED_20000baseKR2_Full |
11856 SUPPORTED_10000baseT_Full |
11857 SUPPORTED_1000baseT_Full |
11794 SUPPORTED_Autoneg | 11858 SUPPORTED_Autoneg |
11795 SUPPORTED_FIBRE | 11859 SUPPORTED_FIBRE |
11796 SUPPORTED_Pause | 11860 SUPPORTED_Pause |
@@ -12465,6 +12529,8 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
12465 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; 12529 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE;
12466 vars->mac_type = MAC_TYPE_NONE; 12530 vars->mac_type = MAC_TYPE_NONE;
12467 vars->phy_flags = 0; 12531 vars->phy_flags = 0;
12532 vars->check_kr2_recovery_cnt = 0;
12533 params->link_flags = PHY_INITIALIZED;
12468 /* Driver opens NIG-BRB filters */ 12534 /* Driver opens NIG-BRB filters */
12469 bnx2x_set_rx_filter(params, 1); 12535 bnx2x_set_rx_filter(params, 1);
12470 /* Check if link flap can be avoided */ 12536 /* Check if link flap can be avoided */
@@ -12629,6 +12695,7 @@ int bnx2x_lfa_reset(struct link_params *params,
12629 struct bnx2x *bp = params->bp; 12695 struct bnx2x *bp = params->bp;
12630 vars->link_up = 0; 12696 vars->link_up = 0;
12631 vars->phy_flags = 0; 12697 vars->phy_flags = 0;
12698 params->link_flags &= ~PHY_INITIALIZED;
12632 if (!params->lfa_base) 12699 if (!params->lfa_base)
12633 return bnx2x_link_reset(params, vars, 1); 12700 return bnx2x_link_reset(params, vars, 1);
12634 /* 12701 /*
@@ -13349,6 +13416,7 @@ static void bnx2x_disable_kr2(struct link_params *params,
13349 vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; 13416 vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE;
13350 bnx2x_update_link_attr(params, vars->link_attr_sync); 13417 bnx2x_update_link_attr(params, vars->link_attr_sync);
13351 13418
13419 vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT;
13352 /* Restart AN on leading lane */ 13420 /* Restart AN on leading lane */
13353 bnx2x_warpcore_restart_AN_KR(phy, params); 13421 bnx2x_warpcore_restart_AN_KR(phy, params);
13354} 13422}
@@ -13377,6 +13445,15 @@ static void bnx2x_check_kr2_wa(struct link_params *params,
13377 return; 13445 return;
13378 } 13446 }
13379 13447
13448 /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery
13449 * since some switches tend to reinit the AN process and clear the
13450 * advertised BP/NP after ~2 seconds causing the KR2 to be disabled
13451 * and recovered many times
13452 */
13453 if (vars->check_kr2_recovery_cnt > 0) {
13454 vars->check_kr2_recovery_cnt--;
13455 return;
13456 }
13380 lane = bnx2x_get_warpcore_lane(phy, params); 13457 lane = bnx2x_get_warpcore_lane(phy, params);
13381 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, 13458 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK,
13382 MDIO_AER_BLOCK_AER_REG, lane); 13459 MDIO_AER_BLOCK_AER_REG, lane);
@@ -13437,7 +13514,7 @@ void bnx2x_period_func(struct link_params *params, struct link_vars *vars)
13437 struct bnx2x_phy *phy = &params->phy[INT_PHY]; 13514 struct bnx2x_phy *phy = &params->phy[INT_PHY];
13438 bnx2x_set_aer_mmd(params, phy); 13515 bnx2x_set_aer_mmd(params, phy);
13439 if ((phy->supported & SUPPORTED_20000baseKR2_Full) && 13516 if ((phy->supported & SUPPORTED_20000baseKR2_Full) &&
13440 (phy->speed_cap_mask & SPEED_20000)) 13517 (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_20G))
13441 bnx2x_check_kr2_wa(params, vars, phy); 13518 bnx2x_check_kr2_wa(params, vars, phy);
13442 bnx2x_check_over_curr(params, vars); 13519 bnx2x_check_over_curr(params, vars);
13443 if (vars->rx_tx_asic_rst) 13520 if (vars->rx_tx_asic_rst)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
index d25c7d79787a..56c2aae4e2c8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
@@ -307,7 +307,9 @@ struct link_params {
307 struct bnx2x *bp; 307 struct bnx2x *bp;
308 u16 req_fc_auto_adv; /* Should be set to TX / BOTH when 308 u16 req_fc_auto_adv; /* Should be set to TX / BOTH when
309 req_flow_ctrl is set to AUTO */ 309 req_flow_ctrl is set to AUTO */
310 u16 rsrv1; 310 u16 link_flags;
311#define LINK_FLAGS_INT_DISABLED (1<<0)
312#define PHY_INITIALIZED (1<<1)
311 u32 lfa_base; 313 u32 lfa_base;
312}; 314};
313 315
@@ -341,7 +343,8 @@ struct link_vars {
341 u32 link_status; 343 u32 link_status;
342 u32 eee_status; 344 u32 eee_status;
343 u8 fault_detected; 345 u8 fault_detected;
344 u8 rsrv1; 346 u8 check_kr2_recovery_cnt;
347#define CHECK_KR2_RECOVERY_CNT 5
345 u16 periodic_flags; 348 u16 periodic_flags;
346#define PERIODIC_FLAGS_LINK_EVENT 0x0001 349#define PERIODIC_FLAGS_LINK_EVENT 0x0001
347 350
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
index 364e37ecbc5c..198f6f1c9ad5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
@@ -459,8 +459,9 @@ struct bnx2x_fw_port_stats_old {
459 459
460#define UPDATE_QSTAT(s, t) \ 460#define UPDATE_QSTAT(s, t) \
461 do { \ 461 do { \
462 qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi); \
463 qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ 462 qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \
463 qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi) \
464 + ((qstats->t##_lo < qstats_old->t##_lo) ? 1 : 0); \
464 } while (0) 465 } while (0)
465 466
466#define UPDATE_QSTAT_OLD(f) \ 467#define UPDATE_QSTAT_OLD(f) \
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index fdb9b5655414..67d2663b3974 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1869,6 +1869,8 @@ static void tg3_link_report(struct tg3 *tp)
1869 1869
1870 tg3_ump_link_report(tp); 1870 tg3_ump_link_report(tp);
1871 } 1871 }
1872
1873 tp->link_up = netif_carrier_ok(tp->dev);
1872} 1874}
1873 1875
1874static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl) 1876static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl)
@@ -2522,12 +2524,6 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
2522 return err; 2524 return err;
2523} 2525}
2524 2526
2525static void tg3_carrier_on(struct tg3 *tp)
2526{
2527 netif_carrier_on(tp->dev);
2528 tp->link_up = true;
2529}
2530
2531static void tg3_carrier_off(struct tg3 *tp) 2527static void tg3_carrier_off(struct tg3 *tp)
2532{ 2528{
2533 netif_carrier_off(tp->dev); 2529 netif_carrier_off(tp->dev);
@@ -2553,7 +2549,7 @@ static int tg3_phy_reset(struct tg3 *tp)
2553 return -EBUSY; 2549 return -EBUSY;
2554 2550
2555 if (netif_running(tp->dev) && tp->link_up) { 2551 if (netif_running(tp->dev) && tp->link_up) {
2556 tg3_carrier_off(tp); 2552 netif_carrier_off(tp->dev);
2557 tg3_link_report(tp); 2553 tg3_link_report(tp);
2558 } 2554 }
2559 2555
@@ -4134,6 +4130,14 @@ static void tg3_phy_copper_begin(struct tg3 *tp)
4134 tp->link_config.active_speed = tp->link_config.speed; 4130 tp->link_config.active_speed = tp->link_config.speed;
4135 tp->link_config.active_duplex = tp->link_config.duplex; 4131 tp->link_config.active_duplex = tp->link_config.duplex;
4136 4132
4133 if (tg3_asic_rev(tp) == ASIC_REV_5714) {
4134 /* With autoneg disabled, 5715 only links up when the
4135 * advertisement register has the configured speed
4136 * enabled.
4137 */
4138 tg3_writephy(tp, MII_ADVERTISE, ADVERTISE_ALL);
4139 }
4140
4137 bmcr = 0; 4141 bmcr = 0;
4138 switch (tp->link_config.speed) { 4142 switch (tp->link_config.speed) {
4139 default: 4143 default:
@@ -4262,9 +4266,9 @@ static bool tg3_test_and_report_link_chg(struct tg3 *tp, int curr_link_up)
4262{ 4266{
4263 if (curr_link_up != tp->link_up) { 4267 if (curr_link_up != tp->link_up) {
4264 if (curr_link_up) { 4268 if (curr_link_up) {
4265 tg3_carrier_on(tp); 4269 netif_carrier_on(tp->dev);
4266 } else { 4270 } else {
4267 tg3_carrier_off(tp); 4271 netif_carrier_off(tp->dev);
4268 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) 4272 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
4269 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT; 4273 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
4270 } 4274 }