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: 079eaca6e7b4 ("net: ravb: 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/ravb.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
index dcd8ba9283f..6129929568a 100644
--- a/drivers/net/ravb.c
+++ b/drivers/net/ravb.c
@@ -576,7 +576,6 @@ static int ravb_probe(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_plat(dev);
        struct ravb_priv *eth = dev_get_priv(dev);
-       struct bb_miiphy_bus *bb_miiphy;
        struct mii_dev *mdiodev;
        void __iomem *iobase;
        int ret;
@@ -588,14 +587,12 @@ static int ravb_probe(struct udevice *dev)
        if (ret < 0)
                goto err_mdio_alloc;
 
-       bb_miiphy = bb_miiphy_alloc();
-       if (!bb_miiphy) {
+       mdiodev = mdio_alloc();
+       if (!mdiodev) {
                ret = -ENOMEM;
                goto err_mdio_alloc;
        }
 
-       mdiodev = &bb_miiphy->mii;
-
        mdiodev->read = ravb_bb_miiphy_read;
        mdiodev->write = ravb_bb_miiphy_write;
        mdiodev->priv = eth;
@@ -605,7 +602,7 @@ static int ravb_probe(struct udevice *dev)
        if (ret < 0)
                goto err_mdio_register;
 
-       eth->bus = &bb_miiphy->mii;
+       eth->bus = mdiodev;
 
        /* Bring up PHY */
        ret = clk_enable_bulk(&eth->clks);
@@ -625,7 +622,7 @@ static int ravb_probe(struct udevice *dev)
 err_mdio_reset:
        clk_release_bulk(&eth->clks);
 err_mdio_register:
-       bb_miiphy_free(bb_miiphy);
+       mdio_free(mdiodev);
 err_mdio_alloc:
        unmap_physmem(eth->iobase, MAP_NOCACHE);
        return ret;
-- 
2.47.2

Reply via email to