arm: mvebu: a38x: 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:
@@ -221,22 +221,35 @@ 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->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;
|
||||
*bus = miiphy_get_dev_by_name(name);
|
||||
|
||||
return mii_mdio_init(&bb_miiphy_buses[k]);
|
||||
return mii_mdio_init(bb_miiphy);
|
||||
}
|
||||
|
||||
struct porttype *get_porttype(uint octo_phy_mask, uint k)
|
||||
|
||||
Reference in New Issue
Block a user