summaryrefslogtreecommitdiffstats
path: root/sys/dev/ep
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2009-04-11 02:47:03 +0000
committerimp <imp@FreeBSD.org>2009-04-11 02:47:03 +0000
commit9cde3e407409ecc37e023b3d0a53c121ffb1cfc7 (patch)
treeb0d6699e2c9500faffbb27ef48b7b148c1434347 /sys/dev/ep
parent4c9797d7424f1644af3085d5fb749437cd231303 (diff)
downloadFreeBSD-src-9cde3e407409ecc37e023b3d0a53c121ffb1cfc7.zip
FreeBSD-src-9cde3e407409ecc37e023b3d0a53c121ffb1cfc7.tar.gz
o Report ethernet status for at least 10BaseT media. Since I don't
have other media to test against, I've left that media reporting unchanged. o Enable the TX_PLL when we enable TX. This is harmless on most cards, but required to get the 3c1 CF card working. Power savings could be had by managing this better, but for now it gets my card working.
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 3b91369..b6aac05 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 25ab182..f3c269f 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.
OpenPOWER on IntegriCloud