Use mdio_alloc() again to allocate MDIO bus. This is possible because all the miiphybb parameters and ops passing is handled in at bb_miiphy_read()/bb_miiphy_write() level.
This also fixes previously missed bb_miiphy_free() in .remove callback of this driver. which does not pose a problem anymore. Fixes: 08eefb5e792d ("net: sh_eth: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks") Signed-off-by: Marek Vasut <marek.vasut+rene...@mailbox.org> --- Cc: Jim Liu <jim.t90...@gmail.com> Cc: Joe Hershberger <joe.hershber...@ni.com> Cc: Mario Six <mario....@gdsys.cc> Cc: Michael Chang <zhang971090...@gmail.com> Cc: Nobuhiro Iwamatsu <iwama...@nigauri.org> Cc: Parvathi Bhogaraju <pbhogar...@microsoft.com> Cc: Paul Barker <paul.barker...@bp.renesas.com> Cc: Ramon Fried <rfried....@gmail.com> Cc: Tom Rini <tr...@konsulko.com> Cc: u-boot@lists.denx.de --- drivers/net/sh_eth.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index c2e2f3fc6c6..f695a3a41d2 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -739,7 +739,6 @@ static int sh_ether_probe(struct udevice *udev) struct eth_pdata *pdata = dev_get_plat(udev); struct sh_ether_priv *priv = dev_get_priv(udev); struct sh_eth_dev *eth = &priv->shdev; - struct bb_miiphy_bus *bb_miiphy; struct mii_dev *mdiodev; int ret; @@ -750,14 +749,12 @@ static int sh_ether_probe(struct udevice *udev) if (ret < 0) return ret; #endif - bb_miiphy = bb_miiphy_alloc(); - if (!bb_miiphy) { + mdiodev = mdio_alloc(); + if (!mdiodev) { ret = -ENOMEM; return ret; } - mdiodev = &bb_miiphy->mii; - mdiodev->read = sh_eth_bb_miiphy_read; mdiodev->write = sh_eth_bb_miiphy_write; mdiodev->priv = eth; @@ -767,7 +764,7 @@ static int sh_ether_probe(struct udevice *udev) if (ret < 0) goto err_mdio_register; - priv->bus = &bb_miiphy->mii; + priv->bus = mdiodev; eth->port = CFG_SH_ETHER_USE_PORT; eth->port_info[eth->port].phy_addr = CFG_SH_ETHER_PHY_ADDR; @@ -797,7 +794,7 @@ err_phy_config: clk_disable(&priv->clk); #endif err_mdio_register: - bb_miiphy_free(bb_miiphy); + mdio_free(mdiodev); return ret; } -- 2.47.2