Skip to contentSkip to conversation

net: phy: Better support for BCM54810

PATCH In review Florian Fainelli 3 participants 6 messages Feb 19, 2020 – Feb 20, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover net: phy: Better support for BCM54810

Hi David, Andrew, Heiner,

This patch series updates the broadcom PHY driver to better support the BCM54810 and allow it to make use of the exiting bcm54xx_adjust_rxrefclk() as well as fix suspend/resume for it.

Changes in v2:

- added Reviewed-by tags from Andrew for patches #1 and #3
- expanded commit message in #2 to explain the change

Florian Fainelli (3):
net: phy: broadcom: Allow BCM54810 to use bcm54xx_adjust_rxrefclk()
net: phy: broadcom: Have bcm54xx_adjust_rxrefclk() check for flags
net: phy: broadcom: Wire suspend/resume for BCM54810

 drivers/net/phy/broadcom.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/3 net: phy: broadcom: Allow BCM54810 to use bcm54xx_adjust_rxrefclk()

The function bcm54xx_adjust_rxrefclk() works correctly on the BCM54810 PHY, allow this device ID to proceed through.

---
 drivers/net/phy/broadcom.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/broadcom.c +2 -1
index 7d68b28bb893..4ad2128cc454 100644
@@ -194,7 +194,8 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
 	/* Abort if we are using an untested phy. */
 	if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
 	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
-	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M)
+	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M &&
+	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54810)
 		return;
 
 	val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3);
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/3 net: phy: broadcom: Have bcm54xx_adjust_rxrefclk() check for flags

In reply to Florian Fainelli

bcm54xx_adjust_rxrefclk() already checks for PHY_BRCM_AUTO_PWRDWN_ENABLE and PHY_BRCM_DIS_TXCRXC_NOENRGY in order to set the appropriate bit. The situation is a bit more complicated with the flag PHY_BRCM_RX_REFCLK_UNUSED but essentially amounts to the same situation.

The default setting for the 125MHz clock is to be on for all PHYs and we still treat BCM50610 and BCM50610M specifically with the polarity of the bit reversed.

---
 drivers/net/phy/broadcom.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/phy/broadcom.c +1 -4
index 4ad2128cc454..b4eae84a9195 100644
@@ -273,10 +273,7 @@ static int bcm54xx_config_init(struct phy_device *phydev)
 	    (phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE))
 		bcm_phy_write_shadow(phydev, BCM54XX_SHD_RGMII_MODE, 0);
 
-	if ((phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) ||
-	    (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) ||
-	    (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
-		bcm54xx_adjust_rxrefclk(phydev);
+	bcm54xx_adjust_rxrefclk(phydev);
 
 	if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) {
 		err = bcm54210e_config_init(phydev);
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 2/3
#3 lore raw

Re: [PATCH net-next v2 2/3] net: phy: broadcom: Have bcm54xx_adjust_rxrefclk() check for flags

Quoted 10 lines · Florian Fainelli

bcm54xx_adjust_rxrefclk() already checks for PHY_BRCM_AUTO_PWRDWN_ENABLE and PHY_BRCM_DIS_TXCRXC_NOENRGY in order to set the appropriate bit. The situation is a bit more complicated with the flag PHY_BRCM_RX_REFCLK_UNUSED but essentially amounts to the same situation.

The default setting for the 125MHz clock is to be on for all PHYs and we still treat BCM50610 and BCM50610M specifically with the polarity of the bit reversed.

Andrew

#4 lore raw

PATCH v2 3/3 net: phy: broadcom: Wire suspend/resume for BCM54810

In reply to Florian Fainelli

The BCM54810 PHY can use the standard BMCR Power down suspend, but needs a custom resume routine which first clear the Power down bit, and then re-initializes the PHY. While in low-power mode, the PHY only accepts writes to the BMCR register. The datasheet clearly says it:

Reads or writes to any MII register other than MII Control register (address 00h) while the device is in the standby power-down mode may cause unpredictable results.

---
 drivers/net/phy/broadcom.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/phy/broadcom.c +16 -0
index b4eae84a9195..ab24692a92c6 100644
@@ -313,6 +313,20 @@ static int bcm54xx_config_init(struct phy_device *phydev)
 	return 0;
 }
 
+static int bcm54xx_resume(struct phy_device *phydev)
+{
+	int ret;
+
+	/* Writes to register other than BMCR would be ignored
+	 * unless we clear the PDOWN bit first
+	 */
+	ret = genphy_resume(phydev);
+	if (ret < 0)
+		return ret;
+
+	return bcm54xx_config_init(phydev);
+}
+
 static int bcm5482_config_init(struct phy_device *phydev)
 {
 	int err, reg;
@@ -706,6 +720,8 @@ static struct phy_driver broadcom_drivers[] = {
 	.config_aneg    = bcm5481_config_aneg,
 	.ack_interrupt  = bcm_phy_ack_intr,
 	.config_intr    = bcm_phy_config_intr,
+	.suspend	= genphy_suspend,
+	.resume		= bcm54xx_resume,
 }, {
 	.phy_id		= PHY_ID_BCM5482,
 	.phy_id_mask	= 0xfffffff0,
Signature · 1 line
2.17.1
maintainer
#5 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Wed, 19 Feb 2020 12:00:46 -0800

Quoted 8 lines

This patch series updates the broadcom PHY driver to better support the BCM54810 and allow it to make use of the exiting bcm54xx_adjust_rxrefclk() as well as fix suspend/resume for it.

Changes in v2:

- added Reviewed-by tags from Andrew for patches #1 and #3
- expanded commit message in #2 to explain the change

Series applied, thanks Florian.