source: hybrid/branches/releng-9/nanobsd/patches/udav-broken-phy.patch@ 12751

Last change on this file since 12751 was 12219, checked in by rick, 12 years ago

Add patch for broken udav adapters.

File size: 2.3 KB
  • TabularUnified sys/dev/usb/net/if_udav.c

    #------------------------------------------------------------------------
    #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.
    #
    #------------------------------------------------------------------------
     
    169169MODULE_DEPEND(udav, miibus, 1, 1, 1);
    170170MODULE_VERSION(udav, 1);
    171171
    172 static const struct usb_ether_methods udav_ue_methods = {
     172static struct usb_ether_methods udav_ue_methods = {
    173173        .ue_attach_post = udav_attach_post,
    174174        .ue_start = udav_start,
    175175        .ue_init = udav_init,
     
    206206        {USB_VPI(USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ADM8515, 0)},
    207207        /* Kontron AG USB Ethernet */
    208208        {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_DM9601, 0)},
    209         {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_JP1082, 0)},
     209        {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_JP1082,
     210            UDAV_FLAG_NO_PHY)},
    210211};
    211212
    212213static void
     
    259260                goto detach;
    260261        }
    261262
     263        /*
     264         * The JP1082 has an unusable PHY and provides no link information.
     265         */
     266        if (sc->sc_flags & UDAV_FLAG_NO_PHY) {
     267                udav_ue_methods.ue_tick = NULL;
     268                udav_ue_methods.ue_mii_upd = NULL;
     269                udav_ue_methods.ue_mii_sts = NULL;
     270                sc->sc_flags |= UDAV_FLAG_LINK;
     271        }
     272
    262273        ue->ue_sc = sc;
    263274        ue->ue_dev = dev;
    264275        ue->ue_udev = uaa->device;
     
    712723        UDAV_LOCK_ASSERT(sc, MA_OWNED);
    713724
    714725        ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
    715         sc->sc_flags &= ~UDAV_FLAG_LINK;
     726        if (!(sc->sc_flags & UDAV_FLAG_NO_PHY))
     727                sc->sc_flags &= ~UDAV_FLAG_LINK;
    716728
    717729        /*
    718730         * stop all the transfers, if not already stopped:
  • TabularUnified sys/dev/usb/net/if_udavreg.h

     
    159159        int                     sc_flags;
    160160#define UDAV_FLAG_LINK          0x0001
    161161#define UDAV_FLAG_EXT_PHY       0x0040
     162#define UDAV_FLAG_NO_PHY        0x0080
    162163};
    163164
    164165#define UDAV_LOCK(_sc)                  mtx_lock(&(_sc)->sc_mtx)
Note: See TracBrowser for help on using the repository browser.