summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii/rlphy.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-10-02 18:53:12 +0000
committermarius <marius@FreeBSD.org>2010-10-02 18:53:12 +0000
commit9c329941907d63b275da17ba20294c7f0a2e324b (patch)
treebe43fedc87f2ffc4b3d13f6ff4002bb017799ac5 /sys/dev/mii/rlphy.c
parente9dc33bfce177d81402bea81ce874ef0bb9f3536 (diff)
downloadFreeBSD-src-9c329941907d63b275da17ba20294c7f0a2e324b.zip
FreeBSD-src-9c329941907d63b275da17ba20294c7f0a2e324b.tar.gz
- In the spirit of previous simplifications factor out the checks for a
different PHY instance being selected and isolation out into the wrappers around the service methods rather than duplicating them over and over again (besides, a PHY driver shouldn't need to care about which instance it actually is). - Centralize the check for the need to isolate a non-zero PHY instance not supporting isolation in mii_mediachg() and just ignore it rather than panicing, which should sufficient given that a) things are likely to just work anyway if one doesn't plug in more than one port at a time and b) refusing to attach in this case just leaves us in a unknown but most likely also not exactly correct configuration (besides several drivers setting MIIF_NOISOLATE didn't care about these anyway, probably due to setting this flag for no real reason). - Minor fixes like removing unnecessary setting of sc->mii_anegticks, using sc->mii_anegticks instead of hardcoded values etc.
Diffstat (limited to 'sys/dev/mii/rlphy.c')
-rw-r--r--sys/dev/mii/rlphy.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c
index e2ceb62..21cce93 100644
--- a/sys/dev/mii/rlphy.c
+++ b/sys/dev/mii/rlphy.c
@@ -139,23 +139,16 @@ rlphy_attach(device_t dev)
if (mii_phy_dev_probe(dev, rlphys, 0) == 0)
rsc->sc_is_RTL8201L++;
- /*
- * The RealTek PHY can never be isolated, so never allow non-zero
- * instances!
- */
- if (mii->mii_instance != 0) {
- device_printf(dev, "ignoring this PHY, non-zero instance\n");
- return (ENXIO);
- }
-
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
- sc->mii_inst = mii->mii_instance;
+ sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = rlphy_service;
sc->mii_pdata = mii;
- mii->mii_instance++;
+ /*
+ * The RealTek PHY can never be isolated.
+ */
sc->mii_flags |= MIIF_NOISOLATE;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
@@ -165,8 +158,7 @@ rlphy_attach(device_t dev)
mii_phy_reset(sc);
- sc->mii_capabilities =
- PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
+ sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
device_printf(dev, " ");
mii_phy_add_media(sc);
printf("\n");
@@ -178,13 +170,6 @@ rlphy_attach(device_t dev)
static int
rlphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{
- struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-
- /*
- * We can't isolate the RealTek PHY, so it has to be the only one!
- */
- if (IFM_INST(ife->ifm_media) != sc->mii_inst)
- panic("rlphy_service: can't isolate RealTek PHY");
switch (cmd) {
case MII_POLLSTAT:
OpenPOWER on IntegriCloud