Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _B44_H
0003 #define _B44_H
0004 
0005 #include <linux/brcmphy.h>
0006 
0007 /* Register layout. (These correspond to struct _bcmenettregs in bcm4400.) */
0008 #define B44_DEVCTRL 0x0000UL /* Device Control */
0009 #define  DEVCTRL_MPM        0x00000040 /* Magic Packet PME Enable (B0 only) */
0010 #define  DEVCTRL_PFE        0x00000080 /* Pattern Filtering Enable */
0011 #define  DEVCTRL_IPP        0x00000400 /* Internal EPHY Present */
0012 #define  DEVCTRL_EPR        0x00008000 /* EPHY Reset */
0013 #define  DEVCTRL_PME        0x00001000 /* PHY Mode Enable */
0014 #define  DEVCTRL_PMCE       0x00002000 /* PHY Mode Clocks Enable */
0015 #define  DEVCTRL_PADDR      0x0007c000 /* PHY Address */
0016 #define  DEVCTRL_PADDR_SHIFT    18
0017 #define B44_BIST_STAT   0x000CUL /* Built-In Self-Test Status */
0018 #define B44_WKUP_LEN    0x0010UL /* Wakeup Length */
0019 #define  WKUP_LEN_P0_MASK   0x0000007f /* Pattern 0 */
0020 #define  WKUP_LEN_D0        0x00000080
0021 #define  WKUP_LEN_P1_MASK   0x00007f00 /* Pattern 1 */
0022 #define  WKUP_LEN_P1_SHIFT  8
0023 #define  WKUP_LEN_D1        0x00008000
0024 #define  WKUP_LEN_P2_MASK   0x007f0000 /* Pattern 2 */
0025 #define  WKUP_LEN_P2_SHIFT  16
0026 #define  WKUP_LEN_D2        0x00000000
0027 #define  WKUP_LEN_P3_MASK   0x7f000000 /* Pattern 3 */
0028 #define  WKUP_LEN_P3_SHIFT  24
0029 #define  WKUP_LEN_D3        0x80000000
0030 #define  WKUP_LEN_DISABLE   0x80808080
0031 #define  WKUP_LEN_ENABLE_TWO    0x80800000
0032 #define  WKUP_LEN_ENABLE_THREE  0x80000000
0033 #define B44_ISTAT   0x0020UL /* Interrupt Status */
0034 #define  ISTAT_LS       0x00000020 /* Link Change (B0 only) */
0035 #define  ISTAT_PME      0x00000040 /* Power Management Event */
0036 #define  ISTAT_TO       0x00000080 /* General Purpose Timeout */
0037 #define  ISTAT_DSCE     0x00000400 /* Descriptor Error */
0038 #define  ISTAT_DATAE        0x00000800 /* Data Error */
0039 #define  ISTAT_DPE      0x00001000 /* Descr. Protocol Error */
0040 #define  ISTAT_RDU      0x00002000 /* Receive Descr. Underflow */
0041 #define  ISTAT_RFO      0x00004000 /* Receive FIFO Overflow */
0042 #define  ISTAT_TFU      0x00008000 /* Transmit FIFO Underflow */
0043 #define  ISTAT_RX       0x00010000 /* RX Interrupt */
0044 #define  ISTAT_TX       0x01000000 /* TX Interrupt */
0045 #define  ISTAT_EMAC     0x04000000 /* EMAC Interrupt */
0046 #define  ISTAT_MII_WRITE    0x08000000 /* MII Write Interrupt */
0047 #define  ISTAT_MII_READ     0x10000000 /* MII Read Interrupt */
0048 #define  ISTAT_ERRORS (ISTAT_DSCE|ISTAT_DATAE|ISTAT_DPE|ISTAT_RDU|ISTAT_RFO|ISTAT_TFU)
0049 #define B44_IMASK   0x0024UL /* Interrupt Mask */
0050 #define  IMASK_DEF      (ISTAT_ERRORS | ISTAT_TO | ISTAT_RX | ISTAT_TX)
0051 #define B44_GPTIMER 0x0028UL /* General Purpose Timer */
0052 #define B44_ADDR_LO 0x0088UL /* ENET Address Lo (B0 only) */
0053 #define B44_ADDR_HI 0x008CUL /* ENET Address Hi (B0 only) */
0054 #define B44_FILT_ADDR   0x0090UL /* ENET Filter Address */
0055 #define B44_FILT_DATA   0x0094UL /* ENET Filter Data */
0056 #define B44_TXBURST 0x00A0UL /* TX Max Burst Length */
0057 #define B44_RXBURST 0x00A4UL /* RX Max Burst Length */
0058 #define B44_MAC_CTRL    0x00A8UL /* MAC Control */
0059 #define  MAC_CTRL_CRC32_ENAB    0x00000001 /* CRC32 Generation Enable */
0060 #define  MAC_CTRL_PHY_PDOWN 0x00000004 /* Onchip EPHY Powerdown */
0061 #define  MAC_CTRL_PHY_EDET  0x00000008 /* Onchip EPHY Energy Detected */
0062 #define  MAC_CTRL_PHY_LEDCTRL   0x000000e0 /* Onchip EPHY LED Control */
0063 #define  MAC_CTRL_PHY_LEDCTRL_SHIFT 5
0064 #define B44_MAC_FLOW    0x00ACUL /* MAC Flow Control */
0065 #define  MAC_FLOW_RX_HI_WATER   0x000000ff /* Receive FIFO HI Water Mark */
0066 #define  MAC_FLOW_PAUSE_ENAB    0x00008000 /* Enable Pause Frame Generation */
0067 #define B44_RCV_LAZY    0x0100UL /* Lazy Interrupt Control */
0068 #define  RCV_LAZY_TO_MASK   0x00ffffff /* Timeout */
0069 #define  RCV_LAZY_FC_MASK   0xff000000 /* Frame Count */
0070 #define  RCV_LAZY_FC_SHIFT  24
0071 #define B44_DMATX_CTRL  0x0200UL /* DMA TX Control */
0072 #define  DMATX_CTRL_ENABLE  0x00000001 /* Enable */
0073 #define  DMATX_CTRL_SUSPEND 0x00000002 /* Suepend Request */
0074 #define  DMATX_CTRL_LPBACK  0x00000004 /* Loopback Enable */
0075 #define  DMATX_CTRL_FAIRPRIOR   0x00000008 /* Fair Priority */
0076 #define  DMATX_CTRL_FLUSH   0x00000010 /* Flush Request */
0077 #define B44_DMATX_ADDR  0x0204UL /* DMA TX Descriptor Ring Address */
0078 #define B44_DMATX_PTR   0x0208UL /* DMA TX Last Posted Descriptor */
0079 #define B44_DMATX_STAT  0x020CUL /* DMA TX Current Active Desc. + Status */
0080 #define  DMATX_STAT_CDMASK  0x00000fff /* Current Descriptor Mask */
0081 #define  DMATX_STAT_SMASK   0x0000f000 /* State Mask */
0082 #define  DMATX_STAT_SDISABLED   0x00000000 /* State Disabled */
0083 #define  DMATX_STAT_SACTIVE 0x00001000 /* State Active */
0084 #define  DMATX_STAT_SIDLE   0x00002000 /* State Idle Wait */
0085 #define  DMATX_STAT_SSTOPPED    0x00003000 /* State Stopped */
0086 #define  DMATX_STAT_SSUSP   0x00004000 /* State Suspend Pending */
0087 #define  DMATX_STAT_EMASK   0x000f0000 /* Error Mask */
0088 #define  DMATX_STAT_ENONE   0x00000000 /* Error None */
0089 #define  DMATX_STAT_EDPE    0x00010000 /* Error Desc. Protocol Error */
0090 #define  DMATX_STAT_EDFU    0x00020000 /* Error Data FIFO Underrun */
0091 #define  DMATX_STAT_EBEBR   0x00030000 /* Error Bus Error on Buffer Read */
0092 #define  DMATX_STAT_EBEDA   0x00040000 /* Error Bus Error on Desc. Access */
0093 #define  DMATX_STAT_FLUSHED 0x00100000 /* Flushed */
0094 #define B44_DMARX_CTRL  0x0210UL /* DMA RX Control */
0095 #define  DMARX_CTRL_ENABLE  0x00000001 /* Enable */
0096 #define  DMARX_CTRL_ROMASK  0x000000fe /* Receive Offset Mask */
0097 #define  DMARX_CTRL_ROSHIFT 1      /* Receive Offset Shift */
0098 #define B44_DMARX_ADDR  0x0214UL /* DMA RX Descriptor Ring Address */
0099 #define B44_DMARX_PTR   0x0218UL /* DMA RX Last Posted Descriptor */
0100 #define B44_DMARX_STAT  0x021CUL /* DMA RX Current Active Desc. + Status */
0101 #define  DMARX_STAT_CDMASK  0x00000fff /* Current Descriptor Mask */
0102 #define  DMARX_STAT_SMASK   0x0000f000 /* State Mask */
0103 #define  DMARX_STAT_SDISABLED   0x00000000 /* State Disabled */
0104 #define  DMARX_STAT_SACTIVE 0x00001000 /* State Active */
0105 #define  DMARX_STAT_SIDLE   0x00002000 /* State Idle Wait */
0106 #define  DMARX_STAT_SSTOPPED    0x00003000 /* State Stopped */
0107 #define  DMARX_STAT_EMASK   0x000f0000 /* Error Mask */
0108 #define  DMARX_STAT_ENONE   0x00000000 /* Error None */
0109 #define  DMARX_STAT_EDPE    0x00010000 /* Error Desc. Protocol Error */
0110 #define  DMARX_STAT_EDFO    0x00020000 /* Error Data FIFO Overflow */
0111 #define  DMARX_STAT_EBEBW   0x00030000 /* Error Bus Error on Buffer Write */
0112 #define  DMARX_STAT_EBEDA   0x00040000 /* Error Bus Error on Desc. Access */
0113 #define B44_DMAFIFO_AD  0x0220UL /* DMA FIFO Diag Address */
0114 #define  DMAFIFO_AD_OMASK   0x0000ffff /* Offset Mask */
0115 #define  DMAFIFO_AD_SMASK   0x000f0000 /* Select Mask */
0116 #define  DMAFIFO_AD_SXDD    0x00000000 /* Select Transmit DMA Data */
0117 #define  DMAFIFO_AD_SXDP    0x00010000 /* Select Transmit DMA Pointers */
0118 #define  DMAFIFO_AD_SRDD    0x00040000 /* Select Receive DMA Data */
0119 #define  DMAFIFO_AD_SRDP    0x00050000 /* Select Receive DMA Pointers */
0120 #define  DMAFIFO_AD_SXFD    0x00080000 /* Select Transmit FIFO Data */
0121 #define  DMAFIFO_AD_SXFP    0x00090000 /* Select Transmit FIFO Pointers */
0122 #define  DMAFIFO_AD_SRFD    0x000c0000 /* Select Receive FIFO Data */
0123 #define  DMAFIFO_AD_SRFP    0x000c0000 /* Select Receive FIFO Pointers */
0124 #define B44_DMAFIFO_LO  0x0224UL /* DMA FIFO Diag Low Data */
0125 #define B44_DMAFIFO_HI  0x0228UL /* DMA FIFO Diag High Data */
0126 #define B44_RXCONFIG    0x0400UL /* EMAC RX Config */
0127 #define  RXCONFIG_DBCAST    0x00000001 /* Disable Broadcast */
0128 #define  RXCONFIG_ALLMULTI  0x00000002 /* Accept All Multicast */
0129 #define  RXCONFIG_NORX_WHILE_TX 0x00000004 /* Receive Disable While Transmitting */
0130 #define  RXCONFIG_PROMISC   0x00000008 /* Promiscuous Enable */
0131 #define  RXCONFIG_LPBACK    0x00000010 /* Loopback Enable */
0132 #define  RXCONFIG_FLOW      0x00000020 /* Flow Control Enable */
0133 #define  RXCONFIG_FLOW_ACCEPT   0x00000040 /* Accept Unicast Flow Control Frame */
0134 #define  RXCONFIG_RFILT     0x00000080 /* Reject Filter */
0135 #define  RXCONFIG_CAM_ABSENT    0x00000100 /* CAM Absent */
0136 #define B44_RXMAXLEN    0x0404UL /* EMAC RX Max Packet Length */
0137 #define B44_TXMAXLEN    0x0408UL /* EMAC TX Max Packet Length */
0138 #define B44_MDIO_CTRL   0x0410UL /* EMAC MDIO Control */
0139 #define  MDIO_CTRL_MAXF_MASK    0x0000007f /* MDC Frequency */
0140 #define  MDIO_CTRL_PREAMBLE 0x00000080 /* MII Preamble Enable */
0141 #define B44_MDIO_DATA   0x0414UL /* EMAC MDIO Data */
0142 #define  MDIO_DATA_DATA     0x0000ffff /* R/W Data */
0143 #define  MDIO_DATA_TA_MASK  0x00030000 /* Turnaround Value */
0144 #define  MDIO_DATA_TA_SHIFT 16
0145 #define  MDIO_TA_VALID      2
0146 #define  MDIO_DATA_RA_MASK  0x007c0000 /* Register Address */
0147 #define  MDIO_DATA_RA_SHIFT 18
0148 #define  MDIO_DATA_PMD_MASK 0x0f800000 /* Physical Media Device */
0149 #define  MDIO_DATA_PMD_SHIFT    23
0150 #define  MDIO_DATA_OP_MASK  0x30000000 /* Opcode */
0151 #define  MDIO_DATA_OP_SHIFT 28
0152 #define  MDIO_OP_WRITE      1
0153 #define  MDIO_OP_READ       2
0154 #define  MDIO_DATA_SB_MASK  0xc0000000 /* Start Bits */
0155 #define  MDIO_DATA_SB_SHIFT 30
0156 #define  MDIO_DATA_SB_START 0x40000000 /* Start Of Frame */
0157 #define B44_EMAC_IMASK  0x0418UL /* EMAC Interrupt Mask */
0158 #define B44_EMAC_ISTAT  0x041CUL /* EMAC Interrupt Status */
0159 #define  EMAC_INT_MII       0x00000001 /* MII MDIO Interrupt */
0160 #define  EMAC_INT_MIB       0x00000002 /* MIB Interrupt */
0161 #define  EMAC_INT_FLOW      0x00000003 /* Flow Control Interrupt */
0162 #define B44_CAM_DATA_LO 0x0420UL /* EMAC CAM Data Low */
0163 #define B44_CAM_DATA_HI 0x0424UL /* EMAC CAM Data High */
0164 #define  CAM_DATA_HI_VALID  0x00010000 /* Valid Bit */
0165 #define B44_CAM_CTRL    0x0428UL /* EMAC CAM Control */
0166 #define  CAM_CTRL_ENABLE    0x00000001 /* CAM Enable */
0167 #define  CAM_CTRL_MSEL      0x00000002 /* Mask Select */
0168 #define  CAM_CTRL_READ      0x00000004 /* Read */
0169 #define  CAM_CTRL_WRITE     0x00000008 /* Read */
0170 #define  CAM_CTRL_INDEX_MASK    0x003f0000 /* Index Mask */
0171 #define  CAM_CTRL_INDEX_SHIFT   16
0172 #define  CAM_CTRL_BUSY      0x80000000 /* CAM Busy */
0173 #define B44_ENET_CTRL   0x042CUL /* EMAC ENET Control */
0174 #define  ENET_CTRL_ENABLE   0x00000001 /* EMAC Enable */
0175 #define  ENET_CTRL_DISABLE  0x00000002 /* EMAC Disable */
0176 #define  ENET_CTRL_SRST     0x00000004 /* EMAC Soft Reset */
0177 #define  ENET_CTRL_EPSEL    0x00000008 /* External PHY Select */
0178 #define B44_TX_CTRL 0x0430UL /* EMAC TX Control */
0179 #define  TX_CTRL_DUPLEX     0x00000001 /* Full Duplex */
0180 #define  TX_CTRL_FMODE      0x00000002 /* Flow Mode */
0181 #define  TX_CTRL_SBENAB     0x00000004 /* Single Backoff Enable */
0182 #define  TX_CTRL_SMALL_SLOT 0x00000008 /* Small Slottime */
0183 #define B44_TX_WMARK    0x0434UL /* EMAC TX Watermark */
0184 #define B44_MIB_CTRL    0x0438UL /* EMAC MIB Control */
0185 #define  MIB_CTRL_CLR_ON_READ   0x00000001 /* Autoclear on Read */
0186 #define B44_TX_GOOD_O   0x0500UL /* MIB TX Good Octets */
0187 #define B44_TX_GOOD_P   0x0504UL /* MIB TX Good Packets */
0188 #define B44_TX_O    0x0508UL /* MIB TX Octets */
0189 #define B44_TX_P    0x050CUL /* MIB TX Packets */
0190 #define B44_TX_BCAST    0x0510UL /* MIB TX Broadcast Packets */
0191 #define B44_TX_MCAST    0x0514UL /* MIB TX Multicast Packets */
0192 #define B44_TX_64   0x0518UL /* MIB TX <= 64 byte Packets */
0193 #define B44_TX_65_127   0x051CUL /* MIB TX 65 to 127 byte Packets */
0194 #define B44_TX_128_255  0x0520UL /* MIB TX 128 to 255 byte Packets */
0195 #define B44_TX_256_511  0x0524UL /* MIB TX 256 to 511 byte Packets */
0196 #define B44_TX_512_1023 0x0528UL /* MIB TX 512 to 1023 byte Packets */
0197 #define B44_TX_1024_MAX 0x052CUL /* MIB TX 1024 to max byte Packets */
0198 #define B44_TX_JABBER   0x0530UL /* MIB TX Jabber Packets */
0199 #define B44_TX_OSIZE    0x0534UL /* MIB TX Oversize Packets */
0200 #define B44_TX_FRAG 0x0538UL /* MIB TX Fragment Packets */
0201 #define B44_TX_URUNS    0x053CUL /* MIB TX Underruns */
0202 #define B44_TX_TCOLS    0x0540UL /* MIB TX Total Collisions */
0203 #define B44_TX_SCOLS    0x0544UL /* MIB TX Single Collisions */
0204 #define B44_TX_MCOLS    0x0548UL /* MIB TX Multiple Collisions */
0205 #define B44_TX_ECOLS    0x054CUL /* MIB TX Excessive Collisions */
0206 #define B44_TX_LCOLS    0x0550UL /* MIB TX Late Collisions */
0207 #define B44_TX_DEFERED  0x0554UL /* MIB TX Defered Packets */
0208 #define B44_TX_CLOST    0x0558UL /* MIB TX Carrier Lost */
0209 #define B44_TX_PAUSE    0x055CUL /* MIB TX Pause Packets */
0210 #define B44_RX_GOOD_O   0x0580UL /* MIB RX Good Octets */
0211 #define B44_RX_GOOD_P   0x0584UL /* MIB RX Good Packets */
0212 #define B44_RX_O    0x0588UL /* MIB RX Octets */
0213 #define B44_RX_P    0x058CUL /* MIB RX Packets */
0214 #define B44_RX_BCAST    0x0590UL /* MIB RX Broadcast Packets */
0215 #define B44_RX_MCAST    0x0594UL /* MIB RX Multicast Packets */
0216 #define B44_RX_64   0x0598UL /* MIB RX <= 64 byte Packets */
0217 #define B44_RX_65_127   0x059CUL /* MIB RX 65 to 127 byte Packets */
0218 #define B44_RX_128_255  0x05A0UL /* MIB RX 128 to 255 byte Packets */
0219 #define B44_RX_256_511  0x05A4UL /* MIB RX 256 to 511 byte Packets */
0220 #define B44_RX_512_1023 0x05A8UL /* MIB RX 512 to 1023 byte Packets */
0221 #define B44_RX_1024_MAX 0x05ACUL /* MIB RX 1024 to max byte Packets */
0222 #define B44_RX_JABBER   0x05B0UL /* MIB RX Jabber Packets */
0223 #define B44_RX_OSIZE    0x05B4UL /* MIB RX Oversize Packets */
0224 #define B44_RX_FRAG 0x05B8UL /* MIB RX Fragment Packets */
0225 #define B44_RX_MISS 0x05BCUL /* MIB RX Missed Packets */
0226 #define B44_RX_CRCA 0x05C0UL /* MIB RX CRC Align Errors */
0227 #define B44_RX_USIZE    0x05C4UL /* MIB RX Undersize Packets */
0228 #define B44_RX_CRC  0x05C8UL /* MIB RX CRC Errors */
0229 #define B44_RX_ALIGN    0x05CCUL /* MIB RX Align Errors */
0230 #define B44_RX_SYM  0x05D0UL /* MIB RX Symbol Errors */
0231 #define B44_RX_PAUSE    0x05D4UL /* MIB RX Pause Packets */
0232 #define B44_RX_NPAUSE   0x05D8UL /* MIB RX Non-Pause Packets */
0233 
0234 /* 4400 PHY registers */
0235 #define B44_MII_AUXCTRL     24  /* Auxiliary Control */
0236 #define  MII_AUXCTRL_DUPLEX 0x0001  /* Full Duplex */
0237 #define  MII_AUXCTRL_SPEED  0x0002  /* 1=100Mbps, 0=10Mbps */
0238 #define  MII_AUXCTRL_FORCED 0x0004  /* Forced 10/100 */
0239 #define B44_MII_ALEDCTRL    26  /* Activity LED */
0240 #define  MII_ALEDCTRL_ALLMSK    0x7fff
0241 #define B44_MII_TLEDCTRL    27  /* Traffic Meter LED */
0242 #define  MII_TLEDCTRL_ENABLE    0x0040
0243 
0244 struct dma_desc {
0245     __le32  ctrl;
0246     __le32  addr;
0247 };
0248 
0249 /* There are only 12 bits in the DMA engine for descriptor offsetting
0250  * so the table must be aligned on a boundary of this.
0251  */
0252 #define DMA_TABLE_BYTES     4096
0253 
0254 #define DESC_CTRL_LEN   0x00001fff
0255 #define DESC_CTRL_CMASK 0x0ff00000 /* Core specific bits */
0256 #define DESC_CTRL_EOT   0x10000000 /* End of Table */
0257 #define DESC_CTRL_IOC   0x20000000 /* Interrupt On Completion */
0258 #define DESC_CTRL_EOF   0x40000000 /* End of Frame */
0259 #define DESC_CTRL_SOF   0x80000000 /* Start of Frame */
0260 
0261 #define RX_COPY_THRESHOLD   256
0262 
0263 struct rx_header {
0264     __le16  len;
0265     __le16  flags;
0266     __le16  pad[12];
0267 };
0268 #define RX_HEADER_LEN   28
0269 
0270 #define RX_FLAG_OFIFO   0x00000001 /* FIFO Overflow */
0271 #define RX_FLAG_CRCERR  0x00000002 /* CRC Error */
0272 #define RX_FLAG_SERR    0x00000004 /* Receive Symbol Error */
0273 #define RX_FLAG_ODD 0x00000008 /* Frame has odd number of nibbles */
0274 #define RX_FLAG_LARGE   0x00000010 /* Frame is > RX MAX Length */
0275 #define RX_FLAG_MCAST   0x00000020 /* Dest is Multicast Address */
0276 #define RX_FLAG_BCAST   0x00000040 /* Dest is Broadcast Address */
0277 #define RX_FLAG_MISS    0x00000080 /* Received due to promisc mode */
0278 #define RX_FLAG_LAST    0x00000800 /* Last buffer in frame */
0279 #define RX_FLAG_ERRORS  (RX_FLAG_ODD | RX_FLAG_SERR | RX_FLAG_CRCERR | RX_FLAG_OFIFO)
0280 
0281 struct ring_info {
0282     struct sk_buff      *skb;
0283     dma_addr_t  mapping;
0284 };
0285 
0286 #define B44_MCAST_TABLE_SIZE        32
0287 /* no local phy regs, e.g: Broadcom switches pseudo-PHY */
0288 #define B44_PHY_ADDR_NO_LOCAL_PHY   BRCM_PSEUDO_PHY_ADDR
0289 /* no phy present at all */
0290 #define B44_PHY_ADDR_NO_PHY     31
0291 #define B44_MDC_RATIO           5000000
0292 
0293 #define B44_STAT_REG_DECLARE        \
0294     _B44(tx_good_octets)        \
0295     _B44(tx_good_pkts)      \
0296     _B44(tx_octets)         \
0297     _B44(tx_pkts)           \
0298     _B44(tx_broadcast_pkts)     \
0299     _B44(tx_multicast_pkts)     \
0300     _B44(tx_len_64)         \
0301     _B44(tx_len_65_to_127)      \
0302     _B44(tx_len_128_to_255)     \
0303     _B44(tx_len_256_to_511)     \
0304     _B44(tx_len_512_to_1023)    \
0305     _B44(tx_len_1024_to_max)    \
0306     _B44(tx_jabber_pkts)        \
0307     _B44(tx_oversize_pkts)      \
0308     _B44(tx_fragment_pkts)      \
0309     _B44(tx_underruns)      \
0310     _B44(tx_total_cols)     \
0311     _B44(tx_single_cols)        \
0312     _B44(tx_multiple_cols)      \
0313     _B44(tx_excessive_cols)     \
0314     _B44(tx_late_cols)      \
0315     _B44(tx_defered)        \
0316     _B44(tx_carrier_lost)       \
0317     _B44(tx_pause_pkts)     \
0318     _B44(rx_good_octets)        \
0319     _B44(rx_good_pkts)      \
0320     _B44(rx_octets)         \
0321     _B44(rx_pkts)           \
0322     _B44(rx_broadcast_pkts)     \
0323     _B44(rx_multicast_pkts)     \
0324     _B44(rx_len_64)         \
0325     _B44(rx_len_65_to_127)      \
0326     _B44(rx_len_128_to_255)     \
0327     _B44(rx_len_256_to_511)     \
0328     _B44(rx_len_512_to_1023)    \
0329     _B44(rx_len_1024_to_max)    \
0330     _B44(rx_jabber_pkts)        \
0331     _B44(rx_oversize_pkts)      \
0332     _B44(rx_fragment_pkts)      \
0333     _B44(rx_missed_pkts)        \
0334     _B44(rx_crc_align_errs)     \
0335     _B44(rx_undersize)      \
0336     _B44(rx_crc_errs)       \
0337     _B44(rx_align_errs)     \
0338     _B44(rx_symbol_errs)        \
0339     _B44(rx_pause_pkts)     \
0340     _B44(rx_nonpause_pkts)
0341 
0342 /* SW copy of device statistics, kept up to date by periodic timer
0343  * which probes HW values. Check b44_stats_update if you mess with
0344  * the layout
0345  */
0346 struct b44_hw_stats {
0347 #define _B44(x) u64 x;
0348 B44_STAT_REG_DECLARE
0349 #undef _B44
0350     struct u64_stats_sync   syncp;
0351 };
0352 
0353 #define B44_BOARDFLAG_ROBO      0x0010  /* Board has robo switch */
0354 #define B44_BOARDFLAG_ADM       0x0080  /* Board has ADMtek switch */
0355 
0356 struct ssb_device;
0357 
0358 struct b44 {
0359     spinlock_t      lock;
0360 
0361     u32         imask, istat;
0362 
0363     struct dma_desc     *rx_ring, *tx_ring;
0364 
0365     u32         tx_prod, tx_cons;
0366     u32         rx_prod, rx_cons;
0367 
0368     struct ring_info    *rx_buffers;
0369     struct ring_info    *tx_buffers;
0370 
0371     struct napi_struct  napi;
0372 
0373     u32         dma_offset;
0374     u32         flags;
0375 #define B44_FLAG_B0_ANDLATER    0x00000001
0376 #define B44_FLAG_BUGGY_TXPTR    0x00000002
0377 #define B44_FLAG_REORDER_BUG    0x00000004
0378 #define B44_FLAG_PAUSE_AUTO 0x00008000
0379 #define B44_FLAG_FULL_DUPLEX    0x00010000
0380 #define B44_FLAG_100_BASE_T 0x00020000
0381 #define B44_FLAG_TX_PAUSE   0x00040000
0382 #define B44_FLAG_RX_PAUSE   0x00080000
0383 #define B44_FLAG_FORCE_LINK 0x00100000
0384 #define B44_FLAG_ADV_10HALF 0x01000000
0385 #define B44_FLAG_ADV_10FULL 0x02000000
0386 #define B44_FLAG_ADV_100HALF    0x04000000
0387 #define B44_FLAG_ADV_100FULL    0x08000000
0388 #define B44_FLAG_EXTERNAL_PHY   0x10000000
0389 #define B44_FLAG_RX_RING_HACK   0x20000000
0390 #define B44_FLAG_TX_RING_HACK   0x40000000
0391 #define B44_FLAG_WOL_ENABLE 0x80000000
0392 
0393     u32         msg_enable;
0394 
0395     struct timer_list   timer;
0396 
0397     struct b44_hw_stats hw_stats;
0398 
0399     struct ssb_device   *sdev;
0400     struct net_device   *dev;
0401 
0402     dma_addr_t      rx_ring_dma, tx_ring_dma;
0403 
0404     u32         rx_pending;
0405     u32         tx_pending;
0406     u8          phy_addr;
0407     u8          force_copybreak;
0408     struct mii_bus      *mii_bus;
0409     int         old_link;
0410     struct mii_if_info  mii_if;
0411 };
0412 
0413 #endif /* _B44_H */