Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Nov 2010 15:15:22 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r215302 - in head/sys/dev: bge mii
Message-ID:  <201011141515.oAEFFMfa085598@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sun Nov 14 15:15:22 2010
New Revision: 215302
URL: http://svn.freebsd.org/changeset/base/215302

Log:
  Move the limiting of the PHY to 10/100 modes of operation due to limitations
  of certain MAC models from brgphy(4) to bge(4) where it belongs. While at it,
  update the list of models having that restriction to what OpenBSD uses, which
  in turn seems to have obtained that information from the Linux tg3 driver.

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/mii/brgphy.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sun Nov 14 14:37:20 2010	(r215301)
+++ head/sys/dev/bge/if_bge.c	Sun Nov 14 15:15:22 2010	(r215302)
@@ -2640,7 +2640,7 @@ bge_attach(device_t dev)
 	struct bge_softc *sc;
 	uint32_t hwcfg = 0, misccfg;
 	u_char eaddr[ETHER_ADDR_LEN];
-	int error, f, msicount, phy_addr, reg, rid, trys;
+	int capmask, error, f, msicount, phy_addr, reg, rid, trys;
 
 	sc = device_get_softc(dev);
 	sc->bge_dev = dev;
@@ -2824,13 +2824,31 @@ bge_attach(device_t dev)
 	if (BGE_IS_5755_PLUS(sc) == 0)
 		sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG;
 
+	misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID;
 	if (sc->bge_asicrev == BGE_ASICREV_BCM5705) {
-		misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID;
 		if (misccfg == BGE_MISCCFG_BOARD_ID_5788 ||
 		    misccfg == BGE_MISCCFG_BOARD_ID_5788M)
 			sc->bge_flags |= BGE_FLAG_5788;
 	}
 
+	capmask = BMSR_DEFCAPMASK;
+	if ((sc->bge_asicrev == BGE_ASICREV_BCM5703 &&
+	    (misccfg == 0x4000 || misccfg == 0x8000)) ||
+	    (sc->bge_asicrev == BGE_ASICREV_BCM5705 &&
+	    pci_get_vendor(dev) == BCOM_VENDORID &&
+	    (pci_get_device(dev) == BCOM_DEVICEID_BCM5901 ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM5901A2 ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM5705F)) ||
+	    (pci_get_vendor(dev) == BCOM_VENDORID &&
+	    (pci_get_device(dev) == BCOM_DEVICEID_BCM5751F ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM5753F ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM5787F)) ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM57790 ||
+	    sc->bge_asicrev == BGE_ASICREV_BCM5906) {
+		/* These chips are 10/100 only. */
+		capmask &= ~BMSR_EXTSTAT;
+	}
+
 	/*
 	 * Some controllers seem to require a special firmware to use
 	 * TSO. But the firmware is not available to FreeBSD and Linux
@@ -3104,9 +3122,9 @@ bge_attach(device_t dev)
 again:
 		bge_asf_driver_up(sc);
 
-		error = mii_attach(dev, &sc->bge_miibus, ifp,
-		    bge_ifmedia_upd, bge_ifmedia_sts, BMSR_DEFCAPMASK,
-		    phy_addr, MII_OFFSET_ANY, MIIF_DOPAUSE);
+		error = mii_attach(dev, &sc->bge_miibus, ifp, bge_ifmedia_upd,
+		    bge_ifmedia_sts, capmask, phy_addr, MII_OFFSET_ANY,
+		    MIIF_DOPAUSE);
 		if (error != 0) {
 			if (trys++ < 4) {
 				device_printf(sc->bge_dev, "Try again\n");

Modified: head/sys/dev/mii/brgphy.c
==============================================================================
--- head/sys/dev/mii/brgphy.c	Sun Nov 14 14:37:20 2010	(r215301)
+++ head/sys/dev/mii/brgphy.c	Sun Nov 14 15:15:22 2010	(r215302)
@@ -268,17 +268,6 @@ brgphy_attach(device_t dev)
 		bce_sc = ifp->if_softc;
 	}
 
-	/* Todo: Need to add additional controllers such as 5906 & 5787F */
-	/* The 590x chips are 10/100 only. */
-	if (bge_sc &&
-	    pci_get_vendor(bge_sc->bge_dev) == BCOM_VENDORID &&
-	    (pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901 ||
-	    pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901A2 ||
-	    pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5906 ||
-	    pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5906M)) {
-		ma->mii_capmask &= ~BMSR_EXTSTAT;
-	}
-
 	brgphy_reset(sc);
 
 	/* Read the PHY's capabilities. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011141515.oAEFFMfa085598>