#------------------------------------------------------------------------ #r238466 | rpaulo | 2012-07-15 07:49:02 +0200 (Sun, 15 Jul 2012) | 4 lines # #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. # #------------------------------------------------------------------------ Index: sys/dev/usb/net/if_udav.c =================================================================== --- sys/dev/usb/net/if_udav.c (revision 238465) +++ sys/dev/usb/net/if_udav.c (revision 238466) @@ -169,7 +169,7 @@ 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 @@ {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 @@ 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_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: Index: sys/dev/usb/net/if_udavreg.h =================================================================== --- sys/dev/usb/net/if_udavreg.h (revision 238465) +++ sys/dev/usb/net/if_udavreg.h (revision 238466) @@ -159,6 +159,7 @@ 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)