Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751162AbdHZVVN (ORCPT ); Sat, 26 Aug 2017 17:21:13 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:45183 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbdHZVVL (ORCPT ); Sat, 26 Aug 2017 17:21:11 -0400 Date: Sat, 26 Aug 2017 23:20:51 +0200 From: Andrew Lunn To: Corentin Labbe Cc: robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, peppe.cavallaro@st.com, alexandre.torgue@st.com, f.fainelli@gmail.com, icenowy@aosc.io, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 4/5] net: stmmac: dwmac-sun8i: choose internal PHY via phy-is-integrated Message-ID: <20170826212051.GA10418@lunn.ch> References: <20170826073311.25612-1-clabbe.montjoie@gmail.com> <20170826073311.25612-5-clabbe.montjoie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170826073311.25612-5-clabbe.montjoie@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2322 Lines: 70 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: 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>; } mdio-mux { #address-cells = <1>; #size-cells = <0>; mdio@0 { reg = <0>; #address-cells = <1>; #size-cells = <0>; int_mii_phy: ethernet-phy@1 { reg = <1>; clocks = <&ccu CLK_BUS_EPHY>; resets = <&ccu RST_BUS_EPHY>; }; }; ext_mdio: mdio@0 { #address-cells = <1>; #size-cells = <0>; ext_rgmii_phy: ethernet-phy@1 { reg = <1>; }; }; }; }; Andrew