diff options
| author | msaitoh <msaitoh@NetBSD.org> | 2009-07-14 00:00:44 +0000 |
|---|---|---|
| committer | msaitoh <msaitoh@NetBSD.org> | 2009-07-14 00:00:44 +0000 |
| commit | 37cdac2fa8c79cd2981c5b99191bbf0e289aa3ff (patch) | |
| tree | 5ebaf5ff19774a05327b4ee036e2cf9399718a8d /sys | |
| parent | 234fc6cd534dd420d1c8dea0122085e54b9866ee (diff) | |
Some fixes for i80003 and ICH{8,9,10} from e1000 driver and document:
Add setting for KABGTXD register for ICH{8,9,10}.
ICH9 and ICH10 has no FCAL, FCAH and FCT like ICH8.
Add special setting for FCTTV and TCTL_EXT register for i80003
The special setting for TIPG is only for i80003.
Some of kumeran settings are only for i80003's bugs.
Add some ICH10 fixes.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/pci/if_wm.c | 89 | ||||
| -rw-r--r-- | sys/dev/pci/if_wmreg.h | 8 |
2 files changed, 70 insertions, 27 deletions
diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c index 68c0f80dcd4..e4e87bd4cb3 100644 --- a/sys/dev/pci/if_wm.c +++ b/sys/dev/pci/if_wm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.176 2009/07/13 23:31:19 msaitoh Exp $ */ +/* $NetBSD: if_wm.c,v 1.177 2009/07/14 00:00:44 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.176 2009/07/13 23:31:19 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.177 2009/07/14 00:00:44 msaitoh Exp $"); #include "bpfilter.h" #include "rnd.h" @@ -3264,7 +3264,8 @@ wm_init(struct ifnet *ifp) * * XXX Values could probably stand some tuning. */ - if (sc->sc_type != WM_T_ICH8) { + if ((sc->sc_type != WM_T_ICH8) && (sc->sc_type != WM_T_ICH9) + && (sc->sc_type != WM_T_ICH10)) { CSR_WRITE(sc, WMREG_FCAL, FCAL_CONST); CSR_WRITE(sc, WMREG_FCAH, FCAH_CONST); CSR_WRITE(sc, WMREG_FCT, ETHERTYPE_FLOWCONTROL); @@ -3278,7 +3279,11 @@ wm_init(struct ifnet *ifp) CSR_WRITE(sc, WMREG_FCRTH, FCRTH_DFLT); CSR_WRITE(sc, WMREG_FCRTL, sc->sc_fcrtl); } - CSR_WRITE(sc, WMREG_FCTTV, FCTTV_DFLT); + + if (sc->sc_type == WM_T_80003) + CSR_WRITE(sc, WMREG_FCTTV, 0xffff); + else + CSR_WRITE(sc, WMREG_FCTTV, FCTTV_DFLT); /* Deal with VLAN enables. */ if (VLAN_ATTACHED(&sc->sc_ethercom)) @@ -3288,29 +3293,47 @@ wm_init(struct ifnet *ifp) /* Write the control registers. */ CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl); - if (sc->sc_type >= WM_T_80003 && (sc->sc_flags & WM_F_HAS_MII)) { + + if (sc->sc_flags & WM_F_HAS_MII) { int val; - val = CSR_READ(sc, WMREG_CTRL_EXT); - val &= ~CTRL_EXT_LINK_MODE_MASK; - CSR_WRITE(sc, WMREG_CTRL_EXT, val); - - /* Bypass RX and TX FIFO's */ - wm_kmrn_i80003_writereg(sc, KUMCTRLSTA_OFFSET_FIFO_CTRL, - KUMCTRLSTA_FIFO_CTRL_RX_BYPASS | - KUMCTRLSTA_FIFO_CTRL_TX_BYPASS); + + switch (sc->sc_type) { + case WM_T_80003: + case WM_T_ICH8: + case WM_T_ICH9: + case WM_T_ICH10: + /* + * Set the mac to wait the maximum time between each + * iteration and increase the max iterations when + * polling the phy; this fixes erroneous timeouts at + * 10Mbps. + */ + wm_kmrn_i80003_writereg(sc, KUMCTRLSTA_OFFSET_TIMEOUTS, + 0xFFFF); + val = wm_kmrn_i80003_readreg(sc, + KUMCTRLSTA_OFFSET_INB_PARAM); + val |= 0x3F; + wm_kmrn_i80003_writereg(sc, + KUMCTRLSTA_OFFSET_INB_PARAM, val); + break; + default: + break; + } + + if (sc->sc_type == WM_T_80003) { + val = CSR_READ(sc, WMREG_CTRL_EXT); + val &= ~CTRL_EXT_LINK_MODE_MASK; + CSR_WRITE(sc, WMREG_CTRL_EXT, val); + + /* Bypass RX and TX FIFO's */ + wm_kmrn_i80003_writereg(sc, KUMCTRLSTA_OFFSET_FIFO_CTRL, + KUMCTRLSTA_FIFO_CTRL_RX_BYPASS | + KUMCTRLSTA_FIFO_CTRL_TX_BYPASS); - wm_kmrn_i80003_writereg(sc, KUMCTRLSTA_OFFSET_INB_CTRL, - KUMCTRLSTA_INB_CTRL_DIS_PADDING | - KUMCTRLSTA_INB_CTRL_LINK_TMOUT_DFLT); - /* - * Set the mac to wait the maximum time between each - * iteration and increase the max iterations when - * polling the phy; this fixes erroneous timeouts at 10Mbps. - */ - wm_kmrn_i80003_writereg(sc, KUMCTRLSTA_OFFSET_TIMEOUTS, 0xFFFF); - val = wm_kmrn_i80003_readreg(sc, KUMCTRLSTA_OFFSET_INB_PARAM); - val |= 0x3F; - wm_kmrn_i80003_writereg(sc, KUMCTRLSTA_OFFSET_INB_PARAM, val); + wm_kmrn_i80003_writereg(sc, KUMCTRLSTA_OFFSET_INB_CTRL, + KUMCTRLSTA_INB_CTRL_DIS_PADDING | + KUMCTRLSTA_INB_CTRL_LINK_TMOUT_DFLT); + } } #if 0 CSR_WRITE(sc, WMREG_CTRL_EXT, sc->sc_ctrl_ext); @@ -3342,6 +3365,13 @@ wm_init(struct ifnet *ifp) sc->sc_icr |= ICR_RXCFG; CSR_WRITE(sc, WMREG_IMS, sc->sc_icr); + if ((sc->sc_type == WM_T_ICH8) || (sc->sc_type == WM_T_ICH9) + || (sc->sc_type == WM_T_ICH10)) { + reg = CSR_READ(sc, WMREG_KABGTXD); + reg |= KABGTXD_BGSQLBIAS; + CSR_WRITE(sc, WMREG_KABGTXD, reg); + } + /* Set up the inter-packet gap. */ CSR_WRITE(sc, WMREG_TIPG, sc->sc_tipg); @@ -3385,6 +3415,13 @@ wm_init(struct ifnet *ifp) sc->sc_tctl |= TCTL_RTLC; CSR_WRITE(sc, WMREG_TCTL, sc->sc_tctl); + if (sc->sc_type == WM_T_80003) { + reg = CSR_READ(sc, WMREG_TCTL_EXT); + reg &= ~TCTL_EXT_GCEX_MASK; + reg |= DEFAULT_80003ES2LAN_TCTL_EXT_GCEX; + CSR_WRITE(sc, WMREG_TCTL_EXT, reg); + } + /* Set the media. */ if ((error = mii_ifmedia_change(&sc->sc_mii)) != 0) goto out; @@ -4487,7 +4524,7 @@ wm_gmii_mediainit(struct wm_softc *sc) /* We have MII. */ sc->sc_flags |= WM_F_HAS_MII; - if (sc->sc_type >= WM_T_80003) + if (sc->sc_type == WM_T_80003) sc->sc_tipg = TIPG_1000T_80003_DFLT; else sc->sc_tipg = TIPG_1000T_DFLT; diff --git a/sys/dev/pci/if_wmreg.h b/sys/dev/pci/if_wmreg.h index 1872dafaf16..802f00b4e55 100644 --- a/sys/dev/pci/if_wmreg.h +++ b/sys/dev/pci/if_wmreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_wmreg.h,v 1.27 2009/04/07 18:23:37 msaitoh Exp $ */ +/* $NetBSD: if_wmreg.h,v 1.28 2009/07/14 00:00:44 msaitoh Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -610,8 +610,14 @@ struct livengood_tcpip_ctxdesc { #define WMREG_TXDMAC 0x3000 /* Transfer DMA Control */ #define TXDMAC_DPP (1U << 0) /* disable packet prefetch */ +#define WMREG_KABGTXD 0x3004 /* AFE and Gap Transmit Ref Data */ +#define KABGTXD_BGSQLBIAS 0x00050000 + #define WMREG_TSPMT 0x3830 /* TCP Segmentation Pad and Minimum Threshold (Cordova) */ + +#define WMREG_TARC0 0x3840 /* Tx arbitration count */ + #define TSPMT_TSMT(x) (x) /* TCP seg min transfer */ #define TSPMT_TSPBP(x) ((x) << 16) /* TCP seg pkt buf padding */ |
