Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752153AbdIAOFK (ORCPT ); Fri, 1 Sep 2017 10:05:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:40072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966AbdIAOFI (ORCPT ); Fri, 1 Sep 2017 10:05:08 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FC0D21AF7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=robh@kernel.org X-Google-Smtp-Source: ADKCNb4DMbTdnUrlO6QuoMPwP0d42xE866NMCsQR3kIaXWB4m91j+HbRHcofWlPvYpXXrT6PFVjKr5hSvQVW7eGSZJM= MIME-Version: 1.0 In-Reply-To: <20170831205928.GS22289@lunn.ch> References: <20170826073311.25612-1-clabbe.montjoie@gmail.com> <20170826073311.25612-5-clabbe.montjoie@gmail.com> <20170826212051.GA10418@lunn.ch> <20170831201803.x6vwftfcllrfpk6q@rob-hp-laptop> <20170831205928.GS22289@lunn.ch> From: Rob Herring Date: Fri, 1 Sep 2017 09:04:46 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 4/5] net: stmmac: dwmac-sun8i: choose internal PHY via phy-is-integrated To: Andrew Lunn Cc: Corentin Labbe , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Russell King , Giuseppe CAVALLARO , Alexandre Torgue , Florian Fainelli , Icenowy Zheng , netdev , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2646 Lines: 67 On Thu, Aug 31, 2017 at 3:59 PM, Andrew Lunn wrote: > On Thu, Aug 31, 2017 at 03:18:03PM -0500, Rob Herring wrote: >> On Sat, Aug 26, 2017 at 11:20:51PM +0200, Andrew Lunn wrote: >> > Hi Corentin >> > >> > I think we have now all agreed this is an mdio-mux, plus it is also an >> > MII mux. We should represent that in device tree. This patchset does >> > this. However, as it is now, the mux structure in DT is ignored. All >> > it does is search for the phy-is-integrated flags and goes on that. >> > >> > I made the comment that the device tree representation cannot be >> > implemented using an MDIO mux driver, because of driver loading >> > issues. However, the core of the MDIO mux code is just a library, >> > symbols exported as GPL, free for anything to use. >> > >> > What i think should happen is the mdio-mux is implemented inside the >> > MAC driver, using the mux-core as a library. The device tree structure >> > of a mix is then reflected within Linux. The mux switch callback is >> > implemented within the MAC driver. So it can reset the MAC when the >> > mux is switched. The 'phy-is-integrated' property is then no longer >> > needed. >> > >> > I would suggest a binding something like: >> >> This is looks better to me, but... >> >> > emac: ethernet@1c0b000 { >> > compatible = "allwinner,sun8i-h3-emac"; >> > syscon = <&syscon>; >> > reg = <0x01c0b000 0x104>; >> > interrupts = ; >> > interrupt-names = "macirq"; >> > resets = <&ccu RST_BUS_EMAC>; >> > reset-names = "stmmaceth"; >> > clocks = <&ccu CLK_BUS_EMAC>; >> > clock-names = "stmmaceth"; >> > #address-cells = <1>; >> > #size-cells = <0>; >> > >> > phy-handle = <&int_mii_phy>; >> > phy-mode = "mii"; >> > allwinner,leds-active-low; >> > >> > mdio: mdio { >> > #address-cells = <1>; >> > #size-cells = <0>; >> > } >> >> Why do you need this node still? > > Hi Rob > > It might not be needed, depending on how it is implemented. But: > > Documentation/devicetree/bindings/net/mdio-mux.txt > > It is normal for an mdio bus mux to have a phandle back to the parent > mdio bus. Also, i think the stmmac driver will only instantiate the > mdio bus if there is a node for it in the device tree. You don't have a phandle to the parent mdio bus though. I think we should allow for both case. The mux could be within the bus hierarchy. Depends where the controls are. Another alternative someone will try sooner or later is using the new mux control binding. Rob