Add mue(4), driver for Microchip LAN75xx/LAN78xx known as internal NIC of
Raspberry Pi 3 B+, from OpenBSD. Tested on Raspberry Pi 3 B+ (LAN7800) and Z-TEK ZE582 (LAN7500). * BUGS/TODO - If the media type is set to something other than 1000baseT-FDX, data transmission becomes quite unstable. Also, ukphy(4) recognize 1000baseT as a supported media type, but it is not in fact. - Catch up with changes made to usmsc(4) in nick-nhusb branch, i.e., make the driver MP-safe. - Support RX/VLAN/TX chekcsum offloading.
This commit is contained in:
parent
6f6568e389
commit
559388397c
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.1611 2018/08/25 11:10:52 martin Exp $
|
||||
# $NetBSD: mi,v 1.1612 2018/08/25 20:12:21 rin Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
|
@ -1455,6 +1455,7 @@
|
|||
./usr/share/man/cat4/mt2131.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/mtd.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/mtio.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/mue.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/multicast.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/music.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/mvme68k/autoconf.0 man-sys-catman .cat
|
||||
|
@ -4566,6 +4567,7 @@
|
|||
./usr/share/man/html4/mt2131.html man-sys-htmlman html
|
||||
./usr/share/man/html4/mtd.html man-sys-htmlman html
|
||||
./usr/share/man/html4/mtio.html man-sys-htmlman html
|
||||
./usr/share/man/html4/mue.html man-sys-htmlman html
|
||||
./usr/share/man/html4/multicast.html man-sys-htmlman html
|
||||
./usr/share/man/html4/music.html man-sys-htmlman html
|
||||
./usr/share/man/html4/mvme68k/autoconf.html man-sys-htmlman html
|
||||
|
@ -7527,6 +7529,7 @@
|
|||
./usr/share/man/man4/mt2131.4 man-sys-man .man
|
||||
./usr/share/man/man4/mtd.4 man-sys-man .man
|
||||
./usr/share/man/man4/mtio.4 man-sys-man .man
|
||||
./usr/share/man/man4/mue.4 man-sys-man .man
|
||||
./usr/share/man/man4/multicast.4 man-sys-man .man
|
||||
./usr/share/man/man4/music.4 man-sys-man .man
|
||||
./usr/share/man/man4/mvme68k/autoconf.4 man-sys-man .man
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.116 2018/05/20 14:08:33 thorpej Exp $
|
||||
# $NetBSD: mi,v 1.117 2018/08/25 20:12:21 rin Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
|
@ -166,6 +166,8 @@
|
|||
./@MODULEDIR@/if_loop/if_loop.kmod base-kernel-modules kmod
|
||||
./@MODULEDIR@/if_mpls base-kernel-modules kmod
|
||||
./@MODULEDIR@/if_mpls/if_mpls.kmod base-kernel-modules kmod
|
||||
./@MODULEDIR@/if_mue base-kernel-modules kmod
|
||||
./@MODULEDIR@/if_mue/if_mue.kmod base-kernel-modules kmod
|
||||
./@MODULEDIR@/if_npflog base-kernel-modules kmod
|
||||
./@MODULEDIR@/if_npflog/if_npflog.kmod base-kernel-modules kmod
|
||||
./@MODULEDIR@/if_ppp base-kernel-modules kmod
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.664 2018/08/14 14:49:13 maxv Exp $
|
||||
# $NetBSD: Makefile,v 1.665 2018/08/25 20:12:21 rin Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/18/93
|
||||
|
||||
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
|
||||
|
@ -75,7 +75,8 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
|
|||
zero.4 zstty.4 zyd.4
|
||||
|
||||
# USB devices
|
||||
MAN+= atu.4 aubtfwl.4 aue.4 axe.4 axen.4 cdce.4 cue.4 ehci.4 kue.4 ohci.4 \
|
||||
MAN+= atu.4 aubtfwl.4 aue.4 axe.4 axen.4 cdce.4 cue.4 ehci.4 kue.4 mue.4 \
|
||||
ohci.4 \
|
||||
slhci.4 stuirda.4 u3g.4 ualea.4 uatp.4 uaudio.4 uberry.4 ubsa.4 ubt.4 \
|
||||
uchcom.4 \
|
||||
ucom.4 ucycom.4 udav.4 udsbr.4 uftdi.4 ugen.4 ugensa.4 uhci.4 uhid.4 \
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
.\" $NetBSD: mue.4,v 1.1 2018/08/25 20:12:21 rin Exp $
|
||||
.\" $OpenBSD: mue.4,v 1.2 2018/08/03 06:13:14 jmc Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2018 Kevin Lo <kevlo@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: August 25 2018 $
|
||||
.Dt MUE 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm mue
|
||||
.Nd Microchip LAN75xx/LAN78xx 10/100/Gigabit USB Ethernet device
|
||||
.Sh SYNOPSIS
|
||||
.Cd "mue* at uhub?"
|
||||
.Cd "ukphy* at mii?"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver supports Microchip LAN7500/LAN7505/LAN7515/LAN7850 USB 2.0 Gigabit
|
||||
Ethernet devices and LAN7800/LAN7801 USB 3.0 Gigabit Ethernet devices,
|
||||
including the following:
|
||||
.Pp
|
||||
.Bl -tag -width Ds -offset indent -compact
|
||||
.It Raspberry Pi 3 Model B+
|
||||
.It Microchip EVB-LAN7800LC
|
||||
.It Z-TEK ZE582
|
||||
.El
|
||||
.Pp
|
||||
For more information on configuring this device, see
|
||||
.Xr ifconfig 8 .
|
||||
.Sh SEE ALSO
|
||||
.Xr arp 4 ,
|
||||
.Xr ifmedia 4 ,
|
||||
.Xr intro 4 ,
|
||||
.Xr netintro 4 ,
|
||||
.Xr ukphy 4 ,
|
||||
.Xr usb 4 ,
|
||||
.\".Xr hostname.if 5 ,
|
||||
.Xr ifconfig 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
device driver first appeared in
|
||||
.Ox 6.3 and
|
||||
.Nx 9.0 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
driver was written by
|
||||
.An Kevin Lo Aq Mt kevlo@openbsd.org
|
||||
for
|
||||
.Ox and ported to
|
||||
.Nx by
|
||||
.An Rin Okuyama Aq Mt rin@netbsd.org .
|
||||
.Sh BUGS
|
||||
If the media type is set to other than 1000BASE-T full-duplex,
|
||||
data transmission becomes quite unstable.
|
||||
Also, ukphy mistakenly recognizes 1000BASE-T half-duplex as a supported media
|
||||
type, although the adapters do not support it.
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.usb,v 1.151 2018/07/31 16:44:29 khorben Exp $
|
||||
# $NetBSD: files.usb,v 1.152 2018/08/25 20:12:22 rin Exp $
|
||||
#
|
||||
# Config file and device description for machine-independent USB code.
|
||||
# Included by ports that need it. Ports that use it must provide
|
||||
|
@ -369,6 +369,11 @@ device axen: arp, ether, ifnet, mii
|
|||
attach axen at usbdevif
|
||||
file dev/usb/if_axen.c axen
|
||||
|
||||
# Microchip LAN750x and LAN85xx
|
||||
device mue: arp, ether, ifnet, mii, mii_phy
|
||||
attach mue at usbdevif
|
||||
file dev/usb/if_mue.c mue
|
||||
|
||||
# DAVICOM DM9601
|
||||
device udav: arp, ether, ifnet, mii, mii_phy
|
||||
attach udav at usbdevif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,225 @@
|
|||
/* $NetBSD: if_muereg.h,v 1.1 2018/08/25 20:12:22 rin Exp $ */
|
||||
/* $OpenBSD: if_muereg.h,v 1.1 2018/08/03 01:50:15 kevlo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018 Kevin Lo <kevlo@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _IF_MUEREG_H_
|
||||
#define _IF_MUEREG_H_
|
||||
|
||||
/* USB vendor requests */
|
||||
#define MUE_UR_WRITEREG 0xa0
|
||||
#define MUE_UR_READREG 0xa1
|
||||
|
||||
/* registers */
|
||||
#define MUE_INT_STATUS 0x00c
|
||||
#define MUE_HW_CFG 0x010
|
||||
#define MUE_PMT_CTL 0x014
|
||||
#define MUE_LED_CFG 0x018
|
||||
#define MUE_DP_SEL 0x024
|
||||
#define MUE_DP_CMD 0x028
|
||||
#define MUE_DP_ADDR 0x02c
|
||||
#define MUE_DP_DATA 0x030
|
||||
#define MUE_7500_BURST_CAP 0x034
|
||||
#define MUE_7500_INT_EP_CTL 0x038
|
||||
#define MUE_7500_BULKIN_DELAY 0x03c
|
||||
#define MUE_E2P_CMD 0x040
|
||||
#define MUE_E2P_DATA 0x044
|
||||
#define MUE_E2P_IND 0x0a5
|
||||
#define MUE_7500_RFE_CTL 0x060
|
||||
#define MUE_USB_CFG0 0x080
|
||||
#define MUE_USB_CFG1 0x084
|
||||
#define MUE_7500_FCT_RX_CTL 0x090
|
||||
#define MUE_7800_BURST_CAP 0x090
|
||||
#define MUE_7500_FCT_TX_CTL 0x094
|
||||
#define MUE_7800_BULKIN_DELAY 0x094
|
||||
#define MUE_7500_FCT_RX_FIFO_END 0x098
|
||||
#define MUE_7800_INT_EP_CTL 0x098
|
||||
#define MUE_7500_FCT_TX_FIFO_END 0x09c
|
||||
#define MUE_7500_FCT_FLOW 0x0a0
|
||||
#define MUE_7800_RFE_CTL 0x0b0
|
||||
#define MUE_7800_FCT_RX_CTL 0x0c0
|
||||
#define MUE_7800_FCT_TX_CTL 0x0c4
|
||||
#define MUE_7800_FCT_RX_FIFO_END 0x0c8
|
||||
#define MUE_7800_FCT_TX_FIFO_END 0x0cc
|
||||
#define MUE_7800_FCT_FLOW 0x0d0
|
||||
#define MUE_LTM_INDEX(idx) (0x0e0 + (idx) * 4)
|
||||
#define MUE_NUM_LTM_INDEX 6
|
||||
#define MUE_MAC_CR 0x100
|
||||
#define MUE_MAC_RX 0x104
|
||||
#define MUE_MAC_TX 0x108
|
||||
#define MUE_FLOW 0x10c
|
||||
#define MUE_RX_ADDRH 0x118
|
||||
#define MUE_RX_ADDRL 0x11c
|
||||
#define MUE_MII_ACCESS 0x120
|
||||
#define MUE_MII_DATA 0x124
|
||||
#define MUE_7500_ADDR_FILTX_BASE 0x300
|
||||
#define MUE_7500_ADDR_FILTX(i) (MUE_7500_ADDR_FILTX_BASE + 8 * (i))
|
||||
#define MUE_7800_ADDR_FILTX_BASE 0x400
|
||||
#define MUE_7800_ADDR_FILTX(i) (MUE_7800_ADDR_FILTX_BASE + 8 * (i))
|
||||
#define MUE_NUM_ADDR_FILTX 33
|
||||
|
||||
/* hardware configuration register */
|
||||
#define MUE_HW_CFG_SRST 0x00000001
|
||||
#define MUE_HW_CFG_LRST 0x00000002
|
||||
#define MUE_HW_CFG_BCE 0x00000004
|
||||
#define MUE_HW_CFG_MEF 0x00000010
|
||||
#define MUE_HW_CFG_BIR 0x00000080
|
||||
#define MUE_HW_CFG_LED0_EN 0x00100000
|
||||
#define MUE_HW_CFG_LED1_EN 0x00200000
|
||||
|
||||
/* power management control register */
|
||||
#define MUE_PMT_CTL_PHY_RST 0x00000010
|
||||
#define MUE_PMT_CTL_READY 0x00000080
|
||||
|
||||
/* LED configuration register */
|
||||
#define MUE_LED_CFG_LEDGPIO_EN 0x0000f000
|
||||
#define MUE_LED_CFG_LED10_FUN_SEL 0x40000000
|
||||
#define MUE_LED_CFG_LED2_FUN_SEL 0x80000000
|
||||
|
||||
/* data port select register */
|
||||
#define MUE_DP_SEL_RSEL_MASK 0x0000000f
|
||||
#define MUE_DP_SEL_VHF 0x00000001
|
||||
#define MUE_DP_SEL_DPRDY 0x80000000
|
||||
#define MUE_DP_SEL_VHF_HASH_LEN 16
|
||||
#define MUE_DP_SEL_VHF_VLAN_LEN 128
|
||||
|
||||
/* data port command register */
|
||||
#define MUE_DP_CMD_WRITE 0x00000001
|
||||
|
||||
/* burst cap register and etc */
|
||||
#define MUE_SS_USB_PKT_SIZE 1024
|
||||
#define MUE_HS_USB_PKT_SIZE 512
|
||||
#define MUE_FS_USB_PKT_SIZE 64
|
||||
#define MUE_7500_HS_BUFSIZE \
|
||||
(16 * 1024 + 5 * MUE_HS_USB_PKT_SIZE)
|
||||
#define MUE_7500_FS_BUFSIZE \
|
||||
(6 * 1024 + 33 * MUE_FS_USB_PKT_SIZE)
|
||||
#define MUE_7500_MAX_RX_FIFO_SIZE (20 * 1024)
|
||||
#define MUE_7500_MAX_TX_FIFO_SIZE (12 * 1024)
|
||||
#define MUE_7800_BUFSIZE (12 * 1024)
|
||||
#define MUE_7800_MAX_RX_FIFO_SIZE MUE_7800_BUFSIZE
|
||||
#define MUE_7800_MAX_TX_FIFO_SIZE MUE_7800_BUFSIZE
|
||||
|
||||
/* interrupt endpoint control register */
|
||||
#define MUE_INT_EP_CTL_PHY_INT 0x20000
|
||||
|
||||
/* bulk-in delay register */
|
||||
#define MUE_7500_DEFAULT_BULKIN_DELAY 0x00002000
|
||||
#define MUE_7800_DEFAULT_BULKIN_DELAY 0x00000800
|
||||
|
||||
/* EEPROM command register */
|
||||
#define MUE_E2P_CMD_ADDR_MASK 0x000001ff
|
||||
#define MUE_E2P_CMD_READ 0x00000000
|
||||
#define MUE_E2P_CMD_LOADED 0x00000200
|
||||
#define MUE_E2P_CMD_TIMEOUT 0x00000400
|
||||
#define MUE_E2P_CMD_BUSY 0x80000000
|
||||
#define MUE_E2P_IND_OFFSET 0x000
|
||||
#define MUE_E2P_MAC_OFFSET 0x001
|
||||
#define MUE_E2P_LTM_OFFSET 0x03f
|
||||
|
||||
/* Receive Filtering Engine control register */
|
||||
#define MUE_RFE_CTL_PERFECT 0x00000002
|
||||
#define MUE_RFE_CTL_MULTICAST_HASH 0x00000008
|
||||
#define MUE_RFE_CTL_VLAN_FILTER 0x00000020
|
||||
#define MUE_RFE_CTL_UNICAST 0x00000100
|
||||
#define MUE_RFE_CTL_MULTICAST 0x00000200
|
||||
#define MUE_RFE_CTL_BROADCAST 0x00000400
|
||||
#define MUE_RFE_CTL_IP_COE 0x00000800
|
||||
#define MUE_RFE_CTL_TCPUDP_COE 0x00001000
|
||||
#define MUE_RFE_CTL_ICMP_COE 0x00002000
|
||||
#define MUE_RFE_CTL_IGMP_COE 0x00004000
|
||||
|
||||
/* USB configuration register 0 */
|
||||
#define MUE_USB_CFG0_BCE 0x00000020
|
||||
#define MUE_USB_CFG0_BIR 0x00000040
|
||||
|
||||
/* USB configuration register 1 */
|
||||
#define MUE_USB_CFG1_LTM_ENABLE 0x00000100
|
||||
#define MUE_USB_CFG1_DEV_U1_INIT_EN 0x00000400
|
||||
#define MUE_USB_CFG1_DEV_U2_INIT_EN 0x00001000
|
||||
|
||||
/* RX FIFO control register */
|
||||
#define MUE_FCT_RX_CTL_EN 0x80000000
|
||||
|
||||
/* TX FIFO control register */
|
||||
#define MUE_FCT_TX_CTL_EN 0x80000000
|
||||
|
||||
/* MAC control register */
|
||||
#define MUE_MAC_CR_RST 0x00000001
|
||||
#define MUE_MAC_CR_FULL_DUPLEX 0x00000008
|
||||
#define MUE_MAC_CR_AUTO_SPEED 0x00000800
|
||||
#define MUE_MAC_CR_AUTO_DUPLEX 0x00001000
|
||||
#define MUE_MAC_CR_GMII_EN 0x00080000
|
||||
|
||||
/* MAC receive register */
|
||||
#define MUE_MAC_RX_RXEN 0x00000001
|
||||
#define MUE_MAC_RX_MAX_SIZE_MASK 0x3fff0000
|
||||
#define MUE_MAC_RX_MAX_SIZE_SHIFT 16
|
||||
#define MUE_MAC_RX_MAX_LEN(x) \
|
||||
(((x) << MUE_MAC_RX_MAX_SIZE_SHIFT) & MUE_MAC_RX_MAX_SIZE_MASK)
|
||||
|
||||
/* MAC transmit register */
|
||||
#define MUE_MAC_TX_TXEN 0x00000001
|
||||
|
||||
/* flow control register */
|
||||
#define MUE_FLOW_PAUSE_TIME 0x0000ffff
|
||||
#define MUE_FLOW_RX_FCEN 0x20000000
|
||||
#define MUE_FLOW_TX_FCEN 0x40000000
|
||||
|
||||
/* MII access register */
|
||||
#define MUE_MII_ACCESS_READ 0x00000000
|
||||
#define MUE_MII_ACCESS_BUSY 0x00000001
|
||||
#define MUE_MII_ACCESS_WRITE 0x00000002
|
||||
#define MUE_MII_ACCESS_REGADDR_MASK 0x000007c0
|
||||
#define MUE_MII_ACCESS_REGADDR_SHIFT 6
|
||||
#define MUE_MII_ACCESS_PHYADDR_MASK 0x0000f800
|
||||
#define MUE_MII_ACCESS_PHYADDR_SHIFT 11
|
||||
#define MUE_MII_ACCESS_REGADDR(x) \
|
||||
(((x) << MUE_MII_ACCESS_REGADDR_SHIFT) & MUE_MII_ACCESS_REGADDR_MASK)
|
||||
#define MUE_MII_ACCESS_PHYADDR(x) \
|
||||
(((x) << MUE_MII_ACCESS_PHYADDR_SHIFT) & MUE_MII_ACCESS_PHYADDR_MASK)
|
||||
|
||||
/* MAC address perfect filter register */
|
||||
#define MUE_ADDR_FILTX_VALID 0x80000000
|
||||
|
||||
/* undocumented OTP registers from Linux via FreeBSD */
|
||||
#define MUE_OTP_BASE_ADDR 0x01000
|
||||
#define MUE_OTP_ADDR(off) (MUE_OTP_BASE_ADDR + 4 * (off))
|
||||
#define MUE_OTP_PWR_DN MUE_OTP_ADDR(0x00)
|
||||
#define MUE_OTP_PWR_DN_PWRDN_N 0x01
|
||||
#define MUE_OTP_ADDR1 MUE_OTP_ADDR(0x01)
|
||||
#define MUE_OTP_ADDR1_MASK 0x1f
|
||||
#define MUE_OTP_ADDR2 MUE_OTP_ADDR(0x02)
|
||||
#define MUE_OTP_ADDR2_MASK 0xff
|
||||
#define MUE_OTP_ADDR3 MUE_OTP_ADDR(0x03)
|
||||
#define MUE_OTP_ADDR3_MASK 0x03
|
||||
#define MUE_OTP_RD_DATA MUE_OTP_ADDR(0x06)
|
||||
#define MUE_OTP_FUNC_CMD MUE_OTP_ADDR(0x08)
|
||||
#define MUE_OTP_FUNC_CMD_RESET 0x04
|
||||
#define MUE_OTP_FUNC_CMD_PROGRAM 0x02
|
||||
#define MUE_OTP_FUNC_CMD_READ 0x01
|
||||
#define MUE_OTP_MAC_OFFSET 0x01
|
||||
#define MUE_OTP_IND_OFFSET 0x00
|
||||
#define MUE_OTP_IND_1 0xf3
|
||||
#define MUE_OTP_IND_2 0xf7
|
||||
#define MUE_OTP_CMD_GO MUE_OTP_ADDR(0x0a)
|
||||
#define MUE_OTP_CMD_GO_GO 0x01
|
||||
#define MUE_OTP_STATUS MUE_OTP_ADDR(0x0a)
|
||||
#define MUE_OTP_STATUS_OTP_LOCK 0x10
|
||||
#define MUE_OTP_STATUS_BUSY 0x01
|
||||
|
||||
#endif /* _IF_MUEREG_H_ */
|
|
@ -0,0 +1,106 @@
|
|||
/* $NetBSD: if_muevar.h,v 1.1 2018/08/25 20:12:22 rin Exp $ */
|
||||
/* $OpenBSD: if_muereg.h,v 1.1 2018/08/03 01:50:15 kevlo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018 Kevin Lo <kevlo@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _IF_MUEVAR_H_
|
||||
#define _IF_MUEVAR_H_
|
||||
|
||||
#include <sys/rndsource.h>
|
||||
|
||||
struct mue_chain {
|
||||
struct mue_softc *mue_sc;
|
||||
struct usbd_xfer *mue_xfer;
|
||||
char *mue_buf;
|
||||
int mue_accum;
|
||||
int mue_idx;
|
||||
};
|
||||
|
||||
struct mue_cdata {
|
||||
#define MUE_TX_LIST_CNT 1
|
||||
struct mue_chain mue_tx_chain[MUE_TX_LIST_CNT];
|
||||
#define MUE_RX_LIST_CNT 1
|
||||
struct mue_chain mue_rx_chain[MUE_RX_LIST_CNT];
|
||||
int mue_tx_prod;
|
||||
int mue_tx_cons;
|
||||
int mue_tx_cnt;
|
||||
int mue_rx_prod;
|
||||
};
|
||||
|
||||
struct mue_rxbuf_hdr {
|
||||
uint32_t rx_cmd_a;
|
||||
#define MUE_RX_CMD_A_LEN_MASK 0x00003fff
|
||||
#define MUE_RX_CMD_A_ICSM 0x00004000
|
||||
#define MUE_RX_CMD_A_RED 0x00400000
|
||||
|
||||
uint32_t rx_cmd_b;
|
||||
uint16_t rx_cmd_c;
|
||||
} __packed;
|
||||
|
||||
struct mue_txbuf_hdr {
|
||||
uint32_t tx_cmd_a;
|
||||
#define MUE_TX_CMD_A_LEN_MASK 0x000fffff
|
||||
#define MUE_TX_CMD_A_FCS 0x00400000
|
||||
|
||||
uint32_t tx_cmd_b;
|
||||
} __packed;
|
||||
|
||||
struct mue_softc {
|
||||
device_t mue_dev;
|
||||
bool mue_dying;
|
||||
|
||||
uint8_t mue_enaddr[ETHER_ADDR_LEN];
|
||||
struct ethercom mue_ec;
|
||||
struct mii_data mue_mii;
|
||||
#define GET_MII(sc) (&(sc)->mue_mii)
|
||||
#define GET_IFP(sc) (&(sc)->mue_ec.ec_if)
|
||||
|
||||
/* The interrupt endpoint is currently unused by the Moschip part. */
|
||||
#define MUE_ENDPT_RX 0
|
||||
#define MUE_ENDPT_TX 1
|
||||
#define MUE_ENDPT_INTR 2
|
||||
#define MUE_ENDPT_MAX 3
|
||||
int mue_ed[MUE_ENDPT_MAX];
|
||||
struct usbd_pipe *mue_ep[MUE_ENDPT_MAX];
|
||||
|
||||
struct mue_cdata mue_cdata;
|
||||
callout_t mue_stat_ch;
|
||||
|
||||
struct usbd_device *mue_udev;
|
||||
struct usbd_interface *mue_iface;
|
||||
|
||||
struct usb_task mue_tick_task;
|
||||
struct usb_task mue_stop_task;
|
||||
|
||||
kmutex_t mue_mii_lock;
|
||||
|
||||
struct timeval mue_rx_notice;
|
||||
|
||||
uint16_t mue_product;
|
||||
uint16_t mue_flags;
|
||||
|
||||
int mue_if_flags;
|
||||
int mue_refcnt;
|
||||
|
||||
krndsource_t mue_rnd_source;
|
||||
|
||||
int mue_phyno;
|
||||
uint32_t mue_bufsz;
|
||||
int mue_link;
|
||||
};
|
||||
|
||||
#endif /* _IF_MUEVAR_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: usbdevices.config,v 1.32 2018/08/13 17:35:31 mrg Exp $
|
||||
# $NetBSD: usbdevices.config,v 1.33 2018/08/25 20:12:22 rin Exp $
|
||||
#
|
||||
# This file contains all USB related configuration.
|
||||
# It is suitable for inclusion in a kernel config(5) file.
|
||||
|
@ -128,6 +128,7 @@ cdce* at uhub? port ? # CDC, Ethernet Networking Control Model
|
|||
cue* at uhub? port ? # CATC USB-EL1201A based adapters
|
||||
kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters
|
||||
#mos* at uhub? port ? # Moschip MCS7730/MCS7830/MCS7832 based adapters
|
||||
mue* at uhub? port ? # Microchip LAN75xx/LAN78xx based adapters
|
||||
udav* at uhub? port ? # Davicom DM9601 based adapters
|
||||
#umb* at uhub? port ? # Mobile Broadband Interface Model (EXPERIMENTAL)
|
||||
url* at uhub? port ? # Realtek RTL8150L based adapters
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.207 2018/07/24 09:47:35 maxv Exp $
|
||||
# $NetBSD: Makefile,v 1.208 2018/08/25 20:12:22 rin Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
|
@ -64,6 +64,7 @@ SUBDIR+= if_gre
|
|||
SUBDIR+= if_l2tp
|
||||
SUBDIR+= if_loop
|
||||
SUBDIR+= if_mpls
|
||||
SUBDIR+= if_mue
|
||||
SUBDIR+= if_npflog
|
||||
SUBDIR+= if_ppp
|
||||
SUBDIR+= if_pppoe
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# $NetBSD: Makefile,v 1.1 2018/08/25 20:12:22 rin Exp $
|
||||
|
||||
.include "../Makefile.inc"
|
||||
|
||||
.PATH: ${S}/dev/usb
|
||||
|
||||
KMOD= if_mue
|
||||
IOCONF= if_mue.ioconf
|
||||
SRCS= if_mue.c
|
||||
|
||||
WARNS= 5
|
||||
|
||||
.include <bsd.kmodule.mk>
|
|
@ -0,0 +1,10 @@
|
|||
# $NetBSD: if_mue.ioconf,v 1.1 2018/08/25 20:12:22 rin Exp $
|
||||
|
||||
ioconf mue
|
||||
|
||||
include "conf/files"
|
||||
include "dev/usb/files.usb"
|
||||
|
||||
pseudo-root usbdevif*
|
||||
|
||||
mue* at usbdevif?
|
Loading…
Reference in New Issue