Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4827991rwb; Tue, 8 Aug 2023 14:47:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhSs035A0i9QZPOrBvSFnTjXbuTqVyD7CxUBbdhG9idBEfzUDIO1iTXdyauy6fgl3lSJDE X-Received: by 2002:a17:902:778c:b0:1bb:a6db:3fd0 with SMTP id o12-20020a170902778c00b001bba6db3fd0mr900965pll.69.1691531246464; Tue, 08 Aug 2023 14:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691531246; cv=none; d=google.com; s=arc-20160816; b=IXy702dpI7gURaZ3gckhQFscy7r3dVGzJIUTZb9HDX8DkvRhj/1RWE2yeEKuBguDQj z4JbVy+0AS04hR/YPmscMol9Tx5WmnM7n+XL2HyeA8A57Hz6E9/BVMTC3swyzROD+D/L TrIcf2XoaXMF87+OhKI5DXuhijniETgjTDgY7zb5d+bEDHuuMB4+8JV2Hia8oZp7hp6l MfBvIiqC64VyPOMIcnPasKzFv2c3366vnyhuuP5La/uGGNFxHX80MxWo/egj/ebTwiwY pYzTsx0J+U6IsuBQxvsTds/UePQXeP20ohL12cDEQlU8fjcqCrQ50si6MWTxs0Sp34KG m7Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TXFRjF7K/onOiZi8P7ylgtGuh71aaBRyhInX/G1pbtc=; fh=R3TiDZv4j0ycJsmbcv0uyhpTYWmSBttbSqXig+EwkXg=; b=Tly6QOsvJtPC7XqcZT7eHpqbqag9Vt5bGIT4PZbFTBysXHwahVUFxo+oTY39bnzMvk xRJPXlUzFbo8M2dM8J86GIKHt6IsYgnNpjqOIXNB6GTVQ1uk+IsYAwyAZ9FrpiX/BsJy 0+APhSdRkL1qrrZ0JyhpNZt4AlYcBeq0JC3/tyoccZ686R63ZkC7ZjfYnnehv85AT621 JSDeD95CUFXJY9FyEcSz0CeDDw2tPUtsqS9ZgTBiGpoca+tUCi9wHFPEstiPwN269ypF T1U9rrINDfyZ8PbqOrwXc/LLMQqc2Fhx6NkCIFEOxsAg7YLVuliZParYzhQePR4VRdsw 5NXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=YnD2VAS1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a170902e80400b001b878f9e11csi8300920plg.54.2023.08.08.14.47.15; Tue, 08 Aug 2023 14:47:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=YnD2VAS1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234509AbjHHUOb (ORCPT + 99 others); Tue, 8 Aug 2023 16:14:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231982AbjHHUOU (ORCPT ); Tue, 8 Aug 2023 16:14:20 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01A74BA911; Tue, 8 Aug 2023 11:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=TXFRjF7K/onOiZi8P7ylgtGuh71aaBRyhInX/G1pbtc=; b=YnD2VAS1P+TJaMnsnk8R87jq86 TyjkHpLTmWYGHTsENLT/RdYspzJXqplJ4aFMEORjjBmEzJTRZ9mp7AaDTIxYHBLmAHtPaXfgZNZI0 v6ZeFiOAAhQeoHDHsZ0lB8yFB+G6mH/nkIBCTRRfZAI/mft0ZPWJTRSITAgzNBwx7ICA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qTRiR-003VHE-Sh; Tue, 08 Aug 2023 20:45:59 +0200 Date: Tue, 8 Aug 2023 20:45:59 +0200 From: Andrew Lunn To: Bartosz Golaszewski Cc: Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alex Elder , Srini Kandagatla , Andrew Halaney , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH net-next] net: stmmac: don't create the MDIO bus if there's no mdio node on DT Message-ID: <82cd26a3-e63d-4251-9d43-d1d7443b9cce@lunn.ch> References: <20230808120254.11653-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230808120254.11653-1-brgl@bgdev.pl> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 08, 2023 at 02:02:54PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > The stmmac_dt_phy() function that parses the device-tree node of the MAC > and allocates the MDIO and PHY resources misses one use-case: when the > MAC doesn't have a fixed link but also doesn't define its own mdio bus > on the device tree and instead shares the MDIO lines with a different > MAC with its PHY phandle reaching over into a different node. It does not share the MDIO lines. The other MDIO bus master happens to have two PHYs and there are no PHYs on this MDIO bus, so no point instantiating it. > static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, > struct device_node *np, struct device *dev) > { > - bool mdio = !of_phy_is_fixed_link(np); > static const struct of_device_id need_mdio_ids[] = { > { .compatible = "snps,dwc-qos-ethernet-4.10" }, > {}, > }; > > + if (of_phy_is_fixed_link(np)) > + return 0; > + /** * If snps,dwmac-mdio is passed from DT, always register * the MDIO */ for_each_child_of_node(np, plat->mdio_node) { if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio")) break; } The comment suggests it should always be registered. This MAC might have a fixed-phy, but that does not mean there is not an Ethernet switch on the bus, or a PHY for some other MAC etc. MDIO busses masters should be considered fully independent devices. https://elixir.bootlin.com/linux/v6.5-rc5/source/arch/arm/boot/dts/nxp/vf/vf610-zii-ssmb-dtu.dts &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>; clock-frequency = <12500000>; suppress-preamble; status = "okay"; switch0: switch0@0 { compatible = "marvell,mv88e6190"; pinctrl-0 = <&pinctrl_gpio_switch0>; pinctrl-names = "default"; reg = <0>; eeprom-length = <65536>; interrupt-parent = <&gpio3>; interrupts = <2 IRQ_TYPE_LEVEL_LOW>; interrupt-controller; #interrupt-cells = <2>; Both a fixed link, and something on the MDIO bus.... Andrew