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

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

Add patch for broken udav adapters.

File size: 2.3 KB
RevLine 
[12219]1#------------------------------------------------------------------------
2#r238466 | rpaulo | 2012-07-15 07:49:02 +0200 (Sun, 15 Jul 2012) | 4 lines
3#
4#The JP1082 device doesn't respond to the MII_BMSR command and it turns
5#out that it has an unusable PHY. It still works, although very slowly,
6#without a PHY, so I implemented non-PHY support in the udav driver.
7#
8#------------------------------------------------------------------------
9Index: sys/dev/usb/net/if_udav.c
10===================================================================
11--- sys/dev/usb/net/if_udav.c (revision 238465)
12+++ sys/dev/usb/net/if_udav.c (revision 238466)
13@@ -169,7 +169,7 @@
14 MODULE_DEPEND(udav, miibus, 1, 1, 1);
15 MODULE_VERSION(udav, 1);
16
17-static const struct usb_ether_methods udav_ue_methods = {
18+static struct usb_ether_methods udav_ue_methods = {
19 .ue_attach_post = udav_attach_post,
20 .ue_start = udav_start,
21 .ue_init = udav_init,
22@@ -206,7 +206,8 @@
23 {USB_VPI(USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ADM8515, 0)},
24 /* Kontron AG USB Ethernet */
25 {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_DM9601, 0)},
26- {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_JP1082, 0)},
27+ {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_JP1082,
28+ UDAV_FLAG_NO_PHY)},
29 };
30
31 static void
32@@ -259,6 +260,16 @@
33 goto detach;
34 }
35
36+ /*
37+ * The JP1082 has an unusable PHY and provides no link information.
38+ */
39+ if (sc->sc_flags & UDAV_FLAG_NO_PHY) {
40+ udav_ue_methods.ue_tick = NULL;
41+ udav_ue_methods.ue_mii_upd = NULL;
42+ udav_ue_methods.ue_mii_sts = NULL;
43+ sc->sc_flags |= UDAV_FLAG_LINK;
44+ }
45+
46 ue->ue_sc = sc;
47 ue->ue_dev = dev;
48 ue->ue_udev = uaa->device;
49@@ -712,7 +723,8 @@
50 UDAV_LOCK_ASSERT(sc, MA_OWNED);
51
52 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
53- sc->sc_flags &= ~UDAV_FLAG_LINK;
54+ if (!(sc->sc_flags & UDAV_FLAG_NO_PHY))
55+ sc->sc_flags &= ~UDAV_FLAG_LINK;
56
57 /*
58 * stop all the transfers, if not already stopped:
59Index: sys/dev/usb/net/if_udavreg.h
60===================================================================
61--- sys/dev/usb/net/if_udavreg.h (revision 238465)
62+++ sys/dev/usb/net/if_udavreg.h (revision 238466)
63@@ -159,6 +159,7 @@
64 int sc_flags;
65 #define UDAV_FLAG_LINK 0x0001
66 #define UDAV_FLAG_EXT_PHY 0x0040
67+#define UDAV_FLAG_NO_PHY 0x0080
68 };
69
70 #define UDAV_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
Note: See TracBrowser for help on using the repository browser.