aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2007-12-20 23:08:32 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:59:32 -0500
commitc98f6e3be1d1b9bc9299d84da4f0b1ea9a50f392 (patch)
tree6b40c900dad3d38e755f1a5a37acea08f98d3b0d /drivers/net/tg3.c
parentba4d07a8483e6ec0de3194960f8aca862711454c (diff)
[TG3]: Replace some magic 5704S constants
This patch replaces magic values with preprocessor definitions for the sg_dig_ctrl and sg_dig_status registers. This is preparatory work for the next patch. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c23
1 files changed, 12 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)
2724restart_autoneg: 2725restart_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 */