@@ -2932,6 +2932,7 @@ static int am65_cpsw_nuss_resume(struct device *dev)
struct net_device *ndev;
int i, ret;
struct am65_cpsw_host *host_p = am65_common_get_host(common);
+ bool need_ale_restore = false;
ret = am65_cpsw_nuss_init_tx_chns(common);
if (ret)
@@ -2954,6 +2955,7 @@ static int am65_cpsw_nuss_resume(struct device *dev)
continue;
if (netif_running(ndev)) {
+ need_ale_restore = true;
rtnl_lock();
ret = am65_cpsw_nuss_ndo_slave_open(ndev);
rtnl_unlock();
@@ -2968,7 +2970,8 @@ static int am65_cpsw_nuss_resume(struct device *dev)
}
writel(host_p->vid_context, host_p->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET);
- cpsw_ale_restore(common->ale, common->ale_context);
+ if (need_ale_restore)
+ cpsw_ale_restore(common->ale, common->ale_context);
return 0;
}
There is no point in restoring ALE if all interfaces were down prior to suspend as ALE will be cleared when any interface is brought up. So restore ALE only if any interface was up before system suspended. Fixes: 1af3cb3702d0 ("net: ethernet: ti: am65-cpsw: Fix hardware switch mode on suspend/resume") Signed-off-by: Roger Quadros <rogerq@kernel.org> --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)