From nobody Sun Sep 14 18:55:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1278C004D4 for ; Thu, 19 Jan 2023 13:19:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231293AbjASNTU (ORCPT ); Thu, 19 Jan 2023 08:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbjASNSf (ORCPT ); Thu, 19 Jan 2023 08:18:35 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A8C846A2 for ; Thu, 19 Jan 2023 05:18:34 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pIUoC-0005u5-Rn; Thu, 19 Jan 2023 14:18:24 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pIUoC-0079jN-5o; Thu, 19 Jan 2023 14:18:24 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pIUoB-00G51C-B9; Thu, 19 Jan 2023 14:18:23 +0100 From: Oleksij Rempel To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: [PATCH net-next v1 3/4] net: phy: micrel: disable 1000Mbit EEE support if 1000Mbit is not supported Date: Thu, 19 Jan 2023 14:18:20 +0100 Message-Id: <20230119131821.3832456-4-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230119131821.3832456-1-o.rempel@pengutronix.de> References: <20230119131821.3832456-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" KSZ8563 is announcing by default 1000Mbit EEE support, but at same time do not supporting 1000Mbit speed. This patch will disable 1000Mbit EEE advertisement if the PHY is not 1000Mbit capable. Signed-off-by: Oleksij Rempel --- drivers/net/phy/micrel.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 099f1e83c08c..11bef217b45a 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1460,6 +1460,27 @@ static int ksz9477_set_eee(struct phy_device *phydev= , struct ethtool_eee *data) return 0; } =20 +static int ksz9477_config_init(struct phy_device *phydev) +{ + int ret; + + /* KSZ8563 is able to advertise not supported MDIO_EEE_1000T. + * We need to test if the PHY is 1Gbit capable. + */ + ret =3D phy_read(phydev, MII_BMSR); + if (ret < 0) + return ret; + + if (!(ret & BMSR_ERCAP)) { + ret =3D phy_clear_bits_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, + MDIO_EEE_1000T); + if (ret) + return ret; + } + + return kszphy_config_init(phydev); +} + #define KSZ8873MLL_GLOBAL_CONTROL_4 0x06 #define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX BIT(6) #define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED BIT(4) @@ -3507,7 +3528,7 @@ static struct phy_driver ksphy_driver[] =3D { .phy_id_mask =3D MICREL_PHY_ID_MASK, .name =3D "Microchip KSZ9477", /* PHY_GBIT_FEATURES */ - .config_init =3D kszphy_config_init, + .config_init =3D ksz9477_config_init, .config_intr =3D kszphy_config_intr, .handle_interrupt =3D kszphy_handle_interrupt, .suspend =3D genphy_suspend, --=20 2.30.2