From: Christian Marangi <ansuelsmth@gmail.com>
To: Tom Rini <trini@konsulko.com>,
Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>,
Weijie Gao <weijie.gao@mediatek.com>,
Christian Marangi <ansuelsmth@gmail.com>,
u-boot@lists.denx.de
Subject: [PATCH v2 5/5] net: airoha: bind MDIO controller on Ethernet load
Date: Sat, 20 Sep 2025 18:09:45 +0200 [thread overview]
Message-ID: <20250920161013.31799-6-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20250920161013.31799-1-ansuelsmth@gmail.com>
Bind MDIO controller on Ethernet Controller load. The Airoha AN7581 SoC
have an integrated Switch based on MT7531 (or more saying MT7988).
Attach it to the switch node to support scanning for MDIO devices on the
BUS.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/Kconfig | 1 +
drivers/net/airoha_eth.c | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index cee4a3fc9bd..ce7c7e6297e 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -126,6 +126,7 @@ config AIROHA_ETH
depends on ARCH_AIROHA
select PHYLIB
select DM_RESET
+ select MDIO_MT7531
help
This Driver support Airoha Ethernet QDMA Driver
Say Y to enable support for the Airoha Ethernet QDMA.
diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c
index 6588eb3a806..6be6ec2845b 100644
--- a/drivers/net/airoha_eth.c
+++ b/drivers/net/airoha_eth.c
@@ -971,6 +971,31 @@ static int arht_eth_write_hwaddr(struct udevice *dev)
return 0;
}
+static int airoha_eth_bind(struct udevice *dev)
+{
+ struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev);
+ struct udevice *mdio_dev;
+ ofnode switch_node;
+ int ret = 0;
+
+ if (!CONFIG_IS_ENABLED(MDIO_MT7531))
+ return 0;
+
+ switch_node = ofnode_by_compatible(ofnode_null(),
+ "airoha,en7581-switch");
+ if (!ofnode_valid(switch_node)) {
+ debug("Warning: missing switch node\n");
+ return 0;
+ }
+
+ ret = device_bind_driver_to_node(dev, "mt7531-mdio", "mdio",
+ switch_node, &mdio_dev);
+ if (ret)
+ debug("Warning: failed to bind mdio controller\n");
+
+ return 0;
+}
+
static const struct udevice_id airoha_eth_ids[] = {
{ .compatible = "airoha,en7581-eth" },
{ }
@@ -990,6 +1015,7 @@ U_BOOT_DRIVER(airoha_eth) = {
.id = UCLASS_ETH,
.of_match = airoha_eth_ids,
.probe = airoha_eth_probe,
+ .bind = airoha_eth_bind,
.ops = &airoha_eth_ops,
.priv_auto = sizeof(struct airoha_eth),
.plat_auto = sizeof(struct eth_pdata),
--
2.51.0
next prev parent reply other threads:[~2025-09-20 16:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 16:09 [PATCH v2 0/5] net: mediatek: mt7988: various fixup + MDIO detach Christian Marangi
2025-09-20 16:09 ` [PATCH v2 1/5] net: mediatek: mt7531/7988: fix broken PHY turn ON/OFF Christian Marangi
2025-09-20 16:09 ` [PATCH v2 2/5] net: mediatek: mt7988: restore PHY page on PHY setting exit Christian Marangi
2025-09-20 16:09 ` [PATCH v2 3/5] net: mediatek: mt7988: free allocated MDIO bus on cleanup Christian Marangi
2025-09-20 16:09 ` [PATCH v2 4/5] net: mediatek: move MT7531 MMIO MDIO to dedicated driver Christian Marangi
2025-09-20 16:09 ` Christian Marangi [this message]
2025-10-22 13:42 ` [PATCH v2 5/5] net: airoha: bind MDIO controller on Ethernet load Jerome Forissier
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=20250920161013.31799-6-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=joe.hershberger@ni.com \
--cc=rfried.dev@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=weijie.gao@mediatek.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