diff options
author | Daniel Hellstrom <daniel@gaisler.com> | 2011-01-14 03:02:41 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-14 12:45:54 -0800 |
commit | 2436af8ca7a6c4679cf7da7e3867f1d5cd8528b7 (patch) | |
tree | b72ea5879776cd81bfd3fc7cf047dc1c654cb892 /drivers/net | |
parent | b669e7f0580f3c0058f1b32c276ef6da8f05c138 (diff) |
GRETH: avoid writing bad speed/duplex when setting transfer mode
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/greth.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/greth.c b/drivers/net/greth.c index 9386bce9dea5..e48d18216cbe 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c @@ -1232,29 +1232,26 @@ static void greth_link_change(struct net_device *dev) struct greth_private *greth = netdev_priv(dev); struct phy_device *phydev = greth->phy; unsigned long flags; - int status_change = 0; + u32 ctrl; spin_lock_irqsave(&greth->devlock, flags); if (phydev->link) { if ((greth->speed != phydev->speed) || (greth->duplex != phydev->duplex)) { - - GRETH_REGANDIN(greth->regs->control, - ~(GRETH_CTRL_FD | GRETH_CTRL_SP | GRETH_CTRL_GB)); + ctrl = GRETH_REGLOAD(greth->regs->control) & + ~(GRETH_CTRL_FD | GRETH_CTRL_SP | GRETH_CTRL_GB); if (phydev->duplex) - GRETH_REGORIN(greth->regs->control, GRETH_CTRL_FD); - - if (phydev->speed == SPEED_100) { - - GRETH_REGORIN(greth->regs->control, GRETH_CTRL_SP); - } + ctrl |= GRETH_CTRL_FD; + if (phydev->speed == SPEED_100) + ctrl |= GRETH_CTRL_SP; else if (phydev->speed == SPEED_1000) - GRETH_REGORIN(greth->regs->control, GRETH_CTRL_GB); + ctrl |= GRETH_CTRL_GB; + GRETH_REGSAVE(greth->regs->control, ctrl); greth->speed = phydev->speed; greth->duplex = phydev->duplex; status_change = 1; |