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.
This commit is contained in:
Bill Paul 1999-04-14 19:40:08 +00:00
parent 35871a15c5
commit bd43efdba2
4 changed files with 53 additions and 35 deletions

View File

@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: pn.4,v 1.2 1998/12/05 09:31:25 rnordier Exp $
.\" $Id: pn.4,v 1.4 1999/04/14 19:02:39 wpaul Exp $
.\"
.Dd November 7, 1998
.Dt PN 4 i386
@ -150,12 +150,11 @@ The
driver was written by
.An Bill Paul Aq wpaul@ctr.columbia.edu .
.Sh BUGS
The
.Nm
driver currently only supports cards with external transceivers
connected to the PNIC controller via its MII bus. This is because
the author had no boards available for testing which made use of the
internal transceiver. Most of the PNIC implementations on the market
today use an external PHY, so hopefully this will not present any
serious problems. Code to support the internal transceiver may be
added later if hardware becomes available.
The internal NWAY support on the 82c168 chip is horribly broken, which
means that autoselection will not work, except maybe for half-duplex
10Mbps links. In order to use other modes (e.g. 100Mbps) it will be
necessary to
use
.Xr ifconfig 8
to set the interface manually. Autoselection for 82c169 boards using
MII transceivers should work correctly.

View File

@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: pn.4,v 1.2 1998/12/05 09:31:25 rnordier Exp $
.\" $Id: pn.4,v 1.4 1999/04/14 19:02:39 wpaul Exp $
.\"
.Dd November 7, 1998
.Dt PN 4 i386
@ -150,12 +150,11 @@ The
driver was written by
.An Bill Paul Aq wpaul@ctr.columbia.edu .
.Sh BUGS
The
.Nm
driver currently only supports cards with external transceivers
connected to the PNIC controller via its MII bus. This is because
the author had no boards available for testing which made use of the
internal transceiver. Most of the PNIC implementations on the market
today use an external PHY, so hopefully this will not present any
serious problems. Code to support the internal transceiver may be
added later if hardware becomes available.
The internal NWAY support on the 82c168 chip is horribly broken, which
means that autoselection will not work, except maybe for half-duplex
10Mbps links. In order to use other modes (e.g. 100Mbps) it will be
necessary to
use
.Xr ifconfig 8
to set the interface manually. Autoselection for 82c169 boards using
MII transceivers should work correctly.

View File

@ -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;

View File

@ -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 */