tg3: Fix AC131 loopback test errors for 5785
authorMatt Carlson <mcarlson@broadcom.com>
Fri, 12 Feb 2010 14:47:12 +0000 (14:47 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Feb 2010 01:05:55 +0000 (17:05 -0800)
The AC131 does not enable the forced transmit clock settings
immediately.  The workaround is to read the register again to get the
setting to take effect.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tg3.c
drivers/net/tg3.h

index cb6967947c30205c910d9706d81b6ce6fd7ca231..128126a87c34ad2e7e01f155fcd9b44ddfa39ea8 100644 (file)
@@ -10822,8 +10822,12 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
 
                mac_mode = tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK;
                if (tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) {
-                       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
-                               tg3_writephy(tp, MII_TG3_FET_PTEST, 0x1800);
+                       tg3_writephy(tp, MII_TG3_FET_PTEST,
+                                    MII_TG3_FET_PTEST_FRC_TX_LINK |
+                                    MII_TG3_FET_PTEST_FRC_TX_LOCK);
+                       /* The write needs to be flushed for the AC131 */
+                       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785)
+                               tg3_readphy(tp, MII_TG3_FET_PTEST, &val);
                        mac_mode |= MAC_MODE_PORT_MODE_MII;
                } else
                        mac_mode |= MAC_MODE_PORT_MODE_GMII;
index a8fb53aaf742b95f2f2f8b581de10d2b01a9fead..b4fd59623cfbb8dca3367c26ffc6593b64829d57 100644 (file)
 
 /* Fast Ethernet Tranceiver definitions */
 #define MII_TG3_FET_PTEST              0x17
+#define  MII_TG3_FET_PTEST_FRC_TX_LINK 0x1000
+#define  MII_TG3_FET_PTEST_FRC_TX_LOCK 0x0800
+
 #define MII_TG3_FET_TEST               0x1f
 #define  MII_TG3_FET_SHADOW_EN         0x0080