瀏覽代碼

net: phy: bcm7xxx: introduce r_rc_cal_reset helper

This function performs a R/RC calibration reset and will start being
used by more than one function in the next patches, create a helper
function to factor code.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Florian Fainelli 10 年之前
父節點
當前提交
9c41f2baa9
共有 1 個文件被更改,包括 10 次插入5 次删除
  1. 10 5
      drivers/net/phy/bcm7xxx.c

+ 10 - 5
drivers/net/phy/bcm7xxx.c

@@ -69,6 +69,15 @@ static void phy_write_misc(struct phy_device *phydev,
 	phy_write(phydev, MII_BCM54XX_EXP_DATA, value);
 	phy_write(phydev, MII_BCM54XX_EXP_DATA, value);
 }
 }
 
 
+static void r_rc_cal_reset(struct phy_device *phydev)
+{
+	/* Reset R_CAL/RC_CAL Engine */
+	phy_write_exp(phydev, 0x00b0, 0x0010);
+
+	/* Disable Reset R_AL/RC_CAL Engine */
+	phy_write_exp(phydev, 0x00b0, 0x0000);
+}
+
 static int bcm7xxx_28nm_b0_afe_config_init(struct phy_device *phydev)
 static int bcm7xxx_28nm_b0_afe_config_init(struct phy_device *phydev)
 {
 {
 	/* Increase VCO range to prevent unlocking problem of PLL at low
 	/* Increase VCO range to prevent unlocking problem of PLL at low
@@ -90,11 +99,7 @@ static int bcm7xxx_28nm_b0_afe_config_init(struct phy_device *phydev)
 	/* Switch to CORE_BASE1E */
 	/* Switch to CORE_BASE1E */
 	phy_write(phydev, MII_BCM7XXX_CORE_BASE1E, 0xd);
 	phy_write(phydev, MII_BCM7XXX_CORE_BASE1E, 0xd);
 
 
-	/* Reset R_CAL/RC_CAL Engine */
-	phy_write_exp(phydev, CORE_EXPB0, 0x0010);
-
-	/* Disable Reset R_CAL/RC_CAL Engine */
-	phy_write_exp(phydev, CORE_EXPB0, 0x0000);
+	r_rc_cal_reset(phydev);
 
 
 	/* write AFE_RXCONFIG_0 */
 	/* write AFE_RXCONFIG_0 */
 	phy_write_misc(phydev, AFE_RXCONFIG_0, 0xeb19);
 	phy_write_misc(phydev, AFE_RXCONFIG_0, 0xeb19);