From: Christian Marangi <ansuelsmth@gmail.com>
To: Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>,
Jerome Forissier <jerome.forissier@arm.com>,
Tom Rini <trini@konsulko.com>,
u-boot@lists.denx.de
Cc: Christian Marangi <ansuelsmth@gmail.com>
Subject: [PATCH 2/2] net: mdio-mt7531-mmio: improve parsing of switch register on probe
Date: Mon, 9 Feb 2026 12:45:06 +0100 [thread overview]
Message-ID: <20260209114515.1916-3-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20260209114515.1916-1-ansuelsmth@gmail.com>
The MDIO node is ALWAYS a parent of the MT7531 switch node and the MDIO
registers are in the MT7531 register space (in the context of MT7988
it's all memory-mapped)
With these assumption, we can simplify and permit better usage of PHY OF
automatic probing by binding the mt7531-mdio-mmio driver with the MDIO
node instead of the switch node.
For OF PHY to be correctly autoprobed, the MDIO driver needs to attached
to the MDIO node (the parent of the PHY nodes).
The driver will reach the parent node (the switch node) and will parse
the register address from there.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/mdio-mt7531-mmio.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mdio-mt7531-mmio.c b/drivers/net/mdio-mt7531-mmio.c
index 58cb6e503b8..930454a9b0e 100644
--- a/drivers/net/mdio-mt7531-mmio.c
+++ b/drivers/net/mdio-mt7531-mmio.c
@@ -149,8 +149,13 @@ static const struct mdio_ops mt7531_mdio_ops = {
static int mt7531_mdio_probe(struct udevice *dev)
{
struct mt7531_mdio_mmio_priv *priv = dev_get_priv(dev);
+ ofnode switch_node;
- priv->switch_regs = dev_read_addr(dev);
+ switch_node = ofnode_get_parent(dev_ofnode(dev));
+ if (!ofnode_valid(switch_node))
+ return -EINVAL;
+
+ priv->switch_regs = ofnode_get_addr(switch_node);
if (priv->switch_regs == FDT_ADDR_T_NONE)
return -EINVAL;
--
2.51.0
next prev parent reply other threads:[~2026-02-09 11:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 11:45 [PATCH 0/2] net: mdio-mt7531-mmio: consolidate and improve probe Christian Marangi
2026-02-09 11:45 ` [PATCH 1/2] net: mdio-mt7531-mmio: use common header priv struct Christian Marangi
2026-02-09 11:45 ` Christian Marangi [this message]
2026-02-23 22:48 ` [PATCH 0/2] net: mdio-mt7531-mmio: consolidate and improve probe Tom Rini
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=20260209114515.1916-3-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=jerome.forissier@arm.com \
--cc=joe.hershberger@ni.com \
--cc=rfried.dev@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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