From patchwork Tue Nov 29 13:35:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 27238 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp341125wrr; Tue, 29 Nov 2022 05:39:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Ta8QklVFLvXTezIyby7NLirV+k0ZKLzWiisfKn5ZLGBSpLhjMveAaXXaXwnDYdyuG/mgf X-Received: by 2002:a05:6402:4289:b0:467:9864:9463 with SMTP id g9-20020a056402428900b0046798649463mr34706463edc.360.1669729143253; Tue, 29 Nov 2022 05:39:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669729143; cv=none; d=google.com; s=arc-20160816; b=A8CpPECNSFPAca7cOvhE/P+1YzoavEpfVwN0VHWMp5b2oOgPlNAvIQWeVp5PSVrXVz 8lZJqSQ4kD24nfvLw+Z9J7rLqD9Fyo4qED0uNVhwqVaebHjYZ0hENvRMeItW/E2+u6Jd OyuPrMD5GItef4+IrqeWlImuP0MhxYqr98i67uuMFgWHhnpcO2kPj0ZkP7+dTNJFxP/L jbXxwX06nxVd/UqUnV+kiI7A8urCEC+OxXSaqaOIXjLYIWjUS2M2K9+0mohxQorpwwlU PzL72xq5w4kuk+kMeNaHVhgRQpjESq685hHED1d6ytlbIvJ4knQTeNpaRvrC6gtqn/Zx BefQ== 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=qy8xA0zcpVafowRrUuOu/cISebPAGYri72aD3olq/Ig=; b=UxE3osrm99kceFHZ30nc2YNCrcRSBpoZLnpskYBLggRKSkNfE7yATb2ibqqu2ANzm5 QGlYnQj2ge3i1vKDXffqdU9G9VVcm7rD4ZeAvT6Eicq0aoAvNOZu8Fl2YcbvS9Se+MFb ouXfk97bDaj9/jzNne6zbidCQM/x9krAvKHxWZyrZh2BQSgbL2o3HTGzn2RZf4Sp4bqB kaHTq2flyo5CJf+RCwpRsHcG/DDxMiZCnUTuQEji/B9qA0vhOX4w1S71oG+5UFZf8A03 qg+EW0NY1e0f9D6tWGHK2Fg92oTvE0Mk6fMPcxgTabMht6gmeDPF8sqLP8cQ3xk6rpJM K+lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xun1aE70; 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 j11-20020aa7de8b000000b0044f2eb2de9asi11162753edv.444.2022.11.29.05.38.37; Tue, 29 Nov 2022 05:39:03 -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=Xun1aE70; 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 S230353AbiK2Nfl (ORCPT + 99 others); Tue, 29 Nov 2022 08:35:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232976AbiK2Nf0 (ORCPT ); Tue, 29 Nov 2022 08:35:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E6931DC6; Tue, 29 Nov 2022 05:35:25 -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 B7C416172F; Tue, 29 Nov 2022 13:35:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8363BC433D7; Tue, 29 Nov 2022 13:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669728924; bh=VRP1vnYIcXaScFgVI3vxzPn1UkCZHA4CW5xgKdTodRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xun1aE70YOFjbOsUl8B3zWhgVOzLJrtV49CZiipMOdZXsPP8Yqbyuk7o1s3VgyW3q 01XTIuEyXXw9FXeoFSPQD54c0AeNTRxw11YBWisKKqEkzscX/YhZYh7M3q6RDnEvyJ ZQ1rM6ZNnuKFnUFqoMCA8q7DQqnGTtDZvZox72PzU3fK4I7j+MKrAadAf+rYsHeUnO JZV3uezSb4sgq3LRGg+WIXEACAgjbpbjB5MSgfOSDzpbMsciaaHELmRwDvs4jXkGM6 ZxhXffFsSg20KAb7PtZZEuDUV3IDhjWY1SlS/Iov0dGzgMu57AMrp/SZ+V/YF0akjM q12sBFJzefjyg== From: Roger Quadros To: davem@davemloft.net, maciej.fijalkowski@intel.com, kuba@kernel.org Cc: andrew@lunn.ch, 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 v4 net-next 5/6] net: ethernet: ti: am65-cpsw: retain PORT_VLAN_REG after suspend/resume Date: Tue, 29 Nov 2022 15:35:00 +0200 Message-Id: <20221129133501.30659-6-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221129133501.30659-1-rogerq@kernel.org> References: <20221129133501.30659-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?1750837905888743867?= X-GMAIL-MSGID: =?utf-8?q?1750837905888743867?= 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 1c5a51439427..3f430f8d8a26 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2872,10 +2872,12 @@ static int am65_cpsw_nuss_remove(struct platform_device *pdev) static int am65_cpsw_nuss_suspend(struct device *dev) { struct am65_cpsw_common *common = dev_get_drvdata(dev); + struct am65_cpsw_host *host_p = am65_common_get_host(common); struct am65_cpsw_port *port; struct net_device *ndev; int i, ret; + 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 {