Commit cf31ea71 authored by Brandon Maier's avatar Brandon Maier Committed by David S. Miller

net: phy: xgmiitorgmii: Use correct mdio bus

The xgmiitorgmii is using the mii_bus of the device it's attached to,
instead of the bus it was given during probe.
Signed-off-by: default avatarBrandon Maier <brandon.maier@rockwellcollins.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ab4e6ee5
...@@ -33,17 +33,19 @@ struct gmii2rgmii { ...@@ -33,17 +33,19 @@ struct gmii2rgmii {
struct phy_device *phy_dev; struct phy_device *phy_dev;
struct phy_driver *phy_drv; struct phy_driver *phy_drv;
struct phy_driver conv_phy_drv; struct phy_driver conv_phy_drv;
int addr; struct mdio_device *mdio;
}; };
static int xgmiitorgmii_read_status(struct phy_device *phydev) static int xgmiitorgmii_read_status(struct phy_device *phydev)
{ {
struct gmii2rgmii *priv = phydev->priv; struct gmii2rgmii *priv = phydev->priv;
struct mii_bus *bus = priv->mdio->bus;
int addr = priv->mdio->addr;
u16 val = 0; u16 val = 0;
priv->phy_drv->read_status(phydev); priv->phy_drv->read_status(phydev);
val = mdiobus_read(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG); val = mdiobus_read(bus, addr, XILINX_GMII2RGMII_REG);
val &= ~XILINX_GMII2RGMII_SPEED_MASK; val &= ~XILINX_GMII2RGMII_SPEED_MASK;
if (phydev->speed == SPEED_1000) if (phydev->speed == SPEED_1000)
...@@ -53,7 +55,7 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev) ...@@ -53,7 +55,7 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
else else
val |= BMCR_SPEED10; val |= BMCR_SPEED10;
mdiobus_write(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG, val); mdiobus_write(bus, addr, XILINX_GMII2RGMII_REG, val);
return 0; return 0;
} }
...@@ -86,7 +88,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev) ...@@ -86,7 +88,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
priv->addr = mdiodev->addr; priv->mdio = mdiodev;
priv->phy_drv = priv->phy_dev->drv; priv->phy_drv = priv->phy_dev->drv;
memcpy(&priv->conv_phy_drv, priv->phy_dev->drv, memcpy(&priv->conv_phy_drv, priv->phy_dev->drv,
sizeof(struct phy_driver)); sizeof(struct phy_driver));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment