Make PHY matching all table-driven.

This commit is contained in:
thorpej 2001-06-02 21:39:38 +00:00
parent 0c870e10e0
commit 424f7a1e65
15 changed files with 208 additions and 133 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: brgphy.c,v 1.1 2001/06/01 16:49:59 thorpej Exp $ */
/* $NetBSD: brgphy.c,v 1.2 2001/06/02 21:39:38 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -105,15 +105,13 @@ const struct mii_phy_funcs brgphy_funcs = {
brgphy_service, brgphy_status, mii_phy_reset,
};
const struct brgdev {
u_int32_t oui;
u_int32_t model;
const char *name;
} brgdevs[] = {
const struct mii_phydesc brgphys[] = {
{ MII_OUI_BROADCOM, MII_MODEL_BROADCOM_BCM5400,
MII_STR_BROADCOM_BCM5400 },
{ MII_OUI_BROADCOM, MII_MODEL_BROADCOM_BCM5401,
MII_STR_BROADCOM_BCM5401 },
{ MII_OUI_BROADCOM, MII_MODEL_BROADCOM_BCM5411,
MII_STR_BROADCOM_BCM5411 },
@ -121,19 +119,6 @@ const struct brgdev {
NULL },
};
static const struct brgdev *
brgphy_lookup(const struct mii_attach_args *ma)
{
const struct brgdev *b;
for (b = brgdevs; b->name != NULL; b++) {
if (MII_OUI(ma->mii_id1, ma->mii_id2) == b->oui &&
MII_MODEL(ma->mii_id2) == b->model)
return (b);
}
return (NULL);
}
int
brgphymatch(parent, match, aux)
struct device *parent;
@ -142,7 +127,7 @@ brgphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (brgphy_lookup(ma) != NULL)
if (mii_phy_match(ma, brgphys) != NULL)
return (10);
return (0);
@ -156,15 +141,10 @@ brgphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct brgdev *b;
const struct mii_phydesc *mpd;
b = brgphy_lookup(ma);
if (b == NULL) {
printf("\n");
panic("brgphyattach: impossible");
}
printf(": %s, rev. %d\n", b->name, MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, brgphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dmphy.c,v 1.9 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: dmphy.c,v 1.10 2001/06/02 21:39:38 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -103,6 +103,17 @@ const struct mii_phy_funcs dmphy_funcs = {
dmphy_service, dmphy_status, mii_phy_reset,
};
const struct mii_phydesc dmphys[] = {
{ MII_OUI_xxDAVICOM, MII_MODEL_xxDAVICOM_DM9101,
MII_STR_xxDAVICOM_DM9101 },
{ MII_OUI_DAVICOM, MII_MODEL_xxDAVICOM_DM9101,
MII_STR_xxDAVICOM_DM9101 },
{ 0, 0,
NULL },
};
int
dmphymatch(parent, match, aux)
struct device *parent;
@ -111,9 +122,7 @@ dmphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if ((MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxDAVICOM ||
MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_DAVICOM) &&
(MII_MODEL(ma->mii_id2) == MII_MODEL_xxDAVICOM_DM9101))
if (mii_phy_match(ma, dmphys) != NULL)
return (10);
return (0);
@ -127,9 +136,10 @@ dmphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_xxDAVICOM_DM9101,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, dmphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: gphyter.c,v 1.2 2001/05/31 18:47:22 thorpej Exp $ */
/* $NetBSD: gphyter.c,v 1.3 2001/06/02 21:39:38 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -106,6 +106,17 @@ const struct mii_phy_funcs gphyter_funcs = {
gphyter_service, gphyter_status, mii_phy_reset,
};
const struct mii_phydesc gphyters[] = {
{ MII_OUI_xxNATSEMI, MII_MODEL_xxNATSEMI_DP83861,
MII_STR_xxNATSEMI_DP83861 },
{ MII_OUI_xxNATSEMI, MII_MODEL_xxNATSEMI_DP83891,
MII_STR_xxNATSEMI_DP83891 },
{ 0, 0,
NULL },
};
int
gphytermatch(parent, match, aux)
struct device *parent;
@ -114,12 +125,7 @@ gphytermatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxNATSEMI &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxNATSEMI_DP83861)
return (10);
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxNATSEMI &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxNATSEMI_DP83891)
if (mii_phy_match(ma, gphyters) != NULL)
return (10);
return (0);
@ -133,22 +139,11 @@ gphyterattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const char *model;
const struct mii_phydesc *mpd;
int anar, strap;
switch (MII_MODEL(ma->mii_id2)) {
case MII_MODEL_xxNATSEMI_DP83861:
model = MII_STR_xxNATSEMI_DP83861;
break;
case MII_MODEL_xxNATSEMI_DP83891:
model = MII_STR_xxNATSEMI_DP83891;
break;
default:
printf("\n");
panic("gphyterattach: impossible");
}
printf(": %s, rev. %d\n", model, MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, gphyters);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: icsphy.c,v 1.21 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: icsphy.c,v 1.22 2001/06/02 21:39:39 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -103,6 +103,14 @@ const struct mii_phy_funcs icsphy_funcs = {
icsphy_service, icsphy_status, icsphy_reset,
};
const struct mii_phydesc icsphys[] = {
{ MII_OUI_ICS, MII_MODEL_ICS_1890,
MII_STR_ICS_1890 },
{ 0, 0,
NULL },
};
int
icsphymatch(parent, match, aux)
struct device *parent;
@ -111,8 +119,7 @@ icsphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_ICS &&
MII_MODEL(ma->mii_id2) == MII_MODEL_ICS_1890)
if (mii_phy_match(ma, icsphys) != NULL)
return (10);
return (0);
@ -126,9 +133,10 @@ icsphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_ICS_1890,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, icsphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: inphy.c,v 1.22 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: inphy.c,v 1.23 2001/06/02 21:39:39 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -103,6 +103,14 @@ const struct mii_phy_funcs inphy_funcs = {
inphy_service, inphy_status, mii_phy_reset,
};
const struct mii_phydesc inphys[] = {
{ MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82555,
MII_STR_yyINTEL_I82555 },
{ 0, 0,
NULL },
};
int
inphymatch(parent, match, aux)
struct device *parent;
@ -111,8 +119,7 @@ inphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_yyINTEL &&
MII_MODEL(ma->mii_id2) == MII_MODEL_yyINTEL_I82555)
if (mii_phy_match(ma, inphys) != NULL)
return (10);
return (0);
@ -126,9 +133,10 @@ inphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_yyINTEL_I82555,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, inphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: iophy.c,v 1.12 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: iophy.c,v 1.13 2001/06/02 21:39:39 thorpej Exp $ */
/*
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -101,6 +101,17 @@ const struct mii_phy_funcs iophy_funcs = {
iophy_service, iophy_status, mii_phy_reset,
};
const struct mii_phydesc iophys[] = {
{ MII_OUI_xxINTEL, MII_MODEL_xxINTEL_I82553,
MII_STR_xxINTEL_I82553 },
{ MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82553,
MII_STR_yyINTEL_I82553 },
{ 0, 0,
NULL },
};
int
iophymatch(parent, match, aux)
struct device *parent;
@ -109,12 +120,7 @@ iophymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxINTEL &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxINTEL_I82553)
return (10);
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_yyINTEL &&
MII_MODEL(ma->mii_id2) == MII_MODEL_yyINTEL_I82553)
if (mii_phy_match(ma, iophys) != NULL)
return (10);
return (0);
@ -128,9 +134,10 @@ iophyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_xxINTEL_I82553,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, iophys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lxtphy.c,v 1.23 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: lxtphy.c,v 1.24 2001/06/02 21:39:40 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -106,6 +106,14 @@ const struct mii_phy_funcs lxtphy_funcs = {
lxtphy_service, lxtphy_status, lxtphy_reset,
};
const struct mii_phydesc lxtphys[] = {
{ MII_OUI_xxLEVEL1, MII_MODEL_xxLEVEL1_LXT970,
MII_STR_xxLEVEL1_LXT970 },
{ 0, 0,
NULL },
};
int
lxtphymatch(parent, match, aux)
struct device *parent;
@ -114,8 +122,7 @@ lxtphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxLEVEL1 &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxLEVEL1_LXT970)
if (mii_phy_match(ma, lxtphys) != NULL)
return (10);
return (0);
@ -129,9 +136,10 @@ lxtphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_xxLEVEL1_LXT970,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, lxtphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mii_physubr.c,v 1.23 2001/05/31 18:44:48 thorpej Exp $ */
/* $NetBSD: mii_physubr.c,v 1.24 2001/06/02 21:39:40 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -525,3 +525,15 @@ mii_phy_detach(self, flags)
return (0);
}
const struct mii_phydesc *
mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd)
{
for (; mpd->mpd_name != NULL; mpd++) {
if (MII_OUI(ma->mii_id1, ma->mii_id2) == mpd->mpd_oui &&
MII_MODEL(ma->mii_id2) == mpd->mpd_model)
return (mpd);
}
return (NULL);
}

View File

@ -1,7 +1,7 @@
/* $NetBSD: miivar.h,v 1.26 2001/05/31 18:44:48 thorpej Exp $ */
/* $NetBSD: miivar.h,v 1.27 2001/06/02 21:39:40 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -173,6 +173,15 @@ struct mii_attach_args {
};
typedef struct mii_attach_args mii_attach_args_t;
/*
* Used to match a PHY.
*/
struct mii_phydesc {
u_int32_t mpd_oui; /* the PHY's OUI */
u_int32_t mpd_model; /* the PHY's model */
const char *mpd_name; /* the PHY's name */
};
/*
* An array of these structures map MII media types to BMCR/ANAR settings.
*/
@ -227,6 +236,9 @@ void mii_down __P((struct mii_data *));
int mii_phy_activate __P((struct device *, enum devact));
int mii_phy_detach __P((struct device *, int));
const struct mii_phydesc *mii_phy_match __P((const struct mii_attach_args *,
const struct mii_phydesc *));
void mii_phy_add_media __P((struct mii_softc *));
void mii_phy_delete_media __P((struct mii_softc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: nsphy.c,v 1.30 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: nsphy.c,v 1.31 2001/06/02 21:39:40 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -103,6 +103,14 @@ const struct mii_phy_funcs nsphy_funcs = {
nsphy_service, nsphy_status, mii_phy_reset,
};
const struct mii_phydesc nsphys[] = {
{ MII_OUI_xxNATSEMI, MII_MODEL_xxNATSEMI_DP83840,
MII_STR_xxNATSEMI_DP83840 },
{ 0, 0,
NULL },
};
int
nsphymatch(parent, match, aux)
struct device *parent;
@ -111,8 +119,7 @@ nsphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxNATSEMI &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxNATSEMI_DP83840)
if (mii_phy_match(ma, nsphys) != NULL)
return (10);
return (0);
@ -126,9 +133,10 @@ nsphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_xxNATSEMI_DP83840,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, nsphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nsphyter.c,v 1.10 2001/05/31 20:30:21 thorpej Exp $ */
/* $NetBSD: nsphyter.c,v 1.11 2001/06/02 21:39:41 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -106,6 +106,17 @@ const struct mii_phy_funcs nsphyter_funcs = {
nsphyter_service, nsphyter_status, mii_phy_reset,
};
const struct mii_phydesc nsphyters[] = {
{ MII_OUI_xxNATSEMI, MII_MODEL_xxNATSEMI_DP83843,
MII_STR_xxNATSEMI_DP83843 },
{ MII_OUI_xxNATSEMI, MII_MODEL_xxNATSEMI_DP83815,
MII_STR_xxNATSEMI_DP83815 },
{ 0, 0,
NULL },
};
int
nsphytermatch(parent, match, aux)
struct device *parent;
@ -114,12 +125,7 @@ nsphytermatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxNATSEMI &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxNATSEMI_DP83843)
return (10);
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxNATSEMI &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxNATSEMI_DP83815)
if (mii_phy_match(ma, nsphyters) != NULL)
return (10);
return (0);
@ -133,21 +139,10 @@ nsphyterattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const char *model;
const struct mii_phydesc *mpd;
switch (MII_MODEL(ma->mii_id2)) {
case MII_MODEL_xxNATSEMI_DP83843:
model = MII_STR_xxNATSEMI_DP83843;
break;
case MII_MODEL_xxNATSEMI_DP83815:
model = MII_STR_xxNATSEMI_DP83815;
break;
default:
printf("\n");
panic("nsphyterattach: impossible");
}
printf(": %s, rev. %d\n", model, MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, nsphyters);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: qsphy.c,v 1.23 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: qsphy.c,v 1.24 2001/06/02 21:39:41 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -103,6 +103,14 @@ const struct mii_phy_funcs qsphy_funcs = {
qsphy_service, qsphy_status, qsphy_reset,
};
const struct mii_phydesc qsphys[] = {
{ MII_OUI_xxQUALSEMI, MII_MODEL_xxQUALSEMI_QS6612,
MII_STR_xxQUALSEMI_QS6612 },
{ 0, 0,
NULL },
};
int
qsphymatch(parent, match, aux)
struct device *parent;
@ -110,9 +118,8 @@ qsphymatch(parent, match, aux)
void *aux;
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxQUALSEMI &&
MII_MODEL(ma->mii_id2) == MII_MODEL_xxQUALSEMI_QS6612)
if (mii_phy_match(ma, qsphys) != NULL)
return (10);
return (0);
@ -126,9 +133,10 @@ qsphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_xxQUALSEMI_QS6612,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, qsphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sqphy.c,v 1.21 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: sqphy.c,v 1.22 2001/06/02 21:39:41 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -103,6 +103,14 @@ const struct mii_phy_funcs sqphy_funcs = {
sqphy_service, sqphy_status, mii_phy_reset,
};
const struct mii_phydesc sqphys[] = {
{ MII_OUI_SEEQ, MII_MODEL_SEEQ_80220,
MII_STR_SEEQ_80220 },
{ 0, 0,
NULL },
};
int
sqphymatch(parent, match, aux)
struct device *parent;
@ -111,8 +119,7 @@ sqphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_SEEQ &&
MII_MODEL(ma->mii_id2) == MII_MODEL_SEEQ_80220)
if (mii_phy_match(ma, sqphys) != NULL)
return (10);
return (0);
@ -126,9 +133,10 @@ sqphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_SEEQ_80220,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, sqphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tlphy.c,v 1.29 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: tlphy.c,v 1.30 2001/06/02 21:39:41 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -119,6 +119,14 @@ const struct mii_phy_funcs tlphy_funcs = {
tlphy_service, tlphy_status, mii_phy_reset,
};
const struct mii_phydesc tlphys[] = {
{ MII_OUI_TI, MII_MODEL_TI_TLAN10T,
MII_STR_TI_TLAN10T },
{ 0, 0,
NULL },
};
int
tlphymatch(parent, match, aux)
struct device *parent;
@ -127,8 +135,7 @@ tlphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_TI &&
MII_MODEL(ma->mii_id2) == MII_MODEL_TI_TLAN10T)
if (mii_phy_match(ma, tlphys) != NULL)
return (10);
return (0);
@ -143,10 +150,11 @@ tlphyattach(parent, self, aux)
struct tl_softc *tlsc = (struct tl_softc *)self->dv_parent;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
const char *sep = "";
printf(": %s, rev. %d\n", MII_STR_TI_TLAN10T,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, tlphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->sc_mii.mii_inst = mii->mii_instance;
sc->sc_mii.mii_phy = ma->mii_phyno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tqphy.c,v 1.13 2001/05/31 16:02:29 thorpej Exp $ */
/* $NetBSD: tqphy.c,v 1.14 2001/06/02 21:39:42 thorpej Exp $ */
/*
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -103,6 +103,17 @@ const struct mii_phy_funcs tqphy_funcs = {
tqphy_service, tqphy_status, mii_phy_reset,
};
const struct mii_phydesc tqphys[] = {
{ MII_OUI_xxTSC, MII_MODEL_xxTSC_78Q2120,
MII_STR_xxTSC_78Q2120 },
#if 0
{ MII_OUI_xxTSC, MII_MODEL_TSC_78Q2121,
MII_STR_TSC_78Q2121 },
#endif
{ 0, 0,
NULL },
};
int
tqphymatch(parent, match, aux)
struct device *parent;
@ -111,12 +122,8 @@ tqphymatch(parent, match, aux)
{
struct mii_attach_args *ma = aux;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxTSC)
switch MII_MODEL(ma->mii_id2) {
case MII_MODEL_xxTSC_78Q2120:
/* case MII_MODEL_TSC_78Q2121: */
return (10);
}
if (mii_phy_match(ma, tqphys) != NULL)
return (10);
return (0);
}
@ -129,9 +136,10 @@ tqphyattach(parent, self, aux)
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
printf(": %s, rev. %d\n", MII_STR_xxTSC_78Q2120,
MII_REV(ma->mii_id2));
mpd = mii_phy_match(ma, tqphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;