static int mii_bb_miiphy_read(struct mii_dev *miidev, int addr,
int devad, int reg)
{
- return bb_miiphy_read(miidev, addr, devad, reg);
+ return bb_miiphy_read(miidev, &mii_bb_miiphy_bus_ops,
+ 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);
+ return bb_miiphy_write(miidev, &mii_bb_miiphy_bus_ops,
+ addr, devad, reg, value);
}
int register_miiphy_bus(uint k, struct mii_dev **bus)
mdiodev->write = mii_bb_miiphy_write;
/* Copy the bus accessors and private data */
- bb_miiphy->ops = &mii_bb_miiphy_bus_ops;
bb_miiphy->priv = &gpio_mii_set[k];
retval = mdio_register(mdiodev);
static int dw_bb_miiphy_read(struct mii_dev *miidev, int addr,
int devad, int reg)
{
- return bb_miiphy_read(miidev, addr, devad, reg);
+ return bb_miiphy_read(miidev, &dw_eth_bb_miiphy_bus_ops,
+ 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);
+ return bb_miiphy_write(miidev, &dw_eth_bb_miiphy_bus_ops,
+ addr, devad, reg, value);
}
static int dw_bb_mdio_init(const char *name, struct udevice *dev)
#if CONFIG_IS_ENABLED(DM_GPIO)
bus->reset = dw_mdio_reset;
#endif
- bus->ops = &dw_eth_bb_miiphy_bus_ops;
bus->priv = dwpriv;
return mdio_register(bus);
* Returns:
* 0 on success
*/
-int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg)
+int bb_miiphy_read(struct mii_dev *miidev, const struct bb_miiphy_bus_ops *ops,
+ int addr, int devad, int reg)
{
unsigned short rdreg; /* register working value */
int v;
int j; /* counter */
struct bb_miiphy_bus *bus;
- const struct bb_miiphy_bus_ops *ops;
bus = bb_miiphy_getbus(miidev);
if (bus == NULL) {
return -1;
}
- ops = bus->ops;
-
miiphy_pre(bus, ops, 1, addr, reg);
/* tri-state our MDIO I/O pin so we can read */
* Returns:
* 0 on success
*/
-int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg,
- u16 value)
+int bb_miiphy_write(struct mii_dev *miidev, const struct bb_miiphy_bus_ops *ops,
+ int addr, int devad, int reg, u16 value)
{
struct bb_miiphy_bus *bus;
- const struct bb_miiphy_bus_ops *ops;
int j; /* counter */
bus = bb_miiphy_getbus(miidev);
return -1;
}
- ops = bus->ops;
-
miiphy_pre(bus, ops, 0, addr, reg);
/* send the turnaround (10) */
static int ravb_bb_miiphy_read(struct mii_dev *miidev, int addr,
int devad, int reg)
{
- return bb_miiphy_read(miidev, addr, devad, reg);
+ return bb_miiphy_read(miidev, &ravb_bb_miiphy_bus_ops,
+ 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);
+ return bb_miiphy_write(miidev, &ravb_bb_miiphy_bus_ops,
+ addr, devad, reg, value);
}
static int ravb_probe(struct udevice *dev)
snprintf(mdiodev->name, sizeof(mdiodev->name), dev->name);
/* Copy the bus accessors and private data */
- bb_miiphy->ops = &ravb_bb_miiphy_bus_ops;
bb_miiphy->priv = eth;
ret = mdio_register(mdiodev);
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);
+ return bb_miiphy_read(miidev, &sh_ether_bb_miiphy_bus_ops,
+ 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);
+ return bb_miiphy_write(miidev, &sh_ether_bb_miiphy_bus_ops,
+ addr, devad, reg, value);
}
static int sh_ether_probe(struct udevice *udev)
snprintf(mdiodev->name, sizeof(mdiodev->name), udev->name);
/* Copy the bus accessors and private data */
- bb_miiphy->ops = &sh_ether_bb_miiphy_bus_ops;
bb_miiphy->priv = eth;
ret = mdio_register(mdiodev);
struct bb_miiphy_bus {
void *priv;
- const struct bb_miiphy_bus_ops *ops;
struct mii_dev mii;
};
struct bb_miiphy_bus *bb_miiphy_alloc(void);
void bb_miiphy_free(struct bb_miiphy_bus *bus);
-int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg);
-int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg,
- u16 value);
+int bb_miiphy_read(struct mii_dev *miidev, const struct bb_miiphy_bus_ops *ops,
+ int addr, int devad, int reg);
+int bb_miiphy_write(struct mii_dev *miidev, const struct bb_miiphy_bus_ops *ops,
+ int addr, int devad, int reg, u16 value);
#endif
/* phy seed setup */