Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2908743iog; Mon, 27 Jun 2022 05:33:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1slYxf19t10/3NOIIz9EPyyq5K6j2OZFRGgeIHorQr8R0BZZRIl1T8DIM/aKhClsdH6XGKc X-Received: by 2002:a17:907:6282:b0:6e0:c64a:60a7 with SMTP id nd2-20020a170907628200b006e0c64a60a7mr12557334ejc.349.1656333210711; Mon, 27 Jun 2022 05:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333210; cv=none; d=google.com; s=arc-20160816; b=caX44OGRCahVhiIdSP5mzB+OQgQw4xkQKj44uqgeY1P7aTx2ciXO6UMyzSxpeC7+F8 Tu0pXwxp/I97ej0xAV0ibpmI0KPm0X8u94jz4T6rnZlW4EMOUo2pGkF2CphdnItITsLg xtoCNdzLtD6AO6I/R6pe2zAlRC2y7mrGI/Zuhijwj3ETKir+yDPW9FMt2vn7jIu5NS/2 yazSgObiMZAS4YqZ7CYWZs5/kAGpCAiJWQzuhdPOkUf8txTvmhtUorPN9iwYmtaJt2EL HRAn9V2uuO71H2PUKvHhIGyOMG7NS6jp2YU7eMfzVpJaB/MJx9M6joWpF+CA12l1cVBn ncNg== 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=81ZUXinwcnwsxfKlCbH1vytjoF8aDcfxGhmuveMrdoA=; b=bQaNzkciNKS1+pLgTfn6cwPy0Dxknd/mLpnXI5sVIEvkKgFoj42cpMURl01orwBA3o jKdFqX6mFHtaDbRwkuP0rzc4wGLKtpi/CpbasTUHDbKDxsFvW5O3PPqk8JinQzI1fdY4 Bd/kv19MoDTrGBXIFytJh+/xKs0iSLIWR4BKHuhUUXahobSsms2jcRTyzVxPsh18pqm2 QjhOVljMt2EdT/PDD6nvVdqrXCesbywl2yg9AoniBlenSzJzs65NXYjOPwxTSgrx21IG Dit9BHsbgMi6LiBsUKkaNLbzByHhX8TF+0uHIkRdd9qRLvXjKoJqiLwwMNyMU7Fqd71F qz/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rkOrmDEv; 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 d10-20020a1709063cea00b00703cb42f1bdsi10980468ejh.181.2022.06.27.05.33.06; Mon, 27 Jun 2022 05:33:30 -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=rkOrmDEv; 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 S235510AbiF0LbI (ORCPT + 99 others); Mon, 27 Jun 2022 07:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235514AbiF0L3x (ORCPT ); Mon, 27 Jun 2022 07:29:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7D00B6A; Mon, 27 Jun 2022 04:28:34 -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 ams.source.kernel.org (Postfix) with ESMTPS id 83344B81123; Mon, 27 Jun 2022 11:28:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA648C3411D; Mon, 27 Jun 2022 11:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329312; bh=H3PkShMS5tf0/PpMKZejczg+nRG9ZJY4p0skfPXy2wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rkOrmDEv3sJlBZNNmswWxBbiWQZwPzRTQT4edRKga5NJQK6C2v7+AWbUK9oKazoqe W+1KlHGSisyjBvg4fdxj/lsYXZ0vSqaT2uWItwq4p6F241gXv54ozVkTzEbT/XEwBw oaMy8eatJv8eVRVXdN+0rUnnkXC35PqFf8K8MRZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ondrej Spacek , Claudiu Manoil , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 18/60] phy: aquantia: Fix AN when higher speeds than 1G are not advertised Date: Mon, 27 Jun 2022 13:21:29 +0200 Message-Id: <20220627111928.196980705@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111927.641837068@linuxfoundation.org> References: <20220627111927.641837068@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=-7.5 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: Claudiu Manoil [ Upstream commit 9b7fd1670a94a57d974795acebde843a5c1a354e ] Even when the eth port is resticted to work with speeds not higher than 1G, and so the eth driver is requesting the phy (via phylink) to advertise up to 1000BASET support, the aquantia phy device is still advertising for 2.5G and 5G speeds. Clear these advertising defaults when requested. Cc: Ondrej Spacek Fixes: 09c4c57f7bc41 ("net: phy: aquantia: add support for auto-negotiation configuration") Signed-off-by: Claudiu Manoil Link: https://lore.kernel.org/r/20220610084037.7625-1-claudiu.manoil@nxp.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/phy/aquantia_main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index 975789d9349d..75d8351ee250 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -34,6 +34,8 @@ #define MDIO_AN_VEND_PROV 0xc400 #define MDIO_AN_VEND_PROV_1000BASET_FULL BIT(15) #define MDIO_AN_VEND_PROV_1000BASET_HALF BIT(14) +#define MDIO_AN_VEND_PROV_5000BASET_FULL BIT(11) +#define MDIO_AN_VEND_PROV_2500BASET_FULL BIT(10) #define MDIO_AN_VEND_PROV_DOWNSHIFT_EN BIT(4) #define MDIO_AN_VEND_PROV_DOWNSHIFT_MASK GENMASK(3, 0) #define MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT 4 @@ -230,9 +232,20 @@ static int aqr_config_aneg(struct phy_device *phydev) phydev->advertising)) reg |= MDIO_AN_VEND_PROV_1000BASET_HALF; + /* Handle the case when the 2.5G and 5G speeds are not advertised */ + if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + phydev->advertising)) + reg |= MDIO_AN_VEND_PROV_2500BASET_FULL; + + if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, + phydev->advertising)) + reg |= MDIO_AN_VEND_PROV_5000BASET_FULL; + ret = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_VEND_PROV, MDIO_AN_VEND_PROV_1000BASET_HALF | - MDIO_AN_VEND_PROV_1000BASET_FULL, reg); + MDIO_AN_VEND_PROV_1000BASET_FULL | + MDIO_AN_VEND_PROV_2500BASET_FULL | + MDIO_AN_VEND_PROV_5000BASET_FULL, reg); if (ret < 0) return ret; if (ret > 0) -- 2.35.1