aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ep
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2009-04-11 02:47:03 +0000
committerWarner Losh <imp@FreeBSD.org>2009-04-11 02:47:03 +0000
commit52fcedff5096739247814d3095870b3a2c1e7786 (patch)
treeb0d6699e2c9500faffbb27ef48b7b148c1434347 /sys/dev/ep
parent88fd9cff39b0d8109b963bf5e5b0e019a9e9fbbc (diff)
Notes
Diffstat (limited to 'sys/dev/ep')
-rw-r--r--sys/dev/ep/if_ep.c19
-rw-r--r--sys/dev/ep/if_epreg.h12
2 files changed, 30 insertions, 1 deletions
diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c
index 3b913693a3dc..b6aac055eb95 100644
--- a/sys/dev/ep/if_ep.c
+++ b/sys/dev/ep/if_ep.c
@@ -435,6 +435,7 @@ epinit_locked(struct ep_softc *sc)
if (!sc->epb.mii_trans)
ep_ifmedia_upd(ifp);
+ CSR_WRITE_2(sc, EP_COMMAND, TX_PLL_ENABLE);
CSR_WRITE_2(sc, EP_COMMAND, RX_ENABLE);
CSR_WRITE_2(sc, EP_COMMAND, TX_ENABLE);
@@ -895,8 +896,24 @@ static void
ep_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
{
struct ep_softc *sc = ifp->if_softc;
+ uint16_t ms;
- ifmr->ifm_active = sc->ifmedia.ifm_media;
+ switch (IFM_SUBTYPE(sc->ifmedia.ifm_media)) {
+ case IFM_10_T:
+ GO_WINDOW(sc, 4);
+ ms = CSR_READ_2(sc, EP_W4_MEDIA_TYPE);
+ GO_WINDOW(sc, 0);
+ ifmr->ifm_status = IFM_AVALID;
+ if (ms & MT_LB) {
+ ifmr->ifm_status |= IFM_ACTIVE;
+ ifmr->ifm_active = IFM_ETHER | IFM_10_T;
+ } else {
+ ifmr->ifm_active = IFM_ETHER | IFM_NONE;
+ }
+ default:
+ ifmr->ifm_active = sc->ifmedia.ifm_media;
+ break;
+ }
}
static int
diff --git a/sys/dev/ep/if_epreg.h b/sys/dev/ep/if_epreg.h
index 25ab182ae40c..f3c269f55619 100644
--- a/sys/dev/ep/if_epreg.h
+++ b/sys/dev/ep/if_epreg.h
@@ -156,6 +156,7 @@
* Window 2 registers. Station Address Setup/Read
*/
/* Read/Write */
+#define EP_W2_PHY_MGMT 0x0c
#define EP_W2_ALT_EEPROM 0x0a
#define EP_W2_ADDR_5 0x05
#define EP_W2_ADDR_4 0x04
@@ -406,6 +407,17 @@
#define LINKBEAT_ENABLE 0x80
#define ENABLE_UTP (JABBER_GUARD_ENABLE | LINKBEAT_ENABLE)
#define DISABLE_UTP 0x0
+#define MT_CSD 0x0004 /* CRC Strip disable */
+#define MT_SQE 0x0008 /* SQE Enable */
+#define MT_C0 0x0010 /* Collison */
+#define MT_CS 0x0020 /* Carrier Sense */
+#define MT_J 0x0200 /* Jabber detected */
+#define MT_PL 0x0400 /* Plarity Inverted */
+#define MT_LB 0x0800 /* Link Beat detected */
+#define MT_SQ 0x1000 /* SQE Present */
+#define MT_IN 0x2000 /* Reserved */
+#define MT_CE 0x4000 /* Coax */
+#define MT_TPE 0x8000
/*
* Misc defines for various things.