]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: sh_eth: Switch back to mdio_alloc()
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Sun, 2 Mar 2025 01:24:49 +0000 (02:24 +0100)
committerMarek Vasut <marek.vasut+renesas@mailbox.org>
Tue, 11 Mar 2025 22:05:57 +0000 (23:05 +0100)
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+renesas@mailbox.org>
Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
drivers/net/sh_eth.c

index c2e2f3fc6c699c038a6f1351818e930db392f447..f695a3a41d2320ce9fa05ae6e210a48fe65f717c 100644 (file)
@@ -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;
 }