From owner-svn-src-head@freebsd.org Tue May 22 20:00:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13025EADD0B; Tue, 22 May 2018 20:00:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B566D86F5B; Tue, 22 May 2018 20:00:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 976D7189B2; Tue, 22 May 2018 20:00:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4MK0vLn007358; Tue, 22 May 2018 20:00:57 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4MK0vCj007355; Tue, 22 May 2018 20:00:57 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805222000.w4MK0vCj007355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 22 May 2018 20:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334063 - in head/sys/dev/usb: . net X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys/dev/usb: . net X-SVN-Commit-Revision: 334063 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 20:00:58 -0000 Author: emaste Date: Tue May 22 20:00:56 2018 New Revision: 334063 URL: https://svnweb.freebsd.org/changeset/base/334063 Log: if_muge: only attach to LAN7800 Chip ID This driver was developed for the LAN7800 and the register-compatible LAN7515 (found on Raspberry Pi 3B+) and has only been tested on those devices. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/usb/net/if_muge.c head/sys/dev/usb/net/if_mugereg.h head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/net/if_muge.c ============================================================================== --- head/sys/dev/usb/net/if_muge.c Tue May 22 19:24:57 2018 (r334062) +++ head/sys/dev/usb/net/if_muge.c Tue May 22 20:00:56 2018 (r334063) @@ -168,7 +168,8 @@ struct muge_softc { /* Settings for the mac control (MAC_CSR) register. */ uint32_t sc_rfe_ctl; uint32_t sc_mdix_ctl; - uint32_t sc_rev_id; + uint16_t chipid; + uint16_t chiprev; uint32_t sc_mchash_table[ETH_DP_SEL_VHF_HASH_LEN]; uint32_t sc_pfilter_table[MUGE_NUM_PFILTER_ADDRS_][2]; @@ -974,15 +975,20 @@ lan78xx_chip_init(struct muge_softc *sc) } /* Read and display the revision register. */ - if ((err = lan78xx_read_reg(sc, ETH_ID_REV, &sc->sc_rev_id)) < 0) { + if ((err = lan78xx_read_reg(sc, ETH_ID_REV, &buf)) < 0) { muge_warn_printf(sc, "failed to read ETH_ID_REV (err = %d)\n", err); goto init_failed; } - - device_printf(sc->sc_ue.ue_dev, "chip 0x%04lx, rev. %04lx\n", - (sc->sc_rev_id & ETH_ID_REV_CHIP_ID_MASK_) >> 16, - (sc->sc_rev_id & ETH_ID_REV_CHIP_REV_MASK_)); + sc->chipid = (buf & ETH_ID_REV_CHIP_ID_MASK_) >> 16; + sc->chiprev = buf & ETH_ID_REV_CHIP_REV_MASK_; + if (sc->chipid != ETH_ID_REV_CHIP_ID_7800_) { + muge_warn_printf(sc, "Chip ID 0x%04x not yet supported\n", + sc->chipid); + goto init_failed; + } + device_printf(sc->sc_ue.ue_dev, "Chip ID 0x%04x rev %04x\n", sc->chipid, + sc->chiprev); /* Respond to BULK-IN tokens with a NAK when RX FIFO is empty. */ if ((err = lan78xx_read_reg(sc, ETH_USB_CFG0, &buf)) != 0) { Modified: head/sys/dev/usb/net/if_mugereg.h ============================================================================== --- head/sys/dev/usb/net/if_mugereg.h Tue May 22 19:24:57 2018 (r334062) +++ head/sys/dev/usb/net/if_mugereg.h Tue May 22 20:00:56 2018 (r334063) @@ -47,6 +47,9 @@ #define ETH_ID_REV 0x000 #define ETH_ID_REV_CHIP_ID_MASK_ 0xFFFF0000UL #define ETH_ID_REV_CHIP_REV_MASK_ 0x0000FFFFUL +#define ETH_ID_REV_CHIP_ID_7800_ 0x7800 +#define ETH_ID_REV_CHIP_ID_7801_ 0x7801 +#define ETH_ID_REV_CHIP_ID_7850_ 0x7850 /* Device interrupt status register. */ #define ETH_INT_STS 0x00C Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue May 22 19:24:57 2018 (r334062) +++ head/sys/dev/usb/usbdevs Tue May 22 20:00:56 2018 (r334063) @@ -4322,6 +4322,7 @@ product SMC2 2514HUB 0x2514 USB Hub product SMC3 2662WUSB 0xa002 2662W-AR Wireless product SMC2 LAN7800_ETH 0x7800 USB/Ethernet product SMC2 LAN7801_ETH 0x7801 USB/Ethernet +product SMC2 LAN7850_ETH 0x7850 USB/Ethernet product SMC2 LAN9500_ETH 0x9500 USB/Ethernet product SMC2 LAN9505_ETH 0x9505 USB/Ethernet product SMC2 LAN9530_ETH 0x9530 USB/Ethernet