From owner-svn-src-stable-9@FreeBSD.ORG Fri Nov 9 06:58:24 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8C5A427C; Fri, 9 Nov 2012 06:58:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6BDBB8FC08; Fri, 9 Nov 2012 06:58:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qA96wOEc015810; Fri, 9 Nov 2012 06:58:24 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qA96wON4015808; Fri, 9 Nov 2012 06:58:24 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201211090658.qA96wON4015808@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 9 Nov 2012 06:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r242819 - stable/9/sys/dev/usb/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Nov 2012 06:58:24 -0000 Author: hselasky Date: Fri Nov 9 06:58:23 2012 New Revision: 242819 URL: http://svnweb.freebsd.org/changeset/base/242819 Log: MFC r238466 and r242777: Implement non-PHY support in the udav driver. Modified: stable/9/sys/dev/usb/net/if_udav.c stable/9/sys/dev/usb/net/if_udavreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/net/if_udav.c ============================================================================== --- stable/9/sys/dev/usb/net/if_udav.c Fri Nov 9 05:44:34 2012 (r242818) +++ stable/9/sys/dev/usb/net/if_udav.c Fri Nov 9 06:58:23 2012 (r242819) @@ -181,6 +181,15 @@ static const struct usb_ether_methods ud .ue_mii_sts = udav_ifmedia_status, }; +static const struct usb_ether_methods udav_ue_methods_nophy = { + .ue_attach_post = udav_attach_post, + .ue_start = udav_start, + .ue_init = udav_init, + .ue_stop = udav_stop, + .ue_setmulti = udav_setmulti, + .ue_setpromisc = udav_setpromisc, +}; + #ifdef USB_DEBUG static int udav_debug = 0; @@ -206,7 +215,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,11 +269,20 @@ 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) { + ue->ue_methods = &udav_ue_methods_nophy; + sc->sc_flags |= UDAV_FLAG_LINK; + } else { + ue->ue_methods = &udav_ue_methods; + } + ue->ue_sc = sc; ue->ue_dev = dev; ue->ue_udev = uaa->device; ue->ue_mtx = &sc->sc_mtx; - ue->ue_methods = &udav_ue_methods; error = uether_ifattach(ue); if (error) { @@ -712,7 +731,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: stable/9/sys/dev/usb/net/if_udavreg.h ============================================================================== --- stable/9/sys/dev/usb/net/if_udavreg.h Fri Nov 9 05:44:34 2012 (r242818) +++ stable/9/sys/dev/usb/net/if_udavreg.h Fri Nov 9 06:58:23 2012 (r242819) @@ -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)