From mboxrd@z Thu Jan 1 00:00:00 1970 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 047ADC46467 for ; Sun, 15 Jan 2023 22:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231570AbjAOW0k (ORCPT ); Sun, 15 Jan 2023 17:26:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231243AbjAOW0i (ORCPT ); Sun, 15 Jan 2023 17:26:38 -0500 X-Greylist: delayed 1665 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 15 Jan 2023 14:26:37 PST Received: from www381.your-server.de (www381.your-server.de [78.46.137.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 699E316307 for ; Sun, 15 Jan 2023 14:26:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=7S7Q3114fxcLMvDP1hObBsSTzMGq4gxDhSezguM5qFQ=; b=LnS6bfzr3ecvlym+Fb7ppwRho/ oS2+gB57uYJrXb6i9LPoS0WKqVvjLcz9xhDsvOHRWJpbWFvk+oAANLRLT+iBKDxb8i7vLfoZmQGVh aWZhUPlgFAbDxaOAWFpeQXmCNWZaOr+HSRRkSbi1/ZM4O/Chfdua/cWUeuJptcMy/o84SYKgvDBsm JKoG7hmcdi5YHLx5wvMIaN0z+59p9UOEEIhw3LAe8+5je4LCxpzpMQXZ5fNBmuVC4q80LOvqSXy8K v3AvRnj9eFN07gT4qwAw7IaQCYp5sglxZBXk5HqRg5CrTRU14URijTxYH5BC32ctuO2dfCWJSCL2Y d6gH+y6Q==; Received: from sslproxy01.your-server.de ([78.46.139.224]) by www381.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pHB1b-000P34-NM; Sun, 15 Jan 2023 22:58:47 +0100 Received: from [2604:5500:c0e5:eb00:da5e:d3ff:feff:933b] by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHB1b-000RAN-5X; Sun, 15 Jan 2023 22:58:47 +0100 Message-ID: Date: Sun, 15 Jan 2023 13:58:43 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] net: mdio: force deassert MDIO reset signal Content-Language: en-US To: Andrew Lunn , Pierluigi Passaro Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, eran.m@variscite.com, nate.d@variscite.com, francesco.f@variscite.com, pierluigi.p@variscite.com References: <20230115161006.16431-1-pierluigi.p@variscite.com> From: Lars-Peter Clausen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.7/26782/Sun Jan 15 09:20:34 2023) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/15/23 09:08, Andrew Lunn wrote: > On Sun, Jan 15, 2023 at 05:10:06PM +0100, Pierluigi Passaro wrote: >> When the reset gpio is defined within the node of the device tree >> describing the PHY, the reset is initialized and managed only after >> calling the fwnode_mdiobus_phy_device_register function. >> However, before calling it, the MDIO communication is checked by the >> get_phy_device function. >> When this happen and the reset GPIO was somehow previously set down, >> the get_phy_device function fails, preventing the PHY detection. >> These changes force the deassert of the MDIO reset signal before >> checking the MDIO channel. >> The PHY may require a minimum deassert time before being responsive: >> use a reasonable sleep time after forcing the deassert of the MDIO >> reset signal. >> Once done, free the gpio descriptor to allow managing it later. > This has been discussed before. The problem is, it is not just a reset > GPIO. There could also be a clock which needs turning on, a regulator, > and/or a linux reset controller. And what order do you turn these on? > > The conclusions of the discussion is you assume the device cannot be > found by enumeration, and you put the ID in the compatible. That is > enough to get the driver to load, and the driver can then turn > everything on in the correct order, with the correct delays, etc. I've been running into this same problem again and again over the past years. Specifying the ID as part of the compatible string works for clause 22 PHYs, but for clause 45 PHYs it does not work. The code always wants to read the ID from the PHY itself. But I do not understand things well enough to tell whether that's a fundamental restriction of C45 or just our implementation and the implementation can be changed to fix it. Do you have some thoughts on this?