Skip to content

Commit c3c397c

Browse files
Doug Bergerdavem330
authored andcommitted
net: bcmgenet: use MAC link status for fixed phy
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: 8d88c6e ("net: bcmgenet: enable MoCA link state change detection") Signed-off-by: Doug Berger <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c305660 commit c3c397c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ struct bcmgenet_mib_counters {
186186
#define UMAC_MAC1 0x010
187187
#define UMAC_MAX_FRAME_LEN 0x014
188188

189+
#define UMAC_MODE 0x44
190+
#define MODE_LINK_STATUS (1 << 5)
191+
189192
#define UMAC_EEE_CTRL 0x064
190193
#define EN_LPI_RX_PAUSE (1 << 0)
191194
#define EN_LPI_TX_PFC (1 << 1)

drivers/net/ethernet/broadcom/genet/bcmmii.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,14 @@ void bcmgenet_mii_setup(struct net_device *dev)
115115
static int bcmgenet_fixed_phy_link_update(struct net_device *dev,
116116
struct fixed_phy_status *status)
117117
{
118-
if (dev && dev->phydev && status)
119-
status->link = dev->phydev->link;
118+
struct bcmgenet_priv *priv;
119+
u32 reg;
120+
121+
if (dev && dev->phydev && status) {
122+
priv = netdev_priv(dev);
123+
reg = bcmgenet_umac_readl(priv, UMAC_MODE);
124+
status->link = !!(reg & MODE_LINK_STATUS);
125+
}
120126

121127
return 0;
122128
}

0 commit comments

Comments
 (0)