Don't do full initialization for autonego when just restarting autonego
because it's not required. This change reduce extra initialization which include PHY_RESET() which caused long delay(max 500ms).
This commit is contained in:
parent
064ff068ec
commit
600be1acda
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $ */
|
||||
/* $NetBSD: ciphy.c,v 1.41 2020/08/24 04:23:41 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.41 2020/08/24 04:23:41 msaitoh Exp $");
|
||||
|
||||
/*
|
||||
* Driver for the Cicada CS8201 10/100/1000 copper PHY.
|
||||
@ -273,7 +273,7 @@ setit:
|
||||
if (sc->mii_ticks <= sc->mii_anegticks)
|
||||
break;
|
||||
|
||||
mii_phy_auto(sc);
|
||||
mii_phy_auto_restart(sc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $ */
|
||||
/* $NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
@ -198,6 +198,7 @@ mii_phy_setmedia(struct mii_softc *sc)
|
||||
PHY_WRITE(sc, MII_BMCR, bmcr);
|
||||
}
|
||||
|
||||
/* Setup autonegotiation and start it. */
|
||||
int
|
||||
mii_phy_auto(struct mii_softc *sc)
|
||||
{
|
||||
@ -283,6 +284,20 @@ mii_phy_auto(struct mii_softc *sc)
|
||||
return EJUSTRETURN;
|
||||
}
|
||||
|
||||
/* Just restart autonegotiation without changing any setting */
|
||||
int
|
||||
mii_phy_auto_restart(struct mii_softc *sc)
|
||||
{
|
||||
uint16_t reg;
|
||||
|
||||
PHY_READ(sc, MII_BMCR, ®);
|
||||
reg |= BMCR_STARTNEG;
|
||||
PHY_WRITE(sc, MII_BMCR, reg);
|
||||
sc->mii_ticks = 0;
|
||||
|
||||
return EJUSTRETURN;
|
||||
}
|
||||
|
||||
static void
|
||||
mii_phy_auto_timeout_locked(struct mii_softc *sc)
|
||||
{
|
||||
@ -365,9 +380,7 @@ mii_phy_tick(struct mii_softc *sc)
|
||||
if (sc->mii_ticks <= sc->mii_anegticks)
|
||||
return EJUSTRETURN;
|
||||
|
||||
PHY_RESET(sc);
|
||||
|
||||
if (mii_phy_auto(sc) == EJUSTRETURN)
|
||||
if (mii_phy_auto_restart(sc) == EJUSTRETURN)
|
||||
return EJUSTRETURN;
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: miivar.h,v 1.72 2020/07/07 08:44:12 msaitoh Exp $ */
|
||||
/* $NetBSD: miivar.h,v 1.73 2020/08/24 04:23:41 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
|
||||
@ -332,6 +332,7 @@ void mii_phy_delete_media(struct mii_softc *);
|
||||
/* MII must be LOCKED */
|
||||
void mii_phy_setmedia(struct mii_softc *);
|
||||
int mii_phy_auto(struct mii_softc *);
|
||||
int mii_phy_auto_restart(struct mii_softc *);
|
||||
void mii_phy_reset(struct mii_softc *);
|
||||
void mii_phy_down(struct mii_softc *);
|
||||
int mii_phy_tick(struct mii_softc *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 msaitoh Exp $ */
|
||||
/* $NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001, 2002
|
||||
* Shingo WATANABE <nabe@nabechan.org>. All rights reserved.
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -199,7 +199,7 @@ urlphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
|
||||
PHY_RESET(sc);
|
||||
|
||||
if (mii_phy_auto(sc) == EJUSTRETURN)
|
||||
if (mii_phy_auto_restart(sc) == EJUSTRETURN)
|
||||
return 0;
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user