diff options
-rw-r--r-- | drivers/net/tg3.c | 23 | ||||
-rw-r--r-- | drivers/net/tg3.h | 7 |
2 files changed, 19 insertions, 11 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 5b83a542660e..6575e9bc170f 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -2683,7 +2683,7 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) | |||
2683 | sg_dig_ctrl = tr32(SG_DIG_CTRL); | 2683 | sg_dig_ctrl = tr32(SG_DIG_CTRL); |
2684 | 2684 | ||
2685 | if (tp->link_config.autoneg != AUTONEG_ENABLE) { | 2685 | if (tp->link_config.autoneg != AUTONEG_ENABLE) { |
2686 | if (sg_dig_ctrl & (1 << 31)) { | 2686 | if (sg_dig_ctrl & SG_DIG_USING_HW_AUTONEG) { |
2687 | if (workaround) { | 2687 | if (workaround) { |
2688 | u32 val = serdes_cfg; | 2688 | u32 val = serdes_cfg; |
2689 | 2689 | ||
@@ -2693,7 +2693,8 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) | |||
2693 | val |= 0x4010000; | 2693 | val |= 0x4010000; |
2694 | tw32_f(MAC_SERDES_CFG, val); | 2694 | tw32_f(MAC_SERDES_CFG, val); |
2695 | } | 2695 | } |
2696 | tw32_f(SG_DIG_CTRL, 0x01388400); | 2696 | |
2697 | tw32_f(SG_DIG_CTRL, SG_DIG_COMMON_SETUP); | ||
2697 | } | 2698 | } |
2698 | if (mac_status & MAC_STATUS_PCS_SYNCED) { | 2699 | if (mac_status & MAC_STATUS_PCS_SYNCED) { |
2699 | tg3_setup_flow_control(tp, 0, 0); | 2700 | tg3_setup_flow_control(tp, 0, 0); |
@@ -2703,13 +2704,13 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) | |||
2703 | } | 2704 | } |
2704 | 2705 | ||
2705 | /* Want auto-negotiation. */ | 2706 | /* Want auto-negotiation. */ |
2706 | expected_sg_dig_ctrl = 0x81388400; | 2707 | expected_sg_dig_ctrl = SG_DIG_USING_HW_AUTONEG | SG_DIG_COMMON_SETUP; |
2707 | 2708 | ||
2708 | /* Pause capability */ | 2709 | /* Pause capability */ |
2709 | expected_sg_dig_ctrl |= (1 << 11); | 2710 | expected_sg_dig_ctrl |= SG_DIG_PAUSE_CAP; |
2710 | 2711 | ||
2711 | /* Asymettric pause */ | 2712 | /* Asymettric pause */ |
2712 | expected_sg_dig_ctrl |= (1 << 12); | 2713 | expected_sg_dig_ctrl |= SG_DIG_ASYM_PAUSE; |
2713 | 2714 | ||
2714 | if (sg_dig_ctrl != expected_sg_dig_ctrl) { | 2715 | if (sg_dig_ctrl != expected_sg_dig_ctrl) { |
2715 | if ((tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT) && | 2716 | if ((tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT) && |
@@ -2724,7 +2725,7 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) | |||
2724 | restart_autoneg: | 2725 | restart_autoneg: |
2725 | if (workaround) | 2726 | if (workaround) |
2726 | tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011000); | 2727 | tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011000); |
2727 | tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | (1 << 30)); | 2728 | tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | SG_DIG_SOFT_RESET); |
2728 | udelay(5); | 2729 | udelay(5); |
2729 | tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl); | 2730 | tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl); |
2730 | 2731 | ||
@@ -2735,22 +2736,22 @@ restart_autoneg: | |||
2735 | sg_dig_status = tr32(SG_DIG_STATUS); | 2736 | sg_dig_status = tr32(SG_DIG_STATUS); |
2736 | mac_status = tr32(MAC_STATUS); | 2737 | mac_status = tr32(MAC_STATUS); |
2737 | 2738 | ||
2738 | if ((sg_dig_status & (1 << 1)) && | 2739 | if ((sg_dig_status & SG_DIG_AUTONEG_COMPLETE) && |
2739 | (mac_status & MAC_STATUS_PCS_SYNCED)) { | 2740 | (mac_status & MAC_STATUS_PCS_SYNCED)) { |
2740 | u32 local_adv, remote_adv; | 2741 | u32 local_adv, remote_adv; |
2741 | 2742 | ||
2742 | local_adv = ADVERTISE_PAUSE_CAP; | 2743 | local_adv = ADVERTISE_PAUSE_CAP; |
2743 | remote_adv = 0; | 2744 | remote_adv = 0; |
2744 | if (sg_dig_status & (1 << 19)) | 2745 | if (sg_dig_status & SG_DIG_PARTNER_PAUSE_CAPABLE) |
2745 | remote_adv |= LPA_PAUSE_CAP; | 2746 | remote_adv |= LPA_PAUSE_CAP; |
2746 | if (sg_dig_status & (1 << 20)) | 2747 | if (sg_dig_status & SG_DIG_PARTNER_ASYM_PAUSE) |
2747 | remote_adv |= LPA_PAUSE_ASYM; | 2748 | remote_adv |= LPA_PAUSE_ASYM; |
2748 | 2749 | ||
2749 | tg3_setup_flow_control(tp, local_adv, remote_adv); | 2750 | tg3_setup_flow_control(tp, local_adv, remote_adv); |
2750 | current_link_up = 1; | 2751 | current_link_up = 1; |
2751 | tp->serdes_counter = 0; | 2752 | tp->serdes_counter = 0; |
2752 | tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; | 2753 | tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; |
2753 | } else if (!(sg_dig_status & (1 << 1))) { | 2754 | } else if (!(sg_dig_status & SG_DIG_AUTONEG_COMPLETE)) { |
2754 | if (tp->serdes_counter) | 2755 | if (tp->serdes_counter) |
2755 | tp->serdes_counter--; | 2756 | tp->serdes_counter--; |
2756 | else { | 2757 | else { |
@@ -2765,7 +2766,7 @@ restart_autoneg: | |||
2765 | tw32_f(MAC_SERDES_CFG, val); | 2766 | tw32_f(MAC_SERDES_CFG, val); |
2766 | } | 2767 | } |
2767 | 2768 | ||
2768 | tw32_f(SG_DIG_CTRL, 0x01388400); | 2769 | tw32_f(SG_DIG_CTRL, SG_DIG_COMMON_SETUP); |
2769 | udelay(40); | 2770 | udelay(40); |
2770 | 2771 | ||
2771 | /* Link parallel detection - link is up */ | 2772 | /* Link parallel detection - link is up */ |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index ac47c176fc03..3938eb35ce8c 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -545,6 +545,8 @@ | |||
545 | #define SG_DIG_FIBER_MODE 0x00008000 | 545 | #define SG_DIG_FIBER_MODE 0x00008000 |
546 | #define SG_DIG_REMOTE_FAULT_MASK 0x00006000 | 546 | #define SG_DIG_REMOTE_FAULT_MASK 0x00006000 |
547 | #define SG_DIG_PAUSE_MASK 0x00001800 | 547 | #define SG_DIG_PAUSE_MASK 0x00001800 |
548 | #define SG_DIG_PAUSE_CAP 0x00000800 | ||
549 | #define SG_DIG_ASYM_PAUSE 0x00001000 | ||
548 | #define SG_DIG_GBIC_ENABLE 0x00000400 | 550 | #define SG_DIG_GBIC_ENABLE 0x00000400 |
549 | #define SG_DIG_CHECK_END_ENABLE 0x00000200 | 551 | #define SG_DIG_CHECK_END_ENABLE 0x00000200 |
550 | #define SG_DIG_SGMII_AUTONEG_TIMER 0x00000100 | 552 | #define SG_DIG_SGMII_AUTONEG_TIMER 0x00000100 |
@@ -556,6 +558,11 @@ | |||
556 | #define SG_DIG_AUTONEG_LOW_ENABLE 0x00000004 | 558 | #define SG_DIG_AUTONEG_LOW_ENABLE 0x00000004 |
557 | #define SG_DIG_REMOTE_LOOPBACK 0x00000002 | 559 | #define SG_DIG_REMOTE_LOOPBACK 0x00000002 |
558 | #define SG_DIG_LOOPBACK 0x00000001 | 560 | #define SG_DIG_LOOPBACK 0x00000001 |
561 | #define SG_DIG_COMMON_SETUP (SG_DIG_CRC16_CLEAR_N | \ | ||
562 | SG_DIG_LOCAL_DUPLEX_STATUS | \ | ||
563 | SG_DIG_LOCAL_LINK_STATUS | \ | ||
564 | (0x2 << SG_DIG_SPEED_STATUS_SHIFT) | \ | ||
565 | SG_DIG_FIBER_MODE | SG_DIG_GBIC_ENABLE) | ||
559 | #define SG_DIG_STATUS 0x000005b4 | 566 | #define SG_DIG_STATUS 0x000005b4 |
560 | #define SG_DIG_CRC16_BUS_MASK 0xffff0000 | 567 | #define SG_DIG_CRC16_BUS_MASK 0xffff0000 |
561 | #define SG_DIG_PARTNER_FAULT_MASK 0x00600000 /* If !MRADV_CRC16_SELECT */ | 568 | #define SG_DIG_PARTNER_FAULT_MASK 0x00600000 /* If !MRADV_CRC16_SELECT */ |