Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/mii Don't do full initialization for autonego when j...
details: https://anonhg.NetBSD.org/src/rev/210d3919044b
branches: trunk
changeset: 943031:210d3919044b
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Aug 24 04:23:41 2020 +0000
description:
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).
diffstat:
sys/dev/mii/ciphy.c | 6 +++---
sys/dev/mii/mii_physubr.c | 23 ++++++++++++++++++-----
sys/dev/mii/miivar.h | 3 ++-
sys/dev/mii/urlphy.c | 6 +++---
4 files changed, 26 insertions(+), 12 deletions(-)
diffs (129 lines):
diff -r 49b438f0b243 -r 210d3919044b sys/dev/mii/ciphy.c
--- a/sys/dev/mii/ciphy.c Sun Aug 23 22:49:45 2020 +0000
+++ b/sys/dev/mii/ciphy.c Mon Aug 24 04:23:41 2020 +0000
@@ -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 @@
if (sc->mii_ticks <= sc->mii_anegticks)
break;
- mii_phy_auto(sc);
+ mii_phy_auto_restart(sc);
return 0;
}
diff -r 49b438f0b243 -r 210d3919044b sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Sun Aug 23 22:49:45 2020 +0000
+++ b/sys/dev/mii/mii_physubr.c Mon Aug 24 04:23:41 2020 +0000
@@ -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 @@
PHY_WRITE(sc, MII_BMCR, bmcr);
}
+/* Setup autonegotiation and start it. */
int
mii_phy_auto(struct mii_softc *sc)
{
@@ -283,6 +284,20 @@
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 @@
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;
/*
diff -r 49b438f0b243 -r 210d3919044b sys/dev/mii/miivar.h
--- a/sys/dev/mii/miivar.h Sun Aug 23 22:49:45 2020 +0000
+++ b/sys/dev/mii/miivar.h Mon Aug 24 04:23:41 2020 +0000
@@ -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 @@
/* 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 *);
diff -r 49b438f0b243 -r 210d3919044b sys/dev/mii/urlphy.c
--- a/sys/dev/mii/urlphy.c Sun Aug 23 22:49:45 2020 +0000
+++ b/sys/dev/mii/urlphy.c Mon Aug 24 04:23:41 2020 +0000
@@ -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@localhost>. 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 @@
PHY_RESET(sc);
- if (mii_phy_auto(sc) == EJUSTRETURN)
+ if (mii_phy_auto_restart(sc) == EJUSTRETURN)
return 0;
break;
Home |
Main Index |
Thread Index |
Old Index