mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-14 19:26:58 +02:00
net: sh_eth: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks
Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks currently listed in bb_miiphy_buses[] array. This is a temporary duplication of assignment to avoid breakage, which will be removed in follow up patches. At this point, the bb_miiphy callbacks can reach these accessors by doing container_of() on struct mii_dev. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
This commit is contained in:
parent
079eaca6e7
commit
08eefb5e79
@ -716,6 +716,7 @@ static int sh_ether_probe(struct udevice *udev)
|
|||||||
struct eth_pdata *pdata = dev_get_plat(udev);
|
struct eth_pdata *pdata = dev_get_plat(udev);
|
||||||
struct sh_ether_priv *priv = dev_get_priv(udev);
|
struct sh_ether_priv *priv = dev_get_priv(udev);
|
||||||
struct sh_eth_dev *eth = &priv->shdev;
|
struct sh_eth_dev *eth = &priv->shdev;
|
||||||
|
struct bb_miiphy_bus *bb_miiphy;
|
||||||
struct mii_dev *mdiodev;
|
struct mii_dev *mdiodev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -726,17 +727,29 @@ static int sh_ether_probe(struct udevice *udev)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
mdiodev = mdio_alloc();
|
bb_miiphy = bb_miiphy_alloc();
|
||||||
if (!mdiodev) {
|
if (!bb_miiphy) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mdiodev = &bb_miiphy->mii;
|
||||||
|
|
||||||
mdiodev->read = bb_miiphy_read;
|
mdiodev->read = bb_miiphy_read;
|
||||||
mdiodev->write = bb_miiphy_write;
|
mdiodev->write = bb_miiphy_write;
|
||||||
bb_miiphy_buses[0].priv = eth;
|
bb_miiphy_buses[0].priv = eth;
|
||||||
snprintf(mdiodev->name, sizeof(mdiodev->name), udev->name);
|
snprintf(mdiodev->name, sizeof(mdiodev->name), udev->name);
|
||||||
|
|
||||||
|
/* Copy the bus accessors, name and private data */
|
||||||
|
bb_miiphy->mdio_active = sh_eth_bb_mdio_active;
|
||||||
|
bb_miiphy->mdio_tristate = sh_eth_bb_mdio_tristate;
|
||||||
|
bb_miiphy->set_mdio = sh_eth_bb_set_mdio;
|
||||||
|
bb_miiphy->get_mdio = sh_eth_bb_get_mdio;
|
||||||
|
bb_miiphy->set_mdc = sh_eth_bb_set_mdc;
|
||||||
|
bb_miiphy->delay = sh_eth_bb_delay;
|
||||||
|
strlcpy(bb_miiphy->name, "sh_eth", MDIO_NAME_LEN);
|
||||||
|
bb_miiphy->priv = eth;
|
||||||
|
|
||||||
ret = mdio_register(mdiodev);
|
ret = mdio_register(mdiodev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_mdio_register;
|
goto err_mdio_register;
|
||||||
@ -771,7 +784,7 @@ err_phy_config:
|
|||||||
clk_disable(&priv->clk);
|
clk_disable(&priv->clk);
|
||||||
#endif
|
#endif
|
||||||
err_mdio_register:
|
err_mdio_register:
|
||||||
mdio_free(mdiodev);
|
bb_miiphy_free(bb_miiphy);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user