For the 21142/21143 internal Nway, only advertise/resolve media for

which we have SROM blocks.
This commit is contained in:
thorpej 2002-09-18 19:12:17 +00:00
parent 60c69eb3f1
commit 620a647b60
2 changed files with 47 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tulip.c,v 1.118 2002/07/14 21:02:41 chs Exp $ */
/* $NetBSD: tulip.c,v 1.119 2002/09/18 19:12:17 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.118 2002/07/14 21:02:41 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.119 2002/09/18 19:12:17 thorpej Exp $");
#include "bpfilter.h"
@ -3632,6 +3632,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_TP, IFM_10_T, 0,
"10baseT",
OPMODE_TTM,
BMSR_10THDX,
{ SIACONN_21040_10BASET,
SIATXRX_21040_10BASET,
SIAGEN_21040_10BASET },
@ -3647,6 +3648,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_BNC, IFM_10_2, 0,
"10base2",
0,
0,
{ 0,
0,
0 },
@ -3662,6 +3664,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_AUI, IFM_10_5, 0,
"10base5",
0,
0,
{ SIACONN_21040_AUI,
SIATXRX_21040_AUI,
SIAGEN_21040_AUI },
@ -3677,6 +3680,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_100TX, IFM_100_TX, 0,
"100baseTX",
OPMODE_PS|OPMODE_PCS|OPMODE_SCR|OPMODE_HBD,
BMSR_100TXHDX,
{ 0,
0,
0 },
@ -3692,6 +3696,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_TP_FDX, IFM_10_T, IFM_FDX,
"10baseT-FDX",
OPMODE_TTM|OPMODE_FD|OPMODE_HBD,
BMSR_10TFDX,
{ SIACONN_21040_10BASET_FDX,
SIATXRX_21040_10BASET_FDX,
SIAGEN_21040_10BASET_FDX },
@ -3707,6 +3712,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_100TX_FDX, IFM_100_TX, IFM_FDX,
"100baseTX-FDX",
OPMODE_PS|OPMODE_PCS|OPMODE_SCR|OPMODE_FD|OPMODE_HBD,
BMSR_100TXFDX,
{ 0,
0,
0 },
@ -3722,6 +3728,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_100T4, IFM_100_T4, 0,
"100baseT4",
OPMODE_PS|OPMODE_PCS|OPMODE_SCR|OPMODE_HBD,
BMSR_100T4,
{ 0,
0,
0 },
@ -3737,6 +3744,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_100FX, IFM_100_FX, 0,
"100baseFX",
OPMODE_PS|OPMODE_PCS|OPMODE_HBD,
0,
{ 0,
0,
0 },
@ -3752,6 +3760,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ TULIP_ROM_MB_MEDIA_100FX_FDX, IFM_100_FX, IFM_FDX,
"100baseFX-FDX",
OPMODE_PS|OPMODE_PCS|OPMODE_FD|OPMODE_HBD,
0,
{ 0,
0,
0 },
@ -3767,6 +3776,7 @@ const struct tulip_srom_to_ifmedia tulip_srom_to_ifmedia_table[] = {
{ 0, 0, 0,
NULL,
0,
0,
{ 0,
0,
0 },
@ -3815,6 +3825,8 @@ tlp_srom_media_info(sc, tsti, tm)
tm->tm_name = tsti->tsti_name;
tm->tm_opmode = tsti->tsti_opmode;
sc->sc_sia_cap |= tsti->tsti_sia_cap;
switch (sc->sc_chip) {
case TULIP_CHIP_DE425:
case TULIP_CHIP_21040:
@ -5156,21 +5168,36 @@ void
tlp_2114x_nway_auto(sc)
struct tulip_softc *sc;
{
uint32_t siastat;
uint32_t siastat, siatxrx;
tlp_idle(sc, OPMODE_ST|OPMODE_SR);
sc->sc_opmode &= ~(OPMODE_PS|OPMODE_PCS|OPMODE_SCR);
sc->sc_opmode |= OPMODE_TTM|OPMODE_FD|OPMODE_HBD;
sc->sc_opmode &= ~(OPMODE_PS|OPMODE_PCS|OPMODE_SCR|OPMODE_FD);
sc->sc_opmode |= OPMODE_TTM|OPMODE_HBD;
siatxrx = 0xffbf; /* XXX magic number */
/* Compute the link code word to advertise. */
if (sc->sc_sia_cap & BMSR_100T4)
siatxrx |= SIATXRX_T4;
if (sc->sc_sia_cap & BMSR_100TXFDX)
siatxrx |= SIATXRX_TXF;
if (sc->sc_sia_cap & BMSR_100TXHDX)
siatxrx |= SIATXRX_THX;
if (sc->sc_sia_cap & BMSR_10TFDX)
sc->sc_opmode |= OPMODE_FD;
if (sc->sc_sia_cap & BMSR_10THDX)
siatxrx |= SIATXRX_TH;
TULIP_WRITE(sc, CSR_OPMODE, sc->sc_opmode);
TULIP_WRITE(sc, CSR_SIACONN, 0);
delay(1000);
TULIP_WRITE(sc, CSR_SIATXRX, 0x3ffff);
TULIP_WRITE(sc, CSR_SIATXRX, siatxrx);
TULIP_WRITE(sc, CSR_SIACONN, SIACONN_SRL);
siastat = TULIP_READ(sc, CSR_SIASTAT);
siastat &= ~(SIASTAT_ANS|SIASTAT_LPC|SIASTAT_TRA|SIASTAT_ARA|SIASTAT_LS100|SIASTAT_LS10|SIASTAT_MRA);
siastat &= ~(SIASTAT_ANS|SIASTAT_LPC|SIASTAT_TRA|SIASTAT_ARA|
SIASTAT_LS100|SIASTAT_LS10|SIASTAT_MRA);
siastat |= SIASTAT_ANS_TXDIS;
TULIP_WRITE(sc, CSR_SIASTAT, siastat);
}
@ -5203,18 +5230,20 @@ tlp_2114x_nway_status(sc)
if (siastat & SIASTAT_LPN) {
anlpar = SIASTAT_GETLPC(siastat);
if (anlpar & ANLPAR_T4 /* &&
sc->mii_capabilities & BMSR_100TXHDX */)
if (anlpar & ANLPAR_T4 &&
sc->sc_sia_cap & BMSR_100T4)
mii->mii_media_active |= IFM_100_T4;
else if (anlpar & ANLPAR_TX_FD /* &&
sc->mii_capabilities & BMSR_100TXFDX */)
else if (anlpar & ANLPAR_TX_FD &&
sc->sc_sia_cap & BMSR_100TXFDX)
mii->mii_media_active |= IFM_100_TX|IFM_FDX;
else if (anlpar & ANLPAR_TX /* &&
sc->mii_capabilities & BMSR_100TXHDX */)
else if (anlpar & ANLPAR_TX &&
sc->sc_sia_cap & BMSR_100TXHDX)
mii->mii_media_active |= IFM_100_TX;
else if (anlpar & ANLPAR_10_FD)
else if (anlpar & ANLPAR_10_FD &&
sc->sc_sia_cap & BMSR_10TFDX)
mii->mii_media_active |= IFM_10_T|IFM_FDX;
else if (anlpar & ANLPAR_10)
else if (anlpar & ANLPAR_10 &&
sc->sc_sia_cap & BMSR_10THDX)
mii->mii_media_active |= IFM_10_T;
else
mii->mii_media_active |= IFM_NONE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tulipvar.h,v 1.47 2002/04/09 05:57:21 chs Exp $ */
/* $NetBSD: tulipvar.h,v 1.48 2002/09/18 19:12:17 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -310,6 +310,7 @@ struct tulip_srom_to_ifmedia {
const char *tsti_name; /* media name */
u_int32_t tsti_opmode; /* OPMODE bits for this media */
u_int32_t tsti_sia_cap; /* "MII" capabilities for this media */
/*
* Settings for 21040, 21041, and 21142/21143 SIA, in the event
@ -381,6 +382,7 @@ struct tulip_softc {
u_int8_t sc_gp_dir; /* GPIO pin direction bits (21140) */
int sc_media_seen; /* ISV media block types seen */
int sc_tlp_minst; /* Tulip internal media instance */
u_int32_t sc_sia_cap; /* SIA media capabilities (21143) */
/* Reset function. */
void (*sc_reset) __P((struct tulip_softc *));