From: Andrew Lunn Subject: Re: [PATCH net-next 1/3] net: nixge: Add support for fixed-link subnodes Date: Thu, 30 Aug 2018 05:04:20 +0200 Message-ID: <20180830030420.GB16896@lunn.ch> References: <20180830004046.9417-1-mdf@kernel.org> <20180830004046.9417-2-mdf@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: davem@davemloft.net, keescook@chromium.org, f.fainelli@gmail.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, alex.williams@ni.com To: Moritz Fischer Return-path: Content-Disposition: inline In-Reply-To: <20180830004046.9417-2-mdf@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Wed, Aug 29, 2018 at 05:40:44PM -0700, Moritz Fischer wrote: > Add support for fixed-link cases where no MDIO is > actually required to run the device. > In that case no MDIO bus is instantiated since the > actual registers are not available in hardware. Hi Moritz There are a few different use cases here: The hardware is missing MDIO - You need fixed-link. The hardware has MDIO, but you don't have a PHY connected on it, and use fixed link. The hardware has MDIO, and it is used e.g. for an Ethernet switch, or a PHY for another Ethernet interface. Plus you need fixed link. The binding typically looks like: &fec1 { phy-mode = "rmii"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_fec1>; status = "okay"; fixed-link { speed = <100>; full-duplex; }; mdio1: mdio { #address-cells = <1>; #size-cells = <0>; status = "okay"; switch0: switch0@0 { compatible = "marvell,mv88e6085"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_switch>; reg = <0>; eeprom-length = <512>; interrupt-parent = <&gpio3>; It is important you have the mdio subnode, with PHYs and switches as children. The driver currently gets this wrong, it uses pdev->dev.of_node. So the first patch should be to extend this behaviour. Look for a child node called mdio. If it exists, call nixge_mdio_setup() passing that child. Otherwise continue using pdev->dev.of_node, so you don't break backwards compatibility. Then a patch adding support for fixed-link. If the mdio child node exists, you still need to register the MDIO bus. If there is no child node, but there is a fixed-link, skip registering the mdio bus with pdev->dev.of_node. Andrew