forked from OERV-BSP/u-boot
net: miiphybb: Wrap driver side bb_miiphy_read/write() accessors
Do not call bb_miiphy_read()/bb_miiphy_write() accessors directly in drivers, instead call them through wrapper functions. Those are meant to be used as function parameter adaptation layer between struct mii_dev callback function parameters and what the miiphybb does expect and will soon expect. This is a preparatory patch, no functional change. 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:
@@ -228,6 +228,18 @@ static const struct bb_miiphy_bus_ops mii_bb_miiphy_bus_ops = {
|
||||
.delay = mii_delay,
|
||||
};
|
||||
|
||||
static int mii_bb_miiphy_read(struct mii_dev *miidev, int addr,
|
||||
int devad, int reg)
|
||||
{
|
||||
return bb_miiphy_read(miidev, addr, devad, reg);
|
||||
}
|
||||
|
||||
static int mii_bb_miiphy_write(struct mii_dev *miidev, int addr,
|
||||
int devad, int reg, u16 value)
|
||||
{
|
||||
return bb_miiphy_write(miidev, addr, devad, reg, value);
|
||||
}
|
||||
|
||||
int register_miiphy_bus(uint k, struct mii_dev **bus)
|
||||
{
|
||||
struct bb_miiphy_bus *bb_miiphy = bb_miiphy_alloc();
|
||||
@@ -239,8 +251,8 @@ int register_miiphy_bus(uint k, struct mii_dev **bus)
|
||||
|
||||
mdiodev = &bb_miiphy->mii;
|
||||
snprintf(mdiodev->name, MDIO_NAME_LEN, "ihs%d", k);
|
||||
mdiodev->read = bb_miiphy_read;
|
||||
mdiodev->write = bb_miiphy_write;
|
||||
mdiodev->read = mii_bb_miiphy_read;
|
||||
mdiodev->write = mii_bb_miiphy_write;
|
||||
|
||||
/* Copy the bus accessors and private data */
|
||||
bb_miiphy->ops = &mii_bb_miiphy_bus_ops;
|
||||
|
||||
@@ -299,6 +299,18 @@ static const struct bb_miiphy_bus_ops dw_eth_bb_miiphy_bus_ops = {
|
||||
.delay = dw_eth_bb_delay,
|
||||
};
|
||||
|
||||
static int dw_bb_miiphy_read(struct mii_dev *miidev, int addr,
|
||||
int devad, int reg)
|
||||
{
|
||||
return bb_miiphy_read(miidev, addr, devad, reg);
|
||||
}
|
||||
|
||||
static int dw_bb_miiphy_write(struct mii_dev *miidev, int addr,
|
||||
int devad, int reg, u16 value)
|
||||
{
|
||||
return bb_miiphy_write(miidev, addr, devad, reg, value);
|
||||
}
|
||||
|
||||
static int dw_bb_mdio_init(const char *name, struct udevice *dev)
|
||||
{
|
||||
struct dw_eth_dev *dwpriv = dev_get_priv(dev);
|
||||
@@ -334,8 +346,8 @@ static int dw_bb_mdio_init(const char *name, struct udevice *dev)
|
||||
dwpriv->dev = dev;
|
||||
|
||||
snprintf(bus->name, sizeof(bus->name), "%s", name);
|
||||
bus->read = bb_miiphy_read;
|
||||
bus->write = bb_miiphy_write;
|
||||
bus->read = dw_bb_miiphy_read;
|
||||
bus->write = dw_bb_miiphy_write;
|
||||
#if CONFIG_IS_ENABLED(DM_GPIO)
|
||||
bus->reset = dw_mdio_reset;
|
||||
#endif
|
||||
|
||||
@@ -558,6 +558,18 @@ static const struct bb_miiphy_bus_ops ravb_bb_miiphy_bus_ops = {
|
||||
.delay = ravb_bb_delay,
|
||||
};
|
||||
|
||||
static int ravb_bb_miiphy_read(struct mii_dev *miidev, int addr,
|
||||
int devad, int reg)
|
||||
{
|
||||
return bb_miiphy_read(miidev, addr, devad, reg);
|
||||
}
|
||||
|
||||
static int ravb_bb_miiphy_write(struct mii_dev *miidev, int addr,
|
||||
int devad, int reg, u16 value)
|
||||
{
|
||||
return bb_miiphy_write(miidev, addr, devad, reg, value);
|
||||
}
|
||||
|
||||
static int ravb_probe(struct udevice *dev)
|
||||
{
|
||||
struct eth_pdata *pdata = dev_get_plat(dev);
|
||||
@@ -582,8 +594,8 @@ static int ravb_probe(struct udevice *dev)
|
||||
|
||||
mdiodev = &bb_miiphy->mii;
|
||||
|
||||
mdiodev->read = bb_miiphy_read;
|
||||
mdiodev->write = bb_miiphy_write;
|
||||
mdiodev->read = ravb_bb_miiphy_read;
|
||||
mdiodev->write = ravb_bb_miiphy_write;
|
||||
snprintf(mdiodev->name, sizeof(mdiodev->name), dev->name);
|
||||
|
||||
/* Copy the bus accessors and private data */
|
||||
|
||||
@@ -720,6 +720,18 @@ static const struct bb_miiphy_bus_ops sh_ether_bb_miiphy_bus_ops = {
|
||||
.delay = sh_eth_bb_delay,
|
||||
};
|
||||
|
||||
static int sh_eth_bb_miiphy_read(struct mii_dev *miidev, int addr,
|
||||
int devad, int reg)
|
||||
{
|
||||
return bb_miiphy_read(miidev, addr, devad, reg);
|
||||
}
|
||||
|
||||
static int sh_eth_bb_miiphy_write(struct mii_dev *miidev, int addr,
|
||||
int devad, int reg, u16 value)
|
||||
{
|
||||
return bb_miiphy_write(miidev, addr, devad, reg, value);
|
||||
}
|
||||
|
||||
static int sh_ether_probe(struct udevice *udev)
|
||||
{
|
||||
struct eth_pdata *pdata = dev_get_plat(udev);
|
||||
@@ -744,8 +756,8 @@ static int sh_ether_probe(struct udevice *udev)
|
||||
|
||||
mdiodev = &bb_miiphy->mii;
|
||||
|
||||
mdiodev->read = bb_miiphy_read;
|
||||
mdiodev->write = bb_miiphy_write;
|
||||
mdiodev->read = sh_eth_bb_miiphy_read;
|
||||
mdiodev->write = sh_eth_bb_miiphy_write;
|
||||
snprintf(mdiodev->name, sizeof(mdiodev->name), udev->name);
|
||||
|
||||
/* Copy the bus accessors and private data */
|
||||
|
||||
Reference in New Issue
Block a user