Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp702112ybt; Wed, 24 Jun 2020 09:09:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6GC/xM+pm/KaFeoWQdG2IRbIDCbXbaYmuQTMkdjm80SpDd2gyeALMBwge9qB5jdldBTpm X-Received: by 2002:aa7:ccc2:: with SMTP id y2mr26757295edt.97.1593014963088; Wed, 24 Jun 2020 09:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593014963; cv=none; d=google.com; s=arc-20160816; b=yvzSSiBF7eDW93H2lkjMOjJT3l71lX7n/99CJ45AFmVJP3+YqPblbXUO+FrYfOxRP5 0K6F+9s858BHyZ9XHDKzztpTWmYSJjfLwyTTY9MA9SuAp0L4OnyW9PXb7QxofFicHOfV zBoCt8xIprhGKMa6OdNZL8Smh2ATEzZ0o2g/RRG7NN0xB+arODOO0kwaqb19eLYs/5j0 AS6z1j9AH21m2eWCo0K+hDOaWURL2pHwGcW0eNT3g+MzDj8BKsOYACnUbp5Dv+CnlZGJ p1rv/vM1gb3+9JKvLiHfvmWNkW/n8rSjbklYk/XDr3o6PJHBIwXs/jPTSC/Tvd2uYE4j gcAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=N5fl5/sMZxwAr7ptc9+M4Sr+AByefpkVY5hVcBVQQ/k=; b=DdmNz1OzwbQ24sRtTuUqG4WY8JCi2TaXcpfhDayQTjQFOMk+CWBLzbP7Vxv4t+UhPs NGAnrdR6Zgod7GDYgPgUtxiiXZ30iCfgjhJmSUGSy+p5cp28N9r+Y8poQyJW+cn+GprM qJdAJhVuhIDOIZinPyZoYoS6MwWe4Exh53pUm3yWf/mHMwxfc/39HC3GJPbW4mvsxKoj 43OnZ/JtmGZfuiMUjVlwgaTCejKAaFcs1OWn35MAdrBtQHurhVsqUHXXhTZhAocq2yvd S2KDzTulIv0rU7kGZUA131PDY3/1Wc2M7Xv/xkE5FetZaI1FsrMj+KNY2pUBVrEpnc14 ikWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c2rzrcC1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si1386682edj.491.2020.06.24.09.08.58; Wed, 24 Jun 2020 09:09:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c2rzrcC1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404878AbgFXQGj (ORCPT + 99 others); Wed, 24 Jun 2020 12:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404525AbgFXQGi (ORCPT ); Wed, 24 Jun 2020 12:06:38 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89512C061573; Wed, 24 Jun 2020 09:06:38 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id l2so1572705wmf.0; Wed, 24 Jun 2020 09:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=N5fl5/sMZxwAr7ptc9+M4Sr+AByefpkVY5hVcBVQQ/k=; b=c2rzrcC1s/RvV0v6BauZL5SgifsfzraAm6dKbwwVmpzxQX4AEpCnmWIyRQjVyJ0BxY VwAF1gysQzcY6viTFWKNd5ER+wald/A+oDJmThbanQzzZTMkP8Syhpwrt+cK1I8evkBw vKEUtxcqdx/YAs6AfAz1YMl1W6EjqZaigjKox7N0hT1oe61tpTl1rIpLMJbIlywMUA6y r9Iqdiq9bK+9J6sjSGr1PFWW6C7ipYzc5btYktjX9GjMxMJrTiHGA4nrljYift0Cb5wn Lo9oppL/ubGVr1CRnyh4GbMhJctzp8q5jjRO/KLV5NGB/8uatOUPDVDfTmK6h+fUbnK4 JiJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=N5fl5/sMZxwAr7ptc9+M4Sr+AByefpkVY5hVcBVQQ/k=; b=QXjwsmM9OpdYZkuQliRgF7KLfozW3Jj6Zznn6cATO31eYn/M3SCI6PUq4saLq52kXc MZQADTovH++L0Mk2WBDMGKVq6arP4jeCcLsrv1iqyrtDLvVIGbgyd4QoEykj0jf+9Zm2 tkDQSHytAu0wBGiLtzsjdfnO6s458eCTidzhGOv6sca+C5kQWC1I5RR3v+sajF2cN4jY gI2S+v3VrJsQueUNamae/pggfrI+/qGHbVtHH6odUJLEkZLxl3dDD4D/QcNBp2Qh0o/M 0V+8qWzyuTVXdf/w2H1uFq0iXfEK/zp5a2r/72sr1TwAxAZ20eNG6pz9X+bKqeLDOucV O+/g== X-Gm-Message-State: AOAM530Hj3RVbEljJELo0oSAzpPDBhS/wFCsdfzuqIiwbxMrwRkIskyr kPpXjjZ05yKWysVHQ19YXgo= X-Received: by 2002:a1c:a90d:: with SMTP id s13mr16491624wme.184.1593014797129; Wed, 24 Jun 2020 09:06:37 -0700 (PDT) Received: from [10.230.189.192] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id f14sm10446689wro.90.2020.06.24.09.06.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Jun 2020 09:06:36 -0700 (PDT) Subject: Re: [PATCH 09/15] net: phy: delay PHY driver probe until PHY registration To: Bartosz Golaszewski , Mark Brown Cc: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Rob Herring , Matthias Brugger , Microchip Linux Driver Support , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , Vivien Didelot , Tom Lendacky , Yisen Zhuang , Salil Mehta , Jassi Brar , Ilias Apalodimas , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , Frank Rowand , Philipp Zabel , Liam Girdwood , netdev , devicetree , Linux Kernel Mailing List , Linux ARM , "moderated list:ARM/Mediatek SoC..." , Fabien Parent , Stephane Le Provost , Pedro Tsai , Andrew Perepech , Bartosz Golaszewski 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> From: Florian Fainelli Message-ID: Date: Wed, 24 Jun 2020 09:06:28 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/24/2020 6:48 AM, Bartosz Golaszewski wrote: > śr., 24 cze 2020 o 11:43 Mark Brown napisał(a): >> >> On Tue, Jun 23, 2020 at 12:49:15PM -0700, Florian Fainelli wrote: >>> On 6/22/20 6:51 AM, Mark Brown wrote: >> >>>> If the bus includes power management for the devices on the bus the >>>> controller is generally responsible for that rather than the devices, >>>> the devices access this via facilities provided by the bus if needed. >>>> If the device is enumerated by firmware prior to being physically >>>> enumerable then the bus will generally instantiate the device model >>>> device and then arrange to wait for the physical device to appear and >>>> get joined up with the device model device, typically in such situations >>>> the physical device might appear and disappear dynamically at runtime >>>> based on what the driver is doing anyway. >> >>> In premise there is nothing that prevents the MDIO bus from taking care >>> of the regulators, resets, prior to probing the PHY driver, what is >>> complicated here is that we do need to issue a read of the actual PHY to >>> know its 32-bit unique identifier and match it with an appropriate >>> driver. The way that we have worked around this with if you do not wish >>> such a hardware access to be made, is to provide an Ethernet PHY node >>> compatible string that encodes that 32-bit OUI directly. In premise the >>> same challenges exist with PCI devices/endpoints as well as USB, would >>> they have reset or regulator typically attached to them. >> >> That all sounds very normal and is covered by both cases I describe? >> >>>> We could use a pre-probe stage in the device model for hotpluggable >>>> buses in embedded contexts where you might need to bring things out of >>>> reset or power them up before they'll appear on the bus for enumeration >>>> but buses have mostly handled that at their level. >> >>> That sounds like a better solution, are there any subsystems currently >>> implementing that, or would this be a generic Linux device driver model >>> addition that needs to be done? >> >> Like I say I'm suggesting doing something at the device model level. > > 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. > > Is there any compromise we could reach to add support for a basic, > common use-case of a single regulator supplying a PHY that needs > enabling before reading its ID short-term (just like we currently > support a single reset or reset-gpios property for PHYs) and > introducing a whole new concept to the device model for more advanced > (but currently mostly hypothetical) cases long-term? The pre-probe use case is absolutely not hypothetical, and I would need it for pcie-brcmstb.c at some point which is a PCIe root complex driver with multiple regulators that need to be turned on *prior* to enumerating the PCIe bus and creating pci_device instances. It is literally the same thing as what you are trying to do, just in a different subsystem, therefore I am happy to test and review your patches. -- Florian