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>
This commit is contained in:
committed by
David S. Miller
parent
b669e7f058
commit
2436af8ca7
@@ -1232,29 +1232,26 @@ static void greth_link_change(struct net_device *dev)
|
|||||||
struct greth_private *greth = netdev_priv(dev);
|
struct greth_private *greth = netdev_priv(dev);
|
||||||
struct phy_device *phydev = greth->phy;
|
struct phy_device *phydev = greth->phy;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
int status_change = 0;
|
int status_change = 0;
|
||||||
|
u32 ctrl;
|
||||||
|
|
||||||
spin_lock_irqsave(&greth->devlock, flags);
|
spin_lock_irqsave(&greth->devlock, flags);
|
||||||
|
|
||||||
if (phydev->link) {
|
if (phydev->link) {
|
||||||
|
|
||||||
if ((greth->speed != phydev->speed) || (greth->duplex != phydev->duplex)) {
|
if ((greth->speed != phydev->speed) || (greth->duplex != phydev->duplex)) {
|
||||||
|
ctrl = GRETH_REGLOAD(greth->regs->control) &
|
||||||
GRETH_REGANDIN(greth->regs->control,
|
~(GRETH_CTRL_FD | GRETH_CTRL_SP | GRETH_CTRL_GB);
|
||||||
~(GRETH_CTRL_FD | GRETH_CTRL_SP | GRETH_CTRL_GB));
|
|
||||||
|
|
||||||
if (phydev->duplex)
|
if (phydev->duplex)
|
||||||
GRETH_REGORIN(greth->regs->control, GRETH_CTRL_FD);
|
ctrl |= GRETH_CTRL_FD;
|
||||||
|
|
||||||
if (phydev->speed == SPEED_100) {
|
|
||||||
|
|
||||||
GRETH_REGORIN(greth->regs->control, GRETH_CTRL_SP);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (phydev->speed == SPEED_100)
|
||||||
|
ctrl |= GRETH_CTRL_SP;
|
||||||
else if (phydev->speed == SPEED_1000)
|
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->speed = phydev->speed;
|
||||||
greth->duplex = phydev->duplex;
|
greth->duplex = phydev->duplex;
|
||||||
status_change = 1;
|
status_change = 1;
|
||||||
|
Reference in New Issue
Block a user