diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-02-05 22:20:43 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-02-05 22:20:43 +0000 |
commit | 07327fa3636b7451ac44f7675de60f241c008ed8 (patch) | |
tree | 3607e4a6d8a437abb56ed6a96e9b9f0b8d88c454 /sys/dev/mii/nsphyter.c | |
parent | 1a3645ca83813fc2e64c18e68bc05f090c935f93 (diff) |
use mii_phy_match()
Diffstat (limited to 'sys/dev/mii/nsphyter.c')
-rw-r--r-- | sys/dev/mii/nsphyter.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/sys/dev/mii/nsphyter.c b/sys/dev/mii/nsphyter.c index e5cab70a76b..0eef321db5f 100644 --- a/sys/dev/mii/nsphyter.c +++ b/sys/dev/mii/nsphyter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nsphyter.c,v 1.9 2005/01/28 18:27:55 brad Exp $ */ +/* $OpenBSD: nsphyter.c,v 1.10 2005/02/05 22:20:42 brad Exp $ */ /* $NetBSD: nsphyter.c,v 1.5 2000/02/02 23:34:57 thorpej Exp $ */ /*- @@ -107,18 +107,23 @@ const struct mii_phy_funcs nsphyter_funcs = { nsphyter_service, nsphyter_status, mii_phy_reset, }; +static const struct mii_phydesc nsphyterphys[] = { + { MII_OUI_NATSEMI, MII_MODEL_NATSEMI_DP83843, + MII_STR_NATSEMI_DP83843 }, + { MII_OUI_NATSEMI, MII_MODEL_NATSEMI_DP83815, + MII_STR_NATSEMI_DP83815 }, + + { 0, 0, + NULL }, +}; + int nsphytermatch(struct device *parent, void *match, void *aux) { struct mii_attach_args *ma = aux; - if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_NATSEMI) { - switch (MII_MODEL(ma->mii_id2)) { - case MII_MODEL_NATSEMI_DP83843: - case MII_MODEL_NATSEMI_DP83815: - return (10); - } - } + if (mii_phy_match(ma, nsphyterphys) != NULL) + return (10); return (0); } @@ -129,12 +134,10 @@ nsphyterattach(struct device *parent, struct device *self, void *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; - if (MII_MODEL(ma->mii_id2) == MII_MODEL_NATSEMI_DP83815) - printf(": %s", MII_STR_NATSEMI_DP83815); - else - printf(": %s", MII_STR_NATSEMI_DP83843); - printf(", rev. %d\n", MII_REV(ma->mii_id2)); + mpd = mii_phy_match(ma, nsphyterphys); + 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; |