Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2056915pxb; Mon, 12 Apr 2021 13:10:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY5w6hec+bLVti4YfWyUH/XcTgNyFPsIrz2m0IMzSmFzVoqHqwoU/t1K5Lg5JT4FO4EJLM X-Received: by 2002:a17:902:8b81:b029:eb:5a4:9cae with SMTP id ay1-20020a1709028b81b02900eb05a49caemr5175793plb.13.1618258243692; Mon, 12 Apr 2021 13:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618258243; cv=none; d=google.com; s=arc-20160816; b=qx1zIIEcBbkLAEiJT31JqUUoYCpQIvHELpcrSAr0V8JG7wXdqHv4fiOclyvKpSInHe YJquDztddJpfT0zuqxhhXsgPsOb8fswSj3aLZm8AyS5G9wkjAbp3IS00kJIkL0V+S+ne 6s1ab4g4HCo6rBTmYL4H0CcH2XZ/6luC/lp82f8PHaEyKTrGI2R0OKk47oAyqcQAj4Ef c1CGr8Smnn6QdgOUbUKgN3sbwX7hTWYG1/xe3aCevQVJ7UAMBSZG/DzRjkPzxnXfBA/s QC8KoyGaKtkZ9426yGNbz3+W4XIp6rAmp0NQIdlxBvPBAdKJ7k+mn8mOWnE8wsWViE9u K7lg== 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=7JHVJfnlgbCoMZAlY9GhrEjAowEJ7hdW3y8Cfpp0wxw=; b=hE1JA93dGUlvEI2a4Crmsb57vzIBkiUUtZ5GPHwweEMMSfZmoLviiMLRqT1cOrhM3R UQUKGLCs8P7iZl/dQq8UXPQRiypdQsGjVWcJkWz9ydVNtDctlk3n/3x5pPzaxn4o0AR5 anF3y4bpEETTHe+N33Xeel6VrxA3dNBHtCfna94ps3I3urXCgvhhJqPyHPFE/Zhbij4j cfdsnz6aTOAh3UkIVMdusHRP+GKVoH9qV/TIrDsCd6O6CvCVqGH9J2pRuUCBcNXvYY2v Q6pAxTW1VeyNdsaMtVh2Oxmk5C5rFfi0E6F3b0P3Ttd4IiYIXL97JM8zkv6cAws4sVPV CPcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SMLFmQEs; 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 gz14si465260pjb.85.2021.04.12.13.10.30; Mon, 12 Apr 2021 13:10:43 -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=SMLFmQEs; 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 S237853AbhDLIxN (ORCPT + 99 others); Mon, 12 Apr 2021 04:53:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:40154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238020AbhDLIsu (ORCPT ); Mon, 12 Apr 2021 04:48:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1826061279; Mon, 12 Apr 2021 08:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217275; bh=bJfR3G0c/1iZa+d8UgeqFhSPFQg+veg3k275rUoBN08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SMLFmQEs1rZc26HdhzmFt/6k00f+k0klIzyempRBgxtXyTB6Pep3dP5leHqLcz03+ 0zL/eJJr+71kGtexjH17dkS6wT5aQwCHjQEzRhPeEny4Xfa8oml2fcr6s4tpSFwcvx YRl+qKAtmEHfI+TGLmKbmdhWCvM/vgm+/Gx477NU= 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.4 067/111] net: phy: broadcom: Only advertise EEE for supported modes Date: Mon, 12 Apr 2021 10:40:45 +0200 Message-Id: <20210412084006.491220825@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084004.200986670@linuxfoundation.org> References: <20210412084004.200986670@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 e0d3310957ff..c99883120556 100644 --- a/drivers/net/phy/bcm-phy-lib.c +++ b/drivers/net/phy/bcm-phy-lib.c @@ -190,7 +190,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); @@ -209,10 +209,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