Author: imp
Date: Sat Apr 11 02:47:03 2009
New Revision: 190907
URL: http://svn.freebsd.org/changeset/base/190907

Log:
  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.

Modified:
  head/sys/dev/ep/if_ep.c
  head/sys/dev/ep/if_epreg.h

Modified: head/sys/dev/ep/if_ep.c
==============================================================================
--- head/sys/dev/ep/if_ep.c     Sat Apr 11 02:39:30 2009        (r190906)
+++ head/sys/dev/ep/if_ep.c     Sat Apr 11 02:47:03 2009        (r190907)
@@ -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

Modified: head/sys/dev/ep/if_epreg.h
==============================================================================
--- head/sys/dev/ep/if_epreg.h  Sat Apr 11 02:39:30 2009        (r190906)
+++ head/sys/dev/ep/if_epreg.h  Sat Apr 11 02:47:03 2009        (r190907)
@@ -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.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to