From patchwork Wed Nov 23 12:48:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 24953 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2787573wrr; Wed, 23 Nov 2022 05:28:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf6yiWYDND2pPGaJaXO2QmJ/Rq6J2puleZgiCG1LKPrdtguDsKuQh2J/bx5K6Dia3yNeEBC0 X-Received: by 2002:aa7:824f:0:b0:56e:8ed7:569f with SMTP id e15-20020aa7824f000000b0056e8ed7569fmr1326954pfn.19.1669210098752; Wed, 23 Nov 2022 05:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669210098; cv=none; d=google.com; s=arc-20160816; b=Nl84i1cn7W8Kn39UvWpI7KB8dt6ItV+ddPQLX6flvdwnsVbxZ5OK6dG9mrULBQiNT0 HKghE5y4rZQB2VTzEpq+iIRvjU7ZTsgIc3QeoOlbpLBZMvw6lm4BISEwJIvLU+CLjkA0 M+GhEZf6W1d9Wwa1tv3BjTZcXm8wq7e1Hc14paLkL7y9SSNw80Z49llKo2miz21lMKmu xSkVyQsVf1nyAWUT2fSw6c6Y6mbAd5w6IJR2rC5LfL5v+JjdoVbLiqo0LUGlUpk0IdYp 6Y0Gmc/C2u7+LrRSUn8NMBLqHXC+u4ED5pckbdfGwfie6maluj4O3ooHYjlim0JFH3Kt Rl8w== 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=ilwrayZ2R3cAZmt6nC0RSEm1iAdat/H1J02yI/Vm/vc=; b=dNTskwJD1Y9G5y5TS5kUsfmxzpJkinvTAdTQelTwfGD7w/Sr53LDyvlRaTJU5R/D+2 ObXirbwIRer0VgpCpxGklSznZvTCj0bh33E12BXv2/HrK3gy2xvBX02+l+J9gayQthSm m2tL4ySTnDJSkmTe9sCS93yfBZeNBBgOWA1/2SsPVE1gWawPmmXDCievq51jAzTVvq3m FncNDXI+ID1VJVTyxUgc4g8s3e2Jemg3AEv+pieH5duRyvvxw/mujGwWSpY1XgkbqJjj 0Yn12Y65hzLI0tWHtP3Ot4SBfMS4coLVnuJYDz/UJiX8RsT/xukUPK5awaE/mTmlDw8R 9YiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D922lsjr; 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 p7-20020a654907000000b0044ed36e4c57si17588729pgs.217.2022.11.23.05.28.05; Wed, 23 Nov 2022 05:28:18 -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=D922lsjr; 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 S238646AbiKWNF0 (ORCPT + 99 others); Wed, 23 Nov 2022 08:05:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238535AbiKWNFB (ORCPT ); Wed, 23 Nov 2022 08:05:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20554CEBA8; Wed, 23 Nov 2022 04:49:13 -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 71500B81FA3; Wed, 23 Nov 2022 12:48:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8612C43470; Wed, 23 Nov 2022 12:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669207736; bh=dvTLeoyNu7eFICLRoSnxH3F03RJcNb7dgmyKN7nwRnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D922lsjrolWkfRD+shTbR3JQGkpK6IwTTITljd7ow9jCKtsfavrU79wOlv8nA/Um7 wmubF2nSKyvickJFawnoQAIjw4AYPbE7vsV5BpFfOj8GykmfYFuzeU5SVN1f4mN7RN FhX8ce8rIUfRU7cVTGVjpXtqkmI9WNeCyWC8HZWE0kq9iX/1Wa6CfmDmvJrpksAf7E M544kEmYJVgjaxqFOvCVkF8NuHbQHJhi2FRmItUmnZ1wnDcUo9/XX392JOeRyv+4hx I2vrjmBSLXVOgyt79hzeJDUR59EihTqMVRiYaxhq+NUl1IIbTqlLFn3BQtQomQp255 /q8yZCOnCbi3Q== From: Roger Quadros To: davem@davemloft.net, maciej.fijalkowski@intel.com, 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 v3 net-next 5/6] net: ethernet: ti: am65-cpsw: retain PORT_VLAN_REG after suspend/resume Date: Wed, 23 Nov 2022 14:48:34 +0200 Message-Id: <20221123124835.18937-6-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221123124835.18937-1-rogerq@kernel.org> References: <20221123124835.18937-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?1750293648679395477?= X-GMAIL-MSGID: =?utf-8?q?1750293648679395477?= During suspend resume the context of PORT_VLAN_REG is lost so save it during suspend and restore it during resume for host port and slave ports. Signed-off-by: Roger Quadros Signed-off-by: David S. Miller --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 7 +++++++ drivers/net/ethernet/ti/am65-cpsw-nuss.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 0b59088e3728..f5357afde527 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2875,7 +2875,9 @@ static int am65_cpsw_nuss_suspend(struct device *dev) struct am65_cpsw_port *port; struct net_device *ndev; int i, ret; + struct am65_cpsw_host *host_p = am65_common_get_host(common); + host_p->vid_context = readl(host_p->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET); for (i = 0; i < common->port_num; i++) { port = &common->ports[i]; ndev = port->ndev; @@ -2883,6 +2885,7 @@ static int am65_cpsw_nuss_suspend(struct device *dev) if (!ndev) continue; + port->vid_context = readl(port->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET); netif_device_detach(ndev); if (netif_running(ndev)) { rtnl_lock(); @@ -2909,6 +2912,7 @@ static int am65_cpsw_nuss_resume(struct device *dev) struct am65_cpsw_port *port; struct net_device *ndev; int i, ret; + struct am65_cpsw_host *host_p = am65_common_get_host(common); ret = am65_cpsw_nuss_init_tx_chns(common); if (ret) @@ -2941,8 +2945,11 @@ static int am65_cpsw_nuss_resume(struct device *dev) } netif_device_attach(ndev); + writel(port->vid_context, port->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET); } + writel(host_p->vid_context, host_p->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET); + return 0; } #endif /* CONFIG_PM_SLEEP */ diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.h b/drivers/net/ethernet/ti/am65-cpsw-nuss.h index 2c9850fdfcb6..e95cc37a7286 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.h +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.h @@ -55,12 +55,16 @@ struct am65_cpsw_port { bool rx_ts_enabled; struct am65_cpsw_qos qos; struct devlink_port devlink_port; + /* Only for suspend resume context */ + u32 vid_context; }; struct am65_cpsw_host { struct am65_cpsw_common *common; void __iomem *port_base; void __iomem *stat_base; + /* Only for suspend resume context */ + u32 vid_context; }; struct am65_cpsw_tx_chn {