summaryrefslogtreecommitdiff
path: root/sys/dev/mii/brgphy.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-02-05 19:11:35 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-02-05 19:11:35 +0000
commit793659cdd76b0f609598306130ebc06d5e79136e (patch)
treed2f4340c435d81fee09945e93c11f6d8fae9b366 /sys/dev/mii/brgphy.c
parent8f106cfcc120c058aea9f5ef15cac8aeb69993b0 (diff)
use mii_phy_match()
Diffstat (limited to 'sys/dev/mii/brgphy.c')
-rw-r--r--sys/dev/mii/brgphy.c64
1 files changed, 30 insertions, 34 deletions
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index 0a8ba6a1758..f383548c5e3 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: brgphy.c,v 1.20 2005/01/24 02:27:12 brad Exp $ */
+/* $OpenBSD: brgphy.c,v 1.21 2005/02/05 19:11:34 brad Exp $ */
/*
* Copyright (c) 2000
@@ -89,21 +89,36 @@ const struct mii_phy_funcs brgphy_funcs = {
brgphy_service, brgphy_status, brgphy_reset,
};
+static const struct mii_phydesc brgphys[] = {
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5400,
+ MII_STR_xxBROADCOM_BCM5400 },
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5401,
+ MII_STR_xxBROADCOM_BCM5401 },
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5411,
+ MII_STR_xxBROADCOM_BCM5411 },
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5421S,
+ MII_STR_xxBROADCOM_BCM5421S },
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5701,
+ MII_STR_xxBROADCOM_BCM5701 },
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5703,
+ MII_STR_xxBROADCOM_BCM5703 },
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5704,
+ MII_STR_xxBROADCOM_BCM5704 },
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5705,
+ MII_STR_xxBROADCOM_BCM5705 },
+ { MII_OUI_xxBROADCOM, MII_MODEL_xxBROADCOM_BCM5750,
+ MII_STR_xxBROADCOM_BCM5750 },
+
+ { 0, 0,
+ NULL },
+};
+
int
brgphy_probe(struct device *parent, void *match, void *aux)
{
struct mii_attach_args *ma = aux;
- if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM &&
- (MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5400 ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5401 ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5411 ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5421S ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5701 ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5703 ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5704 ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5705 ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5750))
+ if(mii_phy_match(ma, brgphys) != NULL)
return(10);
return(0);
@@ -115,29 +130,10 @@ brgphy_attach(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;
- char *model;
-
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5400 ||
- MII_MODEL(ma->mii_id2) == MII_MODEL_BROADCOM_BCM5400)
- model = MII_STR_BROADCOM_BCM5400;
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_BROADCOM_BCM5401)
- model = MII_STR_BROADCOM_BCM5401;
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_BROADCOM_BCM5411)
- model = MII_STR_BROADCOM_BCM5411;
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5421S)
- model = MII_STR_xxBROADCOM_BCM5421S;
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5701)
- model = MII_STR_xxBROADCOM_BCM5701;
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5703)
- model = MII_STR_xxBROADCOM_BCM5703;
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5704)
- model = MII_STR_xxBROADCOM_BCM5704;
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5705)
- model = MII_STR_xxBROADCOM_BCM5705;
- if (MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5750)
- model = MII_STR_xxBROADCOM_BCM5750;
-
- printf(": %s, rev. %d\n", model, MII_REV(ma->mii_id2));
+ const struct mii_phydesc *mpd;
+
+ 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;