Commit 03ba5353 authored by Ed Maste's avatar Ed Maste
Browse files

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
parent 748b15fc
......@@ -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) {
......
......@@ -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
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment