From patchwork Wed Nov 16 16:49:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 21178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp247409wru; Wed, 16 Nov 2022 08:57:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf6cXHkdZBgB2yV2VEOx9YXsLd/nmd/3bVZubRgdu7tSU6sLdMooSPwxqSLKI84U35LlRnY9 X-Received: by 2002:a17:902:76ca:b0:188:4ba9:79ee with SMTP id j10-20020a17090276ca00b001884ba979eemr9865276plt.83.1668617874052; Wed, 16 Nov 2022 08:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668617874; cv=none; d=google.com; s=arc-20160816; b=dzdCVqaJyRUbKLuLxCVvBzRKnDRviHvAyJA5cfbkqSi4bFcNojpjGuzyHlmS2/hqFZ FDbC9N1bGWt7MfGKB7dGtrwtBTqcHR7dik0MqTnlXuF1hw6dfQ7tTaaonJia6zwBT5NL rwRAs64aUMxD0igHLrtdHgx2SEtx62iqsZXOU5g/43Yfq47yH8CjomHk/Aqc8kyl9035 FbfS/0Adm4RVWv+bpPo2MKTaMqPe46NDGpzqCId0DEH9rNVj429Dqe4HXijeD6z+6M68 nYRnm/HIhACH204pwy+G8wDB43SpPOzQ0G129lWtpawP4p56eXPxPbhY4T0Sgr8Xw9M4 rg1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=PQFNmsQA2shYgRBUJtaFfVqsS/IN8otDuRu/VsyQ+Xs=; b=sxFHZ7NEnFtptKdQPazXhpREIk0PQ70KQhW4evtRDfepHMbSSnpP7k0qXhjjsX+6n+ go1LaQUPof/z/uDEgx8INXqk6JYfM/QT6n1r3vSyJmnzolhUuCoUf/qJIAYVrmoy+yhN drqMs4+M1177fJ9/sOtXxiFEpVFiL5GQB5inqnZVabJ7zmy4BM6M86k1Rb6/0rBIqa0P QXNekOJn74XaF/k6Lh301rU/Cvqc/tFKSOCFbd0SMUGpaIO2NBOMNkUgjtakmqZJF9jA epxVnYVMxs1Z99hpZMQ49clJncFwhqoegPc4EsdiKm6aUkVZbgJuKWiAxHZm7ttAEHMC TttQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bRc42h0h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a170902ce8e00b00186b1459953si16949968plg.382.2022.11.16.08.57.41; Wed, 16 Nov 2022 08:57:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bRc42h0h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233378AbiKPQvO (ORCPT + 99 others); Wed, 16 Nov 2022 11:51:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239087AbiKPQus (ORCPT ); Wed, 16 Nov 2022 11:50:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B306127B; Wed, 16 Nov 2022 08:49:30 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 423ED61EEF; Wed, 16 Nov 2022 16:49:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77E5DC433D7; Wed, 16 Nov 2022 16:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668617369; bh=+Yl4jjx33Nm+4lEyKhK/gA6nkezg3rtXvgUlWPsJ0wM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bRc42h0h2SVfBHFiiWOdAzQgZ9ojwrl0PCcB8tMt4/0OM5qTBCUOQd7vuSsMQg7rF /fttjPYOBp1zsMHTohX2Rq3TtgkTP4PVRdWhbQVOd+fXrXRywxaWBXdzigRfzs/Ekq EQiNvTK3lpQupWmbc1uOK3c9lNftGce3/KPwsNC+gQuCpwZMXisQF2SCRsSpZuOb4C Vtg6Sf8OjrrOijqf1UGBKa7L/vu26bFaUSk8QLN33fflTPUCpFas1seSpO15/Sis40 IWsHpyCCdJ1zPR5X3fw8lpTnKMP1ZFXoEXFaAaPOQp11tOAqk5P+BkRGUpKRsJf7aw rQJHZDTPX6StQ== 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 3/4] net: ethernet: ti: am65-cpsw: Restore ALE only if any interface was up Date: Wed, 16 Nov 2022 18:49:14 +0200 Message-Id: <20221116164915.13236-4-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221116164915.13236-1-rogerq@kernel.org> References: <20221116164915.13236-1-rogerq@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749672655786333755?= X-GMAIL-MSGID: =?utf-8?q?1749672655786333755?= 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 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; }