[PATCH 06/17] arm: mvebu: a38x: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks
Marek Vasut
marek.vasut+renesas at mailbox.org
Sat Jan 18 07:53:10 CET 2025
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 at mailbox.org>
---
Cc: Christian Marangi <ansuelsmth at gmail.com>
Cc: Evgeny Bachinin <EABachinin at salutedevices.com>
Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
Cc: Jerome Forissier <jerome.forissier at linaro.org>
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Mario Six <mario.six at gdsys.cc>
Cc: Michal Simek <michal.simek at amd.com>
Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
Cc: Paul Barker <paul.barker.ct at bp.renesas.com>
Cc: Ramon Fried <rfried.dev at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Sughosh Ganu <sughosh.ganu at linaro.org>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at 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;
--
2.45.2
More information about the U-Boot
mailing list