aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-11-02 09:32:38 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-03 02:39:15 -0500
commit52fae0837153e86e4dabaf5df517a0b8b7a20bd7 (patch)
tree72259bf0230f7facdbf6d928f8f1f662a133e10b
parentc704dc23cac0e433796bfe0a1fe2f1a64da11ac7 (diff)
tg3 / broadcom: Optionally disable TXC if no link
This patch adds code to disable the TXC and RXC reference clocks if link is not available. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/broadcom.c5
-rw-r--r--drivers/net/tg3.c1
-rw-r--r--include/linux/brcmphy.h1
3 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 7b10495fe8fb..f63c96a4ecb4 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -108,6 +108,7 @@
108#define BCM54XX_SHD_SCR3 0x05 108#define BCM54XX_SHD_SCR3 0x05
109#define BCM54XX_SHD_SCR3_DEF_CLK125 0x0001 109#define BCM54XX_SHD_SCR3_DEF_CLK125 0x0001
110#define BCM54XX_SHD_SCR3_DLLAPD_DIS 0x0002 110#define BCM54XX_SHD_SCR3_DLLAPD_DIS 0x0002
111#define BCM54XX_SHD_SCR3_TRDDAPD 0x0004
111 112
112/* 01010: Auto Power-Down */ 113/* 01010: Auto Power-Down */
113#define BCM54XX_SHD_APD 0x0a 114#define BCM54XX_SHD_APD 0x0a
@@ -362,6 +363,9 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
362 else 363 else
363 val |= BCM54XX_SHD_SCR3_DLLAPD_DIS; 364 val |= BCM54XX_SHD_SCR3_DLLAPD_DIS;
364 365
366 if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY)
367 val |= BCM54XX_SHD_SCR3_TRDDAPD;
368
365 if (orig != val) 369 if (orig != val)
366 bcm54xx_shadow_write(phydev, BCM54XX_SHD_SCR3, val); 370 bcm54xx_shadow_write(phydev, BCM54XX_SHD_SCR3, val);
367 371
@@ -409,6 +413,7 @@ static int bcm54xx_config_init(struct phy_device *phydev)
409 bcm54xx_shadow_write(phydev, BCM54XX_SHD_RGMII_MODE, 0); 413 bcm54xx_shadow_write(phydev, BCM54XX_SHD_RGMII_MODE, 0);
410 414
411 if ((phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) || 415 if ((phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) ||
416 (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) ||
412 (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) 417 (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
413 bcm54xx_adjust_rxrefclk(phydev); 418 bcm54xx_adjust_rxrefclk(phydev);
414 419
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f74bf91e78cc..50bb53de5ebd 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1103,6 +1103,7 @@ static int tg3_mdio_init(struct tg3 *tp)
1103 case TG3_PHY_ID_BCM50610M: 1103 case TG3_PHY_ID_BCM50610M:
1104 phydev->dev_flags |= PHY_BRCM_CLEAR_RGMII_MODE | 1104 phydev->dev_flags |= PHY_BRCM_CLEAR_RGMII_MODE |
1105 PHY_BRCM_RX_REFCLK_UNUSED | 1105 PHY_BRCM_RX_REFCLK_UNUSED |
1106 PHY_BRCM_DIS_TXCRXC_NOENRGY |
1106 PHY_BRCM_AUTO_PWRDWN_ENABLE; 1107 PHY_BRCM_AUTO_PWRDWN_ENABLE;
1107 if (tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE) 1108 if (tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE)
1108 phydev->dev_flags |= PHY_BRCM_STD_IBND_DISABLE; 1109 phydev->dev_flags |= PHY_BRCM_STD_IBND_DISABLE;
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 59432278ded2..2b31b91f5871 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -9,4 +9,5 @@
9#define PHY_BRCM_EXT_IBND_RX_ENABLE 0x00001000 9#define PHY_BRCM_EXT_IBND_RX_ENABLE 0x00001000
10#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 10#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000
11#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 11#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
12#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
12#define PHY_BCM_FLAGS_VALID 0x80000000 13#define PHY_BCM_FLAGS_VALID 0x80000000