Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp534188lqm; Wed, 1 May 2024 08:08:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXes5xWJ/oBbw6zK+H+G8nDgVs2U67fugC8y+OhUQmL+8WyLkCfTRHoehWvQgoXMJb5jWeCX/cvgN8yOvlMr1MDJw4Bu6DkeOGEuBApnA== X-Google-Smtp-Source: AGHT+IEzhIoAJVn+QCODBwSnFnGg25zjxnzr9yj79PyTrydZs6bOvAa/bMfKYXXBh495C5yj6x8n X-Received: by 2002:a17:90a:394c:b0:2ac:6355:c6dc with SMTP id n12-20020a17090a394c00b002ac6355c6dcmr2462148pjf.19.1714576117349; Wed, 01 May 2024 08:08:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714576117; cv=pass; d=google.com; s=arc-20160816; b=INjvM9pOopSP3U2dEho+xS7ctcuDkPHXo0BObT/T/aw6yt5NrbAUxnY8lKXTuI01gG M5vGOLhhVJFnjUYZkoitomw/O8BnP77gVjbL+u1C9lHy3m5Dby3/crbFlQTgtuU7Pqdr 1p+oOuL80HU6sE4I71r7musPVvLVqSiswwIiY0RHDLHuuYUHrDKTdBwaIsFqr3vKpC8Q /3acoGR/tAHkohREjQR+OMgO21IZ9P51yn2Cl6lqtzFO/te+ZpeFNIVkU+KitFll8uzv 6QlIgaSy+6dacOGYiT9dGnTX8pOFmk8dCLXbFxw/zUQnnPV01ivaA/HdKfipKZENmoA5 SA2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=r7gAXy+cNEHO7G6rohfcs/xnGaGYf4/LzouNOqGTrog=; fh=LSUwHBRP15lABYBDfLs16pTx9/tpvS+OyI3R3iCoElU=; b=RkaLFgS4kv4W6Tf/RaP2WpOYLalmvMbNInknZQsM9gD05PfLfKJBOGi4xxgkpyAzgk V00e958PtHcVMb5L4q8eVEKOV7qfWe72hgm5GzAgm9Ji+Vz1fa0/YTsC/BrrDDT0chMo 3rbFH7JpzLAtdFnleZx4JIw+1Q9PUXoPFRWVGlYW1qBCNw6iRgMyTfM26xeRrhTwhZDJ H4x0vIT8zdjdmpjd4+cVpeT08aP124ckadl7Ps8qmlJ36hLD2y0xRaeJhFsR+O3QKntP E2kCwxagy/Dv9e0LX/5+uQwRKKzpXPUXQ8mt9DzlROS9r+XCbr7oapXZag0vGs2EsVHo L6Iw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Ub7vtwJF; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-165416-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165416-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fy8-20020a17090b020800b002b2872f9187si1648183pjb.58.2024.05.01.08.08.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165416-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Ub7vtwJF; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-165416-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165416-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DF9B62814A9 for ; Wed, 1 May 2024 15:08:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34F5512F588; Wed, 1 May 2024 15:08:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Ub7vtwJF" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30C8E1527AD; Wed, 1 May 2024 15:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714576085; cv=none; b=KLWa+kWZhjzbBNTxosDV1yeeYTgVQaC5SzHUiPj6Il4jeRYUAvdIpOzpGYdHArooVenZfKuM3Zs9Hvg0Q9dIhjIMrFP1JmdjfZEawhWouA3G+ZRPRlW3Ve2N+shEU8RcB4dWqcwUA7NR4RW4oQ4Oy+qQbtAE1VKrRcpJD8eBDP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714576085; c=relaxed/simple; bh=WkNpj7MrWb1DUuLQkCSwYjQqW4spsuCzL5df6e8cjYY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NQsUTn2Dyupc7ScBqaIpadE1rPVlRdNB++EmexKQ+7+n4gCetnoP/Fgf6IjHMBnSWr767GhlV9ogLGxpuQyUBzaE6m0VkuXmUd9h+Agerhsn/PJzhLXvdvsXNEeRlKtRj8/h0rvmoGdPcDZn+siji8dd9lNCyGeUn1BxMn7bQno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=Ub7vtwJF; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch 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=r7gAXy+cNEHO7G6rohfcs/xnGaGYf4/LzouNOqGTrog=; b=Ub7vtwJFu31k+jCSuleQcGO1Qb sfN8ktFXayykcXReCJZQowkbnYKx3TSDpjEm1o8mt0XUt0DXYlyqZiU7v9r7rVUKusSvnVZ5sM22d 5h/kFCCevEEeyuUEiAtX7MZgTd3RdYRuzF+zrYLm7hFVDfTbPQ0T6hRRl4JBw0/yZRxw=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1s2BYe-00EQuu-Kp; Wed, 01 May 2024 17:07:44 +0200 Date: Wed, 1 May 2024 17:07:44 +0200 From: Andrew Lunn To: Andrew Halaney Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, linux@armlinux.org.uk Subject: Re: racing ndo_open()/phylink*connect() with phy_probe() Message-ID: <229b5a82-1086-40be-8ee5-16b7f3a03b30@lunn.ch> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Apr 30, 2024 at 04:02:19PM -0500, Andrew Halaney wrote: > Hi, > > I've been taking a look at the following error message: > > qcom-ethqos 23000000.ethernet end1: __stmmac_open: Cannot attach to PHY (error: -19) > > end1 is using a phy on the mdio bus of end0, not on its own bus. Something > like this devicetree snippet highlights the relationship: > > // end0 > ðernet0 { > phy-mode = "sgmii"; > phy-handle = <&sgmii_phy0>; > > mdio { > compatible = "snps,dwmac-mdio"; > sgmii_phy0: phy@8 { > compatible = "ethernet-phy-id0141.0dd4"; > reg = <0x8>; > device_type = "ethernet-phy"; > }; > > sgmii_phy1: phy@a { > compatible = "ethernet-phy-id0141.0dd4"; > reg = <0xa>; > device_type = "ethernet-phy"; > }; > }; > }; > > // end1 > ðernet1 { > phy-mode = "sgmii"; > phy-handle = <&sgmii_phy1>; > }; I agree with Russell here. You need to determine where the ENODEV comes from. It seems unlikely, but one possibility is: static int stmmac_xgmac2_mdio_read_c22(struct mii_bus *bus, int phyaddr, int phyreg) { struct net_device *ndev = bus->priv; struct stmmac_priv *priv; u32 addr; priv = netdev_priv(ndev); /* Until ver 2.20 XGMAC does not support C22 addr >= 4 */ if (priv->synopsys_id < DWXGMAC_CORE_2_20 && phyaddr > MII_XGMAC_MAX_C22ADDR) return -ENODEV; Maybe if the interface is down, priv->synopsys_id has not been set yet? Your devices are at address 8 and 10, so if priv->synopsys_id where 0, this would give you the ENODEV. Once you know the root cause, we might be able to make suggests how to fix it. Andrew