public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Claudiu Manoil <claudiu.manoil@nxp.com>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Clark Wang <xiaoning.wang@nxp.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	Wei Fang <wei.fang@nxp.com>
Cc: Aziz Sellami <aziz.sellami@nxp.com>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 net-next 1/3] net: enetc: set the external PHY address in IERB for port MDIO usage
Date: Mon, 02 Mar 2026 12:01:57 +0100	[thread overview]
Message-ID: <2256661.irdbgypaU6@steina-w> (raw)
In-Reply-To: <PAXPR04MB85104CDE52FE824736E44ACB887EA@PAXPR04MB8510.eurprd04.prod.outlook.com>

Am Montag, 2. März 2026, 10:24:14 CET schrieb Wei Fang:
> > Am Samstag, 28. Februar 2026, 04:52:01 CET schrieb Wei Fang:
> > > > > +static int imx95_enetc_mdio_phyaddr_config(struct platform_device
> > > > > +*pdev) {
> > > > > +	struct netc_blk_ctrl *priv = platform_get_drvdata(pdev);
> > > > > +	struct device_node *np = pdev->dev.of_node;
> > > > > +	struct device *dev = &pdev->dev;
> > > > > +	int bus_devfn, addr, err;
> > > > > +	u32 phy_mask = 0;
> > > > > +
> > > > > +	err = netc_get_emdio_phy_mask(np, &phy_mask);
> > > > > +	if (err) {
> > > > > +		dev_err(dev, "Failed to get PHY address mask\n");
> > > > > +		return err;
> > > > > +	}
> > > > > +
> > > > > +	/* Update the port EMDIO PHY address through parsing phy
> > properties.
> > > > > +	 * This is needed when using the port EMDIO but it's harmless when
> > > > > +	 * using the central EMDIO. So apply it on all cases.
> > > > > +	 */
> > > > > +	for_each_child_of_node_scoped(np, child) {
> > > > > +		for_each_child_of_node_scoped(child, gchild) {
> > > > > +			if (!of_device_is_compatible(gchild, "pci1131,e101"))
> > > > > +				continue;
> > > > > +
> > > > > +			bus_devfn = netc_of_pci_get_bus_devfn(gchild);
> > > > > +			if (bus_devfn < 0) {
> > > > > +				dev_err(dev, "Failed to get BDF number\n");
> > > > > +				return bus_devfn;
> > > > > +			}
> > > > > +
> > > > > +			addr = netc_get_phy_addr(gchild);
> > > > > +			if (addr < 0) {
> > > > > +				dev_err(dev, "Failed to get PHY address\n");
> > > > > +				return addr;
> > > > > +			}
> > > > > +
> > > > > +			if (phy_mask & BIT(addr)) {
> > > >
> > > > ... which will break here if there is an Ethernet PHY using address 0 in
> > > > 'netc_emdio' node.
> > > > See arch/arm64/boot/dts/freescale/imx95-tqma9596sa.dtsi node
> > > > ethernet-phy@0.
> > >
> > > AFAIU, the PHY address 0 is a special address, below is the description of
> > > PHYAD from IEEE 802.3 Clause 22.
> > >
> > > A PHY that is connected to the station management entity via the
> > > mechanical interface defined in 22.6 shall always respond to transactions
> > > addressed to PHY Address zero <00000>. A station management entity
> > > that is attached to multiple PHYs must have prior knowledge of the
> > > appropriate PHY Address for each PHY.
> > >
> > > Therefore, for most PHYs, PHY address 0 is typically used as the broadcast
> > > address or default response address. In designs that control multiple PHYs
> > > via EMDIO, it is recommended to avoid setting a specific PHY to address 0
> > > to prevent bus conflicts.
> > 
> > I know about this special meaning, but there are hardware design which do not
> > take this into account.
> 
> This might cause potential issues, as all PHYs attached to the same MDIO bus will
> respond to the accesses to PHY address 0.

Is that really the case? So far we didn't have any problems with
PHYAD 0 and 3 on the same bus. I did a bit of research but couldn't find any
information backing that PHYAD 0 is actually a broadcast address. All I could
find is the case with just a single PHY on a MDIO bus, defaulting to 0.

> Is this problem unfixable?

Right now our problem is that the software doesn't work any more.

> > 
> > > If the PHY on your board does not use PHY address 0 as the broadcast address
> > > or the default response address, then we should check the PHY address first
> > and
> > > then check the phy_mask in imx95_enetc_mdio_phyaddr_config(), just the
> > same
> > > as imx94_enetc_mdio_phyaddr_config().
> > 
> > I'm not sure if this is the right fix. What about the case where phy_mask is
> > supposed to be 0, because there are no PHY subnodes of netc_emdio. Instead
> > the PHY with address is a subnode of the enet_portX is supposed to have
> > netc_get_phy_addr() return 0 because that's the actual address. But with
> > the current flow from imx94_enetc_mdio_phyaddr_config() and your suggestion
> > for i.MX95 case we erroneously skip that node.
> > 
> 
> The hardware default value is 0, so no need to configure it. I can send a
> fix patch this week.

Okay, thanks.

Best regards,
Alexander
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



  reply	other threads:[~2026-03-02 11:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 10:25 [PATCH v3 net-next 0/3] net: enetc: add port MDIO support for both i.MX94 and i.MX95 Wei Fang
2025-11-19 10:25 ` [PATCH v3 net-next 1/3] net: enetc: set the external PHY address in IERB for port MDIO usage Wei Fang
2025-11-19 15:20   ` Claudiu Manoil
2026-02-27 13:41   ` Alexander Stein
2026-02-28  3:52     ` Wei Fang
2026-03-02  9:10       ` Alexander Stein
2026-03-02  9:24         ` Wei Fang
2026-03-02 11:01           ` Alexander Stein [this message]
2026-03-02 12:43             ` Wei Fang
2025-11-19 10:25 ` [PATCH v3 net-next 2/3] net: enetc: set external PHY address in IERB for i.MX94 ENETC Wei Fang
2025-11-19 15:20   ` Claudiu Manoil
2025-11-19 10:25 ` [PATCH v3 net-next 3/3] net: enetc: update the base address of port MDIO registers for ENETC v4 Wei Fang
2025-11-19 15:19   ` Claudiu Manoil
2025-11-25 10:05   ` Paolo Abeni
2025-11-25 16:19     ` Andrew Lunn
2025-11-26  3:00 ` [PATCH v3 net-next 0/3] net: enetc: add port MDIO support for both i.MX94 and i.MX95 patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2256661.irdbgypaU6@steina-w \
    --to=alexander.stein@ew.tq-group.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=aziz.sellami@nxp.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox