Module Name: src
Committed By: martin
Date: Sun Sep 1 13:56:01 UTC 2019
Modified Files:
src/sys/dev/mii [netbsd-9]: etphy.c miidevs
Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #144):
sys/dev/mii/miidevs: revision 1.154
sys/dev/mii/etphy.c: revision 1.5
sys/dev/mii/etphy.c: revision 1.6
No functional change:
- Use static.
- KNF.
>From FreeBSD:
- Rename ET1011 to ET1011C
- Add ET1011
>From FreeBSD:
- Support ET1011.
- Use mii_phy_flowstatus() to reflect flow status from negotiated result.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/dev/mii/etphy.c
cvs rdiff -u -r1.153 -r1.153.2.1 src/sys/dev/mii/miidevs
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/mii/etphy.c
diff -u src/sys/dev/mii/etphy.c:1.4 src/sys/dev/mii/etphy.c:1.4.4.1
--- src/sys/dev/mii/etphy.c:1.4 Mon Mar 25 09:29:08 2019
+++ src/sys/dev/mii/etphy.c Sun Sep 1 13:56:01 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: etphy.c,v 1.4 2019/03/25 09:29:08 msaitoh Exp $ */
+/* $NetBSD: etphy.c,v 1.4.4.1 2019/09/01 13:56:01 martin 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.4 2019/03/25 09:29:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: etphy.c,v 1.4.4.1 2019/09/01 13:56:01 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -77,18 +77,19 @@ __KERNEL_RCSID(0, "$NetBSD: etphy.c,v 1.
#define ETPHY_SR_FDX 0x0080
-int etphy_service(struct mii_softc *, struct mii_data *, int);
-void etphy_attach(device_t, device_t, void *);
-int etphy_match(device_t, cfdata_t, void *);
-void etphy_reset(struct mii_softc *);
-void etphy_status(struct mii_softc *);
+static int etphy_service(struct mii_softc *, struct mii_data *, int);
+static void etphy_attach(device_t, device_t, void *);
+static int etphy_match(device_t, cfdata_t, void *);
+static void etphy_reset(struct mii_softc *);
+static void etphy_status(struct mii_softc *);
-const struct mii_phy_funcs etphy_funcs = {
+static const struct mii_phy_funcs etphy_funcs = {
etphy_service, etphy_status, etphy_reset,
};
static const struct mii_phydesc etphys[] = {
MII_PHY_DESC(AGERE, ET1011),
+ MII_PHY_DESC(AGERE, ET1011C),
MII_PHY_END,
};
@@ -133,7 +134,7 @@ static const struct etphy_dsp {
{ 0x8010, 46 } /* IdlguardTime */
};
-int
+static int
etphy_match(device_t parent, cfdata_t match, void *aux)
{
struct mii_attach_args *ma = aux;
@@ -144,7 +145,7 @@ etphy_match(device_t parent, cfdata_t ma
return 0;
}
-void
+static void
etphy_attach(device_t parent, device_t self, void *aux)
{
struct mii_softc *sc = device_private(self);
@@ -185,7 +186,7 @@ etphy_attach(device_t parent, device_t s
aprint_error_dev(self, "couldn't establish power handler\n");
}
-int
+static int
etphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
@@ -229,7 +230,7 @@ etphy_service(struct mii_softc *sc, stru
if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) {
PHY_WRITE(sc, MII_BMCR,
- bmcr | BMCR_AUTOEN | BMCR_STARTNEG);
+ bmcr | BMCR_AUTOEN | BMCR_STARTNEG);
}
}
break;
@@ -252,19 +253,23 @@ etphy_service(struct mii_softc *sc, stru
return 0;
}
-void
+static void
etphy_reset(struct mii_softc *sc)
{
uint16_t reg;
int i;
+ if (sc->mii_mpd_model == MII_MODEL_AGERE_ET1011) {
+ mii_phy_reset(sc);
+ return;
+ }
+
for (i = 0; i < 2; ++i) {
PHY_READ(sc, MII_PHYIDR1, ®);
PHY_READ(sc, MII_PHYIDR2, ®);
PHY_READ(sc, ETPHY_CTRL, ®);
- PHY_WRITE(sc, ETPHY_CTRL,
- ETPHY_CTRL_DIAG | ETPHY_CTRL_RSV1);
+ PHY_WRITE(sc, ETPHY_CTRL, ETPHY_CTRL_DIAG | ETPHY_CTRL_RSV1);
PHY_WRITE(sc, ETPHY_INDEX, ETPHY_INDEX_MAGIC);
PHY_READ(sc, ETPHY_DATA, ®);
@@ -294,13 +299,13 @@ etphy_reset(struct mii_softc *sc)
PHY_READ(sc, MII_BMCR, ®);
PHY_READ(sc, ETPHY_CTRL, ®);
- PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN | BMCR_S1000);
+ PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN | BMCR_S1000);
PHY_WRITE(sc, ETPHY_CTRL, ETPHY_CTRL_RSV1);
mii_phy_reset(sc);
}
-void
+static void
etphy_status(struct mii_softc *sc)
{
struct mii_data *mii = sc->mii_pdata;
@@ -340,7 +345,7 @@ etphy_status(struct mii_softc *sc)
}
if (sr & ETPHY_SR_FDX)
- mii->mii_media_active |= IFM_FDX;
+ mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc);
else
mii->mii_media_active |= IFM_HDX;
}
Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.153 src/sys/dev/mii/miidevs:1.153.2.1
--- src/sys/dev/mii/miidevs:1.153 Thu Jun 6 16:04:13 2019
+++ src/sys/dev/mii/miidevs Sun Sep 1 13:56:01 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.153 2019/06/06 16:04:13 thorpej Exp $
+$NetBSD: miidevs,v 1.153.2.1 2019/09/01 13:56:01 martin Exp $
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -124,7 +124,8 @@ oui xxXAQTI 0xace000 XaQti Corp.
/*
* Agere PHYs
*/
-model AGERE ET1011 0x0004 Agere ET1011 10/100/1000baseT PHY
+model AGERE ET1011 0x0001 ET1011 10/100/1000baseT PHY
+model AGERE ET1011C 0x0004 ET1011C 10/100/1000baseT PHY
/* Asix semiconductor PHYs */
model xxASIX AX88X9X 0x0031 Ax88x9x internal PHY