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 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5A46C433DF for ; Wed, 24 Jun 2020 19:00:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A66BE2082F for ; Wed, 24 Jun 2020 19:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406216AbgFXTAH (ORCPT ); Wed, 24 Jun 2020 15:00:07 -0400 Received: from foss.arm.com ([217.140.110.172]:56106 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405469AbgFXTAG (ORCPT ); Wed, 24 Jun 2020 15:00:06 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA3121F1; Wed, 24 Jun 2020 12:00:04 -0700 (PDT) Received: from [10.57.9.128] (unknown [10.57.9.128]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 470C13F71E; Wed, 24 Jun 2020 11:59:59 -0700 (PDT) Subject: Re: [PATCH 09/15] net: phy: delay PHY driver probe until PHY registration To: Russell King - ARM Linux admin , Florian Fainelli Cc: Andrew Lunn , Alexandre Belloni , devicetree , Vladimir Oltean , Linux Kernel Mailing List , Fabien Parent , Iyappan Subramanian , Quan Nguyen , Frank Rowand , Bartosz Golaszewski , Bartosz Golaszewski , Jakub Kicinski , Yisen Zhuang , Vivien Didelot , Tom Lendacky , Andrew Perepech , Stephane Le Provost , Keyur Chudgar , Jassi Brar , Claudiu Manoil , Rob Herring , "moderated list:ARM/Mediatek SoC..." , Matthias Brugger , Linux ARM , Salil Mehta , netdev , Ilias Apalodimas , Liam Girdwood , Microchip Linux Driver Support , Mark Brown , Philipp Zabel , Pedro Tsai , "David S . Miller" , Heiner Kallweit References: <20200622093744.13685-1-brgl@bgdev.pl> <20200622093744.13685-10-brgl@bgdev.pl> <20200622133940.GL338481@lunn.ch> <20200622135106.GK4560@sirena.org.uk> <20200624094302.GA5472@sirena.org.uk> <20200624165016.GA1551@shell.armlinux.org.uk> From: Robin Murphy Message-ID: <0c78a4ab-5aae-a45c-babd-e860c6cfc3c8@arm.com> Date: Wed, 24 Jun 2020 19:59:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200624165016.GA1551@shell.armlinux.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-24 17:50, Russell King - ARM Linux admin wrote: > On Wed, Jun 24, 2020 at 09:06:28AM -0700, Florian Fainelli wrote: >> On 6/24/2020 6:48 AM, Bartosz Golaszewski wrote: >>> I didn't expect to open such a can of worms... >>> >>> This has evolved into several new concepts being proposed vs my >>> use-case which is relatively simple. The former will probably take >>> several months of development, reviews and discussions and it will >>> block supporting the phy supply on pumpkin boards upstream. I would >>> prefer not to redo what other MAC drivers do (phy-supply property on >>> the MAC node, controlling it from the MAC driver itself) if we've >>> already established it's wrong. >> >> You are not new to Linux development, so none of this should come as a >> surprise to you. Your proposed solution has clearly short comings and is >> a hack, especially around the PHY_ID_NONE business to get a phy_device >> only then to have the real PHY device ID. You should also now that "I >> need it now because my product deliverable depends on it" has never been >> received as a valid argument to coerce people into accepting a solution >> for which there are at review time known deficiencies to the proposed >> approach. > > It /is/ a generic issue. The same problem exists for AMBA Primecell > devices, and that code has an internal deferred device list that it > manages. See drivers/amba/bus.c, amba_deferred_retry_func(), > amba_device_try_add(), and amba_device_add(). > > As we see more devices gain this property, it needs to be addressed > in a generic way, rather than coming up with multiple bus specific > implementations. > > Maybe struct bus_type needs a method to do the preparation to add > a device (such as reading IDs etc), which is called by device_add(). > If that method returns -EPROBE_DEFER, the device gets added to a > deferred list, which gets retried when drivers are successfully > probed. Possible maybe? FWIW that would be ideal for solving an ordering a problem we have in the IOMMU subsystem too (which we currently sort-of-handle by deferring driver probe from dma_configure(), but it really needs to be done earlier and not depend on drivers being present at all). Robin.