diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-02-18 09:40:12 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-02-18 09:40:12 +0000 |
commit | 4da1e121cd1f747f4ec9ea426733e86607e06c09 (patch) | |
tree | a171d521abafb18435687e68b201507ec265bf17 /sys/dev/pci | |
parent | 3c6a0079a631f15a533bf5918bb1e952011f6099 (diff) |
Add initial bits for fiber support with the BCM5714/BCM5715/BCM5780 chipsets.
Tested by brad@, chl@, sthen@, Johan Mson Lindman and Ian Lindsay <iml04@hampshire.edu>
ok dlg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_bge.c | 35 | ||||
-rw-r--r-- | sys/dev/pci/if_bgereg.h | 15 |
2 files changed, 31 insertions, 19 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index e8d7b6a94c2..c7a8dba6074 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.219 2008/02/17 06:39:16 brad Exp $ */ +/* $OpenBSD: if_bge.c,v 1.220 2008/02/18 09:40:11 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -672,7 +672,8 @@ bge_miibus_statchg(struct device *dev) } BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_PORTMODE); - if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T || + IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX) BGE_SETBIT(sc, BGE_MAC_MODE, BGE_PORTMODE_GMII); else BGE_SETBIT(sc, BGE_MAC_MODE, BGE_PORTMODE_MII); @@ -1623,12 +1624,20 @@ bge_blockinit(struct bge_softc *sc) if (!(BGE_IS_5705_OR_BEYOND(sc))) CSR_WRITE_4(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE); + val = BGE_MACMODE_TXDMA_ENB | BGE_MACMODE_RXDMA_ENB | + BGE_MACMODE_RX_STATS_CLEAR | BGE_MACMODE_TX_STATS_CLEAR | + BGE_MACMODE_RX_STATS_ENB | BGE_MACMODE_TX_STATS_ENB | + BGE_MACMODE_FRMHDR_DMA_ENB; + + if (sc->bge_flags & BGE_PHY_FIBER_TBI) + val |= BGE_PORTMODE_TBI; + else if (sc->bge_flags & BGE_PHY_FIBER_MII) + val |= BGE_PORTMODE_GMII; + else + val |= BGE_PORTMODE_MII; + /* Turn on DMA, clear stats */ - CSR_WRITE_4(sc, BGE_MAC_MODE, BGE_MACMODE_TXDMA_ENB| - BGE_MACMODE_RXDMA_ENB|BGE_MACMODE_RX_STATS_CLEAR| - BGE_MACMODE_TX_STATS_CLEAR|BGE_MACMODE_RX_STATS_ENB| - BGE_MACMODE_TX_STATS_ENB|BGE_MACMODE_FRMHDR_DMA_ENB| - (sc->bge_flags & BGE_PHY_FIBER_TBI ? BGE_PORTMODE_TBI : BGE_PORTMODE_MII)); + CSR_WRITE_4(sc, BGE_MAC_MODE, val); /* Set misc. local control, enable interrupts on attentions */ CSR_WRITE_4(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_ONATTN); @@ -2103,12 +2112,14 @@ bge_attach(struct device *parent, struct device *self, void *aux) hwcfg = ntohl(hwcfg); } - if ((hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER) - sc->bge_flags |= BGE_PHY_FIBER_TBI; - /* The SysKonnect SK-9D41 is a 1000baseSX card. */ - if (PCI_PRODUCT(subid) == SK_SUBSYSID_9D41) - sc->bge_flags |= BGE_PHY_FIBER_TBI; + if (PCI_PRODUCT(subid) == SK_SUBSYSID_9D41 || + (hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER) { + if (BGE_IS_5714_FAMILY(sc)) + sc->bge_flags |= BGE_PHY_FIBER_MII; + else + sc->bge_flags |= BGE_PHY_FIBER_TBI; + } /* Hookup IRQ last. */ DPRINTFN(5, ("pci_intr_establish\n")); diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h index 2beee541ed5..ba66309c63f 100644 --- a/sys/dev/pci/if_bgereg.h +++ b/sys/dev/pci/if_bgereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bgereg.h,v 1.77 2008/02/02 04:03:33 brad Exp $ */ +/* $OpenBSD: if_bgereg.h,v 1.78 2008/02/18 09:40:11 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2437,12 +2437,13 @@ struct bge_softc { #define BGE_JUMBO_CAP 0x00000200 #define BGE_10_100_ONLY 0x00000400 #define BGE_PHY_FIBER_TBI 0x00000800 -#define BGE_PHY_ADC_BUG 0x00001000 -#define BGE_PHY_5704_A0_BUG 0x00002000 -#define BGE_PHY_JITTER_BUG 0x00004000 -#define BGE_PHY_BER_BUG 0x00008000 -#define BGE_PHY_ADJUST_TRIM 0x00010000 -#define BGE_NO_ETH_WIRE_SPEED 0x00020000 +#define BGE_PHY_FIBER_MII 0x00001000 +#define BGE_PHY_ADC_BUG 0x00002000 +#define BGE_PHY_5704_A0_BUG 0x00004000 +#define BGE_PHY_JITTER_BUG 0x00008000 +#define BGE_PHY_BER_BUG 0x00010000 +#define BGE_PHY_ADJUST_TRIM 0x00020000 +#define BGE_NO_ETH_WIRE_SPEED 0x00040000 bus_dma_tag_t bge_dmatag; u_int32_t bge_chipid; |