Author: rpaulo
Date: Sun Jul 15 05:49:02 2012
New Revision: 238466
URL: http://svn.freebsd.org/changeset/base/238466

Log:
  The JP1082 device doesn't respond to the MII_BMSR command and it turns
  out that it has an unusable PHY. It still works, although very slowly,
  without a PHY, so I implemented non-PHY support in the udav driver.

Modified:
  head/sys/dev/usb/net/if_udav.c
  head/sys/dev/usb/net/if_udavreg.h

Modified: head/sys/dev/usb/net/if_udav.c
==============================================================================
--- head/sys/dev/usb/net/if_udav.c      Sun Jul 15 05:41:43 2012        
(r238465)
+++ head/sys/dev/usb/net/if_udav.c      Sun Jul 15 05:49:02 2012        
(r238466)
@@ -169,7 +169,7 @@ MODULE_DEPEND(udav, ether, 1, 1, 1);
 MODULE_DEPEND(udav, miibus, 1, 1, 1);
 MODULE_VERSION(udav, 1);
 
-static const struct usb_ether_methods udav_ue_methods = {
+static struct usb_ether_methods udav_ue_methods = {
        .ue_attach_post = udav_attach_post,
        .ue_start = udav_start,
        .ue_init = udav_init,
@@ -206,7 +206,8 @@ static const STRUCT_USB_HOST_ID udav_dev
        {USB_VPI(USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ADM8515, 0)},
        /* Kontron AG USB Ethernet */
        {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_DM9601, 0)},
-       {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_JP1082, 0)},
+       {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_JP1082,
+           UDAV_FLAG_NO_PHY)},
 };
 
 static void
@@ -259,6 +260,16 @@ udav_attach(device_t dev)
                goto detach;
        }
 
+       /*
+        * The JP1082 has an unusable PHY and provides no link information.
+        */
+       if (sc->sc_flags & UDAV_FLAG_NO_PHY) {
+               udav_ue_methods.ue_tick = NULL;
+               udav_ue_methods.ue_mii_upd = NULL;
+               udav_ue_methods.ue_mii_sts = NULL;
+               sc->sc_flags |= UDAV_FLAG_LINK;
+       }
+
        ue->ue_sc = sc;
        ue->ue_dev = dev;
        ue->ue_udev = uaa->device;
@@ -712,7 +723,8 @@ udav_stop(struct usb_ether *ue)
        UDAV_LOCK_ASSERT(sc, MA_OWNED);
 
        ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-       sc->sc_flags &= ~UDAV_FLAG_LINK;
+       if (!(sc->sc_flags & UDAV_FLAG_NO_PHY))
+               sc->sc_flags &= ~UDAV_FLAG_LINK;
 
        /*
         * stop all the transfers, if not already stopped:

Modified: head/sys/dev/usb/net/if_udavreg.h
==============================================================================
--- head/sys/dev/usb/net/if_udavreg.h   Sun Jul 15 05:41:43 2012        
(r238465)
+++ head/sys/dev/usb/net/if_udavreg.h   Sun Jul 15 05:49:02 2012        
(r238466)
@@ -159,6 +159,7 @@ struct udav_softc {
        int                     sc_flags;
 #define        UDAV_FLAG_LINK          0x0001
 #define        UDAV_FLAG_EXT_PHY       0x0040
+#define        UDAV_FLAG_NO_PHY        0x0080
 };
 
 #define        UDAV_LOCK(_sc)                  mtx_lock(&(_sc)->sc_mtx)
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to