Add a MIIF_FORCEANEG flag to be passed to mii_attach. This forces an

autonegotiation to take place if IFM_AUTO is selected in mii_media_set.
Make the gem driver use it.  (XXX hme probably should use it but I can't
test that).
This commit is contained in:
matt 2003-02-20 00:55:21 +00:00
parent b42cde14b7
commit 4630a8e7f3
3 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: gem.c,v 1.24 2003/01/31 00:26:30 thorpej Exp $ */
/* $NetBSD: gem.c,v 1.25 2003/02/20 00:55:21 matt Exp $ */
/*
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.24 2003/01/31 00:26:30 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.25 2003/02/20 00:55:21 matt Exp $");
#include "bpfilter.h"
@ -259,7 +259,7 @@ gem_attach(sc, enaddr)
gem_mifinit(sc);
mii_attach(&sc->sc_dev, mii, 0xffffffff,
MII_PHY_ANY, MII_OFFSET_ANY, 0);
MII_PHY_ANY, MII_OFFSET_ANY, MIIF_FORCEANEG);
child = LIST_FIRST(&mii->mii_phys);
if (child == NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: mii_physubr.c,v 1.34 2002/11/07 07:41:24 thorpej Exp $ */
/* $NetBSD: mii_physubr.c,v 1.35 2003/02/20 00:55:21 matt Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.34 2002/11/07 07:41:24 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.35 2003/02/20 00:55:21 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -114,7 +114,8 @@ mii_phy_setmedia(struct mii_softc *sc)
int bmcr, anar, gtcr;
if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0)
if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0 ||
(sc->mii_flags & MIIF_FORCEANEG))
(void) mii_phy_auto(sc, 1);
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: miivar.h,v 1.34 2002/11/07 07:45:03 thorpej Exp $ */
/* $NetBSD: miivar.h,v 1.35 2003/02/20 00:55:22 matt Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -150,6 +150,7 @@ typedef struct mii_softc mii_softc_t;
#define MIIF_IS_1000X 0x0080 /* is a 1000BASE-X device */
#define MIIF_DOPAUSE 0x0100 /* advertise PAUSE capability */
#define MIIF_IS_HPNA 0x0200 /* is a HomePNA device */
#define MIIF_FORCEANEG 0x0400 /* is a HomePNA device */
#define MIIF_INHERIT_MASK (MIIF_NOISOLATE|MIIF_NOLOOP|MIIF_AUTOTSLEEP)