Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp632827iog; Mon, 13 Jun 2022 09:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7tgkv1FG3uOWmtYvNKkUPNrf3RTFDE2anl/kmvgdEL8CkeOM8Txuh6nFAR6ewKf/tXXRE X-Received: by 2002:a63:ea06:0:b0:3fd:a385:a856 with SMTP id c6-20020a63ea06000000b003fda385a856mr360369pgi.393.1655137940332; Mon, 13 Jun 2022 09:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655137940; cv=none; d=google.com; s=arc-20160816; b=Lk/qc64eqEZILGYjfqAanOnY9XrnJnaO/iByFcLjKEEkAa4XkXXctnqIs4hb7ZIwy9 rnZQTB5Ut7tgsGE/agPh9CR4s4M/SjAbeN5PkQNn4u+4R9l7VRvi2TZwjl6b+ciN2BiM k42dCWs1ab6ipCd7TFzKAFyZ8Om46EIzlbfdlb7CQt2o8OzVmwUVNkQv0lFcTKEO87OM E5sfUmXMC4/8Lme+ItxFnK3Cuc+gs4PaKU4MQw9kbGMcImsZqGSr816SUSHKDzB8JecX Tft4lVKqC6D13cGcmkTH4LnND4z44tJsTH3aK2RbA9QOFWM1Dzibt6pZsotxotiRDD8E e7hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O1S/k51JI7UHkkxZVuy2Gww8olYLMXuJFL9TZv2v1QY=; b=pgUHKBpg8dABXE7wmhj+JT6/fuBoY0XdN7klkgxqjv84XQxA/BnqQJoPZcnfBSOwIO 2JF7WDcHKzcVtoFV/oWV9eu9OUMm1HxYLcueeDCPSmv6h84mx1//uO0qokB3gzsXd5wp r5N3xcabUhA2W5xfxcB1EC8hd9h4xT1vJb9IGk1ea8RGNPilZO0jc7ghtIHWK29T0Jjk lyWChP36h8o1QzT1l4z3K30YaGGWufViVd8jtdW5Z2vgeAH+oIe8OD9pKkiSAhj54TQX 99Dm5yP9l9o7FpKG37dfVscF+NMJAaBexAiypjIg875TadsFx2JkoBc0xyb4TymPWmb6 WP+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zXD/Zxnl"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a17090a64c300b001e26550d25esi12391311pjm.142.2022.06.13.09.32.07; Mon, 13 Jun 2022 09:32:20 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b="zXD/Zxnl"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378671AbiFMNn1 (ORCPT + 99 others); Mon, 13 Jun 2022 09:43:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379137AbiFMNjx (ORCPT ); Mon, 13 Jun 2022 09:39:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7E07A45F; Mon, 13 Jun 2022 04:28:51 -0700 (PDT) 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 990C461036; Mon, 13 Jun 2022 11:28:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEDC6C34114; Mon, 13 Jun 2022 11:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655119730; bh=wLl1b1j+BhIXPavSmYrCqWAoy3JDpgcE7FuuK5Gym5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zXD/ZxnlRBae/kO/iH7bVtw3CDIY7Rj3d9Mj1jJ9v3/WMrMJzOgKz/m5QGiMCvhOK wACODG9e1eb5HtFphCB9w4bZ/gmKR7eE5+2U9+MnGceguDeHxQGQZwUGWWJYcPX7qo LFyY1WSoAzOKK5OyK3M6/0dPQx8D7rtdUZwNEcVA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Viorel Suman , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 119/339] net: phy: at803x: disable WOL at probe Date: Mon, 13 Jun 2022 12:09:04 +0200 Message-Id: <20220613094930.118185904@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094926.497929857@linuxfoundation.org> References: <20220613094926.497929857@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 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,T_SCC_BODY_TEXT_LINE 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 From: Viorel Suman [ Upstream commit d7cd5e06c9dd70a82f1461c7b5f676bc03f5cd61 ] Before 7beecaf7d507b ("net: phy: at803x: improve the WOL feature") patch "at803x_get_wol" implementation used AT803X_INTR_ENABLE_WOL value to set WAKE_MAGIC flag, and now AT803X_WOL_EN value is used for the same purpose. The problem here is that the values of these two bits are different after hardware reset: AT803X_INTR_ENABLE_WOL=0 after hardware reset, but AT803X_WOL_EN=1. So now, if called right after boot, "at803x_get_wol" will set WAKE_MAGIC flag, even if WOL function is not enabled by calling "at803x_set_wol" function. The patch disables WOL function on probe thus the behavior is consistent. Fixes: 7beecaf7d507b ("net: phy: at803x: improve the WOL feature") Signed-off-by: Viorel Suman Link: https://lore.kernel.org/r/20220527084935.235274-1-viorel.suman@oss.nxp.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/phy/at803x.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 73926006d319..6a467e7817a6 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -433,20 +433,21 @@ static void at803x_context_restore(struct phy_device *phydev, static int at803x_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) { - struct net_device *ndev = phydev->attached_dev; - const u8 *mac; int ret, irq_enabled; - unsigned int i; - static const unsigned int offsets[] = { - AT803X_LOC_MAC_ADDR_32_47_OFFSET, - AT803X_LOC_MAC_ADDR_16_31_OFFSET, - AT803X_LOC_MAC_ADDR_0_15_OFFSET, - }; - - if (!ndev) - return -ENODEV; if (wol->wolopts & WAKE_MAGIC) { + struct net_device *ndev = phydev->attached_dev; + const u8 *mac; + unsigned int i; + static const unsigned int offsets[] = { + AT803X_LOC_MAC_ADDR_32_47_OFFSET, + AT803X_LOC_MAC_ADDR_16_31_OFFSET, + AT803X_LOC_MAC_ADDR_0_15_OFFSET, + }; + + if (!ndev) + return -ENODEV; + mac = (const u8 *) ndev->dev_addr; if (!is_valid_ether_addr(mac)) @@ -857,6 +858,9 @@ static int at803x_probe(struct phy_device *phydev) if (phydev->drv->phy_id == ATH8031_PHY_ID) { int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG); int mode_cfg; + struct ethtool_wolinfo wol = { + .wolopts = 0, + }; if (ccr < 0) goto err; @@ -872,6 +876,13 @@ static int at803x_probe(struct phy_device *phydev) priv->is_fiber = true; break; } + + /* Disable WOL by default */ + ret = at803x_set_wol(phydev, &wol); + if (ret < 0) { + phydev_err(phydev, "failed to disable WOL on probe: %d\n", ret); + goto err; + } } return 0; -- 2.35.1