Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/mii Attansic L2 is 10/100 but the status registers r...
details: https://anonhg.NetBSD.org/src/rev/70b4bf17fddb
branches: trunk
changeset: 770082:70b4bf17fddb
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Oct 02 21:42:19 2011 +0000
description:
Attansic L2 is 10/100 but the status registers report 1000 Mbps, so don't
bother reading MII_EXTSR for this part. Also use MII_ANEGTICKS instead of
MII_ANEGTICKS_GIGE for this part.
diffstat:
sys/dev/mii/atphy.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diffs (68 lines):
diff -r f182a0c33cfa -r 70b4bf17fddb sys/dev/mii/atphy.c
--- a/sys/dev/mii/atphy.c Sun Oct 02 21:32:48 2011 +0000
+++ b/sys/dev/mii/atphy.c Sun Oct 02 21:42:19 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atphy.c,v 1.10 2011/02/23 03:22:44 jmcneill Exp $ */
+/* $NetBSD: atphy.c,v 1.11 2011/10/02 21:42:19 jmcneill Exp $ */
/* $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $ */
/*-
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.10 2011/02/23 03:22:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.11 2011/10/02 21:42:19 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -81,6 +81,7 @@
static void atphy_reset(struct mii_softc *);
static void atphy_status(struct mii_softc *);
static int atphy_mii_phy_auto(struct mii_softc *);
+static bool atphy_is_gige(const struct mii_phydesc *);
CFATTACH_DECL_NEW(atphy, sizeof(struct mii_softc),
atphy_match, atphy_attach, mii_phy_detach, mii_phy_activate);
@@ -102,6 +103,20 @@
NULL },
};
+static bool
+atphy_is_gige(const struct mii_phydesc *mpd)
+{
+ switch (mpd->mpd_oui) {
+ case MII_OUI_ATTANSIC:
+ switch (mpd->mpd_model) {
+ case MII_MODEL_ATTANSIC_L2:
+ return false;
+ }
+ }
+
+ return true;
+}
+
static int
atphy_match(device_t parent, cfdata_t match, void *aux)
{
@@ -132,7 +147,10 @@
sc->mii_funcs = &atphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = MII_ANEGTICKS_GIGE;
+ if (atphy_is_gige(mpd))
+ sc->mii_anegticks = MII_ANEGTICKS_GIGE;
+ else
+ sc->mii_anegticks = MII_ANEGTICKS;
sc->mii_flags |= MIIF_NOLOOP;
@@ -140,7 +158,7 @@
bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
sc->mii_capabilities = bmsr & ma->mii_capmask;
- if (sc->mii_capabilities & BMSR_EXTSTAT)
+ if (atphy_is_gige(mpd) && (sc->mii_capabilities & BMSR_EXTSTAT))
sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
aprint_normal_dev(self, "");
Home |
Main Index |
Thread Index |
Old Index