Home | History | Annotate | Line # | Download | only in usb
      1  1.21       mrg /*	$NetBSD: if_axereg.h,v 1.21 2019/07/14 21:37:09 mrg Exp $	*/
      2   1.1  augustss 
      3   1.1  augustss /*
      4   1.1  augustss  * Copyright (c) 1997, 1998, 1999, 2000-2003
      5   1.1  augustss  *	Bill Paul <wpaul (at) windriver.com>.  All rights reserved.
      6   1.1  augustss  *
      7   1.1  augustss  * Redistribution and use in source and binary forms, with or without
      8   1.1  augustss  * modification, are permitted provided that the following conditions
      9   1.1  augustss  * are met:
     10   1.1  augustss  * 1. Redistributions of source code must retain the above copyright
     11   1.1  augustss  *    notice, this list of conditions and the following disclaimer.
     12   1.1  augustss  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1  augustss  *    notice, this list of conditions and the following disclaimer in the
     14   1.1  augustss  *    documentation and/or other materials provided with the distribution.
     15   1.1  augustss  * 3. All advertising materials mentioning features or use of this software
     16   1.1  augustss  *    must display the following acknowledgement:
     17   1.1  augustss  *	This product includes software developed by Bill Paul.
     18   1.1  augustss  * 4. Neither the name of the author nor the names of any co-contributors
     19   1.1  augustss  *    may be used to endorse or promote products derived from this software
     20   1.1  augustss  *    without specific prior written permission.
     21   1.1  augustss  *
     22   1.1  augustss  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
     23   1.1  augustss  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24   1.1  augustss  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25   1.1  augustss  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
     26   1.1  augustss  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27   1.1  augustss  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     28   1.1  augustss  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     29   1.1  augustss  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     30   1.1  augustss  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     31   1.1  augustss  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     32   1.1  augustss  * THE POSSIBILITY OF SUCH DAMAGE.
     33   1.1  augustss  *
     34   1.1  augustss  * $FreeBSD: src/sys/dev/usb/if_axereg.h,v 1.2 2003/06/15 21:45:43 wpaul Exp $
     35   1.1  augustss  */
     36   1.1  augustss 
     37   1.1  augustss /*
     38   1.1  augustss  * Definitions for the ASIX Electronics AX88172 to ethernet controller.
     39   1.1  augustss  */
     40   1.1  augustss 
     41  1.17  riastrad #include <sys/rndsource.h>
     42   1.1  augustss 
     43   1.1  augustss /*
     44   1.1  augustss  * Vendor specific commands
     45   1.1  augustss  * ASIX conveniently doesn't document the 'set NODEID' command in their
     46   1.1  augustss  * datasheet (thanks a lot guys).
     47   1.1  augustss  * To make handling these commands easier, I added some extra data
     48   1.1  augustss  * which is decided by the axe_cmd() routine. Commands are encoded
     49   1.1  augustss  * in 16 bites, with the format: LDCC. L and D are both nibbles in
     50   1.1  augustss  * the high byte. L represents the data length (0 to 15) and D
     51   1.1  augustss  * represents the direction (0 for vendor read, 1 for vendor write).
     52   1.1  augustss  * CC is the command byte, as specified in the manual.
     53   1.1  augustss  */
     54   1.1  augustss 
     55   1.1  augustss #define AXE_CMD_DIR(x)	(((x) & 0x0F00) >> 8)
     56   1.1  augustss #define AXE_CMD_LEN(x)	(((x) & 0xF000) >> 12)
     57   1.1  augustss #define AXE_CMD_CMD(x)	((x) & 0x00FF)
     58   1.1  augustss 
     59   1.8  pgoyette #define AXE_172_CMD_READ_RXTX_SRAM		0x2002
     60  1.19     skrll #define AXE_182_CMD_READ_RXTX_SRAM		0x8002
     61   1.8  pgoyette #define AXE_172_CMD_WRITE_RX_SRAM		0x0103
     62  1.19     skrll #define AXE_182_CMD_WRITE_RXTX_SRAM		0x8103
     63   1.8  pgoyette #define AXE_172_CMD_WRITE_TX_SRAM		0x0104
     64  1.19     skrll 
     65   1.1  augustss #define AXE_CMD_MII_OPMODE_SW			0x0106
     66   1.1  augustss #define AXE_CMD_MII_READ_REG			0x2007
     67   1.1  augustss #define AXE_CMD_MII_WRITE_REG			0x2108
     68   1.1  augustss #define AXE_CMD_MII_READ_OPMODE			0x1009
     69   1.1  augustss #define AXE_CMD_MII_OPMODE_HW			0x010A
     70   1.1  augustss #define AXE_CMD_SROM_READ			0x200B
     71   1.1  augustss #define AXE_CMD_SROM_WRITE			0x010C
     72   1.1  augustss #define AXE_CMD_SROM_WR_ENABLE			0x010D
     73   1.1  augustss #define AXE_CMD_SROM_WR_DISABLE			0x010E
     74   1.1  augustss #define AXE_CMD_RXCTL_READ			0x200F
     75   1.1  augustss #define AXE_CMD_RXCTL_WRITE			0x0110
     76   1.1  augustss #define AXE_CMD_READ_IPG012			0x3011
     77   1.8  pgoyette #define AXE_172_CMD_WRITE_IPG0			0x0112
     78   1.8  pgoyette #define AXE_172_CMD_WRITE_IPG1			0x0113
     79   1.8  pgoyette #define AXE_172_CMD_WRITE_IPG2			0x0114
     80   1.8  pgoyette #define AXE_178_CMD_WRITE_IPG012		0x0112
     81   1.1  augustss #define AXE_CMD_READ_MCAST			0x8015
     82   1.1  augustss #define AXE_CMD_WRITE_MCAST			0x8116
     83   1.8  pgoyette #define AXE_172_CMD_READ_NODEID			0x6017
     84   1.8  pgoyette #define AXE_172_CMD_WRITE_NODEID		0x6118
     85   1.8  pgoyette #define AXE_178_CMD_READ_NODEID			0x6013
     86   1.8  pgoyette #define AXE_178_CMD_WRITE_NODEID		0x6114
     87   1.1  augustss #define AXE_CMD_READ_PHYID			0x2019
     88   1.8  pgoyette #define AXE_172_CMD_READ_MEDIA			0x101A
     89   1.8  pgoyette #define AXE_178_CMD_READ_MEDIA			0x201A
     90   1.1  augustss #define AXE_CMD_WRITE_MEDIA			0x011B
     91   1.1  augustss #define AXE_CMD_READ_MONITOR_MODE		0x101C
     92   1.1  augustss #define AXE_CMD_WRITE_MONITOR_MODE		0x011D
     93   1.1  augustss #define AXE_CMD_READ_GPIO			0x101E
     94   1.1  augustss #define AXE_CMD_WRITE_GPIO			0x011F
     95   1.8  pgoyette #define AXE_CMD_SW_RESET_REG			0x0120
     96   1.8  pgoyette #define AXE_CMD_SW_PHY_STATUS			0x0021
     97   1.8  pgoyette #define AXE_CMD_SW_PHY_SELECT			0x0122
     98   1.8  pgoyette 
     99  1.19     skrll /* AX88772A and AX88772B only. */
    100  1.19     skrll #define AXE_CMD_READ_VLAN_CTRL			0x4027
    101  1.19     skrll #define AXE_CMD_WRITE_VLAN_CTRL			0x4028
    102  1.19     skrll 
    103  1.19     skrll #define AXE_772B_CMD_RXCTL_WRITE_CFG		0x012A
    104  1.19     skrll #define AXE_772B_CMD_READ_RXCSUM		0x002B
    105  1.19     skrll #define AXE_772B_CMD_WRITE_RXCSUM		0x012C
    106  1.19     skrll #define AXE_772B_CMD_READ_TXCSUM		0x002D
    107  1.19     skrll #define AXE_772B_CMD_WRITE_TXCSUM		0x012E
    108  1.19     skrll 
    109   1.8  pgoyette #define AXE_SW_RESET_CLEAR			0x00
    110   1.8  pgoyette #define AXE_SW_RESET_RR				0x01
    111   1.8  pgoyette #define AXE_SW_RESET_RT				0x02
    112   1.8  pgoyette #define AXE_SW_RESET_PRTE			0x04
    113   1.8  pgoyette #define AXE_SW_RESET_PRL			0x08
    114   1.8  pgoyette #define AXE_SW_RESET_BZ				0x10
    115   1.8  pgoyette #define AXE_SW_RESET_IPRL			0x20
    116   1.8  pgoyette #define AXE_SW_RESET_IPPD			0x40
    117   1.8  pgoyette 
    118   1.8  pgoyette /* AX88178 documentation says to always write this bit... */
    119   1.8  pgoyette #define AXE_178_RESET_MAGIC			0x40
    120   1.8  pgoyette 
    121   1.8  pgoyette #define AXE_178_MEDIA_GMII			0x0001
    122   1.8  pgoyette #define AXE_MEDIA_FULL_DUPLEX			0x0002
    123   1.8  pgoyette #define AXE_172_MEDIA_TX_ABORT_ALLOW		0x0004
    124  1.19     skrll 
    125  1.19     skrll /* AX88178/88772 documentation says to always write 1 to bit 2 */
    126   1.8  pgoyette #define AXE_178_MEDIA_MAGIC			0x0004
    127  1.19     skrll /* AX88772 documentation says to always write 0 to bit 3 */
    128   1.8  pgoyette #define AXE_178_MEDIA_ENCK			0x0008
    129   1.8  pgoyette #define AXE_172_MEDIA_FLOW_CONTROL_EN		0x0010
    130   1.8  pgoyette #define AXE_178_MEDIA_RXFLOW_CONTROL_EN		0x0010
    131   1.8  pgoyette #define AXE_178_MEDIA_TXFLOW_CONTROL_EN		0x0020
    132   1.8  pgoyette #define AXE_178_MEDIA_JUMBO_EN			0x0040
    133   1.8  pgoyette #define AXE_178_MEDIA_LTPF_ONLY			0x0080
    134   1.8  pgoyette #define AXE_178_MEDIA_RX_EN			0x0100
    135   1.8  pgoyette #define AXE_178_MEDIA_100TX			0x0200
    136   1.8  pgoyette #define AXE_178_MEDIA_SBP			0x0800
    137   1.8  pgoyette #define AXE_178_MEDIA_SUPERMAC			0x1000
    138   1.2  augustss 
    139  1.19     skrll #define	AXE_RXCMD_PROMISC			0x0001
    140  1.19     skrll #define	AXE_RXCMD_ALLMULTI			0x0002
    141  1.19     skrll #define	AXE_172_RXCMD_UNICAST			0x0004
    142  1.19     skrll #define	AXE_178_RXCMD_KEEP_INVALID_CRC		0x0004
    143  1.19     skrll #define	AXE_RXCMD_BROADCAST			0x0008
    144  1.19     skrll #define	AXE_RXCMD_MULTICAST			0x0010
    145  1.19     skrll #define	AXE_RXCMD_ACCEPT_RUNT			0x0040	/* AX88772B */
    146  1.19     skrll #define	AXE_RXCMD_ENABLE			0x0080
    147  1.19     skrll #define	AXE_178_RXCMD_MFB_MASK			0x0300
    148  1.19     skrll #define	AXE_178_RXCMD_MFB_2048			0x0000
    149  1.19     skrll #define	AXE_178_RXCMD_MFB_4096			0x0100
    150  1.19     skrll #define	AXE_178_RXCMD_MFB_8192			0x0200
    151  1.19     skrll #define	AXE_178_RXCMD_MFB_16384			0x0300
    152  1.19     skrll #define	AXE_772B_RXCMD_HDR_TYPE_0		0x0000
    153  1.19     skrll #define	AXE_772B_RXCMD_HDR_TYPE_1		0x0100
    154  1.19     skrll #define	AXE_772B_RXCMD_IPHDR_ALIGN		0x0200
    155  1.19     skrll #define	AXE_772B_RXCMD_ADD_CHKSUM		0x0400
    156  1.19     skrll #define	AXE_RXCMD_LOOPBACK			0x1000	/* AX88772A/AX88772B */
    157  1.19     skrll 
    158  1.16       roy #define AXE_PHY_SEL_PRI		1
    159  1.16       roy #define AXE_PHY_SEL_SEC		0
    160  1.16       roy #define AXE_PHY_TYPE_MASK	0xE0
    161  1.16       roy #define AXE_PHY_TYPE_SHIFT	5
    162  1.16       roy #define AXE_PHY_TYPE(x)		\
    163  1.16       roy 	(((x) & AXE_PHY_TYPE_MASK) >> AXE_PHY_TYPE_SHIFT)
    164  1.16       roy 
    165  1.16       roy #define PHY_TYPE_100_HOME	0	/* 10/100 or 1M HOME PHY */
    166  1.16       roy #define PHY_TYPE_GIG		1	/* Gigabit PHY */
    167  1.16       roy #define PHY_TYPE_SPECIAL	4	/* Special case */
    168  1.16       roy #define PHY_TYPE_RSVD		5	/* Reserved */
    169  1.16       roy #define PHY_TYPE_NON_SUP	7	/* Non-supported PHY */
    170  1.16       roy 
    171  1.16       roy #define AXE_PHY_NO_MASK		0x1F
    172  1.16       roy #define AXE_PHY_NO(x)		((x) & AXE_PHY_NO_MASK)
    173  1.16       roy 
    174  1.16       roy #define AXE_772_PHY_NO_EPHY	0x10	/* Embedded 10/100 PHY of AX88772 */
    175  1.16       roy 
    176  1.19     skrll 
    177  1.19     skrll /* 178, 772, 772A, 172A, 772B */
    178  1.19     skrll #define AXE_IPG0_DEFAULT	0x15
    179  1.19     skrll #define AXE_IPG1_DEFAULT	0x0c
    180  1.19     skrll #define AXE_IPG2_DEFAULT	0x12
    181  1.19     skrll 
    182  1.16       roy #define	AXE_GPIO0_EN		0x01
    183  1.16       roy #define	AXE_GPIO0		0x02
    184  1.16       roy #define	AXE_GPIO1_EN		0x04
    185  1.16       roy #define	AXE_GPIO1		0x08
    186  1.16       roy #define	AXE_GPIO2_EN		0x10
    187  1.16       roy #define	AXE_GPIO2		0x20
    188  1.16       roy #define	AXE_GPIO_RELOAD_EEPROM	0x80
    189  1.16       roy 
    190  1.16       roy #define	AXE_PHY_MODE_MARVELL		0x00
    191  1.16       roy #define	AXE_PHY_MODE_CICADA		0x01
    192  1.16       roy #define	AXE_PHY_MODE_AGERE		0x02
    193  1.16       roy #define	AXE_PHY_MODE_CICADA_V2		0x05
    194  1.16       roy #define	AXE_PHY_MODE_AGERE_GMII		0x06
    195  1.16       roy #define	AXE_PHY_MODE_CICADA_V2_ASIX	0x09
    196  1.16       roy #define	AXE_PHY_MODE_REALTEK_8211CL	0x0C
    197  1.16       roy #define	AXE_PHY_MODE_REALTEK_8211BN	0x0D
    198  1.16       roy #define	AXE_PHY_MODE_REALTEK_8251CL	0x0E
    199  1.16       roy #define	AXE_PHY_MODE_ATTANSIC		0x40
    200  1.16       roy 
    201  1.19     skrll /* AX88772A/AX88772B only. */
    202  1.19     skrll #define	AXE_SW_PHY_SELECT_EXT		0x0000
    203  1.19     skrll #define	AXE_SW_PHY_SELECT_EMBEDDED	0x0001
    204  1.19     skrll #define	AXE_SW_PHY_SELECT_AUTO		0x0002
    205  1.19     skrll #define	AXE_SW_PHY_SELECT_SS_MII	0x0004
    206  1.19     skrll #define	AXE_SW_PHY_SELECT_SS_RVRS_MII	0x0008
    207  1.19     skrll #define	AXE_SW_PHY_SELECT_SS_RVRS_RMII	0x000C
    208  1.19     skrll #define	AXE_SW_PHY_SELECT_SS_ENB	0x0010
    209  1.19     skrll 
    210  1.19     skrll #define	AXE_SW_RESET_CLEAR		0x00
    211  1.19     skrll #define	AXE_SW_RESET_RR			0x01
    212  1.19     skrll #define	AXE_SW_RESET_RT			0x02
    213  1.19     skrll #define	AXE_SW_RESET_PRTE		0x04	/* not 772b */
    214  1.19     skrll #define	AXE_SW_RESET_PRL		0x08	/* not 772b */
    215  1.19     skrll #define	AXE_SW_RESET_BZ			0x10
    216  1.19     skrll #define	AXE_SW_RESET_IPRL		0x20
    217  1.19     skrll #define	AXE_SW_RESET_IPPD		0x40
    218  1.19     skrll #define	AXE_SW_RESET_IPOSC		__BIT(7)
    219  1.19     skrll /* 772B only */
    220  1.19     skrll #define	AXE_SW_RESET_IPPSL_MASK		__BITS(9,8)
    221  1.19     skrll #define	 AXE_SW_RESET_IPPSL_0		0
    222  1.19     skrll #define	 AXE_SW_RESET_IPPSL_1		1
    223  1.19     skrll #define	AXE_SW_RESET_IPCOPS		__BIT(10)
    224  1.19     skrll #define	AXE_SW_RESET_IPCOPSC		__BIT(11)
    225  1.19     skrll #define	AXE_SW_RESET_AD			__BIT(12)
    226  1.19     skrll #define	AXE_SW_RESET_IPFPS		__BIT(13)
    227  1.19     skrll #define	AXE_SW_RESET_WOLLP		__BIT(14)
    228  1.19     skrll 
    229  1.19     skrll /* AX88772A/AX88772B VLAN control. */
    230  1.19     skrll #define	AXE_VLAN_CTRL_ENB		0x00001000
    231  1.19     skrll #define	AXE_VLAN_CTRL_STRIP		0x00002000
    232  1.19     skrll #define	AXE_VLAN_CTRL_VID1_MASK		0x00000FFF
    233  1.19     skrll #define	AXE_VLAN_CTRL_VID2_MASK		0x0FFF0000
    234  1.19     skrll 
    235  1.19     skrll #define	AXE_RXCSUM_IP			0x0001
    236  1.19     skrll #define	AXE_RXCSUM_IPVE			0x0002
    237  1.19     skrll #define	AXE_RXCSUM_IPV6E		0x0004
    238  1.19     skrll #define	AXE_RXCSUM_TCP			0x0008
    239  1.19     skrll #define	AXE_RXCSUM_UDP			0x0010
    240  1.19     skrll #define	AXE_RXCSUM_ICMP			0x0020
    241  1.19     skrll #define	AXE_RXCSUM_IGMP			0x0040
    242  1.19     skrll #define	AXE_RXCSUM_ICMP6		0x0080
    243  1.19     skrll #define	AXE_RXCSUM_TCPV6		0x0100
    244  1.19     skrll #define	AXE_RXCSUM_UDPV6		0x0200
    245  1.19     skrll #define	AXE_RXCSUM_ICMPV6		0x0400
    246  1.19     skrll #define	AXE_RXCSUM_IGMPV6		0x0800
    247  1.19     skrll #define	AXE_RXCSUM_ICMP6V6		0x1000
    248  1.19     skrll #define	AXE_RXCSUM_FOPC			0x8000
    249  1.19     skrll 
    250  1.19     skrll #define	AXE_RXCSUM_64TE			0x0100
    251  1.19     skrll #define	AXE_RXCSUM_PPPOE		0x0200
    252  1.19     skrll #define	AXE_RXCSUM_RPCE			0x8000
    253  1.19     skrll 
    254  1.19     skrll #define	AXE_TXCSUM_IP			0x0001
    255  1.19     skrll #define	AXE_TXCSUM_TCP			0x0002
    256  1.19     skrll #define	AXE_TXCSUM_UDP			0x0004
    257  1.19     skrll #define	AXE_TXCSUM_ICMP			0x0008
    258  1.19     skrll #define	AXE_TXCSUM_IGMP			0x0010
    259  1.19     skrll #define	AXE_TXCSUM_ICMP6		0x0020
    260  1.19     skrll #define	AXE_TXCSUM_TCPV6		0x0100
    261  1.19     skrll #define	AXE_TXCSUM_UDPV6		0x0200
    262  1.19     skrll #define	AXE_TXCSUM_ICMPV6		0x0400
    263  1.19     skrll #define	AXE_TXCSUM_IGMPV6		0x0800
    264  1.19     skrll #define	AXE_TXCSUM_ICMP6V6		0x1000
    265  1.19     skrll 
    266  1.19     skrll #define	AXE_TXCSUM_64TE			0x0001
    267  1.19     skrll #define	AXE_TXCSUM_PPPOE		0x0002
    268  1.19     skrll 
    269  1.19     skrll #define AXE_NOPHY			0xE0
    270  1.19     skrll #define AXE_INTPHY			0x10
    271  1.15  christos 
    272  1.15  christos #define AXE_RH1M_RXLEN_MASK	0x07ff
    273  1.15  christos 
    274   1.1  augustss #define AXE_TIMEOUT		1000
    275   1.8  pgoyette 
    276   1.8  pgoyette #define AXE_172_BUFSZ		1536
    277   1.8  pgoyette #define AXE_178_MIN_BUFSZ	2048
    278   1.8  pgoyette #define AXE_178_MAX_BUFSZ	16384
    279   1.8  pgoyette 
    280   1.1  augustss #define AXE_MIN_FRAMELEN	60
    281   1.1  augustss #define AXE_RX_FRAMES		1
    282   1.1  augustss #define AXE_TX_FRAMES		1
    283   1.1  augustss 
    284   1.1  augustss #define AXE_RX_LIST_CNT		1
    285   1.1  augustss #define AXE_TX_LIST_CNT		1
    286   1.1  augustss 
    287   1.1  augustss #define AXE_CTL_READ		0x01
    288   1.1  augustss #define AXE_CTL_WRITE		0x02
    289   1.1  augustss 
    290   1.1  augustss #define AXE_CONFIG_NO		1
    291   1.1  augustss #define AXE_IFACE_IDX		0
    292   1.1  augustss 
    293  1.19     skrll /* EEPROM Map. */
    294  1.19     skrll #define	AXE_EEPROM_772B_NODE_ID		0x04
    295  1.19     skrll #define	AXE_EEPROM_772B_PHY_PWRCFG	0x18
    296  1.19     skrll 
    297  1.19     skrll struct ax88772b_mfb {
    298  1.19     skrll 	int	byte_cnt;
    299  1.19     skrll 	int	threshold;
    300  1.19     skrll 	int	size;
    301  1.19     skrll };
    302  1.19     skrll #define	AX88772B_MFB_2K		0
    303  1.19     skrll #define	AX88772B_MFB_4K		1
    304  1.19     skrll #define	AX88772B_MFB_6K		2
    305  1.19     skrll #define	AX88772B_MFB_8K		3
    306  1.19     skrll #define	AX88772B_MFB_16K	4
    307  1.19     skrll #define	AX88772B_MFB_20K	5
    308  1.19     skrll #define	AX88772B_MFB_24K	6
    309  1.19     skrll #define	AX88772B_MFB_32K	7
    310  1.19     skrll 
    311  1.19     skrll struct axe_sframe_hdr {
    312  1.19     skrll 	uint16_t len;
    313  1.19     skrll #define	AXE_HDR_LEN_MASK	0xFFFF
    314  1.19     skrll 	uint16_t ilen;
    315  1.19     skrll } __packed;
    316  1.19     skrll 
    317  1.19     skrll #define	AXE_TX_CSUM_PSEUDO_HDR	0x4000
    318  1.19     skrll #define	AXE_TX_CSUM_DIS		0x8000
    319  1.19     skrll 
    320   1.1  augustss /*
    321  1.19     skrll  * When RX checksum offloading is enabled, AX88772B uses new RX header
    322  1.19     skrll  * format and it's not compatible with previous RX header format.  In
    323  1.19     skrll  * addition, IP header align option should be enabled to get correct
    324  1.19     skrll  * frame size including RX header.  Total transferred size including
    325  1.19     skrll  * the RX header is multiple of 4 and controller will pad necessary
    326  1.19     skrll  * bytes if the length is not multiple of 4.
    327  1.19     skrll  * This driver does not enable partial checksum feature which will
    328  1.19     skrll  * compute 16bit checksum from 14th byte to the end of the frame.  If
    329  1.19     skrll  * this feature is enabled, computed checksum value is embedded into
    330  1.19     skrll  * RX header which in turn means it uses different RX header format.
    331   1.1  augustss  */
    332  1.19     skrll struct axe_csum_hdr {
    333  1.19     skrll 	uint16_t len;
    334  1.19     skrll #define	AXE_CSUM_HDR_LEN_MASK		0x07FF
    335  1.19     skrll #define	AXE_CSUM_HDR_CRC_ERR		0x1000
    336  1.19     skrll #define	AXE_CSUM_HDR_MII_ERR		0x2000
    337  1.19     skrll #define	AXE_CSUM_HDR_RUNT		0x4000
    338  1.19     skrll #define	AXE_CSUM_HDR_BMCAST		0x8000
    339  1.19     skrll 	uint16_t ilen;
    340  1.19     skrll 	uint16_t cstatus;
    341  1.19     skrll #define	AXE_CSUM_HDR_VLAN_MASK		0x0007
    342  1.19     skrll #define	AXE_CSUM_HDR_VLAN_STRIP		0x0008
    343  1.19     skrll #define	AXE_CSUM_HDR_VLAN_PRI_MASK	0x0070
    344  1.19     skrll #define	AXE_CSUM_HDR_L4_CSUM_ERR	0x0100
    345  1.19     skrll #define	AXE_CSUM_HDR_L3_CSUM_ERR	0x0200
    346  1.19     skrll #define	AXE_CSUM_HDR_L4_TYPE_UDP	0x0400
    347  1.19     skrll #define	AXE_CSUM_HDR_L4_TYPE_ICMP	0x0800
    348  1.19     skrll #define	AXE_CSUM_HDR_L4_TYPE_IGMP	0x0C00
    349  1.19     skrll #define	AXE_CSUM_HDR_L4_TYPE_TCP	0x1000
    350  1.19     skrll #define	AXE_CSUM_HDR_L4_TYPE_TCPV6	0x1400
    351  1.19     skrll #define	AXE_CSUM_HDR_L4_TYPE_MASK	0x1C00
    352  1.19     skrll #define	AXE_CSUM_HDR_L3_TYPE_IPV4	0x2000
    353  1.19     skrll #define	AXE_CSUM_HDR_L3_TYPE_IPV6	0x4000
    354  1.19     skrll 
    355  1.19     skrll #ifdef AXE_APPEND_PARTIAL_CSUM
    356  1.19     skrll 	/*
    357  1.19     skrll 	 * These members present only when partial checksum
    358  1.19     skrll 	 * offloading is enabled.  The checksum value is simple
    359  1.19     skrll 	 * 16bit sum of received frame starting at offset 14 of
    360  1.19     skrll 	 * the frame to the end of the frame excluding FCS bytes.
    361  1.19     skrll 	 */
    362  1.19     skrll 	uint16_t csum_value;
    363  1.19     skrll 	uint16_t dummy;
    364  1.19     skrll #endif
    365  1.19     skrll } __packed;
    366  1.19     skrll 
    367  1.19     skrll #define	AXE_CSUM_RXBYTES(x)	((x) & AXE_CSUM_HDR_LEN_MASK)
    368  1.19     skrll 
    369  1.19     skrll /*
    370  1.21       mrg  * The interrupt and CBW endpoints are currently unused by tthe driver.
    371  1.19     skrll  */
    372  1.19     skrll #define AXE_ENDPT_CTRL		0x0
    373  1.19     skrll #define AXE_ENDPT_INTR		0x1
    374  1.19     skrll #define AXE_ENDPT_RX		0x2
    375  1.19     skrll #define AXE_ENDPT_TX		0x3
    376  1.19     skrll #define AXx72A_ENDPT_RXCBW	0x4	/* AX88172A, and AX88772A */
    377  1.19     skrll #define AXx72A_ENDPT_TXCBW	0x5	/* AX88172A, and AX88772A */
    378  1.19     skrll #define AX772B_ENDPT_BOTM	0x5	/* AX88772B */
    379  1.19     skrll #define AXE_ENDPT_MAX		0x6
    380