Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp789626ybz; Fri, 17 Apr 2020 10:04:08 -0700 (PDT) X-Google-Smtp-Source: APiQypLnORS3va9Df6+IXnJQBQSZOv9DqI67O75F41D2hAXbCQSMWbJTSehq33wIOApxlGhFOHIa X-Received: by 2002:a17:906:7f01:: with SMTP id d1mr3895683ejr.49.1587143048225; Fri, 17 Apr 2020 10:04:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587143048; cv=none; d=google.com; s=arc-20160816; b=Rwv10e+J3jfGCUuajuR+CjOmTp2QNvHjlHuxXGyZLHFdhrHR1thvdb6p5ul2cVCVak Ss+5pvrsSefUiV1DfTbrM7eefkJO75ajx3ewZ213cdTgXvVwH1yhtx2irOLJ/t9aJg5q cELxdsf8fqJnvQB2dbgOp6ExylaFPTwSnzCvAw/GOh4dvXdvV/VfzlKKjrsySaNTYmdb A6ZUypExRvRq5PCRCuNwBWgZCqV496eDxBzEQGgS1u6dibIuOlezFrWBUAAx/ucbDGKv XnedBN/7ENz14b9jZeYrLzamIkwDfhpH8RkrxeZa5rFlfVH5Lk9tSW669mr3dYPzYFnU txPw== 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=GDt6Kg65vGRHTbVpxtwsO49QfnwXL2hG69odrZ95CMU=; b=iQDDP0pzs9qlh5HtgdD3sOJrZIH+T6GuYJIIVNCS/MS6K3KeQOo8SnVJ907TeAt3/g LXMVYu/KtPrcXAuRj/WAM7VJBeKM8EKn0kXaCglMRvjpVpxBDZOYnpwGo8Ui1moWTXos BN8Sx5+M4763BBoiuabFRhHsma5DiinvIA4maIUmlCvWPikhzzPlcNY/8uOYbOVaHYMb 65WeeH09TCDZIIJmUwElohumkEEjUZLD5FLCxTpimZEv44Q4CQ0Bl1VseYUdRuBHI1nU sJ0A/tcQ4SSo7f2bf+NKmyffWN4IKzASXdJ8xSvNgYBqwMrAluHDVa/CtfXQ7PKalwfY yH4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=hFTCB2el; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si13955654edy.564.2020.04.17.10.03.44; Fri, 17 Apr 2020 10:04:08 -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=fail header.i=@lunn.ch header.s=20171124 header.b=hFTCB2el; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728523AbgDQRBt (ORCPT + 99 others); Fri, 17 Apr 2020 13:01:49 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:44580 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728092AbgDQRBs (ORCPT ); Fri, 17 Apr 2020 13:01:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender: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=GDt6Kg65vGRHTbVpxtwsO49QfnwXL2hG69odrZ95CMU=; b=hFTCB2elCtEZeaC6o6m91HbKSs e+jNfounAVKh/FRtsRCRy+TsjFMezugcIv1OgyXfebFunp2bndZ8jG4CHHlKqnoaTJBumqO7iwjyn hFoD69plmRq81SR0UsS5SnRTFij5AMkSacKykva5C4O/TS1PCPjGqwDbcRh+lgLGUwhc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jPUN0-003JwF-8T; Fri, 17 Apr 2020 19:01:38 +0200 Date: Fri, 17 Apr 2020 19:01:38 +0200 From: Andrew Lunn To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: robh+dt@kernel.org, f.fainelli@gmail.com, Heiner Kallweit , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux@armlinux.org.uk, mripard@kernel.org, linux-kernel@vger.kernel.org, wens@csie.org, lee.jones@linaro.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH 2/4] net: phy: Add support for AC200 EPHY Message-ID: <20200417170138.GD785713@lunn.ch> References: <20200416185758.1388148-1-jernej.skrabec@siol.net> <20200416185758.1388148-3-jernej.skrabec@siol.net> <0340f85c-987f-900b-53c8-d29b4672a8fa@gmail.com> <6176364.4vTCxPXJkl@jernej-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6176364.4vTCxPXJkl@jernej-laptop> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > You could use PHY_ID_MATCH_MODEL() here. > > Hm... This doesn't work with dynamically allocated memory, right? I would suggest we get the right structure first, then figure out details like this. Depending on when the device will respond to MDIO, we might be able to make this a normal PHY driver. It then probes in the normal way, and all the horrible dependencies you talked about, module loading order, etc all go away. There were 3 things you talked about to make the PHY usable: 1) Clock 2) Reset 3) Must be enabled and configured through I2C We already have the concept of a PHY device having a reset controller as a property. e.g. Documentation/devicetree/bindings/net/ethernet-phy.yaml resets = <&rst 8>; So if the MFD exports a reset controller, we can control that from the PHY core. If the MFD has not probed yet, the reset core code will return EPROBE_DEFFER, and the PHY probe will get differed until late. That solves a lot of probe order issues. The clock can be handled in two different ways, depending on if the clock needs to be ticking to read the PHY ID registers. If it does need to be ticking, we add support for a clks property in just the same way we have support for the reset property. The PHY core will clk_enable_prepare() the clock before probing the PHY. If the clock is not needed for probing, the PHY driver can enable the clock as needed. The last part, Must be enabled and configured through I2C, we need to look at the details. It could be the reset controller also enabled the PHY. If that is enough that the PHY then probes, the PHY driver can then configure the PHY as needed via i2c. Andrew