- Remove the waitfor argument from mii_phy_auto().
- Whitespace fix.
This commit is contained in:
parent
53f3973f63
commit
d245628f58
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ciphy.c,v 1.39 2020/03/15 23:04:50 thorpej Exp $ */
|
||||
/* $NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.39 2020/03/15 23:04:50 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $");
|
||||
|
||||
/*
|
||||
* Driver for the Cicada CS8201 10/100/1000 copper PHY.
|
||||
|
@ -173,7 +173,7 @@ ciphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
|||
if (reg & BMCR_AUTOEN)
|
||||
return 0;
|
||||
#endif
|
||||
(void) mii_phy_auto(sc, 0);
|
||||
(void) mii_phy_auto(sc);
|
||||
break;
|
||||
case IFM_1000_T:
|
||||
speed = BMCR_S1000;
|
||||
|
@ -273,7 +273,7 @@ setit:
|
|||
if (sc->mii_ticks <= sc->mii_anegticks)
|
||||
break;
|
||||
|
||||
mii_phy_auto(sc, 0);
|
||||
mii_phy_auto(sc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: igphy.c,v 1.33 2020/03/15 23:04:50 thorpej Exp $ */
|
||||
/* $NetBSD: igphy.c,v 1.34 2020/07/07 08:44:12 msaitoh Exp $ */
|
||||
|
||||
/*
|
||||
* The Intel copyright applies to the analog register setup, and the
|
||||
|
@ -70,7 +70,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.33 2020/03/15 23:04:50 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.34 2020/07/07 08:44:12 msaitoh Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_mii.h"
|
||||
|
@ -523,14 +523,14 @@ igphy_smartspeed_workaround(struct mii_softc *sc)
|
|||
gtcr &= ~GTCR_MAN_MS;
|
||||
PHY_WRITE(sc, MII_100T2CR, gtcr);
|
||||
}
|
||||
mii_phy_auto(sc, 0);
|
||||
mii_phy_auto(sc);
|
||||
}
|
||||
break;
|
||||
case IGPHY_TICK_DOWNSHIFT:
|
||||
PHY_READ(sc, MII_100T2CR, >cr);
|
||||
gtcr |= GTCR_MAN_MS;
|
||||
PHY_WRITE(sc, MII_100T2CR, gtcr);
|
||||
mii_phy_auto(sc, 0);
|
||||
mii_phy_auto(sc);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mii_physubr.c,v 1.90 2020/03/15 23:04:50 thorpej Exp $ */
|
||||
/* $NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 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.90 2020/03/15 23:04:50 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -147,7 +147,7 @@ mii_phy_setmedia(struct mii_softc *sc)
|
|||
PHY_READ(sc, MII_BMCR, &bmcr);
|
||||
if ((bmcr & BMCR_AUTOEN) == 0 ||
|
||||
(sc->mii_flags & (MIIF_FORCEANEG | MIIF_DOPAUSE)))
|
||||
(void) mii_phy_auto(sc, 1);
|
||||
(void) mii_phy_auto(sc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -193,15 +193,14 @@ mii_phy_setmedia(struct mii_softc *sc)
|
|||
if (sc->mii_flags & MIIF_HAVE_GTCR)
|
||||
PHY_WRITE(sc, MII_100T2CR, gtcr);
|
||||
if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T)
|
||||
mii_phy_auto(sc, 0);
|
||||
mii_phy_auto(sc);
|
||||
else
|
||||
PHY_WRITE(sc, MII_BMCR, bmcr);
|
||||
}
|
||||
|
||||
int
|
||||
mii_phy_auto(struct mii_softc *sc, int waitfor)
|
||||
mii_phy_auto(struct mii_softc *sc)
|
||||
{
|
||||
int i;
|
||||
struct mii_data *mii = sc->mii_pdata;
|
||||
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
|
||||
|
||||
|
@ -266,24 +265,6 @@ mii_phy_auto(struct mii_softc *sc, int waitfor)
|
|||
PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG);
|
||||
}
|
||||
|
||||
if (waitfor) {
|
||||
/* Wait 500ms for it to complete. */
|
||||
for (i = 0; i < 500; i++) {
|
||||
uint16_t bmsr;
|
||||
|
||||
PHY_READ(sc, MII_BMSR, &bmsr);
|
||||
if (bmsr & BMSR_ACOMP)
|
||||
return 0;
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't need to worry about clearing MIIF_DOINGAUTO. If that's
|
||||
* set, a timeout is pending, and it will clear the flag.
|
||||
*/
|
||||
return EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
* Just let it finish asynchronously. This is for the benefit of
|
||||
* the tick handler driving autonegotiation. Don't want 500ms
|
||||
|
@ -308,7 +289,7 @@ mii_phy_auto_timeout_locked(struct mii_softc *sc)
|
|||
|
||||
if (!device_is_active(sc->mii_dev))
|
||||
return;
|
||||
|
||||
|
||||
sc->mii_flags &= ~MIIF_DOINGAUTO;
|
||||
|
||||
/* Update the media status. */
|
||||
|
@ -386,7 +367,7 @@ mii_phy_tick(struct mii_softc *sc)
|
|||
|
||||
PHY_RESET(sc);
|
||||
|
||||
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
|
||||
if (mii_phy_auto(sc) == EJUSTRETURN)
|
||||
return EJUSTRETURN;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: miivar.h,v 1.71 2020/05/25 19:47:58 jmcneill Exp $ */
|
||||
/* $NetBSD: miivar.h,v 1.72 2020/07/07 08:44:12 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
|
||||
|
@ -331,7 +331,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);
|
||||
int mii_phy_auto(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: tlphy.c,v 1.70 2020/07/07 08:35:16 msaitoh Exp $ */
|
||||
/* $NetBSD: tlphy.c,v 1.71 2020/07/07 08:44:12 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -59,7 +59,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.70 2020/07/07 08:35:16 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.71 2020/07/07 08:44:12 msaitoh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -367,15 +367,7 @@ tlphy_auto(struct tlphy_softc *tsc)
|
|||
struct mii_softc *sc = &tsc->sc_mii;
|
||||
int error;
|
||||
|
||||
switch ((error = mii_phy_auto(sc, 0))) {
|
||||
case EIO:
|
||||
/*
|
||||
* Just assume we're not in full-duplex mode.
|
||||
* XXX Check link and try AUI/BNC?
|
||||
*/
|
||||
PHY_WRITE(sc, MII_BMCR, 0);
|
||||
break;
|
||||
|
||||
switch ((error = mii_phy_auto(sc))) {
|
||||
case EJUSTRETURN:
|
||||
/* Flag that we need to program when it completes. */
|
||||
tsc->sc_need_acomp = 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: urlphy.c,v 1.35 2019/11/27 10:19:21 msaitoh Exp $ */
|
||||
/* $NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 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.35 2019/11/27 10:19:21 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 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, 0) == EJUSTRETURN)
|
||||
if (mii_phy_auto(sc) == EJUSTRETURN)
|
||||
return 0;
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue