Hi Christian,

On 9/20/25 18:09, Christian Marangi wrote:
> 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 <[email protected]>
> ---
>  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);

data is unused and causes a build warning which is an error in CI.

> +     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);

This needs #include <dm/lists.h> AFAICT

> +     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),

I have picked up the four other patches in this series [1]. Please fix
and resend only that one.

[1] https://source.denx.de/u-boot/custodians/u-boot-net/-/commits/net-20251022

Thanks,
-- 
Jerome

Reply via email to