From patchwork Fri Jan 5 08:23:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu X-Patchwork-Id: 13511816 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 617C925116 for ; Fri, 5 Jan 2024 08:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="Z6eRd4Mc" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a28a997f3dfso106480866b.0 for ; Fri, 05 Jan 2024 00:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1704443069; x=1705047869; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/2ZqOfc2YusgwP+oQ4T/Qs2/x8rT4twAhOHtA+/5S5g=; b=Z6eRd4MceanzZw9QupE9PURLXR/QlNSGPF5nUrkjvEgDW6Q08NOOHVnnew5Pmbf4oq lkbAvBwxzB1HN9QpWKPNQBRxmEpdU8776nXoofOhdyHqMXvSF55+Csc3tq+wdXdUju6c PfkfPGn3sMhhQzilbQXXaXpx9SQYE+YJ3HlPRfvcoExykQnM8I91QZUjbRA355ttc5g9 PMwZu5em1MT/NhI8AN89sIKrHlWf94yTlEMLHmtdw8qVObj7lG4HzVnKMeNWHOe9aTSN cH95pceAua3/khSYPcy16yjkZYTmBZSlnB53pPYa2B0IXn7JbHvreaZXHExX3XkHQKjB J6WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704443069; x=1705047869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/2ZqOfc2YusgwP+oQ4T/Qs2/x8rT4twAhOHtA+/5S5g=; b=Q5RKigsQksrKN7qWkBDI+ZINO9NLEkawduzWToSwZtV6VCFQhzLEFgGOe5x/hvKvYF 4zBrggEbYZhc6SU2WyHaukqFZEy1cgiXk95CwIQpluBMiCcawnRofB0g6cVT157oR3VZ f4enKvwBIE6O90qYNjO0zvfVISIfh7Zn2NnHFqkf5gyfTqSoeL0bx6V8zqxTQoKfpQrC xNhBU5UFg3r+S8cAg0qpbdArxtLcA+tmHDxm6nJxDWyTKtepQNtfzIPlrxGA1dl/f82d 4Iyj+k0btwHF8+Ir2J4cYI39dBcF5Fwogjw//92k6a7tleMSKOePZpBvudTbCrtwyW4a U/Sw== X-Gm-Message-State: AOJu0YxFHdeVIak4TK0mkddIYc3h1XuT+Fw4tP/Ic3uGOZCXMQWWlcsp GYq6DU9kSrGQ6eIssEvf2ITf4s+P7eeRqQ== X-Google-Smtp-Source: AGHT+IEebcMHP/l3wa8/tlp0iaG0Wl4wsPVIQVAulNpsIk/nVH1V1B4OCf8ED3tUzulGHaAcwT790A== X-Received: by 2002:a17:906:8cc:b0:a23:713f:9851 with SMTP id o12-20020a17090608cc00b00a23713f9851mr584922eje.18.1704443069163; Fri, 05 Jan 2024 00:24:29 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.5]) by smtp.gmail.com with ESMTPSA id j15-20020a1709064b4f00b00a28e759a447sm596198ejv.213.2024.01.05.00.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 00:24:28 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, wsa+renesas@sang-engineering.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, geert+renesas@glider.be, Claudiu Beznea Subject: [PATCH net-next v3 06/19] net: ravb: Assert/de-assert reset on suspend/resume Date: Fri, 5 Jan 2024 10:23:26 +0200 Message-Id: <20240105082339.1468817-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240105082339.1468817-1-claudiu.beznea.uj@bp.renesas.com> References: <20240105082339.1468817-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Claudiu Beznea RZ/G3S can go to deep sleep states where power to most of the SoC parts is off. When resuming from such a state, the Ethernet controller needs to be reinitialized. De-asserting the reset signal for it should also be done. Thus, add reset assert/de-assert on suspend/resume functions. On the resume function, the de-assert was not reverted in case of failures to give the user a chance to restore the interface (e.g., bringing down/up the interface) in case suspend/resume failed. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v3: - collected tags Changes in v2: - fixed typos in patch description and subject - on ravb_suspend() assert the reset signal in case interface is down; due to this the Sergey's Rb tag was left aside in this version drivers/net/ethernet/renesas/ravb_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 0731857c2a0c..844ac3306e93 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2978,7 +2978,7 @@ static int ravb_suspend(struct device *dev) int ret; if (!netif_running(ndev)) - return 0; + goto reset_assert; netif_device_detach(ndev); @@ -2990,7 +2990,11 @@ static int ravb_suspend(struct device *dev) if (priv->info->ccc_gac) ravb_ptp_stop(ndev); - return ret; + if (priv->wol_enabled) + return ret; + +reset_assert: + return reset_control_assert(priv->rstc); } static int ravb_resume(struct device *dev) @@ -2998,7 +3002,11 @@ static int ravb_resume(struct device *dev) struct net_device *ndev = dev_get_drvdata(dev); struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; - int ret = 0; + int ret; + + ret = reset_control_deassert(priv->rstc); + if (ret) + return ret; /* If WoL is enabled set reset mode to rearm the WoL logic */ if (priv->wol_enabled) {