CRISv10: Don't autonegotiate if autonegotiation is off

Previous thread: ecryptfs: Remove unneeded locking that triggers lockdep false positives by Linux Kernel Mailing List on Thursday, September 24, 2009 - 6:01 pm. (1 message)

Next thread: Thumb-2: Correctly handle undefined instructions in the kernel by Linux Kernel Mailing List on Thursday, September 24, 2009 - 6:01 pm. (1 message)
From: Linux Kernel Mailing List
Date: Thursday, September 24, 2009 - 6:01 pm

Gitweb:     http://git.kernel.org/linus/e6cd19743bfc76ca81804c2a259e3a0d7b03fd73
Commit:     e6cd19743bfc76ca81804c2a259e3a0d7b03fd73
Parent:     a090ca2c840a3459642971f26bdbad96d2482e32
Author:     Jesper Nilsson <jesper.nilsson@axis.com>
AuthorDate: Mon Aug 31 18:28:26 2009 +0200
Committer:  Jesper Nilsson <jesper.nilsson@axis.com>
CommitDate: Mon Aug 31 18:38:17 2009 +0200

    CRISv10: Don't autonegotiate if autonegotiation is off
    
    If autonegotiation was disabled, we still set the
    BMCR_ANENABLE and BMCR_ANRESTART, which resulted in autonegotiation
    never being disabled.
    
    Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
    Reported-by: Julia Lawall <julia@diku.dk>
---
 drivers/net/cris/eth_v10.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index 7a18dc7..d70d203 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -768,10 +768,24 @@ e100_negotiate(struct net_device* dev)
 
 	e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE, data);
 
-	/* Renegotiate with link partner */
+	data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR);
 	if (autoneg_normal) {
-	  data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR);
-	data |= BMCR_ANENABLE | BMCR_ANRESTART;
+		/* Renegotiate with link partner */
+		data |= BMCR_ANENABLE | BMCR_ANRESTART;
+	} else {
+		/* Don't negotiate speed or duplex */
+		data &= ~(BMCR_ANENABLE | BMCR_ANRESTART);
+
+		/* Set speed and duplex static */
+		if (current_speed_selection == 10)
+			data &= ~BMCR_SPEED100;
+		else
+			data |= BMCR_SPEED100;
+
+		if (current_duplex != full)
+			data &= ~BMCR_FULLDPLX;
+		else
+			data |= BMCR_FULLDPLX;
 	}
 	e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR, data);
 }
--

Previous thread: ecryptfs: Remove unneeded locking that triggers lockdep false positives by Linux Kernel Mailing List on Thursday, September 24, 2009 - 6:01 pm. (1 message)

Next thread: Thumb-2: Correctly handle undefined instructions in the kernel by Linux Kernel Mailing List on Thursday, September 24, 2009 - 6:01 pm. (1 message)