svn commit: r334063 - in head/sys/dev/usb: . net

Ed Maste emaste at FreeBSD.org
Tue May 22 20:00:58 UTC 2018


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


More information about the svn-src-all mailing list