Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp4074708rdb; Wed, 30 Aug 2023 15:01:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEh4i6uuCDhF1JGPtB+V81p+1cgVcZEEU7e/kyE8FfaQalteBBAsugi6Ng6A4RyTbIzvh2M X-Received: by 2002:a17:906:2202:b0:9a5:ed5b:2418 with SMTP id s2-20020a170906220200b009a5ed5b2418mr2128564ejs.55.1693432864164; Wed, 30 Aug 2023 15:01:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693432864; cv=none; d=google.com; s=arc-20160816; b=IOipai+mYo62TU8aHyI9Yx/h8TJeVTphCyY5PdcRnFDGJx/VxDRbQSTg8ip8NLA4hO czmrHT9sQRCEiyziazJXpEQJklYg9jT3mOXYWoabnQjFYkbpMBqrcpJfIdbBHo7GPb0t ZB81XjNsEo9M7BL2Fn887Slv4qUT5VQh361mnJPCqxF8XeQ1AUpRCokDftt14BT6S3ds y0LUfYV08g58HxVGc4IIDHQWD80DgUqyh/CI0BRi5DNZSuBu4i5m8B+bBNgpbgpaHTg3 WcL2Y/f/1f8UhejXVbscqK3AIAlneTxIbgTar8WPApPI0Yw5TTYdAlPknK0vrbbQ+fkM tWog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=T2O+sBlbvdpS0hoU5T0fb6i/Wy/HRU/MDJb7UwbbaxA=; fh=qvjTytidzSG8hLJF3dOXHgkpUlfrtbJfXqvm2mjKzfU=; b=xdrTQDZDHU81HpJYJPPLZA4rJ5vwsosMag/3/MTOzhTdHLVTYxGFy1J+Ly7YQckAPP uQUCbZvqp3tGHtnZqicqAYL3GQMvjyU18jVqScBvGvqlct1j1ZA+dVpcYpgHydoJe6Hk NUufARXjmbmOKZTi14KiYqedPHseInCtdKMyulOHXTnlMs+k+OfZHJz9rjOCcc3ncijO eUub+Sb12jFF4BvdsdKvto+u68MqPi6X3hDXttQDuVujz/qZP5nFhMDWmeGQmWYmjLLu hbkiHa+OtrKrkbJ93qvTAUfztc2/LzwNWyMwPqRQY6w0EWOpGn/eHTTKIlcvAdo2oU9T Rafg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=B0PIR7P7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lt14-20020a170906fa8e00b0099bcf9c2ec5si34046ejb.967.2023.08.30.15.00.28; Wed, 30 Aug 2023 15:01:04 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=B0PIR7P7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239220AbjH3SkP (ORCPT + 99 others); Wed, 30 Aug 2023 14:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244120AbjH3Mfk (ORCPT ); Wed, 30 Aug 2023 08:35:40 -0400 Received: from pandora.armlinux.org.uk (unknown [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E95E8; Wed, 30 Aug 2023 05:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=T2O+sBlbvdpS0hoU5T0fb6i/Wy/HRU/MDJb7UwbbaxA=; b=B0PIR7P723ofepUo8TBm5pvms9 KEe7g27iq3BAJ9U3a0CfNnS7OlQjbPOEKMiAU70aOdkVCEDLjcN5BweXpJES02hcYS0pwq0WNvzxZ 8gqk6cXZfGwKc9+FtFSu7gGFeHBpdwzhj5YgMBse325oixL3mWlDXCq25IOK6er4DUwDfQoK70W+w LSe0ahEKAdTbEjaIb3IUWeJp2tIm6uXiXkcuddgcHatnxN1e6xhR8giS5/OTpzfJ45DYgcYDokehr EcPvt7De5bSDvUF3o6qfryeZgSF/jVmps8IQ2v/lWR6zXqSLc4wkZ1WITD9CPrr/uAn6N4XKxFCfU in5L7A/w==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:56508) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qbKPn-0001bb-1X; Wed, 30 Aug 2023 13:35:19 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qbKPm-0005go-4T; Wed, 30 Aug 2023 13:35:18 +0100 Date: Wed, 30 Aug 2023 13:35:18 +0100 From: "Russell King (Oracle)" To: Oleksij Rempel Cc: Lukasz Majewski , Eric Dumazet , Andrew Lunn , davem@davemloft.net, Woojung Huh , Vladimir Oltean , Tristram.Ha@microchip.com, Florian Fainelli , Jakub Kicinski , Paolo Abeni , UNGLinuxDriver@microchip.com, Heiner Kallweit , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] net: phy: Provide Module 4 KSZ9477 errata (DS80000754C) Message-ID: References: <20230830092119.458330-1-lukma@denx.de> <20230830092119.458330-2-lukma@denx.de> <20230830101813.GG31399@pengutronix.de> <20230830125224.1012459f@wsk> <20230830105941.GH31399@pengutronix.de> <20230830135151.683303db@wsk> <20230830121738.GJ31399@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230830121738.GJ31399@pengutronix.de> Sender: Russell King (Oracle) X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RDNS_NONE, SPF_HELO_NONE,SPF_NONE autolearn=no 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 On Wed, Aug 30, 2023 at 02:17:38PM +0200, Oleksij Rempel wrote: > On Wed, Aug 30, 2023 at 01:51:51PM +0200, Lukasz Majewski wrote: > > Hi Oleksij, > > > It looks like the most optimal solution would be the one proposed by > > Tristam: > > https://www.spinics.net/lists/netdev/msg932044.html > > In this case, please add the reason why it would work on this HW and > will not break by any changes in PHYlib or micrel.c driver. > > If I remember it correctly, in KSZ9477 variants, if you write to EEE > advertisement register, it will affect the state of a EEE capability > register. Which break IEEE 802.3 specification and the reason why > ksz9477_get_features() actually exist. But can be used as workaround if > it is written early enough before PHYlib tried to read EEE capability > register. > > Please confirm my assumption by applying your workaround and testing it > with ethtool --show-eee lanX. > > It should be commented in the code with all kind of warnings: > Don't move!!! We use one bug to workaround another bug!!! If PHYlib > start scanning PHYs before this code is executed, then thing may break!! Why would phylib's scanning cause breakage? phylib's scanning for PHYs is about reading the ID registers etc. It doesn't do anything until the PHY has been found, and then the first thing that happens when the phy_device structure is created is an appropriate driver is located, and the driver's ->probe function is called. If that is successful, then the fewatures are read. If the PHY driver's ->features member is set, then that initialises the "supported" mask and we read the EEE abilities. If ->features is not set, then we look to see whether the driver provides a ->get_features method, and call that. Otherwise we use the generic genphy_c45_pma_read_abilities() or genphy_read_abilities() depending whether the PHY's is_c45 is set or not. So, if you want to do something very early before features are read, then either don't set .features, and do it early in .get_features before calling anything else, or do it in the ->probe function. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!