[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221116164915.13236-4-rogerq@kernel.org>
Date: Wed, 16 Nov 2022 18:49:14 +0200
From: Roger Quadros <rogerq@...nel.org>
To: davem@...emloft.net, kuba@...nel.org
Cc: edumazet@...gle.com, pabeni@...hat.com, vigneshr@...com,
linux-omap@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Roger Quadros <rogerq@...nel.org>
Subject: [PATCH 3/4] net: ethernet: ti: am65-cpsw: Restore ALE only if any interface was up
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@...nel.org>
---
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 4107e9df65cd..9f3871373ebd 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -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;
}
--
2.17.1
Powered by blists - more mailing lists