
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 --- Cc: Christian Marangi ansuelsmth@gmail.com Cc: Evgeny Bachinin EABachinin@salutedevices.com Cc: Ilias Apalodimas ilias.apalodimas@linaro.org Cc: Jerome Forissier jerome.forissier@linaro.org Cc: Joe Hershberger joe.hershberger@ni.com Cc: Mario Six mario.six@gdsys.cc Cc: Michal Simek michal.simek@amd.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Ramon Fried rfried.dev@gmail.com Cc: Simon Glass sjg@chromium.org Cc: Sughosh Ganu sughosh.ganu@linaro.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/gdsys/a38x/ihs_phys.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/board/gdsys/a38x/ihs_phys.c b/board/gdsys/a38x/ihs_phys.c index 3370a4fa1a3..aa738016025 100644 --- a/board/gdsys/a38x/ihs_phys.c +++ b/board/gdsys/a38x/ihs_phys.c @@ -221,16 +221,30 @@ static int mii_delay(struct bb_miiphy_bus *bus)
int register_miiphy_bus(uint k, struct mii_dev **bus) { - int retval; - struct mii_dev *mdiodev = mdio_alloc(); + struct bb_miiphy_bus *bb_miiphy = bb_miiphy_alloc(); + struct mii_dev *mdiodev; char *name = bb_miiphy_buses[k].name; + int retval;
- if (!mdiodev) + if (!bb_miiphy) return -ENOMEM; + + mdiodev = &bb_miiphy->mii; strlcpy(mdiodev->name, name, MDIO_NAME_LEN); mdiodev->read = bb_miiphy_read; mdiodev->write = bb_miiphy_write;
+ /* Copy the bus accessors, name and private data */ + bb_miiphy->init = mii_mdio_init; + bb_miiphy->mdio_active = mii_mdio_active; + bb_miiphy->mdio_tristate = mii_mdio_tristate; + bb_miiphy->set_mdio = mii_set_mdio; + bb_miiphy->get_mdio = mii_get_mdio; + bb_miiphy->set_mdc = mii_set_mdc; + bb_miiphy->delay = mii_delay; + strlcpy(bb_miiphy->name, name, MDIO_NAME_LEN); + bb_miiphy->priv = &(gpio_mii_set[k]); + retval = mdio_register(mdiodev); if (retval < 0) return retval;