Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2138047pxb; Mon, 12 Apr 2021 15:43:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw06K5WaunoshXKR/G1wOfzINyNDxXV2HK/to3TnFQChdb7RfuNbDXk4YdEGKysCBANjddl X-Received: by 2002:a17:90b:30d2:: with SMTP id hi18mr1523357pjb.94.1618267435917; Mon, 12 Apr 2021 15:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618267435; cv=none; d=google.com; s=arc-20160816; b=YyvJVBYjgobDtqwvP/IXUgDSx14XNL9Yf1eK6rYnJxAwJ4LFSRWTeFDIj8HQ99rXHL iAowgA5BrbNtlw1xLwprv7fvH//m1jry/3MDFtsez0SlluusA0kgTdIrCcebbm5ooZt/ bWNJsQvRaFXi+mX5u1KNdD/2DndRQB8WrmbGeaVeFh1bYo/yU4JIG5RYYqXwQQdiUQna xXzcjXL+iMex81Fk+bf5mT+CA9ATDsT6z3mpTy/ldp/VZaP6iWaG6ew9FhWXyfnqwTbi Hdhj/8hjm3jl2YEZEJ4KYzeUDeK4lmgIIMgkvuNe3CrO/6z/ZbNADN+eqzdKdorM5RJX dZ5A== 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=Rs1H4Rand/7WqyzOMfKOjADXmeLLf7yODgZZfgVOzC0=; b=fb3fh6gIN9r8m+mWOSwhnMvYI8ZACu0Lxo1j2FxvaKATrK624hn17jjMyIa3bVbQWy wkVGkWWsjJ5rdzSyvQXvXAM2AAuuN5KaTTZhR/vVB/nvfnmlXCOhnJlUIvAXegTVJIPg HDhY1FLXwixXsWwS5H50dtEKQ4TdjKhKWTk9wYwXF9aN66rH8z3TQ3ruGr+6USRKUp4W 5qq3q524O5gdJwXKTj8UpfsEk5RIosJPa8GZc9Umw0xXaZRYcW2t5Vn6yIIZpr2Pk/n2 Ktv2AQ2oxvmFOI/74zjfKNKVoKoy2o8xucD+sS+fPrIRODRk/eaL7V2uxAPr7+6b02RM 8hSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sk0Jg6ZX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 34si15104160plf.51.2021.04.12.15.43.41; Mon, 12 Apr 2021 15:43:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sk0Jg6ZX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S239204AbhDLJea (ORCPT + 99 others); Mon, 12 Apr 2021 05:34:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:34712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239637AbhDLJJP (ORCPT ); Mon, 12 Apr 2021 05:09:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 56F4961381; Mon, 12 Apr 2021 09:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218282; bh=lUqXMk/8Sq6AQkGIHh12ieyFV6dH+60BXeaxPCXTSyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sk0Jg6ZXdBgaTMyMos1LU53smog/W/ryuiNdh/4frYOnq1AwPScpIHVuMy7owYiB/ 1HvraxwAdJsNHu8K+yB8MDU4X/5yPuCDeiBPxsSa9YI7HWbbr0QxHyQ8iZsothMkX2 V4GWu903IFPoDYVJq6OcrO8p++GmIPa166ezdSgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 5.11 140/210] net: phy: broadcom: Only advertise EEE for supported modes Date: Mon, 12 Apr 2021 10:40:45 +0200 Message-Id: <20210412084020.665670583@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Fainelli [ Upstream commit c056d480b40a68f2520ccc156c7fae672d69d57d ] We should not be advertising EEE for modes that we do not support, correct that oversight by looking at the PHY device supported linkmodes. Fixes: 99cec8a4dda2 ("net: phy: broadcom: Allow enabling or disabling of EEE") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/bcm-phy-lib.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c index 53282a6d5928..287cccf8f7f4 100644 --- a/drivers/net/phy/bcm-phy-lib.c +++ b/drivers/net/phy/bcm-phy-lib.c @@ -369,7 +369,7 @@ EXPORT_SYMBOL_GPL(bcm_phy_enable_apd); int bcm_phy_set_eee(struct phy_device *phydev, bool enable) { - int val; + int val, mask = 0; /* Enable EEE at PHY level */ val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL); @@ -388,10 +388,17 @@ int bcm_phy_set_eee(struct phy_device *phydev, bool enable) if (val < 0) return val; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + phydev->supported)) + mask |= MDIO_EEE_1000T; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + phydev->supported)) + mask |= MDIO_EEE_100TX; + if (enable) - val |= (MDIO_EEE_100TX | MDIO_EEE_1000T); + val |= mask; else - val &= ~(MDIO_EEE_100TX | MDIO_EEE_1000T); + val &= ~mask; phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val); -- 2.30.2