Get rid of global bb_miiphy_buses[] which does not fit well with U-Boot DM in favor of usual per-ethernet-MAC-driver-instance MDIO bus accessors.
Introduce the ability to allocate struct bb_miiphy_bus {} and make it wrap struct mii_dev {}, so the struct mii_dev can be passed into MDIO bus access infrastructure as usual. When the MDIO bus access infrastructure attempts to access the MDIO bus and invokes any of the bbmiiphy accessors, those accessors are passed the structu mii_dev {}, but can also access struct bb_miiphy_bus using plain container_of() . Clean up the drivers and update them to match. Marek Vasut (23): net: ravb: Drop empty init callback net: sh_eth: Drop empty init callback net: designware: Drop NULL priv assignment net: ravb: Reorder bb_miiphy functions net: sh_eth: Reorder bb_miiphy functions arm: mvebu: a38x: Reorder bb_miiphy functions net: designware: Reorder bb_miiphy functions arm: mvebu: a38x: Call bb_miiphy init directly in driver probe net: miiphybb: Drop bb_miiphy_init() and .init callback net: designware: Drop bus index net: designware: Extract bbmiiphy initialization into dedicated function net: miiphy: Introduce mdio_init() net: miiphybb: Introduce bb_miiphy_alloc()/bb_miiphy_free() wrappers arm: mvebu: a38x: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks net: ravb: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks net: sh_eth: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks net: designware: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks net: miiphybb: Use container_of() in bb_miiphy_getbus() net: miiphybb: Drop name field from struct bb_miiphy_bus arm: mvebu: a38x: Drop use of miiphy_get_dev_by_name() net: ravb: Drop use of miiphy_get_dev_by_name() net: sh_eth: Drop use of miiphy_get_dev_by_name() net: miiphybb: Drop bb_miiphy_buses and bb_miiphy_buses_num board/gdsys/a38x/ihs_phys.c | 237 ++++++++++++++------------------ common/board_r.c | 3 - common/miiphyutil.c | 13 +- drivers/net/designware.c | 263 ++++++++++++++++++++---------------- drivers/net/phy/miiphybb.c | 36 ++--- drivers/net/ravb.c | 159 ++++++++++------------ drivers/net/sh_eth.c | 179 ++++++++++++------------ include/miiphy.h | 17 +-- 8 files changed, 438 insertions(+), 469 deletions(-) --- Cc: Christian Marangi <ansuels...@gmail.com> Cc: Ilias Apalodimas <ilias.apalodi...@linaro.org> Cc: Jerome Forissier <jerome.foriss...@linaro.org> Cc: Jim Liu <jjl...@nuvoton.com> Cc: Joe Hershberger <joe.hershber...@ni.com> Cc: Mario Six <mario....@gdsys.cc> Cc: Michal Simek <michal.si...@amd.com> Cc: Nobuhiro Iwamatsu <iwama...@nigauri.org> Cc: Paul Barker <paul.barker...@bp.renesas.com> Cc: Ramon Fried <rfried....@gmail.com> Cc: Simon Glass <s...@chromium.org> Cc: Sughosh Ganu <sughosh.g...@linaro.org> Cc: Tom Rini <tr...@konsulko.com> Cc: u-boot@lists.denx.de -- 2.47.2