Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 3158

kernel-2.6.18-238.el5.src.rpm

From: Andy Gospodarek <gospo@redhat.com>
Date: Fri, 8 May 2009 15:31:49 -0400
Subject: [net] tg3: allow 5785 to work when running at 10Mbps
Message-id: 20090508193149.GA26634@gospo.rdu.redhat.com
O-Subject: [RHEL5.4 PATCH] tg3: allow 5785 to work when running at 10Mbps
Bugzilla: 469772
RH-Acked-by: David Miller <davem@redhat.com>
RH-Acked-by: Neil Horman <nhorman@redhat.com>
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>

When testing my tg3 backport for 5.4, it was found that the 5785 devices
didn't work at 10Mbps.  The hunk below was included originally in this
patch:

    commit fcb389dfd842be54545cb436b3437f07da10115c
    Author: Matt Carlson <mcarlson@broadcom.com>
    Date:   Mon Nov 3 16:55:44 2008 -0800

        tg3: 5785 enhancements

Since we didn't take any of the upstream support for 5785 that used the
external phy driver we need to add this patch into a different spot.

This will resolve the concern bought up when testing the patch in RHBZ
469772.

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ecc9cf5..6310674 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2601,6 +2601,15 @@ relink:
 	tw32_f(MAC_MODE, tp->mac_mode);
 	udelay(40);
 
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) {
+		if (tp->link_config.active_speed == SPEED_10)
+			tw32(MAC_MI_STAT,
+			     MAC_MI_STAT_10MBPS_MODE |
+			     MAC_MI_STAT_LNKSTAT_ATTN_ENAB);
+		else
+			tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB);
+	}
+
 	if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) {
 		/* Polled via timer. */
 		tw32_f(MAC_EVENT, 0);
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 4827889..7ff6dcc 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -422,6 +422,7 @@
 #define  MI_COM_DATA_MASK		 0x0000ffff
 #define MAC_MI_STAT			0x00000450
 #define  MAC_MI_STAT_LNKSTAT_ATTN_ENAB	 0x00000001
+#define  MAC_MI_STAT_10MBPS_MODE	 0x00000002
 #define MAC_MI_MODE			0x00000454
 #define  MAC_MI_MODE_CLK_10MHZ		 0x00000001
 #define  MAC_MI_MODE_SHORT_PREAMBLE	 0x00000002