Skip to content

Commit 2b56687

Browse files
grygoriySkuba-moo
authored andcommitted
net: ethernet: ti: cpsw: fix cpts irq after suspend
Depending on the SoC/platform the CPSW can completely lose context after a suspend/resume cycle, including CPSW wrapper (WR) which will cause reset of WR_C0_MISC_EN register, so CPTS IRQ will became disabled. Fix it by moving CPTS IRQ enabling in cpsw_ndo_open() where CPTS is actually started. Fixes: 84ea9c0 ("net: ethernet: ti: cpsw: enable cpts irq") Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20201112111546.20343-1-grygorii.strashko@ti.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1395f8d commit 2b56687

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

drivers/net/ethernet/ti/cpsw.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,12 @@ static int cpsw_ndo_open(struct net_device *ndev)
838838
if (ret < 0)
839839
goto err_cleanup;
840840

841-
if (cpts_register(cpsw->cpts))
842-
dev_err(priv->dev, "error registering cpts device\n");
843-
841+
if (cpsw->cpts) {
842+
if (cpts_register(cpsw->cpts))
843+
dev_err(priv->dev, "error registering cpts device\n");
844+
else
845+
writel(0x10, &cpsw->wr_regs->misc_en);
846+
}
844847
}
845848

846849
cpsw_restore(priv);
@@ -1716,7 +1719,6 @@ static int cpsw_probe(struct platform_device *pdev)
17161719

17171720
/* Enable misc CPTS evnt_pend IRQ */
17181721
cpts_set_irqpoll(cpsw->cpts, false);
1719-
writel(0x10, &cpsw->wr_regs->misc_en);
17201722

17211723
skip_cpts:
17221724
cpsw_notice(priv, probe,

drivers/net/ethernet/ti/cpsw_new.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,12 @@ static int cpsw_ndo_open(struct net_device *ndev)
873873
if (ret < 0)
874874
goto err_cleanup;
875875

876-
if (cpts_register(cpsw->cpts))
877-
dev_err(priv->dev, "error registering cpts device\n");
876+
if (cpsw->cpts) {
877+
if (cpts_register(cpsw->cpts))
878+
dev_err(priv->dev, "error registering cpts device\n");
879+
else
880+
writel(0x10, &cpsw->wr_regs->misc_en);
881+
}
878882

879883
napi_enable(&cpsw->napi_rx);
880884
napi_enable(&cpsw->napi_tx);
@@ -2006,7 +2010,6 @@ static int cpsw_probe(struct platform_device *pdev)
20062010

20072011
/* Enable misc CPTS evnt_pend IRQ */
20082012
cpts_set_irqpoll(cpsw->cpts, false);
2009-
writel(0x10, &cpsw->wr_regs->misc_en);
20102013

20112014
skip_cpts:
20122015
ret = cpsw_register_notifiers(cpsw);

0 commit comments

Comments
 (0)