1 From c2e963057ca5635d6e5387623c3ad0c0b3123754 Mon Sep 17 00:00:00 2001
2 From: Daniel Hellstrom <daniel@gaisler.com>
3 Date: Wed, 1 Dec 2010 10:28:37 +0100
4 Subject: [PATCH] GRETH: avoid writing bad speed/duplex when setting transfer mode
6 Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
8 drivers/net/greth.c | 19 ++++++++-----------
9 1 files changed, 8 insertions(+), 11 deletions(-)
11 --- a/drivers/net/greth.c
12 +++ b/drivers/net/greth.c
13 @@ -1236,29 +1236,26 @@ static void greth_link_change(struct net
14 struct greth_private *greth = netdev_priv(dev);
15 struct phy_device *phydev = greth->phy;
18 int status_change = 0;
21 spin_lock_irqsave(&greth->devlock, flags);
25 if ((greth->speed != phydev->speed) || (greth->duplex != phydev->duplex)) {
27 - GRETH_REGANDIN(greth->regs->control,
28 - ~(GRETH_CTRL_FD | GRETH_CTRL_SP | GRETH_CTRL_GB));
29 + ctrl = GRETH_REGLOAD(greth->regs->control) &
30 + ~(GRETH_CTRL_FD | GRETH_CTRL_SP | GRETH_CTRL_GB);
33 - GRETH_REGORIN(greth->regs->control, GRETH_CTRL_FD);
35 - if (phydev->speed == SPEED_100) {
37 - GRETH_REGORIN(greth->regs->control, GRETH_CTRL_SP);
39 + ctrl |= GRETH_CTRL_FD;
41 + if (phydev->speed == SPEED_100)
42 + ctrl |= GRETH_CTRL_SP;
43 else if (phydev->speed == SPEED_1000)
44 - GRETH_REGORIN(greth->regs->control, GRETH_CTRL_GB);
45 + ctrl |= GRETH_CTRL_GB;
47 + GRETH_REGSAVE(greth->regs->control, ctrl);
48 greth->speed = phydev->speed;
49 greth->duplex = phydev->duplex;