Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp855646rdg; Wed, 11 Oct 2023 07:26:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2TIt/1P3EpSR7Ious09Infjp0e4Aoglh+PaXTDvEDS/GwG1iKWW3nCdPYGYlggOoXEZNe X-Received: by 2002:a05:6a20:f3a6:b0:16b:74db:8fe1 with SMTP id qr38-20020a056a20f3a600b0016b74db8fe1mr15800247pzb.29.1697034388186; Wed, 11 Oct 2023 07:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697034388; cv=none; d=google.com; s=arc-20160816; b=w54Wo8pZuEiu6yxyqvKUJvYqx6p2sjzgxNjpNU0OgIh69UvbWrzV69Xq0UjOecjvNT qKw2ypPJrEDO8vO/y4gksHXDyYxa1ZeSTnQyYZr/QxD428/qcOABZXE+qcjGURPqxNHi GFC6y1w/nPCXxVQarRMvhjlDNYFWmzSjB4ZSG7/dPrpHN/yx0X0mS4iLpCSDXE2aMXxG CW41BHCyIYoTfPdY5/obCWWZC3tfvDc7ey9WNzPINvReq/cKdPKwVKLksDpsV04of5/y 0ACs+e/K4xVhorl76hi3XdPko0NsXQpm3AvqQXSTHlVCgrrmGkSEzphY1+Z3azjI8h0W /xvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=KUkvtF777319d5w+5vosm44mfHQ55et4xB7Xw/uWx3M=; fh=jmYQm58kszJ1HwzjG+Enqtxds6NWwT8d8ymkzLPQVq4=; b=jDnRdxDYT0vFonPIaKB44+uL6eEqnkcsSdRaA0TabguO0aD0QMeUh3FYk4CpN+bGXg Gvx1HZ7fY8Ogi+b3YCSp2DnlQZZZWIVTE7cFaklNNkK1KsD6erjSnogHSQtOvRVSsc1M BJIssenIcT+h9fXpuExhfWSNgQ9UdBTdMNnzXJ86XK4OzTDL3zj2SKbuzvzlM5e9Omle O/aAHTs891YNhkkK7MHsv+CSnFsPIOupBeeJkbEc9gpHmVGmVr7FUE2m/i2bYq/WlbsQ AmaV3E7On9wKJMQ/6PpqV53PiuIVdOtEOzlQ7+q9Vl0sS9DScN+wq5q8HvUvISiQ7wtt kerg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id n6-20020a170903110600b001bba7713547si15161185plh.151.2023.10.11.07.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 07:26:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id DFFAF80A97A1; Wed, 11 Oct 2023 07:26:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346815AbjJKOZx (ORCPT + 99 others); Wed, 11 Oct 2023 10:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235016AbjJKOZv (ORCPT ); Wed, 11 Oct 2023 10:25:51 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCF61B0 for ; Wed, 11 Oct 2023 07:25:49 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qqa9P-0007Ck-PJ; Wed, 11 Oct 2023 16:25:27 +0200 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqa9O-000vWv-7M; Wed, 11 Oct 2023 16:25:26 +0200 Received: from ore by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qqa9O-00DwOh-4T; Wed, 11 Oct 2023 16:25:26 +0200 Date: Wed, 11 Oct 2023 16:25:26 +0200 From: Oleksij Rempel To: Alexander Stein Cc: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Russell King Subject: Re: [PATCH net-next v1 3/3] net: phy: micrel: Fix forced link mode for KSZ886X switches Message-ID: <20231011142526.GA3306548@pengutronix.de> References: <20231011123856.1443308-1-o.rempel@pengutronix.de> <20231011123856.1443308-3-o.rempel@pengutronix.de> <3767760.kQq0lBPeGt@steina-w> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3767760.kQq0lBPeGt@steina-w> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 11 Oct 2023 07:26:21 -0700 (PDT) X-Spam-Level: ** Hi Alexander, thank you for review! On Wed, Oct 11, 2023 at 03:29:49PM +0200, Alexander Stein wrote: > Hi Oleksij, > > Am Mittwoch, 11. Oktober 2023, 14:38:56 CEST schrieb Oleksij Rempel: > > Address a link speed detection issue in KSZ886X PHY driver when in > > forced link mode. Previously, link partners like "ASIX AX88772B" > > with KSZ8873 could fall back to 10Mbit instead of configured 100Mbit. > > > > The issue arises as KSZ886X PHY continues sending Fast Link Pulses (FLPs) > > even with autonegotiation off, misleading link partners in autoneg mode, > > leading to incorrect link speed detection. > > > > Now, when autonegotiation is disabled, the driver sets the link state > > forcefully using KSZ886X_CTRL_FORCE_LINK bit. This action, beyond just > > disabling autonegotiation, makes the PHY state more reliably detected by > > link partners using parallel detection, thus fixing the link speed > > misconfiguration. > > > > With autonegotiation enabled, link state is not forced, allowing proper > > autonegotiation process participation. > > > > Signed-off-by: Oleksij Rempel > > --- > > drivers/net/phy/micrel.c | 32 +++++++++++++++++++++++++++++--- > > 1 file changed, 29 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c > > index 927d3d54658e..12f093aed4ff 100644 > > --- a/drivers/net/phy/micrel.c > > +++ b/drivers/net/phy/micrel.c > > @@ -1729,9 +1729,35 @@ static int ksz886x_config_aneg(struct phy_device > > *phydev) { > > int ret; > > > > - ret = genphy_config_aneg(phydev); > > - if (ret) > > - return ret; > > + if (phydev->autoneg != AUTONEG_ENABLE) { > > + ret = genphy_setup_forced(phydev); > > + if (ret) > > + return ret; > > + > > + /* When autonegotation is disabled, we need to manually > force > > + * the link state. If we don't do this, the PHY will keep > > + * sending Fast Link Pulses (FLPs) which are part of the > > + * autonegotiation process. This is not desired when > > + * autonegotiation is off. > > + */ > > + ret = phy_set_bits(phydev, MII_KSZPHY_CTRL, > > + KSZ886X_CTRL_FORCE_LINK); > > + if (ret) > > + return ret; > > + } else { > > + /* Make sure, the link state is not forced. > > + * Otherwise, the PHY we create a link by skipping the > > PHY will create? > > > + * autonegotiation process. > > + */ > > + ret = phy_clear_bits(phydev, MII_KSZPHY_CTRL, > > + KSZ886X_CTRL_FORCE_LINK); > > + if (ret) > > + return ret; > > Isn't this call to phy_clear_bits() a fix for autonegotiation mode? This > should be a separate patch then. First time this bit is set by this patch, I assume this problem would not exist without fixed link fix. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |