Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2387520rwb; Sun, 15 Jan 2023 14:36:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXutnNSqLBt1v0ZSvYQiFVeoyj4I0unEG09FXt7vBI0FiAlUqwb3U63sH/FVu4l3NxqTWb1m X-Received: by 2002:a17:907:3ad8:b0:85d:3771:18b7 with SMTP id fi24-20020a1709073ad800b0085d377118b7mr15192287ejc.70.1673822205583; Sun, 15 Jan 2023 14:36:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673822205; cv=none; d=google.com; s=arc-20160816; b=Hnv+iZQRGWyPQATvorgiMgVG2MO3igYLMk7R8so+R4dO/WLn7QwdZ9ChEHlxE3kDhN hm1bj23qlbJLYtcDUX45JEL4b+1cJ1SsM4ce6lBWEZK85DZfIT3LWtv4TMg45Zc/UlSV fxAC5YwERCY/8J6KJr2mP1QDvPmkzkgzWVG/nWxkrhCVZx1i/sAF3fUe+1c4xEZ7my7r 0Wc+wPoGWab6NHv59ojjEtXWZBuUICkzKDU71+CMdH/qTPfFisZ/xonOTEdfdHscdLas n2mpjoFBZdbAERC+DKQ1a4HG4g+03sGaMlQ6zPRm1zRo3wSalMGdg5vQ5FJtjyXnM82L yDhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=7S7Q3114fxcLMvDP1hObBsSTzMGq4gxDhSezguM5qFQ=; b=MymcARLRmhGw0+8RaMYIcGae9uyWxnLs/a6aPYOcisxNI+2p+wk48awze7aPej7J1t ndbeM2/tuD32S4Wo2zcqMIUEYqcGl1z9C6L2g2unjvbOFvk7kSRB9C828b5scyQLNI4I wF+hUp0+rCAucWNv7/rVSvd0R59MmW/ShCG4bx1fd2hNJeE8uXxiGGpNiElIqUtEsKZz Tg++QEMPC5ToknmRVx0CaSWcZu/fjo6flOL9HmR1qyFEsI20CIbBOYikXeaHHvfCCSVd Zj1/2eclI6E6BYku8K5IHtwq2cjhLGizM4ArAF0yJc8S8wXkRemmEV6CBMAYCjVnPAJ2 1CNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@metafoo.de header.s=default2002 header.b=LnS6bfzr; 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=metafoo.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb23-20020a170907961700b0078e1d1d6005si31089523ejc.23.2023.01.15.14.36.32; Sun, 15 Jan 2023 14:36:45 -0800 (PST) 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=@metafoo.de header.s=default2002 header.b=LnS6bfzr; 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=metafoo.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231528AbjAOW0j (ORCPT + 52 others); Sun, 15 Jan 2023 17:26:39 -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) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS 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 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?