summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1999-04-14 19:40:08 +0000
committerwpaul <wpaul@FreeBSD.org>1999-04-14 19:40:08 +0000
commit831605e7eec4e20879a1fe547048780b72bdbdd9 (patch)
treecf5b6472008f9bad87d7e841cf2d2344ac2d1623 /sys/pci
parent490abdf54dd38f7601522e418cd309fa280a102a (diff)
downloadFreeBSD-src-831605e7eec4e20879a1fe547048780b72bdbdd9.zip
FreeBSD-src-831605e7eec4e20879a1fe547048780b72bdbdd9.tar.gz
Grrr. Make all modes work properly with the 82c168 chip and built-in
transceiver. Note in the manual page that autoselection doesn't work on the 82c168 because the built-in NWAY support is horribly broken. Manual mode selection works fine, but autoneg is broken for everything except maybe 10Mbps half-duplex. There's no simple way to fix this at the moment, so I have to settle for documenting the bug for now. Fortunately, there aren't anywhere near as many 82c168 boards around as there are 82c169s.
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/if_pn.c47
-rw-r--r--sys/pci/if_pnreg.h3
2 files changed, 35 insertions, 15 deletions
diff --git a/sys/pci/if_pn.c b/sys/pci/if_pn.c
index 9ea0c2f..425195e 100644
--- a/sys/pci/if_pn.c
+++ b/sys/pci/if_pn.c
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_pn.c,v 1.49 1999/04/13 16:57:36 wpaul Exp $
+ * $Id: if_pn.c,v 1.50 1999/04/14 18:52:02 wpaul Exp $
*/
/*
@@ -97,7 +97,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: if_pn.c,v 1.49 1999/04/13 16:57:36 wpaul Exp $";
+ "$Id: if_pn.c,v 1.50 1999/04/14 18:52:02 wpaul Exp $";
#endif
/*
@@ -177,11 +177,11 @@ static int pn_list_tx_init __P((struct pn_softc *));
#define PN_SETBIT(sc, reg, x) \
CSR_WRITE_4(sc, reg, \
- CSR_READ_4(sc, reg) | x)
+ CSR_READ_4(sc, reg) | (x))
#define PN_CLRBIT(sc, reg, x) \
CSR_WRITE_4(sc, reg, \
- CSR_READ_4(sc, reg) & ~x)
+ CSR_READ_4(sc, reg) & ~(x))
/*
* Read a word of data stored in the EEPROM at address 'addr.'
@@ -659,7 +659,6 @@ static void pn_setmode(sc, media)
struct pn_softc *sc;
int media;
{
- u_int32_t nway = 0;
struct ifnet *ifp;
ifp = &sc->arpcom.ac_if;
@@ -677,28 +676,23 @@ static void pn_setmode(sc, media)
if (IFM_SUBTYPE(media) == IFM_100_T4) {
printf("100Mbps/T4, half-duplex\n");
- nway = PN_NWAY_MODE_100T4;
}
if (IFM_SUBTYPE(media) == IFM_100_TX) {
printf("100Mbps, ");
- nway = PN_NWAY_MODE_100HD;
}
if (IFM_SUBTYPE(media) == IFM_10_T) {
printf("10Mbps, ");
- nway = PN_NWAY_MODE_10HD;
}
if ((media & IFM_GMASK) == IFM_FDX) {
printf("full duplex\n");
- nway |= PN_NWAY_DUPLEX;
} else {
printf("half duplex\n");
}
pn_setcfg(sc, media);
- CSR_WRITE_4(sc, PN_NWAY, nway);
return;
}
@@ -874,20 +868,33 @@ static void pn_setcfg(sc, media)
if (IFM_SUBTYPE(media) == IFM_100_TX) {
PN_CLRBIT(sc, PN_NETCFG, PN_NETCFG_SPEEDSEL);
- if (sc->pn_pinfo == NULL)
+ if (sc->pn_pinfo == NULL) {
CSR_WRITE_4(sc, PN_GEN, PN_GEN_MUSTBEONE|
PN_GEN_SPEEDSEL|PN_GEN_100TX_LOOP);
+ PN_SETBIT(sc, PN_NETCFG, PN_NETCFG_PCS|
+ PN_NETCFG_SCRAMBLER|PN_NETCFG_MIIENB);
+ PN_SETBIT(sc, PN_NWAY, PN_NWAY_SPEEDSEL);
+ }
} else {
PN_SETBIT(sc, PN_NETCFG, PN_NETCFG_SPEEDSEL);
- if (sc->pn_pinfo == NULL)
+ if (sc->pn_pinfo == NULL) {
CSR_WRITE_4(sc, PN_GEN,
PN_GEN_MUSTBEONE|PN_GEN_100TX_LOOP);
+ PN_CLRBIT(sc, PN_NETCFG, PN_NETCFG_PCS|
+ PN_NETCFG_SCRAMBLER|PN_NETCFG_MIIENB);
+ PN_CLRBIT(sc, PN_NWAY, PN_NWAY_SPEEDSEL);
+ }
}
- if ((media & IFM_GMASK) == IFM_FDX)
+ if ((media & IFM_GMASK) == IFM_FDX) {
PN_SETBIT(sc, PN_NETCFG, PN_NETCFG_FULLDUPLEX);
- else
+ if (sc->pn_pinfo == NULL)
+ PN_SETBIT(sc, PN_NWAY, PN_NWAY_DUPLEX);
+ } else {
PN_CLRBIT(sc, PN_NETCFG, PN_NETCFG_FULLDUPLEX);
+ if (sc->pn_pinfo == NULL)
+ PN_CLRBIT(sc, PN_NWAY, PN_NWAY_DUPLEX);
+ }
if (restart)
PN_SETBIT(sc, PN_NETCFG, PN_NETCFG_TX_ON|PN_NETCFG_RX_ON);
@@ -2077,6 +2084,18 @@ static void pn_ifmedia_sts(ifp, ifmr)
ifmr->ifm_active = IFM_ETHER;
+ if (sc->pn_pinfo == NULL) {
+ if (CSR_READ_4(sc, PN_NETCFG) & PN_NETCFG_SPEEDSEL)
+ ifmr->ifm_active = IFM_ETHER|IFM_10_T;
+ else
+ ifmr->ifm_active = IFM_ETHER|IFM_100_TX;
+ if (CSR_READ_4(sc, PN_NETCFG) & PN_NETCFG_FULLDUPLEX)
+ ifmr->ifm_active |= IFM_FDX;
+ else
+ ifmr->ifm_active |= IFM_HDX;
+ return;
+ }
+
if (!(pn_phy_readreg(sc, PHY_BMCR) & PHY_BMCR_AUTONEGENBL)) {
if (pn_phy_readreg(sc, PHY_BMCR) & PHY_BMCR_SPEEDSEL)
ifmr->ifm_active = IFM_ETHER|IFM_100_TX;
diff --git a/sys/pci/if_pnreg.h b/sys/pci/if_pnreg.h
index 85292a3..4c299d1 100644
--- a/sys/pci/if_pnreg.h
+++ b/sys/pci/if_pnreg.h
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_pnreg.h,v 1.25 1999/04/13 16:57:36 wpaul Exp $
+ * $Id: if_pnreg.h,v 1.26 1999/04/14 18:52:02 wpaul Exp $
*/
/*
@@ -167,6 +167,7 @@
#define PN_NETCFG_STORENFWD 0x00200000
#define PN_NETCFG_SPEEDSEL 0x00400000 /* 1 == 10Mbps 0 == 100Mbps */
#define PN_NETCFG_PCS 0x00800000 /* 1 == 100baseTX */
+#define PN_NETCFG_SCRAMBLER 0x01000000
#define PN_NETCFG_NO_RXCRC 0x20000000
#define PN_NETCFG_EXT_ENDEC 0x40000000 /* 1 == ext, 0 == int PHY */
OpenPOWER on IntegriCloud