Skip to content

Commit 0da70f8

Browse files
anssihdavem330
authored andcommitted
net: macb: do not disable MDIO bus at open/close time
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 <[email protected]> Reviewed-by: Claudiu Beznea <[email protected]> Tested-by: Claudiu Beznea <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f7b9e8e commit 0da70f8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,14 +2035,17 @@ static void macb_reset_hw(struct macb *bp)
20352035
{
20362036
struct macb_queue *queue;
20372037
unsigned int q;
2038+
u32 ctrl = macb_readl(bp, NCR);
20382039

20392040
/* Disable RX and TX (XXX: Should we halt the transmission
20402041
* more gracefully?)
20412042
*/
2042-
macb_writel(bp, NCR, 0);
2043+
ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE));
20432044

20442045
/* Clear the stats registers (XXX: Update stats first?) */
2045-
macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
2046+
ctrl |= MACB_BIT(CLRSTAT);
2047+
2048+
macb_writel(bp, NCR, ctrl);
20462049

20472050
/* Clear all status flags */
20482051
macb_writel(bp, TSR, -1);
@@ -2230,7 +2233,7 @@ static void macb_init_hw(struct macb *bp)
22302233
}
22312234

22322235
/* Enable TX and RX */
2233-
macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE));
2236+
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
22342237
}
22352238

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

0 commit comments

Comments
 (0)