aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-08-02 07:26:04 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-02 18:46:31 -0400
commit6ee7c0a0a5003abd4afd724f5c2f654fe7328c0a (patch)
tree191edcc071eecda31fbf67bee1cc5bab7e4dab84 /drivers/net/tg3.c
parentf65aac166fe10b96e64c233980a3522fc50fbecf (diff)
tg3: Add error reporting to tg3_phydsp_write()
This patch adds error reporting to the tg3_phydsp_write() function and converts a few more locations to use this function over the inlined equivalent. Reviewed-by: Benjamin Li <benli@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c51
1 files changed, 20 insertions, 31 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 820a7ddd7e09..a9bca8aa254f 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1572,10 +1572,15 @@ static void tg3_phy_fini(struct tg3 *tp)
1572 } 1572 }
1573} 1573}
1574 1574
1575static void tg3_phydsp_write(struct tg3 *tp, u32 reg, u32 val) 1575static int tg3_phydsp_write(struct tg3 *tp, u32 reg, u32 val)
1576{ 1576{
1577 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, reg); 1577 int err;
1578 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, val); 1578
1579 err = tg3_writephy(tp, MII_TG3_DSP_ADDRESS, reg);
1580 if (!err)
1581 err = tg3_writephy(tp, MII_TG3_DSP_RW_PORT, val);
1582
1583 return err;
1579} 1584}
1580 1585
1581static void tg3_phy_fet_toggle_apd(struct tg3 *tp, bool enable) 1586static void tg3_phy_fet_toggle_apd(struct tg3 *tp, bool enable)
@@ -1872,8 +1877,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
1872 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 1877 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
1873 1878
1874 /* Block the PHY control access. */ 1879 /* Block the PHY control access. */
1875 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005); 1880 tg3_phydsp_write(tp, 0x8005, 0x0800);
1876 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0800);
1877 1881
1878 err = tg3_phy_write_and_check_testpat(tp, &do_phy_reset); 1882 err = tg3_phy_write_and_check_testpat(tp, &do_phy_reset);
1879 if (!err) 1883 if (!err)
@@ -1884,8 +1888,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
1884 if (err) 1888 if (err)
1885 return err; 1889 return err;
1886 1890
1887 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005); 1891 tg3_phydsp_write(tp, 0x8005, 0x0000);
1888 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0000);
1889 1892
1890 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200); 1893 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200);
1891 tg3_writephy(tp, 0x16, 0x0000); 1894 tg3_writephy(tp, 0x16, 0x0000);
@@ -1994,10 +1997,8 @@ static int tg3_phy_reset(struct tg3 *tp)
1994out: 1997out:
1995 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { 1998 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) {
1996 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 1999 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
1997 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x201f); 2000 tg3_phydsp_write(tp, 0x201f, 0x2aaa);
1998 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x2aaa); 2001 tg3_phydsp_write(tp, 0x000a, 0x0323);
1999 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
2000 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0323);
2001 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); 2002 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
2002 } 2003 }
2003 if (tp->tg3_flags2 & TG3_FLG2_PHY_5704_A0_BUG) { 2004 if (tp->tg3_flags2 & TG3_FLG2_PHY_5704_A0_BUG) {
@@ -2006,12 +2007,9 @@ out:
2006 } 2007 }
2007 if (tp->tg3_flags2 & TG3_FLG2_PHY_BER_BUG) { 2008 if (tp->tg3_flags2 & TG3_FLG2_PHY_BER_BUG) {
2008 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 2009 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
2009 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a); 2010 tg3_phydsp_write(tp, 0x000a, 0x310b);
2010 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x310b); 2011 tg3_phydsp_write(tp, 0x201f, 0x9506);
2011 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x201f); 2012 tg3_phydsp_write(tp, 0x401f, 0x14e2);
2012 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x9506);
2013 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x401f);
2014 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x14e2);
2015 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); 2013 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
2016 } else if (tp->tg3_flags2 & TG3_FLG2_PHY_JITTER_BUG) { 2014 } else if (tp->tg3_flags2 & TG3_FLG2_PHY_JITTER_BUG) {
2017 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 2015 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
@@ -2979,20 +2977,11 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp)
2979 /* Set Extended packet length bit */ 2977 /* Set Extended packet length bit */
2980 err = tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20); 2978 err = tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20);
2981 2979
2982 err |= tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x0012); 2980 err |= tg3_phydsp_write(tp, 0x0012, 0x1804);
2983 err |= tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x1804); 2981 err |= tg3_phydsp_write(tp, 0x0013, 0x1204);
2984 2982 err |= tg3_phydsp_write(tp, 0x8006, 0x0132);
2985 err |= tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x0013); 2983 err |= tg3_phydsp_write(tp, 0x8006, 0x0232);
2986 err |= tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x1204); 2984 err |= tg3_phydsp_write(tp, 0x201f, 0x0a20);
2987
2988 err |= tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8006);
2989 err |= tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0132);
2990
2991 err |= tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8006);
2992 err |= tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0232);
2993
2994 err |= tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x201f);
2995 err |= tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0a20);
2996 2985
2997 udelay(40); 2986 udelay(40);
2998 2987