提交 76231e02 编写于 作者: D David Daney 提交者: David S. Miller

netdev/phy/icplus: Use mdiobus_write() and mdiobus_read() for proper locking.

Usually you have to take the bus lock.  Why not here too?

I saw this when working on something else.  Not even compile tested.
Signed-off-by: NDavid Daney <david.daney@cavium.com>
Cc: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Cc: "Uwe Kleine-Konig" <u.kleine-koenig@pengutronix.de>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6fe32649
...@@ -49,36 +49,36 @@ static int ip175c_config_init(struct phy_device *phydev) ...@@ -49,36 +49,36 @@ static int ip175c_config_init(struct phy_device *phydev)
if (full_reset_performed == 0) { if (full_reset_performed == 0) {
/* master reset */ /* master reset */
err = phydev->bus->write(phydev->bus, 30, 0, 0x175c); err = mdiobus_write(phydev->bus, 30, 0, 0x175c);
if (err < 0) if (err < 0)
return err; return err;
/* ensure no bus delays overlap reset period */ /* ensure no bus delays overlap reset period */
err = phydev->bus->read(phydev->bus, 30, 0); err = mdiobus_read(phydev->bus, 30, 0);
/* data sheet specifies reset period is 2 msec */ /* data sheet specifies reset period is 2 msec */
mdelay(2); mdelay(2);
/* enable IP175C mode */ /* enable IP175C mode */
err = phydev->bus->write(phydev->bus, 29, 31, 0x175c); err = mdiobus_write(phydev->bus, 29, 31, 0x175c);
if (err < 0) if (err < 0)
return err; return err;
/* Set MII0 speed and duplex (in PHY mode) */ /* Set MII0 speed and duplex (in PHY mode) */
err = phydev->bus->write(phydev->bus, 29, 22, 0x420); err = mdiobus_write(phydev->bus, 29, 22, 0x420);
if (err < 0) if (err < 0)
return err; return err;
/* reset switch ports */ /* reset switch ports */
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
err = phydev->bus->write(phydev->bus, i, err = mdiobus_write(phydev->bus, i,
MII_BMCR, BMCR_RESET); MII_BMCR, BMCR_RESET);
if (err < 0) if (err < 0)
return err; return err;
} }
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
err = phydev->bus->read(phydev->bus, i, MII_BMCR); err = mdiobus_read(phydev->bus, i, MII_BMCR);
mdelay(2); mdelay(2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册