linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: bcmgenet: use MAC link status for fixed phy
@ 2018-08-29 18:27 Doug Berger
  2018-09-01  5:59 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Berger @ 2018-08-29 18:27 UTC (permalink / raw)
  To: David S. Miller; +Cc: Florian Fainelli, netdev, linux-kernel, Doug Berger

When using the fixed PHY with GENET (e.g. MOCA) the PHY link
status can be determined from the internal link status captured
by the MAC. This allows the PHY state machine to use the correct
link state with the fixed PHY even if MAC link event interrupts
are missed when the net device is opened.

Fixes: 8d88c6ebb34c ("net: bcmgenet: enable MoCA link state change detection")
Signed-off-by: Doug Berger <opendmb@gmail.com>
---
v2: increased "Fixes" sha1 to 12 digits

 drivers/net/ethernet/broadcom/genet/bcmgenet.h |  3 +++
 drivers/net/ethernet/broadcom/genet/bcmmii.c   | 10 ++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
index b773bc07edf7..14b49612aa86 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -186,6 +186,9 @@ struct bcmgenet_mib_counters {
 #define UMAC_MAC1			0x010
 #define UMAC_MAX_FRAME_LEN		0x014
 
+#define UMAC_MODE			0x44
+#define  MODE_LINK_STATUS		(1 << 5)
+
 #define UMAC_EEE_CTRL			0x064
 #define  EN_LPI_RX_PAUSE		(1 << 0)
 #define  EN_LPI_TX_PFC			(1 << 1)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 5333274a283c..4241ae928d4a 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -115,8 +115,14 @@ void bcmgenet_mii_setup(struct net_device *dev)
 static int bcmgenet_fixed_phy_link_update(struct net_device *dev,
 					  struct fixed_phy_status *status)
 {
-	if (dev && dev->phydev && status)
-		status->link = dev->phydev->link;
+	struct bcmgenet_priv *priv;
+	u32 reg;
+
+	if (dev && dev->phydev && status) {
+		priv = netdev_priv(dev);
+		reg = bcmgenet_umac_readl(priv, UMAC_MODE);
+		status->link = !!(reg & MODE_LINK_STATUS);
+	}
 
 	return 0;
 }
-- 
2.7.4


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

* Re: [PATCH net v2] net: bcmgenet: use MAC link status for fixed phy
  2018-08-29 18:27 [PATCH net v2] net: bcmgenet: use MAC link status for fixed phy Doug Berger
@ 2018-09-01  5:59 ` David Miller
  2018-09-03 17:25   ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2018-09-01  5:59 UTC (permalink / raw)
  To: opendmb; +Cc: f.fainelli, netdev, linux-kernel

From: Doug Berger <opendmb@gmail.com>
Date: Wed, 29 Aug 2018 11:27:49 -0700

> When using the fixed PHY with GENET (e.g. MOCA) the PHY link
> status can be determined from the internal link status captured
> by the MAC. This allows the PHY state machine to use the correct
> link state with the fixed PHY even if MAC link event interrupts
> are missed when the net device is opened.
> 
> Fixes: 8d88c6ebb34c ("net: bcmgenet: enable MoCA link state change detection")
> Signed-off-by: Doug Berger <opendmb@gmail.com>
> ---
> v2: increased "Fixes" sha1 to 12 digits

This doesn't apply cleanly to the net tree.

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

* Re: [PATCH net v2] net: bcmgenet: use MAC link status for fixed phy
  2018-09-01  5:59 ` David Miller
@ 2018-09-03 17:25   ` Florian Fainelli
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2018-09-03 17:25 UTC (permalink / raw)
  To: David Miller, opendmb; +Cc: netdev, linux-kernel



On 8/31/2018 10:59 PM, David Miller wrote:
> From: Doug Berger <opendmb@gmail.com>
> Date: Wed, 29 Aug 2018 11:27:49 -0700
> 
>> When using the fixed PHY with GENET (e.g. MOCA) the PHY link
>> status can be determined from the internal link status captured
>> by the MAC. This allows the PHY state machine to use the correct
>> link state with the fixed PHY even if MAC link event interrupts
>> are missed when the net device is opened.
>>
>> Fixes: 8d88c6ebb34c ("net: bcmgenet: enable MoCA link state change detection")
>> Signed-off-by: Doug Berger <opendmb@gmail.com>
>> ---
>> v2: increased "Fixes" sha1 to 12 digits
> 
> This doesn't apply cleanly to the net tree.

You've applied and fixed the sha1 to 12 digits (thanks for doing that) 
of the v1 previously submitted:

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=c3c397c1f16c51601a3fac4fe0c63ad8aa85a904
-- 
Florian

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

end of thread, other threads:[~2018-09-03 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29 18:27 [PATCH net v2] net: bcmgenet: use MAC link status for fixed phy Doug Berger
2018-09-01  5:59 ` David Miller
2018-09-03 17:25   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).