All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] net: support bgmac with B50212E B1 PHY
@ 2017-10-12  8:21 Rafał Miłecki
  2017-10-12  8:21 ` [PATCH 1/2] net: phy: broadcom: support new device flag for setting master mode Rafał Miłecki
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Rafał Miłecki @ 2017-10-12  8:21 UTC (permalink / raw)
  To: David S . Miller, netdev
  Cc: Andrew Lunn, Florian Fainelli, Hauke Mehrtens, Jon Mason,
	Steve Lin, Tobias Klauser, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

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(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] net: phy: broadcom: support new device flag for setting master mode
  2017-10-12  8:21 [PATCH 0/2] net: support bgmac with B50212E B1 PHY Rafał Miłecki
@ 2017-10-12  8:21 ` Rafał Miłecki
  2017-10-12  8:21 ` [PATCH 2/2] net: bgmac: enable master mode for BCM54210E and B50212E PHYs Rafał Miłecki
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Rafał Miłecki @ 2017-10-12  8:21 UTC (permalink / raw)
  To: David S . Miller, netdev
  Cc: Andrew Lunn, Florian Fainelli, Hauke Mehrtens, Jon Mason,
	Steve Lin, Tobias Klauser, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

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.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/net/phy/broadcom.c | 6 ++++++
 include/linux/brcmphy.h    | 1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 1e9ad30a35c8..d7ed69deabfb 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -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;
 }
 
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index abcda9b458ab..9ac9e3e3d1e5 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -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)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] net: bgmac: enable master mode for BCM54210E and B50212E PHYs
  2017-10-12  8:21 [PATCH 0/2] net: support bgmac with B50212E B1 PHY Rafał Miłecki
  2017-10-12  8:21 ` [PATCH 1/2] net: phy: broadcom: support new device flag for setting master mode Rafał Miłecki
@ 2017-10-12  8:21 ` Rafał Miłecki
  2017-10-13  5:59 ` [PATCH 0/2] net: support bgmac with B50212E B1 PHY David Miller
  2017-10-13 19:14 ` Florian Fainelli
  3 siblings, 0 replies; 5+ messages in thread
From: Rafał Miłecki @ 2017-10-12  8:21 UTC (permalink / raw)
  To: David S . Miller, netdev
  Cc: Andrew Lunn, Florian Fainelli, Hauke Mehrtens, Jon Mason,
	Steve Lin, Tobias Klauser, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

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.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/net/ethernet/broadcom/bgmac-bcma.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ethernet/broadcom/bgmac-bcma.c
index 6322594ab260..6fe074c1588b 100644
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
@@ -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) {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] net: support bgmac with B50212E B1 PHY
  2017-10-12  8:21 [PATCH 0/2] net: support bgmac with B50212E B1 PHY Rafał Miłecki
  2017-10-12  8:21 ` [PATCH 1/2] net: phy: broadcom: support new device flag for setting master mode Rafał Miłecki
  2017-10-12  8:21 ` [PATCH 2/2] net: bgmac: enable master mode for BCM54210E and B50212E PHYs Rafał Miłecki
@ 2017-10-13  5:59 ` David Miller
  2017-10-13 19:14 ` Florian Fainelli
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-10-13  5:59 UTC (permalink / raw)
  To: zajec5
  Cc: netdev, andrew, f.fainelli, hauke, jon.mason, steven.lin1,
	tklauser, bcm-kernel-feedback-list, rafal

From: Rafał Miłecki <zajec5@gmail.com>
Date: Thu, 12 Oct 2017 10:21:24 +0200

> From: Rafał Miłecki <rafal@milecki.pl>
> 
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] net: support bgmac with B50212E B1 PHY
  2017-10-12  8:21 [PATCH 0/2] net: support bgmac with B50212E B1 PHY Rafał Miłecki
                   ` (2 preceding siblings ...)
  2017-10-13  5:59 ` [PATCH 0/2] net: support bgmac with B50212E B1 PHY David Miller
@ 2017-10-13 19:14 ` Florian Fainelli
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2017-10-13 19:14 UTC (permalink / raw)
  To: Rafał Miłecki, David S . Miller, netdev
  Cc: Andrew Lunn, Hauke Mehrtens, Jon Mason, Steve Lin,
	Tobias Klauser, bcm-kernel-feedback-list,
	Rafał Miłecki

On 10/12/2017 01:21 AM, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> 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!
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-13 19:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12  8:21 [PATCH 0/2] net: support bgmac with B50212E B1 PHY Rafał Miłecki
2017-10-12  8:21 ` [PATCH 1/2] net: phy: broadcom: support new device flag for setting master mode Rafał Miłecki
2017-10-12  8:21 ` [PATCH 2/2] net: bgmac: enable master mode for BCM54210E and B50212E PHYs Rafał Miłecki
2017-10-13  5:59 ` [PATCH 0/2] net: support bgmac with B50212E B1 PHY David Miller
2017-10-13 19:14 ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.