From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx-relay92-hz2.antispameurope.com (mx-relay92-hz2.antispameurope.com [94.100.136.192]) (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 95592371CE4 for ; Wed, 4 Mar 2026 13:59:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=94.100.136.192 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772632747; cv=pass; b=avUgK8y9LRMGf9N3ucNwOkth1R+7InJr34W3OYFCa3UBbSNpS+P8lHLM8ubLQRCvtnegp0aaafSZwDGpWCTk6A/fm9NFnmjh7g/M1NOkgvu5bSnMQgMn9+vBKbQyjodCwRo0EWD54mTH7yyS+12b7J3sjli4PFuTI2WM0zOt5Wk= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772632747; c=relaxed/simple; bh=YjQvBPnz5w+n6o4jeKrsQnkPSb1XKtMdj2bYvjGkJfk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UJibkZ/1YCMXIxypysG/y4GWvgfMmFqbXfCog4TamSTUkYn0Nq2iCnGiRX0whLd+bDlpRP23kMPv8pxleV8+Lbv7Q5JlJm1ODRJjCR4X2f2Ix5FKej9U0wVMoF4Puv71vwoCeop6LXMgN0SlBDxKPNv8YVsmD9WOtgJINssDFAk= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=E89kXBe9; arc=pass smtp.client-ip=94.100.136.192 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="E89kXBe9" ARC-Authentication-Results: i=1; mx-gate92-hz2.hornetsecurity.com 1; spf=pass reason=mailfrom (ip=94.100.132.6, headerfrom=ew.tq-group.com) smtp.mailfrom=ew.tq-group.com smtp.helo=hmail-p-smtp01-out04-hz1.hornetsecurity.com; dmarc=pass header.from=ew.tq-group.com orig.disposition=pass ARC-Message-Signature: a=rsa-sha256; bh=5DnBcRqn/2PHlj5yIxkWZa44u0ODIznnWZcL8KBuF3E=; c=relaxed/relaxed; d=hornetsecurity.com; h=from:to:date:subject:mime-version:; i=1; s=hse1; t=1772632711; b=lR2GW+4hK3SJypCSuCerhZw/TDqcj5/na1Fc8WH4nSNI57RLtg0mGVFp/qm/zWYkK+/eB5BN CAHFq7X7haNpXUakO89owKB2DsVz9+Jd6Nq3Q3NQ8mNqIu6gThyDjS8v42EMpNGNgxQzRaj8age uRYgub4gQSHJWmVrVVAS6U87Sf4cmN9HaAjAA4VS4CWjgbR/pSsJjVl3kaIpTk94boybbz2g4O1 SI7N1YwGX+SbIYaL8QQDK4urYluHAJ18xMmylivuT6gA7FbznPGVkjvb62dOMjK5CLNr+tJCcfh kzvFku381ptN4cMRSWPvYSjLL5wj8p6zGbP2FIb+v6VsQ== ARC-Seal: a=rsa-sha256; cv=none; d=hornetsecurity.com; i=1; s=hse1; t=1772632711; b=HzcWybeIxOeW4UAr4A5rUTezDKl2zx763m5aTkePfEXmjYGfX8/qywTMU6s7rL9xf/bMqij+ sep76o34n9NJgm5eJ8xZ7l5FOATg9OKwPzjQrj2MWO9FdcGDOStZbJzZvxYLWltQiQ9J6UkBuGQ /RzISjbe8MB3RieuJt1M+R9006XefoNjjw1eERM6kzXiOIQ0WK0sqJ2QWLQDi7PjmKdaLWmGwL0 5WBM5V6vIWaFSHI8EylXZZRvqrmoEkIZ61wde8SGwN+oSIQDNE+8PwWvOWvZ8c6si92FWBJSUP0 7Rs7GX0X4frBZFAxGOfwarz4jElEfSAHvxHxjk0OyLv2g== Received: from he-nlb01-hz1.hornetsecurity.com ([94.100.132.6]) by mx-relay92-hz2.antispameurope.com; Wed, 04 Mar 2026 14:58:31 +0100 Received: from steina-w.localnet (host-82-135-125-110.customer.m-online.net [82.135.125.110]) (Authenticated sender: alexander.stein@ew.tq-group.com) by hmail-p-smtp01-out04-hz1.hornetsecurity.com (Postfix) with ESMTPSA id 1850C22074F; Wed, 4 Mar 2026 14:58:18 +0100 (CET) From: Alexander Stein To: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, xiaoning.wang@nxp.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Wei Fang Cc: aziz.sellami@nxp.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: Re: [PATCH net] net: enetc: fix fallback PHY address handling and do not skip setting for addr 0 Date: Wed, 04 Mar 2026 14:58:18 +0100 Message-ID: <6437896.GXAFRqVoOG@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20260303103047.228005-1-wei.fang@nxp.com> References: <20260303103047.228005-1-wei.fang@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-cloud-security-sender:alexander.stein@ew.tq-group.com X-cloud-security-recipient:linux-kernel@vger.kernel.org X-cloud-security-crypt: load encryption module X-cloud-security-Mailarchiv: E-Mail archived for: alexander.stein@ew.tq-group.com X-cloud-security-Mailarchivtype:outbound X-cloud-security-Virusscan:CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mx-relay92-hz2.antispameurope.com with 4fQvQL6yj6z1R5Wq X-cloud-security-connect: he-nlb01-hz1.hornetsecurity.com[94.100.132.6], TLS=1, IP=94.100.132.6 X-cloud-security-Digest:f8a0c59699ddcf4d7cbc1c4697f18c93 X-cloud-security:scantime:2.460 DKIM-Signature: a=rsa-sha256; bh=5DnBcRqn/2PHlj5yIxkWZa44u0ODIznnWZcL8KBuF3E=; c=relaxed/relaxed; d=ew.tq-group.com; h=content-type:mime-version:subject:from:to:message-id:date; s=hse1; t=1772632710; v=1; b=E89kXBe9/kVVBrbFTcHtLRpwpClCN6WD8JfJnGJeZUVUYs+a9tLO9KjWuQB3qsrLWKWfugbQ 9EIvczy2uabagVCUz2rajiLqH+XIEQiYjlkzuXEe5/+zMLZW/vAM0uDazziFU+Gb27yVRBeG05P MLuYqo/hf+lxk9IrjKK57Q03erPeIrUAAT2Sd52HR4Qt6DItJyKxWE0R4WVGFFYDBaUx2pGkZ8j MdCJiTgStTy1/IlZOoIyzSlsOGmAVzZ+w07kcLfqkmLRFN0T9iGGFICPXmjzZgkUCSALwF/MjVj l0niDdgYNGn5gWZYAaXu2ei/iOs4F/EQGKZ4qFOUzPwpA== Am Dienstag, 3. M=E4rz 2026, 11:30:47 CET schrieb Wei Fang: > The current netc_get_phy_addr() implementation falls back to PHY address > 0 when the "mdio" node or any PHY child node is missing. On i.MX95, this > causes failures when a real PHY is actually assigned address 0 and is > managed through the EMDIO interface, the bit 0 of phy_mask becomes set, > leading imx95_enetc_mdio_phyaddr_config() to return an error, and the > netc_blk_ctrl driver probe subsequently fails. Fix this by returning > -ENODEV when neither an "mdio" node nor any PHY node is present. >=20 > Given that some platforms may use PHY address 0 (I suppose the PHY may > not treat address 0 as a broadcast address or default response address). > It is possible for some boards to connect multiple PHYs to a single > ENETC MAC, for example: >=20 > - a SGMII PHY with a non-zero address (selected via DTS_A) > - a RGMII PHY with address 0 (selected via DTS_B) >=20 > For the case where the ENETC port MDIO is used to manage the PHY, when > switching from DTS_A to DTS_B via soft reboot, LaBCR[MDIO_PHYAD_PRTAD] > must be updated to 0 because the NETCMIX block is not reset during soft > reboot. However, the current driver explicitly skips configuring address > 0, which leaves the hardware in an inconsistent state. >=20 > Therefore, remove the special-case skip of PHY address 0 so that valid > configurations using address 0 are properly supported. >=20 > Reported-by: Alexander Stein > Closes: https://lore.kernel.org/all/7825188.GXAFRqVoOG@steina-w > Fixes: 6633df05f3ad ("net: enetc: set the external PHY address in IERB fo= r port MDIO usage") > Fixes: 50bfd9c06f0f ("net: enetc: set external PHY address in IERB for i.= MX94 ENETC") > Signed-off-by: Wei Fang Thanks, Tested-by: Alexander Stein > --- > .../ethernet/freescale/enetc/netc_blk_ctrl.c | 24 ++++++++----------- > 1 file changed, 10 insertions(+), 14 deletions(-) >=20 > diff --git a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c b/drive= rs/net/ethernet/freescale/enetc/netc_blk_ctrl.c > index 7fd39f895290..92a0f824dae7 100644 > --- a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c > +++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c > @@ -333,11 +333,13 @@ static int netc_get_phy_addr(struct device_node *np) > =20 > mdio_node =3D of_get_child_by_name(np, "mdio"); > if (!mdio_node) > - return 0; > + return -ENODEV; > =20 > phy_node =3D of_get_next_child(mdio_node, NULL); > - if (!phy_node) > + if (!phy_node) { > + err =3D -ENODEV; > goto of_put_mdio_node; > + } > =20 > err =3D of_property_read_u32(phy_node, "reg", &addr); > if (err) > @@ -423,6 +425,9 @@ static int imx95_enetc_mdio_phyaddr_config(struct pla= tform_device *pdev) > =20 > addr =3D netc_get_phy_addr(gchild); > if (addr < 0) { > + if (addr =3D=3D -ENODEV) > + continue; > + > dev_err(dev, "Failed to get PHY address\n"); > return addr; > } > @@ -433,12 +438,6 @@ static int imx95_enetc_mdio_phyaddr_config(struct pl= atform_device *pdev) > return -EINVAL; > } > =20 > - /* The default value of LaBCR[MDIO_PHYAD_PRTAD ] is > - * 0, so no need to set the register. > - */ > - if (!addr) > - continue; > - > switch (bus_devfn) { > case IMX95_ENETC0_BUS_DEVFN: > netc_reg_write(priv->ierb, IERB_LBCR(0), > @@ -578,16 +577,13 @@ static int imx94_enetc_mdio_phyaddr_config(struct n= etc_blk_ctrl *priv, > =20 > addr =3D netc_get_phy_addr(np); > if (addr < 0) { > + if (addr =3D=3D -ENODEV) > + return 0; > + > dev_err(dev, "Failed to get PHY address\n"); > return addr; > } > =20 > - /* The default value of LaBCR[MDIO_PHYAD_PRTAD] is 0, > - * so no need to set the register. > - */ > - if (!addr) > - return 0; > - > if (phy_mask & BIT(addr)) { > dev_err(dev, > "Find same PHY address in EMDIO and ENETC node\n"); >=20 =2D-=20 TQ-Systems GmbH | M=FChlstra=DFe 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht M=FCnchen, HRB 105018 Gesch=E4ftsf=FChrer: Detlef Schneider, R=FCdiger Stahl, Stefan Schneider http://www.tq-group.com/