Skip to content

Commit 6b97a19

Browse files
anssihclaudiubeznea
authored andcommitted
net: macb: do not disable MDIO bus at open/close time
[ Upstream commit 0da70f8 ] macb_reset_hw() is called from macb_close() and indirectly from macb_open(). macb_reset_hw() zeroes the NCR register, including the MPE (Management Port Enable) bit. This will prevent accessing any other PHYs for other Ethernet MACs on the MDIO bus, which remains registered at macb_reset_hw() time, until macb_init_hw() is called from macb_open() which sets the MPE bit again. I.e. currently the MDIO bus has a short disruption at open time and is disabled at close time until the interface is opened again. Fix that by only touching the RE and TE bits when enabling and disabling RX/TX. v2: Make macb_init_hw() NCR write a single statement. Fixes: 6c36a70 ("macb: Use generic PHY layer") Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5ec52d5 commit 6b97a19

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,22 +2048,16 @@ static void macb_reset_hw(struct macb *bp)
20482048
{
20492049
struct macb_queue *queue;
20502050
unsigned int q;
2051-
unsigned long ctrl;
2052-
2053-
/*
2054-
* Be careful to not disable port management, it seems that some
2055-
* PHYs don't like it.
2056-
*/
2057-
ctrl = macb_readl(bp, NCR);
2051+
u32 ctrl = macb_readl(bp, NCR);
20582052

20592053
/* Disable RX and TX (XXX: Should we halt the transmission
20602054
* more gracefully?)
20612055
*/
20622056
ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE));
2063-
macb_writel(bp, NCR, ctrl);
20642057

20652058
/* Clear the stats registers (XXX: Update stats first?) */
20662059
ctrl |= MACB_BIT(CLRSTAT);
2060+
20672061
macb_writel(bp, NCR, ctrl);
20682062

20692063
/* Clear all status flags */
@@ -2253,7 +2247,7 @@ static void macb_init_hw(struct macb *bp)
22532247
}
22542248

22552249
/* Enable TX and RX */
2256-
macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE));
2250+
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
22572251
}
22582252

22592253
/* The hash address register is 64 bits long and takes up two

0 commit comments

Comments
 (0)