Skip to content

Commit 0c717f6

Browse files
ldesrochesclaudiubeznea
authored andcommitted
net: macb: fix for suspend-to-mem feature
When suspending the macb, the management port for the MIIM interface was disabled. When resuming, the PHY (KSZ8081RNB) was no longer responding. We have to keep the management port enable to fix this issue. Moreover, to get an up-to-date backup of the NCFGR register, it has to be done just before suspending the macb. Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com> [claudiu.beznea@microchip.com: conform with latest driver version] Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent 6e113ec commit 0c717f6

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,14 +1884,23 @@ static void macb_reset_hw(struct macb *bp)
18841884
{
18851885
struct macb_queue *queue;
18861886
unsigned int q;
1887+
unsigned long ctrl;
1888+
1889+
/*
1890+
* Be careful to not disable port management, it seems that some
1891+
* PHYs don't like it.
1892+
*/
1893+
ctrl = macb_readl(bp, NCR);
18871894

18881895
/* Disable RX and TX (XXX: Should we halt the transmission
18891896
* more gracefully?)
18901897
*/
1891-
macb_writel(bp, NCR, 0);
1898+
ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE));
1899+
macb_writel(bp, NCR, ctrl);
18921900

18931901
/* Clear the stats registers (XXX: Update stats first?) */
1894-
macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
1902+
ctrl |= MACB_BIT(CLRSTAT);
1903+
macb_writel(bp, NCR, ctrl);
18951904

18961905
/* Clear all status flags */
18971906
macb_writel(bp, TSR, -1);
@@ -3650,6 +3659,7 @@ static int __maybe_unused macb_suspend(struct device *dev)
36503659
macb_writel(bp, WOL, MACB_BIT(MAG));
36513660
enable_irq_wake(bp->queues[0].irq);
36523661
} else {
3662+
bp->suspend.ncfgr = macb_readl(bp, NCFGR);
36533663
if (netif_running(netdev)) {
36543664
macb_close(netdev);
36553665
}

0 commit comments

Comments
 (0)