From patchwork Mon Nov 21 14:22:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13051076 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B959BC43219 for ; Mon, 21 Nov 2022 14:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbiKUOXh (ORCPT ); Mon, 21 Nov 2022 09:23:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbiKUOXS (ORCPT ); Mon, 21 Nov 2022 09:23:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B82BA13EA6; Mon, 21 Nov 2022 06:23:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 14534B81057; Mon, 21 Nov 2022 14:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C670C433D7; Mon, 21 Nov 2022 14:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669040594; bh=/jH9GYwDzo2HsuJAbISAsztvTBt8ms8nOOwZqv/Mke8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E8j/afhgrCow+OkHmWwi/LOPFVdR6d5GZ0YUosld+p174tdNR2q494HyQLCZF2AX2 ifTVbaC8Ev8c4mWlSiHQ7DLcACuL0cnAMSLlMwLZqMUZ3PBaeTKYsVuD36PnXwe9Pt elOinOX6CTyNMi03LeCL9Iz+JkN+xRBJIx4aR+Lh2dBNx5q7QcZwgHGzn32OP+5pH2 X/o5gMirLaLai0AHRzi6F58UYWRYF2K2BrQ8MFN+24QIBwlx8qYZGFIH5yTOTpazZz ZGZ549pI3kGrKfD/xpxZM7jNg1q1DzGzUGggK2taltDifjUl3TEQCIhIRIWRioLGvl h/1UgX2+Sk6Ng== From: Roger Quadros To: davem@davemloft.net, kuba@kernel.org Cc: edumazet@google.com, pabeni@redhat.com, vigneshr@ti.com, linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH v2 3/4] net: ethernet: ti: am65-cpsw: Restore ALE only if any interface was up Date: Mon, 21 Nov 2022 16:22:59 +0200 Message-Id: <20221121142300.9320-4-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221121142300.9320-1-rogerq@kernel.org> References: <20221121142300.9320-1-rogerq@kernel.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 --- 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 2acde5b14516..dda9afe5410c 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2935,6 +2935,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) @@ -2957,6 +2958,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(); @@ -2971,7 +2973,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; }