summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2006-04-12 17:45:27 +0000
committerps <ps@FreeBSD.org>2006-04-12 17:45:27 +0000
commitfe4b347428109f8a1a0bfe66e8524781ceebd159 (patch)
tree1ebead16dab249c620319936026741ade1441c29
parent430ed388b5407752e6ab3a4807178f50b1f6508e (diff)
downloadFreeBSD-src-fe4b347428109f8a1a0bfe66e8524781ceebd159.zip
FreeBSD-src-fe4b347428109f8a1a0bfe66e8524781ceebd159.tar.gz
MFC: Add bce
Approved by: re
-rw-r--r--share/man/man4/Makefile1
-rw-r--r--sys/amd64/conf/GENERIC1
-rw-r--r--sys/conf/files1
-rw-r--r--sys/conf/options3
-rw-r--r--sys/dev/mii/brgphy.c108
-rw-r--r--sys/dev/mii/miidevs2
-rw-r--r--sys/i386/conf/GENERIC1
-rw-r--r--sys/modules/Makefile1
8 files changed, 92 insertions, 26 deletions
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 1d4e984..010e5dc 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -29,6 +29,7 @@ MAN= aac.4 \
aue.4 \
awi.4 \
axe.4 \
+ bce.4 \
bfe.4 \
bge.4 \
bktr.4 \
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index f830753..0646ae0 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -181,6 +181,7 @@ device vx # 3Com 3c590, 3c595 (``Vortex'')
# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device miibus # MII bus support
+device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet
device bfe # Broadcom BCM440x 10/100 Ethernet
device bge # Broadcom BCM570xx Gigabit Ethernet
device dc # DEC/Intel 21143 and various workalikes
diff --git a/sys/conf/files b/sys/conf/files
index 2cbac4c..6edf669 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -439,6 +439,7 @@ dev/ath/if_ath_pci.c optional ath pci
dev/awi/am79c930.c optional awi
dev/awi/awi.c optional awi
dev/awi/if_awi_pccard.c optional awi pccard
+dev/bce/if_bce.c optional bce
dev/bfe/if_bfe.c optional bfe
dev/bge/if_bge.c optional bge
dev/bktr/bktr_audio.c optional bktr pci
diff --git a/sys/conf/options b/sys/conf/options
index 5b7a93a..b960012 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -630,6 +630,9 @@ ED_HPP opt_ed.h
ED_3C503 opt_ed.h
ED_SIC opt_ed.h
+# bce driver
+BCE_DEBUG opt_bce.h
+
# bge driver
BGE_FAKE_AUTONEG opt_bge.h
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index 336e189..e0a5d41 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <machine/clock.h>
#include <net/if.h>
+#include <net/ethernet.h>
#include <net/if_media.h>
#include <dev/mii/mii.h>
@@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_arp.h>
#include <machine/bus.h>
#include <dev/bge/if_bgereg.h>
+#include <dev/bce/if_bcereg.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -162,6 +164,17 @@ brgphy_probe(dev)
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5780) {
device_set_desc(dev, MII_STR_xxBROADCOM_BCM5780);
+ }
+
+ if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
+ MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5706C) {
+ device_set_desc(dev, MII_STR_xxBROADCOM_BCM5706C);
+ return(0);
+ }
+
+ if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
+ MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5708C) {
+ device_set_desc(dev, MII_STR_xxBROADCOM_BCM5708C);
return(0);
}
@@ -176,7 +189,8 @@ brgphy_attach(dev)
struct mii_attach_args *ma;
struct mii_data *mii;
const char *sep = "";
- struct bge_softc *bge_sc;
+ struct bge_softc *bge_sc = NULL;
+ struct bce_softc *bce_sc = NULL;
int fast_ether_only = FALSE;
sc = device_get_softc(dev);
@@ -212,10 +226,14 @@ brgphy_attach(dev)
device_printf(dev, " ");
mii_add_media(sc);
- /* The 590x chips are 10/100 only. */
-
- bge_sc = mii->mii_ifp->if_softc;
+ /* Find the driver associated with this PHY. */
+ if (strcmp(mii->mii_ifp->if_dname, "bge") == 0) {
+ bge_sc = mii->mii_ifp->if_softc;
+ } else if (strcmp(mii->mii_ifp->if_dname, "bce") == 0) {
+ bce_sc = mii->mii_ifp->if_softc;
+ }
+ /* The 590x chips are 10/100 only. */
if (strcmp(mii->mii_ifp->if_dname, "bge") == 0 &&
pci_get_vendor(bge_sc->bge_dev) == BCOM_VENDORID &&
(pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901 ||
@@ -626,7 +644,8 @@ brgphy_reset(struct mii_softc *sc)
{
u_int32_t val;
struct ifnet *ifp;
- struct bge_softc *bge_sc;
+ struct bge_softc *bge_sc = NULL;
+ struct bce_softc *bce_sc = NULL;
mii_phy_reset(sc);
@@ -647,34 +666,71 @@ brgphy_reset(struct mii_softc *sc)
case MII_MODEL_xxBROADCOM_BCM5750:
case MII_MODEL_xxBROADCOM_BCM5714:
case MII_MODEL_xxBROADCOM_BCM5780:
+ case MII_MODEL_xxBROADCOM_BCM5706C:
+ case MII_MODEL_xxBROADCOM_BCM5708C:
bcm5750_load_dspcode(sc);
break;
}
ifp = sc->mii_pdata->mii_ifp;
- bge_sc = ifp->if_softc;
- /*
- * Don't enable Ethernet@WireSpeed for the 5700 or the
- * 5705 A1 and A2 chips. Make sure we only do this test
- * on "bge" NICs, since other drivers may use this same
- * PHY subdriver.
- */
- if (strcmp(ifp->if_dname, "bge") == 0 &&
- (bge_sc->bge_asicrev == BGE_ASICREV_BCM5700 ||
- bge_sc->bge_chipid == BGE_CHIPID_BCM5705_A1 ||
- bge_sc->bge_chipid == BGE_CHIPID_BCM5705_A2))
- return;
+ /* Find the driver associated with this PHY. */
+ if (strcmp(ifp->if_dname, "bge") == 0) {
+ bge_sc = ifp->if_softc;
+ } else if (strcmp(ifp->if_dname, "bce") == 0) {
+ bce_sc = ifp->if_softc;
+ }
+
+ /* Handle any NetXtreme/bge workarounds. */
+ if (bge_sc) {
+ /*
+ * Don't enable Ethernet@WireSpeed for the 5700 or the
+ * 5705 A1 and A2 chips. Make sure we only do this test
+ * on "bge" NICs, since other drivers may use this same
+ * PHY subdriver.
+ */
+ if (bge_sc->bge_asicrev == BGE_ASICREV_BCM5700 ||
+ bge_sc->bge_chipid == BGE_CHIPID_BCM5705_A1 ||
+ bge_sc->bge_chipid == BGE_CHIPID_BCM5705_A2)
+ return;
+
+ /* Enable Ethernet@WireSpeed. */
+ PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x7007);
+ val = PHY_READ(sc, BRGPHY_MII_AUXCTL);
+ PHY_WRITE(sc, BRGPHY_MII_AUXCTL, val | (1 << 15) | (1 << 4));
- /* Enable Ethernet@WireSpeed. */
- PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x7007);
- val = PHY_READ(sc, BRGPHY_MII_AUXCTL);
- PHY_WRITE(sc, BRGPHY_MII_AUXCTL, val | (1 << 15) | (1 << 4));
+ /* Enable Link LED on Dell boxes */
+ if (bge_sc->bge_no_3_led) {
+ PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL,
+ PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL)
+ & ~BRGPHY_PHY_EXTCTL_3_LED);
+ }
+ } else if (bce_sc) {
+
+ /* Set or clear jumbo frame settings in the PHY. */
+ if (ifp->if_mtu > ETHER_MAX_LEN) {
+ PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x7);
+ val = PHY_READ(sc, BRGPHY_MII_AUXCTL);
+ PHY_WRITE(sc, BRGPHY_MII_AUXCTL,
+ val | BRGPHY_AUXCTL_LONG_PKT);
+
+ val = PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL);
+ PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL,
+ val | BRGPHY_PHY_EXTCTL_HIGH_LA);
+ } else {
+ PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x7);
+ val = PHY_READ(sc, BRGPHY_MII_AUXCTL);
+ PHY_WRITE(sc, BRGPHY_MII_AUXCTL,
+ val & ~(BRGPHY_AUXCTL_LONG_PKT | 0x7));
+
+ val = PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL);
+ PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL,
+ val & ~BRGPHY_PHY_EXTCTL_HIGH_LA);
+ }
- /* Enable Link LED on Dell boxes */
- if (bge_sc->bge_no_3_led) {
- PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL,
- PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL)
- & ~BRGPHY_PHY_EXTCTL_3_LED);
+ /* Enable Ethernet@Wirespeed */
+ PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x7007);
+ val = PHY_READ(sc, BRGPHY_MII_AUXCTL);
+ PHY_WRITE(sc, BRGPHY_MII_AUXCTL, (val | (1 << 15) | (1 << 4)));
}
}
diff --git a/sys/dev/mii/miidevs b/sys/dev/mii/miidevs
index 6356c7b..14b5193 100644
--- a/sys/dev/mii/miidevs
+++ b/sys/dev/mii/miidevs
@@ -124,6 +124,8 @@ model xxBROADCOM BCM5705 0x001a BCM5705 10/100/1000baseTX PHY
model xxBROADCOM BCM5750 0x0018 BCM5750 10/100/1000baseTX PHY
model xxBROADCOM BCM5714 0x0034 BCM5714 10/100/1000baseTX PHY
model xxBROADCOM BCM5780 0x0035 BCM5780 10/100/1000baseTX PHY
+model xxBROADCOM BCM5706C 0x0015 BCM5706C 10/100/1000baseTX PHY
+model xxBROADCOM BCM5708C 0x0036 BCM5708C 10/100/1000baseTX PHY
/* Cicada Semiconductor PHYs (now owned by Vitesse?) */
model CICADA CS8201 0x0001 Cicada CS8201 10/100/1000TX PHY
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index 36336ce..4d87ff1 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -191,6 +191,7 @@ device vx # 3Com 3c590, 3c595 (``Vortex'')
# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device miibus # MII bus support
+device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet
device bfe # Broadcom BCM440x 10/100 Ethernet
device bge # Broadcom BCM570xx Gigabit Ethernet
device dc # DEC/Intel 21143 and various workalikes
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index ca99164..624855d 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -35,6 +35,7 @@ SUBDIR= ${_3dfx} \
${_auxio} \
${_awi} \
axe \
+ bce \
bfe \
bge \
${_bios} \
OpenPOWER on IntegriCloud