Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6657163ybn; Mon, 30 Sep 2019 01:24:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkf4kZFHOuxYV6NVghHwQAx3cOW/Zl/XEznVEm02TNnvuKy7f9Q6ZbOLe47I8nEgS9UbjS X-Received: by 2002:aa7:dcca:: with SMTP id w10mr18376755edu.183.1569831857295; Mon, 30 Sep 2019 01:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569831857; cv=none; d=google.com; s=arc-20160816; b=D7ulPFqi7BNlAOCNJXgyVUWVhJNLarKEWVw32p9JQaEl3qRtdUY7MoGB7B+tEuiF6s Z8IwvcX6VwIKPaJ/gKzWP43+x0nwIPdhc37eupiqs/tKoLhwQXdq85yMeo5pXkbICwpM YV9172MMcHI4oedj2BTgIH9FcOegPCos3KpwvJhRKG9Qoati3YKR3qer0urfGbZZy1G7 7qKiYEbgELINIbGj8wCN7duDKcgDaxFXxOiZGSqoSDEJB6T0VYspfthel9t8S32XwHSU +LoTK6vnzRtdqKS01wcDtvy2QfYLaDOiMu5rcxOPORJCgC7qnUk3Aaw/l+TlygrWn5CO MImA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=fjsv4kvBzAOkX/UFzeEfXW6fQDiOSY4YEQJA3XbBEow=; b=X6RCiSRXk8wNTSushouOUzRAAh7zikTJwl5Xl6RgrqYot+BTW8FH9Y6niIwvkObRV9 zTRVVHutAwBOvB+lp7zezioS3QrRTQiu0wnKutGrTH98BD1SCYzXB/O6cjP8nD9a7y0c fbgHgZWXj4zuXicBj9xtGSD6JeZTOHNw/sbuZlHhRN4RyLzAacINaTTUlbiV1ZSj6YCm t/XNx/bnmssF7oAquKeqoeJOAYdqJWD3axy8k/p1W5EmxClwI3y5m/cOIgvqlQePbOfL jgYUvbIY1jqE5nyclDyCRfDLUc4LYQsWijahps30q93kCkkoQhg4QtlLt1AOvKW8R6Zz akZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=jcbWQmhF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si9si6853671ejb.97.2019.09.30.01.23.53; Mon, 30 Sep 2019 01:24:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=jcbWQmhF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730250AbfI3IUX (ORCPT + 99 others); Mon, 30 Sep 2019 04:20:23 -0400 Received: from dc2-smtprelay2.synopsys.com ([198.182.61.142]:46044 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730016AbfI3IT1 (ORCPT ); Mon, 30 Sep 2019 04:19:27 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id C5879C0376; Mon, 30 Sep 2019 08:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1569831566; bh=DIrBlnTN+2e2Xshklv4tKK7eG84iI4t6E5yVB8RhCTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=jcbWQmhFxuQMxnU1sQk3n6K56I5PWCNjR5Uh4r7SwHdYHb8w1HpcaGowIPSzUADj9 9IyWhgqLFK7nokgbW+7btXhxG7MBQ1FPvCc2lurXv+f1kT/a2iymj9KoE13qIEPVVD UYHKxLWpZoB4T2ejSt/k1BfyG6oGUvk++nsdjpJDnkx7W/+wdFwMhNES5kH9qghHBU GMa0mIB7qs5U/1MqTbp1dQppzGi68zC6gbfLb9vEeMmCjMtQ6AvR1vafUpGL1tLnO9 WzNz9uKXrexZLZ/2OuRWxCztnHTfdeCyXgazx51iPnHMa4tOm8n8He/+t8gaEsBtdx Su4w2LFhWQ20A== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 8366AA0084; Mon, 30 Sep 2019 08:19:23 +0000 (UTC) From: Jose Abreu To: netdev@vger.kernel.org Cc: Joao Pinto , Jose Abreu , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net 6/9] net: stmmac: Do not stop PHY if WoL is enabled Date: Mon, 30 Sep 2019 10:19:10 +0200 Message-Id: <7f8094c677036ef0600002f683633d39d61242d9.1569831229.git.Jose.Abreu@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If WoL is enabled we can't really stop the PHY, otherwise we will not receive the WoL packet. Fix this by telling phylink that only the MAC is down and only stop the PHY if WoL is not enabled. Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic") Signed-off-by: Jose Abreu --- Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Jose Abreu Cc: "David S. Miller" Cc: Maxime Coquelin Cc: netdev@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 31a237ec73bc..843d53e084b7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4718,9 +4718,7 @@ int stmmac_suspend(struct device *dev) mutex_lock(&priv->lock); - rtnl_lock(); - phylink_stop(priv->phylink); - rtnl_unlock(); + phylink_mac_change(priv->phylink, false); netif_device_detach(ndev); stmmac_stop_all_queues(priv); @@ -4735,6 +4733,10 @@ int stmmac_suspend(struct device *dev) stmmac_pmt(priv, priv->hw, priv->wolopts); priv->irq_wake = 1; } else { + rtnl_lock(); + phylink_stop(priv->phylink); + rtnl_unlock(); + stmmac_mac_set(priv, priv->ioaddr, false); pinctrl_pm_select_sleep_state(priv->device); /* Disable clock in case of PWM is off */ @@ -4825,9 +4827,13 @@ int stmmac_resume(struct device *dev) stmmac_start_all_queues(priv); - rtnl_lock(); - phylink_start(priv->phylink); - rtnl_unlock(); + if (!device_may_wakeup(priv->device)) { + rtnl_lock(); + phylink_start(priv->phylink); + rtnl_unlock(); + } + + phylink_mac_change(priv->phylink, true); mutex_unlock(&priv->lock); -- 2.7.4