#include <dm.h>
#include <dm/devres.h>
+#include <dm/lists.h>
#include <mapmem.h>
#include <net.h>
#include <regmap.h>
return 0;
}
+static int airoha_eth_bind(struct udevice *dev)
+{
+ ofnode switch_node, mdio_node;
+ struct udevice *mdio_dev;
+ 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;
+ }
+
+ mdio_node = ofnode_find_subnode(switch_node, "mdio");
+ if (!ofnode_valid(mdio_node)) {
+ debug("Warning: missing mdio node\n");
+ return 0;
+ }
+
+ ret = device_bind_driver_to_node(dev, "mt7531-mdio", "mdio",
+ mdio_node, &mdio_dev);
+ if (ret)
+ debug("Warning: failed to bind mdio controller\n");
+
+ return 0;
+}
+
static const struct airoha_eth_soc_data en7523_data = {
.xsi_rsts_names = en7523_xsi_rsts_names,
.num_xsi_rsts = ARRAY_SIZE(en7523_xsi_rsts_names),
.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),