2 * Copyright (c) 1997, 1998, 1999, 2000-2003
3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Bill Paul.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
32 * $FreeBSD: src/sys/dev/usb/if_axereg.h,v 1.2 2003/06/15 21:45:43 wpaul Exp $
33 * $DragonFly: src/sys/dev/netif/axe/if_axereg.h,v 1.4 2005/05/25 13:38:59 joerg Exp $
37 * Definitions for the ASIX Electronics AX88172 to ethernet controller.
42 * Vendor specific commands
43 * ASIX conveniently doesn't document the 'set NODEID' command in their
44 * datasheet (thanks a lot guys).
45 * To make handling these commands easier, I added some extra data
46 * which is decided by the axe_cmd() routine. Commands are encoded
47 * in 16 bites, with the format: LDCC. L and D are both nibbles in
48 * the high byte. L represents the data length (0 to 15) and D
49 * represents the direction (0 for vendor read, 1 for vendor write).
50 * CC is the command byte, as specified in the manual.
53 #define AXE_CMD_DIR(x) (((x) & 0x0F00) >> 8)
54 #define AXE_CMD_LEN(x) (((x) & 0xF000) >> 12)
55 #define AXE_CMD_CMD(x) ((x) & 0x00FF)
57 #define AXE_CMD_READ_RXTX_SRAM 0x2002
58 #define AXE_CMD_WRITE_RX_SRAM 0x0103
59 #define AXE_CMD_WRITE_TX_SRAM 0x0104
60 #define AXE_CMD_MII_OPMODE_SW 0x0106
61 #define AXE_CMD_MII_READ_REG 0x2007
62 #define AXE_CMD_MII_WRITE_REG 0x2108
63 #define AXE_CMD_MII_READ_OPMODE 0x1009
64 #define AXE_CMD_MII_OPMODE_HW 0x010A
65 #define AXE_CMD_SROM_READ 0x200B
66 #define AXE_CMD_SROM_WRITE 0x010C
67 #define AXE_CMD_SROM_WR_ENABLE 0x010D
68 #define AXE_CMD_SROM_WR_DISABLE 0x010E
69 #define AXE_CMD_RXCTL_READ 0x200F
70 #define AXE_CMD_RXCTL_WRITE 0x0110
71 #define AXE_CMD_READ_IPG012 0x3011
72 #define AXE_CMD_WRITE_IPG0 0x0112
73 #define AXE_CMD_WRITE_IPG1 0x0113
74 #define AXE_CMD_WRITE_IPG2 0x0114
75 #define AXE_CMD_READ_MCAST 0x8015
76 #define AXE_CMD_WRITE_MCAST 0x8116
77 #define AXE_CMD_READ_NODEID 0x6017
78 #define AXE_CMD_WRITE_NODEID 0x6118
79 #define AXE_CMD_READ_PHYID 0x2019
80 #define AXE_CMD_READ_MEDIA 0x101A
81 #define AXE_CMD_WRITE_MEDIA 0x011B
82 #define AXE_CMD_READ_MONITOR_MODE 0x101C
83 #define AXE_CMD_WRITE_MONITOR_MODE 0x011D
84 #define AXE_CMD_READ_GPIO 0x101E
85 #define AXE_CMD_WRITE_GPIO 0x011F
87 #define AXE_RXCMD_PROMISC 0x0001
88 #define AXE_RXCMD_ALLMULTI 0x0002
89 #define AXE_RXCMD_UNICAST 0x0004
90 #define AXE_RXCMD_BROADCAST 0x0008
91 #define AXE_RXCMD_MULTICAST 0x0010
92 #define AXE_RXCMD_ENABLE 0x0080
94 #define AXE_NOPHY 0xE0
96 #define AXE_TIMEOUT 1000
97 #define AXE_BUFSZ 1536
98 #define AXE_MIN_FRAMELEN 60
99 #define AXE_RX_FRAMES 1
100 #define AXE_TX_FRAMES 1
102 #define AXE_RX_LIST_CNT 1
103 #define AXE_TX_LIST_CNT 1
105 #define AXE_CTL_READ 0x01
106 #define AXE_CTL_WRITE 0x02
108 #define AXE_CONFIG_NO 1
109 #define AXE_IFACE_IDX 0
112 * The interrupt endpoint is currently unused
115 #define AXE_ENDPT_RX 0x0
116 #define AXE_ENDPT_TX 0x1
117 #define AXE_ENDPT_INTR 0x2
118 #define AXE_ENDPT_MAX 0x3
128 struct axe_softc
*axe_sc
;
129 usbd_xfer_handle axe_xfer
;
131 struct mbuf
*axe_mbuf
;
137 struct axe_chain axe_tx_chain
[AXE_TX_LIST_CNT
];
138 struct axe_chain axe_rx_chain
[AXE_RX_LIST_CNT
];
145 #define AXE_INC(x, y) (x) = (x + 1) % y
148 #define GET_MII(sc) (device_get_softc((sc)->axe_miibus))
149 struct arpcom arpcom
;
151 usbd_device_handle axe_udev
;
152 usbd_interface_handle axe_iface
;
153 int axe_ed
[AXE_ENDPT_MAX
];
154 usbd_pipe_handle axe_ep
[AXE_ENDPT_MAX
];
156 struct axe_cdata axe_cdata
;
157 struct callout axe_stat_timer
;
160 unsigned char axe_ipgs
[3];
161 unsigned char axe_phyaddrs
[2];
162 struct timeval axe_rx_notice
;