net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume
Subsystems (3)
PATCH 1/1 net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume
To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1 on dual MAC enabled machines.
--- drivers/net/ethernet/ti/cpsw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +4 -1
@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)if (netif_running (ndev))cpsw_ndo_stop (ndev); +soft_reset ("sliver 0" , &priv->slaves[0 ].sliver->soft_reset); -soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset); +if (priv->data.dual_emac) +soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset); +pm_runtime_put_sync (&pdev->dev);/* Select sleep pin state */
Signature · 1 line
1.8.4.2
Quoted 13 lines · Daniel Mack
To prevent Oopses,
cpsw_suspend()should only soft-reset sliver 1 on dual MAC enabled machines.Signed-off-by Daniel Mack <[email protected]>--- drivers/net/ethernet/ti/cpsw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/ethernet/ti/cpsw.c +0
-0
drivers/net/ethernet/ti/cpsw.c static int cpsw_suspend(struct device *dev) · line 2179
Quoted 8 lines
drivers/net/ethernet/ti/cpsw.c +3
-1@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)if (netif_running (ndev))cpsw_ndo_stop (ndev); +soft_reset ("sliver 0" , &priv->slaves[0 ].sliver->soft_reset); -soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset); +if (priv->data.dual_emac) +soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset);
Is this tested on a system with both ports in switch mode? I don't think this will not work with both ports in switch mode.
Regards
Mugunthan V N
Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Daniel Mack
To prevent Oopses,
cpsw_suspend()should only soft-reset sliver 1 on dual MAC enabled machines.Signed-off-by Daniel Mack <[email protected]>--- drivers/net/ethernet/ti/cpsw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/ethernet/ti/cpsw.c +0
-0@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
Quoted 9 lines
drivers/net/ethernet/ti/cpsw.c static int cpsw_suspend(struct device *dev) · line 2179
Quoted 7 lines
drivers/net/ethernet/ti/cpsw.c +3
-1if (netif_running (ndev))cpsw_ndo_stop (ndev); +soft_reset ("sliver 0" , &priv->slaves[0 ].sliver->soft_reset); -soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset); +if (priv->data.dual_emac) +soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset);Is this tested on a system with both ports in switch mode?
Nope. I got an Ooops when I tried to suspend a machine that has only one slave configured in DTS.
Quoted 1 line
I don't think this will not work with both ports in switch mode.
Why? Isn't priv->data.dual_emac in that case? The same condition is checked for in cpsw_remove().
Thanks,
Daniel
Quoted 24 lines · Daniel Mack
Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Daniel Mack
To prevent Oopses,
cpsw_suspend()should only soft-reset sliver 1 on dual MAC enabled machines.Signed-off-by Daniel Mack <[email protected]>--- drivers/net/ethernet/ti/cpsw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/ethernet/ti/cpsw.c +0
-0@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)Quoted 8 lines
drivers/net/ethernet/ti/cpsw.c static int cpsw_suspend(struct device *dev) · line 2179
Quoted 7 lines
drivers/net/ethernet/ti/cpsw.c +3
-1if (netif_running (ndev))cpsw_ndo_stop (ndev); +soft_reset ("sliver 0" , &priv->slaves[0 ].sliver->soft_reset); -soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset); +if (priv->data.dual_emac) +soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset);Is this tested on a system with both ports in switch mode?
Quoted 2 lines
Nope. I got an Ooops when I tried to suspend a machine that has only one slave configured in DTS.
But the changes above will fail with system with two ports and in switch mode.
Quoted 4 lines
Quoted 2 lines
I don't think this will not work with both ports in switch mode.
Why? Isn't
priv->data.dual_emacin that case? The same condition is checked for incpsw_remove().
In cpsw_remove that check is used to unregister the second network interface registered for same device for port 2. Now I got the issue, this has to be done via for_each_slave().
Regards
Mugunthan V N
Quoted 32 lines · Mugunthan V N
Quoted 24 lines · Daniel Mack
Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Daniel Mack
To prevent Oopses,
cpsw_suspend()should only soft-reset sliver 1 on dual MAC enabled machines.Signed-off-by Daniel Mack <[email protected]>--- drivers/net/ethernet/ti/cpsw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/ethernet/ti/cpsw.c +0
-0@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)Quoted 8 lines
drivers/net/ethernet/ti/cpsw.c static int cpsw_suspend(struct device *dev) · line 2179
Quoted 7 lines
drivers/net/ethernet/ti/cpsw.c +3
-1if (netif_running (ndev))cpsw_ndo_stop (ndev); +soft_reset ("sliver 0" , &priv->slaves[0 ].sliver->soft_reset); -soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset); +if (priv->data.dual_emac) +soft_reset ("sliver 1" , &priv->slaves[1 ].sliver->soft_reset);Is this tested on a system with both ports in switch mode?
Quoted 2 lines
Nope. I got an Ooops when I tried to suspend a machine that has only one slave configured in DTS.
But the changes above will fail with system with two ports and in switch mode.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I don't think this will not work with both ports in switch mode.
Why? Isn't
priv->data.dual_emacin that case? The same condition is checked for incpsw_remove().In
cpsw_removethat check is used to unregister the second network interface registered for same device for port 2. Now I got the issue, this has to be done viafor_each_slave().
Aah, right, thanks :) Will repost.
Daniel
David Miller
maintainerFrom: Daniel Mack <[email protected]>
Date: Wed, 13 Nov 2013 13:53:00 +0100
Quoted 4 lines
To prevent Oopses,
cpsw_suspend()should only soft-reset sliver 1 on dual MAC enabled machines.Signed-off-by Daniel Mack <[email protected]>
Please reimplement this using for_each_slave() as Mungunthan suggested.
Thanks.