Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Move PHY_RESET() in the media change path from if_et...
details: https://anonhg.NetBSD.org/src/rev/ae4e38700fef
branches: trunk
changeset: 969697:ae4e38700fef
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Fri Feb 28 05:13:19 2020 +0000
description:
Move PHY_RESET() in the media change path from if_et.c to etphy.c.
I don't know if the reset is required or not. I tested some media
transitions without the reset and it worked. It might be OK to remove
but Linux does it only in et1011c_config_aneg(). So move the reset to
etphy_service(,,MII_MEDIACHG)'s autonego case. This change is also
required for future locking changes.
diffstat:
sys/dev/mii/etphy.c | 10 ++++++++--
sys/dev/pci/if_et.c | 24 +++++-------------------
2 files changed, 13 insertions(+), 21 deletions(-)
diffs (97 lines):
diff -r 712c0e0464af -r ae4e38700fef sys/dev/mii/etphy.c
--- a/sys/dev/mii/etphy.c Fri Feb 28 03:52:26 2020 +0000
+++ b/sys/dev/mii/etphy.c Fri Feb 28 05:13:19 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: etphy.c,v 1.7 2019/11/27 10:19:20 msaitoh Exp $ */
+/* $NetBSD: etphy.c,v 1.8 2020/02/28 05:13:19 msaitoh Exp $ */
/* $OpenBSD: etphy.c,v 1.4 2008/04/02 20:12:58 brad Exp $ */
/*
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: etphy.c,v 1.7 2019/11/27 10:19:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: etphy.c,v 1.8 2020/02/28 05:13:19 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -212,6 +212,12 @@
bmcr &= ~BMCR_AUTOEN;
PHY_WRITE(sc, MII_BMCR, bmcr);
PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_PDOWN);
+ } else {
+ /*
+ * Issue reset before configuring autonego.
+ * XXX Is this required?
+ */
+ PHY_RESET(sc);
}
mii_phy_setmedia(sc);
diff -r 712c0e0464af -r ae4e38700fef sys/dev/pci/if_et.c
--- a/sys/dev/pci/if_et.c Fri Feb 28 03:52:26 2020 +0000
+++ b/sys/dev/pci/if_et.c Fri Feb 28 05:13:19 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_et.c,v 1.30 2020/02/04 05:44:14 thorpej Exp $ */
+/* $NetBSD: if_et.c,v 1.31 2020/02/28 05:13:19 msaitoh Exp $ */
/* $OpenBSD: if_et.c,v 1.12 2008/07/11 09:29:02 kevlo $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.30 2020/02/04 05:44:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.31 2020/02/28 05:13:19 msaitoh Exp $");
#include "opt_inet.h"
#include "vlan.h"
@@ -93,7 +93,6 @@
static int et_ioctl(struct ifnet *, u_long, void *);
static void et_start(struct ifnet *);
static void et_watchdog(struct ifnet *);
-static int et_ifmedia_upd(struct ifnet *);
static void et_ifmedia_sts(struct ifnet *, struct ifmediareq *);
static int et_intr(void *);
@@ -280,7 +279,8 @@
mii->mii_statchg = et_miibus_statchg;
sc->sc_ethercom.ec_mii = mii;
- ifmedia_init(&mii->mii_media, 0, et_ifmedia_upd, et_ifmedia_sts);
+ ifmedia_init(&mii->mii_media, 0, ether_mediachange,
+ et_ifmedia_sts);
mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (LIST_FIRST(&mii->mii_phys) == NULL) {
aprint_error_dev(self, "no PHY found!\n");
@@ -544,20 +544,6 @@
#undef NRETRY
}
-static int
-et_ifmedia_upd(struct ifnet *ifp)
-{
- struct et_softc *sc;
- struct mii_data *mii;
- struct mii_softc *miisc;
-
- sc = ifp->if_softc;
- mii = &sc->sc_miibus;
- LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
- PHY_RESET(miisc);
- return (mii_mediachg(mii));
-}
-
static void
et_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
{
@@ -1115,7 +1101,7 @@
ifp->if_flags &= ~IFF_OACTIVE;
sc->sc_flags &= ~ET_FLAG_LINK;
- et_ifmedia_upd(ifp);
+ ether_mediachange(ifp);
back:
if (error)
et_stop(sc);
Home |
Main Index |
Thread Index |
Old Index