Skip to contentSkip to conversation

net: support bgmac with B50212E B1 PHY

PATCH In review Rafał Miłecki 3 participants 5 messages Oct 12, 2017 – Oct 13, 2017

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

cover net: support bgmac with B50212E B1 PHY

From: Rafał Miłecki <[email protected]>

I got a report that a board with BCM47189 SoC and B50212E B1 PHY doesn't work well some devices as there is massive ping loss. After analyzing PHY state it has appeared that is runs in slave mode and doesn't auto switch to master properly when needed.

This patchset fixes this by:
1) Adding new flag support to the PHY driver for setting master mode
2) Modifying bgmac to request master mode for reported hardware

Rafał Miłecki (2):
net: phy: broadcom: support new device flag for setting master mode
net: bgmac: enable master mode for BCM54210E and B50212E PHYs

 drivers/net/ethernet/broadcom/bgmac-bcma.c | 8 +++++++-
 drivers/net/phy/broadcom.c                 | 6 ++++++
 include/linux/brcmphy.h                    | 1 +
 3 files changed, 14 insertions(+), 1 deletion(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 net: phy: broadcom: support new device flag for setting master mode

From: Rafał Miłecki <[email protected]>

Some of Broadcom's PHYs run by default in slave mode with Automatic Slave/Master configuration disabled. It stops them from working properly with some devices.

So far it has been verified for BCM54210E and BCM50212E which don't work well with Intel's I217-LM and I218-LM:
http://ark.intel.com/products/60019/Intel-Ethernet-Connection-I217-LM
http://ark.intel.com/products/71307/Intel-Ethernet-Connection-I218-LM
I was told there is massive ping loss.

This commit adds support for a new flag which can be set by an ethernet driver to fixup PHY setup.

---
 drivers/net/phy/broadcom.c | 6 ++++++
 include/linux/brcmphy.h    | 1 +
 2 files changed, 7 insertions(+)
drivers/net/phy/broadcom.c +6 -0
index 1e9ad30a35c8..d7ed69deabfb 100644
@@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct phy_device *phydev)
 	val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
 	bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
 
+	if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
+		val = phy_read(phydev, MII_CTRL1000);
+		val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER;
+		phy_write(phydev, MII_CTRL1000, val);
+	}
+
 	return 0;
 }
 
include/linux/brcmphy.h +1 -0
index abcda9b458ab..9ac9e3e3d1e5 100644
@@ -63,6 +63,7 @@
 #define PHY_BRCM_EXT_IBND_TX_ENABLE	0x00002000
 #define PHY_BRCM_CLEAR_RGMII_MODE	0x00004000
 #define PHY_BRCM_DIS_TXCRXC_NOENRGY	0x00008000
+#define PHY_BRCM_EN_MASTER_MODE		0x00010000
 
 /* Broadcom BCM7xxx specific workarounds */
 #define PHY_BRCM_7XXX_REV(x)		(((x) >> 8) & 0xff)
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/2 net: bgmac: enable master mode for BCM54210E and B50212E PHYs

In reply to Rafał Miłecki

From: Rafał Miłecki <[email protected]>

There are 4 very similar PHYs:
0x600d84a1: BCM54210E (rev B0)
0x600d84a2: BCM54210E (rev B1)
0x600d84a5: B50212E (rev B0)
0x600d84a6: B50212E (rev B1)
that need setting master mode manually. It's because they run in slave mode by default with Automatic Slave/Master configuration disabled which can lead to unreliable connection with massive ping loss.

So far it was reported for a board with BCM47189 SoC and B50212E B1 PHY connected to the bgmac supported ethernet device. Telling PHY driver to setup PHY properly solves this issue.

---
 drivers/net/ethernet/broadcom/bgmac-bcma.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bgmac-bcma.c +7 -1
index 6322594ab260..6fe074c1588b 100644
@@ -184,13 +184,19 @@ static int bgmac_probe(struct bcma_device *core)
 
 	if (!bgmac_is_bcm4707_family(core) &&
 	    !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
+		struct phy_device *phydev;
+
 		mii_bus = bcma_mdio_mii_register(bgmac);
 		if (IS_ERR(mii_bus)) {
 			err = PTR_ERR(mii_bus);
 			goto err;
 		}
-
 		bgmac->mii_bus = mii_bus;
+
+		phydev = mdiobus_get_phy(bgmac->mii_bus, bgmac->phyaddr);
+		if (ci->id == BCMA_CHIP_ID_BCM53573 && phydev &&
+		    (phydev->drv->phy_id & phydev->drv->phy_id_mask) == PHY_ID_BCM54210E)
+			phydev->dev_flags |= PHY_BRCM_EN_MASTER_MODE;
 	}
 
 	if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {
Signature · 1 line
2.11.0
maintainer
#3 lore raw
In reply to Rafał Miłecki

From: Rafał Miłecki <[email protected]>
Date: Thu, 12 Oct 2017 10:21:24 +0200

Quoted 10 lines

From: Rafał Miłecki <[email protected]>

I got a report that a board with BCM47189 SoC and B50212E B1 PHY doesn't work well some devices as there is massive ping loss. After analyzing PHY state it has appeared that is runs in slave mode and doesn't auto switch to master properly when needed.

This patchset fixes this by:
1) Adding new flag support to the PHY driver for setting master mode
2) Modifying bgmac to request master mode for reported hardware

Series applied to net-next, thanks.

#4 lore raw
In reply to Rafał Miłecki
Quoted 10 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

I got a report that a board with BCM47189 SoC and B50212E B1 PHY doesn't work well some devices as there is massive ping loss. After analyzing PHY state it has appeared that is runs in slave mode and doesn't auto switch to master properly when needed.

This patchset fixes this by:
1) Adding new flag support to the PHY driver for setting master mode
2) Modifying bgmac to request master mode for reported hardware

Sorry for the late reply, and it's been applied already, but this looks good to me, thanks for implementing it this way!

Signature · 1 line
Florian