]> git.neil.brown.name Git - history.git/commitdiff
[TG3]: Fix jimbo frame PHY programming.
authorMichael Chan <mchan@broadcom.com>
Mon, 26 Apr 2004 14:02:26 +0000 (07:02 -0700)
committerDavid S. Miller <davem@kernel.bkbits.net>
Mon, 26 Apr 2004 14:02:26 +0000 (07:02 -0700)
1. Added new workaround for 5705 to improve bit error rate.

2. Changed to use read-modify-write to set the extended packet bit in
tg3_phy_reset.

3. Removed some phy setup code in tg3_phy_probe. All of that is already
in the end of tg3_phy_reset. Writing to the phy during probe time may
contend with ASF because ASF is constantly reading phy registers to
determine the link.

4. Removed the write to phy register 0x18 in tg3_phy_copper_begin. Not
sure what it was for and it will overwrite that regsiter.

drivers/net/tg3.c
drivers/net/tg3.h

index d7199e061ddc13581afbff9e572f23474222e7bf..775c4369fe6c3ad76b724cfb1b22c65dcc4c33db 100644 (file)
@@ -700,14 +700,29 @@ out:
                tg3_writephy(tp, 0x1c, 0x8d68);
                tg3_writephy(tp, 0x1c, 0x8d68);
        }
+       if (tp->tg3_flags2 & TG3_FLG2_PHY_BER_BUG) {
+               tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
+               tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
+               tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x310b);
+               tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x201f);
+               tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x9506);
+               tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x401f);
+               tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x14e2);
+               tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
+       }
        /* Set Extended packet length bit (bit 14) on all chips that */
        /* support jumbo frames */
-       if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401 ||
-           (tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5411) {
+       if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) {
+               /* Cannot do read-modify-write on 5401 */
                tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20);
        }
        else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
-               tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4400);
+               u32 phy_reg;
+
+               /* Set bit 14 with read-modify-write to preserve other bits */
+               tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0007);
+               tg3_readphy(tp, MII_TG3_AUX_CTRL, &phy_reg);
+               tg3_writephy(tp, MII_TG3_AUX_CTRL, phy_reg | 0x4000);
        }
        tg3_phy_set_wirespeed(tp);
        return 0;
@@ -1060,8 +1075,6 @@ static int tg3_phy_copper_begin(struct tg3 *tp)
        u32 new_adv;
        int i;
 
-       tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
-
        if (tp->link_config.phy_is_low_power) {
                /* Entering low power mode.  Disable gigabit and
                 * 100baseT advertisements.
@@ -6605,21 +6618,6 @@ skip_phy_reset:
                        return err;
        }
 
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) {
-               tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c00);
-               tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x201f);
-               tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x2aaa);
-       }
-
-       if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) &&
-           (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0)) {
-               tg3_writephy(tp, 0x1c, 0x8d68);
-               tg3_writephy(tp, 0x1c, 0x8d68);
-       }
-
-       /* Enable Ethernet@WireSpeed */
-       tg3_phy_set_wirespeed(tp);
-
        if (!err && ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401)) {
                err = tg3_init_5401phy_dsp(tp);
        }
@@ -6934,6 +6932,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
        if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0)
                tp->tg3_flags2 |= TG3_FLG2_PHY_5704_A0_BUG;
 
+       /* Note: 5750 also needs this flag set to improve bit error rate. */
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
+               tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG;
+
        /* Only 5701 and later support tagged irq status mode.
         * Also, 5788 chips cannot use tagged irq status.
         *
index 2973130bc7d11674c67ff3194512a9366342d3ff..04e9055041d2680d46d3d4098ea4d1d0cc345a89 100644 (file)
@@ -1929,6 +1929,7 @@ struct tg3 {
 #define TG3_FLG2_TSO_CAPABLE           0x00000020
 #define TG3_FLG2_PHY_ADC_BUG           0x00000040
 #define TG3_FLG2_PHY_5704_A0_BUG       0x00000080
+#define TG3_FLG2_PHY_BER_BUG           0x00000100
 
        u32                             split_mode_max_reqs;
 #define SPLIT_MODE_5704_MAX_REQ                3