Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1322510rdb; Sat, 3 Feb 2024 01:26:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IE26FjrCt5kH+bT9oTF9wgUXUURKRZ2mxkNh92AUgIVmbPL+dkTPmz6lBrmDc4FMOYRhAFd X-Received: by 2002:a05:6808:5c7:b0:3bd:c7c0:afe2 with SMTP id d7-20020a05680805c700b003bdc7c0afe2mr9314431oij.59.1706952416933; Sat, 03 Feb 2024 01:26:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706952416; cv=pass; d=google.com; s=arc-20160816; b=a9qUf2zNResCJ/hR5uNasZNIdVm5ZGQ/ih4NxCe6bwNsu5UpUOaZz3xzwzyJrh0LT6 5t0T3XR9x3JPz+8RohUjFhyTEkQUzO9vT1CFtvh2vTC95kQ9nTD6FSu8f8JAMN+o0xA9 UIYEkB+Ye5z5QXtnQvtcmUE4PamJBg3Mv3TpTALnjrDpQz2979ROSj6emSbyWA87EAs6 Xvgw4JcCOMeNC1AsmYLYdRiGr7bk1JlUiXNdPLzjcR68AdAhAH7IVpZIwFe1ZxGQf+dd aXbkoSfji7Y6wgwgopUhAnF8i1wDDdiOo4lQmiVbxhLqgPodFaz3NFPnxndtDn129Rkc aewg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=WWxwGazwGxFm9RJ3W3AXRBZkyy08qk5mh8Ekn6FcMvw=; fh=Epj8kTOyYpOgvl9Y9pDDAYy2BtCl5xlb0sL4QVPZDkE=; b=WNcGL7Nj2GH7ZZPItU6dzpb1nicVV/cJOVy4bnfDPWwOWp1WBK8j8ykLzlUZ935Hvc ql58csQJWUEwJLhwgxpdcrlWgqLxO4DDs0bDOqX25X5win5yC4NcNpRMxLOoVJPIz2TN zqN/EZIhw4FvpMwAqlhDXBZB+rq8ePvhpE+WrZPkqZhva5Tly9xEtVBbHPoCbc9O1J/u YbFQHTtLUZI8b0X9PQh0QAKCyeAFIlWjwYdv48F5mI4QnfGppxtY4dq6DBfDk2pcJYe2 siWfOUkeiZbLsm+Nx3BwlvIu7oDxIMoTX7z707xn2t2QLv9H9aDhJuME+g6h03W/HMoi 90jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=iTrYRCMS; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-49487-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49487-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXpGPQEYquJV+h2i2OEWf4uc2KLU6DEwI7QhPOyEW+zkVRgNFNL/s+xYeT19r6mE/CeHViiv9mWkHYzTVrVcXUbmSh24dj62Cy01+Nnng== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h22-20020a056a00231600b006dd88165669si2975207pfh.306.2024.02.03.01.26.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 01:26:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49487-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=iTrYRCMS; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-49487-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49487-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EC321294A5A for ; Fri, 2 Feb 2024 08:44:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F29C460BAE; Fri, 2 Feb 2024 08:42:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="iTrYRCMS" Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 149E461682 for ; Fri, 2 Feb 2024 08:42:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706863325; cv=none; b=uSv+R41hE+Olr6iV9KHHYyEWEqB8XHuGgbYVJnXHzJg1oAi+q6UamOoEwUYsOOmmoCnzNiHoAvBauLpYGHe0nQlnFRaTHs0SpjAjbFAHTPsEsvY/jiwViLqnKSk26J9Ccdvy/hak7c02tzWDSYKwihJcU1T8gYDA8tE0TKEnvGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706863325; c=relaxed/simple; bh=F0bxqF2Bs1iyl0FY+5Twbfa3UZ4Z4U0JEOAmmYMmU2U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AHU08NCZ/d3/ddW9Sq7EfsFLWYwZt32/A4x1NRW5aKRSIvfy/tfOx3tp+qcwhEJKKRbP5ESr12NpQVIFosOUTQgNqCnmfijwuz+xc0WweiniQraQw1iEhncXH7VTtJi/zlkUo6MClj5h4w9Zzugl9xy6TOfAn+XlUCcmNmKWKoc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=iTrYRCMS; arc=none smtp.client-ip=209.85.208.43 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 Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-55a179f5fa1so2515529a12.0 for ; Fri, 02 Feb 2024 00:42:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706863322; x=1707468122; 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=WWxwGazwGxFm9RJ3W3AXRBZkyy08qk5mh8Ekn6FcMvw=; b=iTrYRCMSSkiXyJdzcEt3hWjfSwR4K1sVnyUGiif+4ReaDaxWlBm8HBC1EaLIp4X7ED NfNjUTNBViaIR2CfYyPFLPQ1Xr7ezt+YOwQaZAYZo/dccYskzQpGBBKH5ULtZwY3rNFm OLwvk8qP01pclstTdB/lEqR1es887YdounYZYrkjnua9JqRGDR0QDKrv1HTH0skSgJXi bLB/uJbTussSEqiiaocjcl33JdCl3jk1PbSQZQD/zigf+doMYp8hflUrpf/FKPcyYh2S VSN4/AQICK0T0v2MSdSpmHQDnHZR4qk9YG2x4bT5wmfm7qDolTaaPgi1WKVN6Pi1RiIt +dug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706863322; x=1707468122; 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=WWxwGazwGxFm9RJ3W3AXRBZkyy08qk5mh8Ekn6FcMvw=; b=G6YOOJPNFDQITVNNdpgVGzN6dHK4UrbPz+TZtIoP0c69cejESe3TwgMEsrU5oasw0N buYpssgrWrUbi45OTOrG6d9sUC6swvSXzThmhyjFVJMDAWIiU/HFi8MaAYEjgegxfhEN WiPuZBEOp4x98CvfBtwtzIOJQ7ZOfpvnL9EaPUkC+x8I+cBAtwGTyToSwFiCSUZn8gpk XEa08E1R4BVtjfR9mPHl7/TcTUXElC52Nb120j1XROkGDiV3EtKK4/wZahcTkuTSgtWe Wu5WT5ACzUU5iQsznIu/+6LbCLvMYW7+JYsR1GWJA3L11yyMG+azDw1zzF0KOd0+ks/n jl6g== X-Gm-Message-State: AOJu0YxBES/jeE1dHk7GoV5sl7b8R6zcYTB2ZMqxQq3ZvW7R61VS/7VT xbh2DdaaN9xeKVSSwO4pTKwpXF6h68qNfcv+WNpDopwRE4MX1Lu9+lh/FN21Ozs= X-Received: by 2002:a17:906:6d4c:b0:a35:6a40:b4cf with SMTP id a12-20020a1709066d4c00b00a356a40b4cfmr4641441ejt.19.1706863322413; Fri, 02 Feb 2024 00:42:02 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXwxLgk/J7vwLpbCP7gKuXZjoVSAZe65SJRtwC1O+341OqzcHNX4l3ZibHNNcJ4kz8EK8gIai+Yp5IFQocAWclZpoHZvagaDP9K11bH37oSTrJHzujj0z3mxShLgq1n36O9Xcmr7U/Jz2Dq5rG/WM8zA3ap7EvObKDt+YXP70HiRCTeQPavPnsHxzLPkuooGpi7YqqTiF27rWP9UmwbgO00k7WTZnw3TCjFERqEGd1mlaRVfbim8NHE/9+jnUY0TTOuMw1mmVpHafbKCeYu35vlf+JPmt6se7d74nu3pP7iaWvm383nS8b4MCks01liCufnbG9YcXFEuXRn0EM5QO0/xgiRPjvinkTTnhtQVtHiLoW/6MjwUsNFAt66VQXxVJhmkO903jblheQfkw== Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id oz35-20020a1709077da300b00a361c1375absm631642ejc.133.2024.02.02.00.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 00:42:01 -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 Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v6 06/15] net: ravb: Assert/de-assert reset on suspend/resume Date: Fri, 2 Feb 2024 10:41:27 +0200 Message-Id: <20240202084136.3426492-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240202084136.3426492-1-claudiu.beznea.uj@bp.renesas.com> References: <20240202084136.3426492-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- Changes in v6: - re-arranged the tags as my b4 am/shazam placed the Rb tags before author's Sob tag Changes in v5: - none Changes in v4: - none 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 c05d4a2664eb..c2b65bdad13c 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) { -- 2.39.2