![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* $Id: sungem.h,v 1.10.2.4 2002/03/11 08:54:48 davem Exp $ 0003 * sungem.h: Definitions for Sun GEM ethernet driver. 0004 * 0005 * Copyright (C) 2000 David S. Miller (davem@redhat.com) 0006 */ 0007 0008 #ifndef _SUNGEM_H 0009 #define _SUNGEM_H 0010 0011 /* Global Registers */ 0012 #define GREG_SEBSTATE 0x0000UL /* SEB State Register */ 0013 #define GREG_CFG 0x0004UL /* Configuration Register */ 0014 #define GREG_STAT 0x000CUL /* Status Register */ 0015 #define GREG_IMASK 0x0010UL /* Interrupt Mask Register */ 0016 #define GREG_IACK 0x0014UL /* Interrupt ACK Register */ 0017 #define GREG_STAT2 0x001CUL /* Alias of GREG_STAT */ 0018 #define GREG_PCIESTAT 0x1000UL /* PCI Error Status Register */ 0019 #define GREG_PCIEMASK 0x1004UL /* PCI Error Mask Register */ 0020 #define GREG_BIFCFG 0x1008UL /* BIF Configuration Register */ 0021 #define GREG_BIFDIAG 0x100CUL /* BIF Diagnostics Register */ 0022 #define GREG_SWRST 0x1010UL /* Software Reset Register */ 0023 0024 /* Global SEB State Register */ 0025 #define GREG_SEBSTATE_ARB 0x00000003 /* State of Arbiter */ 0026 #define GREG_SEBSTATE_RXWON 0x00000004 /* RX won internal arbitration */ 0027 0028 /* Global Configuration Register */ 0029 #define GREG_CFG_IBURST 0x00000001 /* Infinite Burst */ 0030 #define GREG_CFG_TXDMALIM 0x0000003e /* TX DMA grant limit */ 0031 #define GREG_CFG_RXDMALIM 0x000007c0 /* RX DMA grant limit */ 0032 #define GREG_CFG_RONPAULBIT 0x00000800 /* Use mem read multiple for PCI read 0033 * after infinite burst (Apple) */ 0034 #define GREG_CFG_ENBUG2FIX 0x00001000 /* Fix Rx hang after overflow */ 0035 0036 /* Global Interrupt Status Register. 0037 * 0038 * Reading this register automatically clears bits 0 through 6. 0039 * This auto-clearing does not occur when the alias at GREG_STAT2 0040 * is read instead. The rest of the interrupt bits only clear when 0041 * the secondary interrupt status register corresponding to that 0042 * bit is read (ie. if GREG_STAT_PCS is set, it will be cleared by 0043 * reading PCS_ISTAT). 0044 */ 0045 #define GREG_STAT_TXINTME 0x00000001 /* TX INTME frame transferred */ 0046 #define GREG_STAT_TXALL 0x00000002 /* All TX frames transferred */ 0047 #define GREG_STAT_TXDONE 0x00000004 /* One TX frame transferred */ 0048 #define GREG_STAT_RXDONE 0x00000010 /* One RX frame arrived */ 0049 #define GREG_STAT_RXNOBUF 0x00000020 /* No free RX buffers available */ 0050 #define GREG_STAT_RXTAGERR 0x00000040 /* RX tag framing is corrupt */ 0051 #define GREG_STAT_PCS 0x00002000 /* PCS signalled interrupt */ 0052 #define GREG_STAT_TXMAC 0x00004000 /* TX MAC signalled interrupt */ 0053 #define GREG_STAT_RXMAC 0x00008000 /* RX MAC signalled interrupt */ 0054 #define GREG_STAT_MAC 0x00010000 /* MAC Control signalled irq */ 0055 #define GREG_STAT_MIF 0x00020000 /* MIF signalled interrupt */ 0056 #define GREG_STAT_PCIERR 0x00040000 /* PCI Error interrupt */ 0057 #define GREG_STAT_TXNR 0xfff80000 /* == TXDMA_TXDONE reg val */ 0058 #define GREG_STAT_TXNR_SHIFT 19 0059 0060 #define GREG_STAT_ABNORMAL (GREG_STAT_RXNOBUF | GREG_STAT_RXTAGERR | \ 0061 GREG_STAT_PCS | GREG_STAT_TXMAC | GREG_STAT_RXMAC | \ 0062 GREG_STAT_MAC | GREG_STAT_MIF | GREG_STAT_PCIERR) 0063 0064 #define GREG_STAT_NAPI (GREG_STAT_TXALL | GREG_STAT_TXINTME | \ 0065 GREG_STAT_RXDONE | GREG_STAT_ABNORMAL) 0066 0067 /* The layout of GREG_IMASK and GREG_IACK is identical to GREG_STAT. 0068 * Bits set in GREG_IMASK will prevent that interrupt type from being 0069 * signalled to the cpu. GREG_IACK can be used to clear specific top-level 0070 * interrupt conditions in GREG_STAT, ie. it only works for bits 0 through 6. 0071 * Setting the bit will clear that interrupt, clear bits will have no effect 0072 * on GREG_STAT. 0073 */ 0074 0075 /* Global PCI Error Status Register */ 0076 #define GREG_PCIESTAT_BADACK 0x00000001 /* No ACK64# during ABS64 cycle */ 0077 #define GREG_PCIESTAT_DTRTO 0x00000002 /* Delayed transaction timeout */ 0078 #define GREG_PCIESTAT_OTHER 0x00000004 /* Other PCI error, check cfg space */ 0079 0080 /* The layout of the GREG_PCIEMASK is identical to that of GREG_PCIESTAT. 0081 * Bits set in GREG_PCIEMASK will prevent that interrupt type from being 0082 * signalled to the cpu. 0083 */ 0084 0085 /* Global BIF Configuration Register */ 0086 #define GREG_BIFCFG_SLOWCLK 0x00000001 /* Set if PCI runs < 25Mhz */ 0087 #define GREG_BIFCFG_B64DIS 0x00000002 /* Disable 64bit wide data cycle*/ 0088 #define GREG_BIFCFG_M66EN 0x00000004 /* Set if on 66Mhz PCI segment */ 0089 0090 /* Global BIF Diagnostics Register */ 0091 #define GREG_BIFDIAG_BURSTSM 0x007f0000 /* PCI Burst state machine */ 0092 #define GREG_BIFDIAG_BIFSM 0xff000000 /* BIF state machine */ 0093 0094 /* Global Software Reset Register. 0095 * 0096 * This register is used to perform a global reset of the RX and TX portions 0097 * of the GEM asic. Setting the RX or TX reset bit will start the reset. 0098 * The driver _MUST_ poll these bits until they clear. One may not attempt 0099 * to program any other part of GEM until the bits clear. 0100 */ 0101 #define GREG_SWRST_TXRST 0x00000001 /* TX Software Reset */ 0102 #define GREG_SWRST_RXRST 0x00000002 /* RX Software Reset */ 0103 #define GREG_SWRST_RSTOUT 0x00000004 /* Force RST# pin active */ 0104 #define GREG_SWRST_CACHESIZE 0x00ff0000 /* RIO only: cache line size */ 0105 #define GREG_SWRST_CACHE_SHIFT 16 0106 0107 /* TX DMA Registers */ 0108 #define TXDMA_KICK 0x2000UL /* TX Kick Register */ 0109 #define TXDMA_CFG 0x2004UL /* TX Configuration Register */ 0110 #define TXDMA_DBLOW 0x2008UL /* TX Desc. Base Low */ 0111 #define TXDMA_DBHI 0x200CUL /* TX Desc. Base High */ 0112 #define TXDMA_FWPTR 0x2014UL /* TX FIFO Write Pointer */ 0113 #define TXDMA_FSWPTR 0x2018UL /* TX FIFO Shadow Write Pointer */ 0114 #define TXDMA_FRPTR 0x201CUL /* TX FIFO Read Pointer */ 0115 #define TXDMA_FSRPTR 0x2020UL /* TX FIFO Shadow Read Pointer */ 0116 #define TXDMA_PCNT 0x2024UL /* TX FIFO Packet Counter */ 0117 #define TXDMA_SMACHINE 0x2028UL /* TX State Machine Register */ 0118 #define TXDMA_DPLOW 0x2030UL /* TX Data Pointer Low */ 0119 #define TXDMA_DPHI 0x2034UL /* TX Data Pointer High */ 0120 #define TXDMA_TXDONE 0x2100UL /* TX Completion Register */ 0121 #define TXDMA_FADDR 0x2104UL /* TX FIFO Address */ 0122 #define TXDMA_FTAG 0x2108UL /* TX FIFO Tag */ 0123 #define TXDMA_DLOW 0x210CUL /* TX FIFO Data Low */ 0124 #define TXDMA_DHIT1 0x2110UL /* TX FIFO Data HighT1 */ 0125 #define TXDMA_DHIT0 0x2114UL /* TX FIFO Data HighT0 */ 0126 #define TXDMA_FSZ 0x2118UL /* TX FIFO Size */ 0127 0128 /* TX Kick Register. 0129 * 0130 * This 13-bit register is programmed by the driver to hold the descriptor 0131 * entry index which follows the last valid transmit descriptor. 0132 */ 0133 0134 /* TX Completion Register. 0135 * 0136 * This 13-bit register is updated by GEM to hold to descriptor entry index 0137 * which follows the last descriptor already processed by GEM. Note that 0138 * this value is mirrored in GREG_STAT which eliminates the need to even 0139 * access this register in the driver during interrupt processing. 0140 */ 0141 0142 /* TX Configuration Register. 0143 * 0144 * Note that TXDMA_CFG_FTHRESH, the TX FIFO Threshold, is an obsolete feature 0145 * that was meant to be used with jumbo packets. It should be set to the 0146 * maximum value of 0x4ff, else one risks getting TX MAC Underrun errors. 0147 */ 0148 #define TXDMA_CFG_ENABLE 0x00000001 /* Enable TX DMA channel */ 0149 #define TXDMA_CFG_RINGSZ 0x0000001e /* TX descriptor ring size */ 0150 #define TXDMA_CFG_RINGSZ_32 0x00000000 /* 32 TX descriptors */ 0151 #define TXDMA_CFG_RINGSZ_64 0x00000002 /* 64 TX descriptors */ 0152 #define TXDMA_CFG_RINGSZ_128 0x00000004 /* 128 TX descriptors */ 0153 #define TXDMA_CFG_RINGSZ_256 0x00000006 /* 256 TX descriptors */ 0154 #define TXDMA_CFG_RINGSZ_512 0x00000008 /* 512 TX descriptors */ 0155 #define TXDMA_CFG_RINGSZ_1K 0x0000000a /* 1024 TX descriptors */ 0156 #define TXDMA_CFG_RINGSZ_2K 0x0000000c /* 2048 TX descriptors */ 0157 #define TXDMA_CFG_RINGSZ_4K 0x0000000e /* 4096 TX descriptors */ 0158 #define TXDMA_CFG_RINGSZ_8K 0x00000010 /* 8192 TX descriptors */ 0159 #define TXDMA_CFG_PIOSEL 0x00000020 /* Enable TX FIFO PIO from cpu */ 0160 #define TXDMA_CFG_FTHRESH 0x001ffc00 /* TX FIFO Threshold, obsolete */ 0161 #define TXDMA_CFG_PMODE 0x00200000 /* TXALL irq means TX FIFO empty*/ 0162 0163 /* TX Descriptor Base Low/High. 0164 * 0165 * These two registers store the 53 most significant bits of the base address 0166 * of the TX descriptor table. The 11 least significant bits are always 0167 * zero. As a result, the TX descriptor table must be 2K aligned. 0168 */ 0169 0170 /* The rest of the TXDMA_* registers are for diagnostics and debug, I will document 0171 * them later. -DaveM 0172 */ 0173 0174 /* WakeOnLan Registers */ 0175 #define WOL_MATCH0 0x3000UL 0176 #define WOL_MATCH1 0x3004UL 0177 #define WOL_MATCH2 0x3008UL 0178 #define WOL_MCOUNT 0x300CUL 0179 #define WOL_WAKECSR 0x3010UL 0180 0181 /* WOL Match count register 0182 */ 0183 #define WOL_MCOUNT_N 0x00000010 0184 #define WOL_MCOUNT_M 0x00000000 /* 0 << 8 */ 0185 0186 #define WOL_WAKECSR_ENABLE 0x00000001 0187 #define WOL_WAKECSR_MII 0x00000002 0188 #define WOL_WAKECSR_SEEN 0x00000004 0189 #define WOL_WAKECSR_FILT_UCAST 0x00000008 0190 #define WOL_WAKECSR_FILT_MCAST 0x00000010 0191 #define WOL_WAKECSR_FILT_BCAST 0x00000020 0192 #define WOL_WAKECSR_FILT_SEEN 0x00000040 0193 0194 0195 /* Receive DMA Registers */ 0196 #define RXDMA_CFG 0x4000UL /* RX Configuration Register */ 0197 #define RXDMA_DBLOW 0x4004UL /* RX Descriptor Base Low */ 0198 #define RXDMA_DBHI 0x4008UL /* RX Descriptor Base High */ 0199 #define RXDMA_FWPTR 0x400CUL /* RX FIFO Write Pointer */ 0200 #define RXDMA_FSWPTR 0x4010UL /* RX FIFO Shadow Write Pointer */ 0201 #define RXDMA_FRPTR 0x4014UL /* RX FIFO Read Pointer */ 0202 #define RXDMA_PCNT 0x4018UL /* RX FIFO Packet Counter */ 0203 #define RXDMA_SMACHINE 0x401CUL /* RX State Machine Register */ 0204 #define RXDMA_PTHRESH 0x4020UL /* Pause Thresholds */ 0205 #define RXDMA_DPLOW 0x4024UL /* RX Data Pointer Low */ 0206 #define RXDMA_DPHI 0x4028UL /* RX Data Pointer High */ 0207 #define RXDMA_KICK 0x4100UL /* RX Kick Register */ 0208 #define RXDMA_DONE 0x4104UL /* RX Completion Register */ 0209 #define RXDMA_BLANK 0x4108UL /* RX Blanking Register */ 0210 #define RXDMA_FADDR 0x410CUL /* RX FIFO Address */ 0211 #define RXDMA_FTAG 0x4110UL /* RX FIFO Tag */ 0212 #define RXDMA_DLOW 0x4114UL /* RX FIFO Data Low */ 0213 #define RXDMA_DHIT1 0x4118UL /* RX FIFO Data HighT0 */ 0214 #define RXDMA_DHIT0 0x411CUL /* RX FIFO Data HighT1 */ 0215 #define RXDMA_FSZ 0x4120UL /* RX FIFO Size */ 0216 0217 /* RX Configuration Register. */ 0218 #define RXDMA_CFG_ENABLE 0x00000001 /* Enable RX DMA channel */ 0219 #define RXDMA_CFG_RINGSZ 0x0000001e /* RX descriptor ring size */ 0220 #define RXDMA_CFG_RINGSZ_32 0x00000000 /* - 32 entries */ 0221 #define RXDMA_CFG_RINGSZ_64 0x00000002 /* - 64 entries */ 0222 #define RXDMA_CFG_RINGSZ_128 0x00000004 /* - 128 entries */ 0223 #define RXDMA_CFG_RINGSZ_256 0x00000006 /* - 256 entries */ 0224 #define RXDMA_CFG_RINGSZ_512 0x00000008 /* - 512 entries */ 0225 #define RXDMA_CFG_RINGSZ_1K 0x0000000a /* - 1024 entries */ 0226 #define RXDMA_CFG_RINGSZ_2K 0x0000000c /* - 2048 entries */ 0227 #define RXDMA_CFG_RINGSZ_4K 0x0000000e /* - 4096 entries */ 0228 #define RXDMA_CFG_RINGSZ_8K 0x00000010 /* - 8192 entries */ 0229 #define RXDMA_CFG_RINGSZ_BDISAB 0x00000020 /* Disable RX desc batching */ 0230 #define RXDMA_CFG_FBOFF 0x00001c00 /* Offset of first data byte */ 0231 #define RXDMA_CFG_CSUMOFF 0x000fe000 /* Skip bytes before csum calc */ 0232 #define RXDMA_CFG_FTHRESH 0x07000000 /* RX FIFO dma start threshold */ 0233 #define RXDMA_CFG_FTHRESH_64 0x00000000 /* - 64 bytes */ 0234 #define RXDMA_CFG_FTHRESH_128 0x01000000 /* - 128 bytes */ 0235 #define RXDMA_CFG_FTHRESH_256 0x02000000 /* - 256 bytes */ 0236 #define RXDMA_CFG_FTHRESH_512 0x03000000 /* - 512 bytes */ 0237 #define RXDMA_CFG_FTHRESH_1K 0x04000000 /* - 1024 bytes */ 0238 #define RXDMA_CFG_FTHRESH_2K 0x05000000 /* - 2048 bytes */ 0239 0240 /* RX Descriptor Base Low/High. 0241 * 0242 * These two registers store the 53 most significant bits of the base address 0243 * of the RX descriptor table. The 11 least significant bits are always 0244 * zero. As a result, the RX descriptor table must be 2K aligned. 0245 */ 0246 0247 /* RX PAUSE Thresholds. 0248 * 0249 * These values determine when XOFF and XON PAUSE frames are emitted by 0250 * GEM. The thresholds measure RX FIFO occupancy in units of 64 bytes. 0251 */ 0252 #define RXDMA_PTHRESH_OFF 0x000001ff /* XOFF emitted w/FIFO > this */ 0253 #define RXDMA_PTHRESH_ON 0x001ff000 /* XON emitted w/FIFO < this */ 0254 0255 /* RX Kick Register. 0256 * 0257 * This 13-bit register is written by the host CPU and holds the last 0258 * valid RX descriptor number plus one. This is, if 'N' is written to 0259 * this register, it means that all RX descriptors up to but excluding 0260 * 'N' are valid. 0261 * 0262 * The hardware requires that RX descriptors are posted in increments 0263 * of 4. This means 'N' must be a multiple of four. For the best 0264 * performance, the first new descriptor being posted should be (PCI) 0265 * cache line aligned. 0266 */ 0267 0268 /* RX Completion Register. 0269 * 0270 * This 13-bit register is updated by GEM to indicate which RX descriptors 0271 * have already been used for receive frames. All descriptors up to but 0272 * excluding the value in this register are ready to be processed. GEM 0273 * updates this register value after the RX FIFO empties completely into 0274 * the RX descriptor's buffer, but before the RX_DONE bit is set in the 0275 * interrupt status register. 0276 */ 0277 0278 /* RX Blanking Register. */ 0279 #define RXDMA_BLANK_IPKTS 0x000001ff /* RX_DONE asserted after this 0280 * many packets received since 0281 * previous RX_DONE. 0282 */ 0283 #define RXDMA_BLANK_ITIME 0x000ff000 /* RX_DONE asserted after this 0284 * many clocks (measured in 2048 0285 * PCI clocks) were counted since 0286 * the previous RX_DONE. 0287 */ 0288 0289 /* RX FIFO Size. 0290 * 0291 * This 11-bit read-only register indicates how large, in units of 64-bytes, 0292 * the RX FIFO is. The driver uses this to properly configure the RX PAUSE 0293 * thresholds. 0294 */ 0295 0296 /* The rest of the RXDMA_* registers are for diagnostics and debug, I will document 0297 * them later. -DaveM 0298 */ 0299 0300 /* MAC Registers */ 0301 #define MAC_TXRST 0x6000UL /* TX MAC Software Reset Command*/ 0302 #define MAC_RXRST 0x6004UL /* RX MAC Software Reset Command*/ 0303 #define MAC_SNDPAUSE 0x6008UL /* Send Pause Command Register */ 0304 #define MAC_TXSTAT 0x6010UL /* TX MAC Status Register */ 0305 #define MAC_RXSTAT 0x6014UL /* RX MAC Status Register */ 0306 #define MAC_CSTAT 0x6018UL /* MAC Control Status Register */ 0307 #define MAC_TXMASK 0x6020UL /* TX MAC Mask Register */ 0308 #define MAC_RXMASK 0x6024UL /* RX MAC Mask Register */ 0309 #define MAC_MCMASK 0x6028UL /* MAC Control Mask Register */ 0310 #define MAC_TXCFG 0x6030UL /* TX MAC Configuration Register*/ 0311 #define MAC_RXCFG 0x6034UL /* RX MAC Configuration Register*/ 0312 #define MAC_MCCFG 0x6038UL /* MAC Control Config Register */ 0313 #define MAC_XIFCFG 0x603CUL /* XIF Configuration Register */ 0314 #define MAC_IPG0 0x6040UL /* InterPacketGap0 Register */ 0315 #define MAC_IPG1 0x6044UL /* InterPacketGap1 Register */ 0316 #define MAC_IPG2 0x6048UL /* InterPacketGap2 Register */ 0317 #define MAC_STIME 0x604CUL /* SlotTime Register */ 0318 #define MAC_MINFSZ 0x6050UL /* MinFrameSize Register */ 0319 #define MAC_MAXFSZ 0x6054UL /* MaxFrameSize Register */ 0320 #define MAC_PASIZE 0x6058UL /* PA Size Register */ 0321 #define MAC_JAMSIZE 0x605CUL /* JamSize Register */ 0322 #define MAC_ATTLIM 0x6060UL /* Attempt Limit Register */ 0323 #define MAC_MCTYPE 0x6064UL /* MAC Control Type Register */ 0324 #define MAC_ADDR0 0x6080UL /* MAC Address 0 Register */ 0325 #define MAC_ADDR1 0x6084UL /* MAC Address 1 Register */ 0326 #define MAC_ADDR2 0x6088UL /* MAC Address 2 Register */ 0327 #define MAC_ADDR3 0x608CUL /* MAC Address 3 Register */ 0328 #define MAC_ADDR4 0x6090UL /* MAC Address 4 Register */ 0329 #define MAC_ADDR5 0x6094UL /* MAC Address 5 Register */ 0330 #define MAC_ADDR6 0x6098UL /* MAC Address 6 Register */ 0331 #define MAC_ADDR7 0x609CUL /* MAC Address 7 Register */ 0332 #define MAC_ADDR8 0x60A0UL /* MAC Address 8 Register */ 0333 #define MAC_AFILT0 0x60A4UL /* Address Filter 0 Register */ 0334 #define MAC_AFILT1 0x60A8UL /* Address Filter 1 Register */ 0335 #define MAC_AFILT2 0x60ACUL /* Address Filter 2 Register */ 0336 #define MAC_AF21MSK 0x60B0UL /* Address Filter 2&1 Mask Reg */ 0337 #define MAC_AF0MSK 0x60B4UL /* Address Filter 0 Mask Reg */ 0338 #define MAC_HASH0 0x60C0UL /* Hash Table 0 Register */ 0339 #define MAC_HASH1 0x60C4UL /* Hash Table 1 Register */ 0340 #define MAC_HASH2 0x60C8UL /* Hash Table 2 Register */ 0341 #define MAC_HASH3 0x60CCUL /* Hash Table 3 Register */ 0342 #define MAC_HASH4 0x60D0UL /* Hash Table 4 Register */ 0343 #define MAC_HASH5 0x60D4UL /* Hash Table 5 Register */ 0344 #define MAC_HASH6 0x60D8UL /* Hash Table 6 Register */ 0345 #define MAC_HASH7 0x60DCUL /* Hash Table 7 Register */ 0346 #define MAC_HASH8 0x60E0UL /* Hash Table 8 Register */ 0347 #define MAC_HASH9 0x60E4UL /* Hash Table 9 Register */ 0348 #define MAC_HASH10 0x60E8UL /* Hash Table 10 Register */ 0349 #define MAC_HASH11 0x60ECUL /* Hash Table 11 Register */ 0350 #define MAC_HASH12 0x60F0UL /* Hash Table 12 Register */ 0351 #define MAC_HASH13 0x60F4UL /* Hash Table 13 Register */ 0352 #define MAC_HASH14 0x60F8UL /* Hash Table 14 Register */ 0353 #define MAC_HASH15 0x60FCUL /* Hash Table 15 Register */ 0354 #define MAC_NCOLL 0x6100UL /* Normal Collision Counter */ 0355 #define MAC_FASUCC 0x6104UL /* First Attmpt. Succ Coll Ctr. */ 0356 #define MAC_ECOLL 0x6108UL /* Excessive Collision Counter */ 0357 #define MAC_LCOLL 0x610CUL /* Late Collision Counter */ 0358 #define MAC_DTIMER 0x6110UL /* Defer Timer */ 0359 #define MAC_PATMPS 0x6114UL /* Peak Attempts Register */ 0360 #define MAC_RFCTR 0x6118UL /* Receive Frame Counter */ 0361 #define MAC_LERR 0x611CUL /* Length Error Counter */ 0362 #define MAC_AERR 0x6120UL /* Alignment Error Counter */ 0363 #define MAC_FCSERR 0x6124UL /* FCS Error Counter */ 0364 #define MAC_RXCVERR 0x6128UL /* RX code Violation Error Ctr */ 0365 #define MAC_RANDSEED 0x6130UL /* Random Number Seed Register */ 0366 #define MAC_SMACHINE 0x6134UL /* State Machine Register */ 0367 0368 /* TX MAC Software Reset Command. */ 0369 #define MAC_TXRST_CMD 0x00000001 /* Start sw reset, self-clears */ 0370 0371 /* RX MAC Software Reset Command. */ 0372 #define MAC_RXRST_CMD 0x00000001 /* Start sw reset, self-clears */ 0373 0374 /* Send Pause Command. */ 0375 #define MAC_SNDPAUSE_TS 0x0000ffff /* The pause_time operand used in 0376 * Send_Pause and flow-control 0377 * handshakes. 0378 */ 0379 #define MAC_SNDPAUSE_SP 0x00010000 /* Setting this bit instructs the MAC 0380 * to send a Pause Flow Control 0381 * frame onto the network. 0382 */ 0383 0384 /* TX MAC Status Register. */ 0385 #define MAC_TXSTAT_XMIT 0x00000001 /* Frame Transmitted */ 0386 #define MAC_TXSTAT_URUN 0x00000002 /* TX Underrun */ 0387 #define MAC_TXSTAT_MPE 0x00000004 /* Max Packet Size Error */ 0388 #define MAC_TXSTAT_NCE 0x00000008 /* Normal Collision Cntr Expire */ 0389 #define MAC_TXSTAT_ECE 0x00000010 /* Excess Collision Cntr Expire */ 0390 #define MAC_TXSTAT_LCE 0x00000020 /* Late Collision Cntr Expire */ 0391 #define MAC_TXSTAT_FCE 0x00000040 /* First Collision Cntr Expire */ 0392 #define MAC_TXSTAT_DTE 0x00000080 /* Defer Timer Expire */ 0393 #define MAC_TXSTAT_PCE 0x00000100 /* Peak Attempts Cntr Expire */ 0394 0395 /* RX MAC Status Register. */ 0396 #define MAC_RXSTAT_RCV 0x00000001 /* Frame Received */ 0397 #define MAC_RXSTAT_OFLW 0x00000002 /* Receive Overflow */ 0398 #define MAC_RXSTAT_FCE 0x00000004 /* Frame Cntr Expire */ 0399 #define MAC_RXSTAT_ACE 0x00000008 /* Align Error Cntr Expire */ 0400 #define MAC_RXSTAT_CCE 0x00000010 /* CRC Error Cntr Expire */ 0401 #define MAC_RXSTAT_LCE 0x00000020 /* Length Error Cntr Expire */ 0402 #define MAC_RXSTAT_VCE 0x00000040 /* Code Violation Cntr Expire */ 0403 0404 /* MAC Control Status Register. */ 0405 #define MAC_CSTAT_PRCV 0x00000001 /* Pause Received */ 0406 #define MAC_CSTAT_PS 0x00000002 /* Paused State */ 0407 #define MAC_CSTAT_NPS 0x00000004 /* Not Paused State */ 0408 #define MAC_CSTAT_PTR 0xffff0000 /* Pause Time Received */ 0409 0410 /* The layout of the MAC_{TX,RX,C}MASK registers is identical to that 0411 * of MAC_{TX,RX,C}STAT. Bits set in MAC_{TX,RX,C}MASK will prevent 0412 * that interrupt type from being signalled to front end of GEM. For 0413 * the interrupt to actually get sent to the cpu, it is necessary to 0414 * properly set the appropriate GREG_IMASK_{TX,RX,}MAC bits as well. 0415 */ 0416 0417 /* TX MAC Configuration Register. 0418 * 0419 * NOTE: The TX MAC Enable bit must be cleared and polled until 0420 * zero before any other bits in this register are changed. 0421 * 0422 * Also, enabling the Carrier Extension feature of GEM is 0423 * a 3 step process 1) Set TX Carrier Extension 2) Set 0424 * RX Carrier Extension 3) Set Slot Time to 0x200. This 0425 * mode must be enabled when in half-duplex at 1Gbps, else 0426 * it must be disabled. 0427 */ 0428 #define MAC_TXCFG_ENAB 0x00000001 /* TX MAC Enable */ 0429 #define MAC_TXCFG_ICS 0x00000002 /* Ignore Carrier Sense */ 0430 #define MAC_TXCFG_ICOLL 0x00000004 /* Ignore Collisions */ 0431 #define MAC_TXCFG_EIPG0 0x00000008 /* Enable IPG0 */ 0432 #define MAC_TXCFG_NGU 0x00000010 /* Never Give Up */ 0433 #define MAC_TXCFG_NGUL 0x00000020 /* Never Give Up Limit */ 0434 #define MAC_TXCFG_NBO 0x00000040 /* No Backoff */ 0435 #define MAC_TXCFG_SD 0x00000080 /* Slow Down */ 0436 #define MAC_TXCFG_NFCS 0x00000100 /* No FCS */ 0437 #define MAC_TXCFG_TCE 0x00000200 /* TX Carrier Extension */ 0438 0439 /* RX MAC Configuration Register. 0440 * 0441 * NOTE: The RX MAC Enable bit must be cleared and polled until 0442 * zero before any other bits in this register are changed. 0443 * 0444 * Similar rules apply to the Hash Filter Enable bit when 0445 * programming the hash table registers, and the Address Filter 0446 * Enable bit when programming the address filter registers. 0447 */ 0448 #define MAC_RXCFG_ENAB 0x00000001 /* RX MAC Enable */ 0449 #define MAC_RXCFG_SPAD 0x00000002 /* Strip Pad */ 0450 #define MAC_RXCFG_SFCS 0x00000004 /* Strip FCS */ 0451 #define MAC_RXCFG_PROM 0x00000008 /* Promiscuous Mode */ 0452 #define MAC_RXCFG_PGRP 0x00000010 /* Promiscuous Group */ 0453 #define MAC_RXCFG_HFE 0x00000020 /* Hash Filter Enable */ 0454 #define MAC_RXCFG_AFE 0x00000040 /* Address Filter Enable */ 0455 #define MAC_RXCFG_DDE 0x00000080 /* Disable Discard on Error */ 0456 #define MAC_RXCFG_RCE 0x00000100 /* RX Carrier Extension */ 0457 0458 /* MAC Control Config Register. */ 0459 #define MAC_MCCFG_SPE 0x00000001 /* Send Pause Enable */ 0460 #define MAC_MCCFG_RPE 0x00000002 /* Receive Pause Enable */ 0461 #define MAC_MCCFG_PMC 0x00000004 /* Pass MAC Control */ 0462 0463 /* XIF Configuration Register. 0464 * 0465 * NOTE: When leaving or entering loopback mode, a global hardware 0466 * init of GEM should be performed. 0467 */ 0468 #define MAC_XIFCFG_OE 0x00000001 /* MII TX Output Driver Enable */ 0469 #define MAC_XIFCFG_LBCK 0x00000002 /* Loopback TX to RX */ 0470 #define MAC_XIFCFG_DISE 0x00000004 /* Disable RX path during TX */ 0471 #define MAC_XIFCFG_GMII 0x00000008 /* Use GMII clocks + datapath */ 0472 #define MAC_XIFCFG_MBOE 0x00000010 /* Controls MII_BUF_EN pin */ 0473 #define MAC_XIFCFG_LLED 0x00000020 /* Force LINKLED# active (low) */ 0474 #define MAC_XIFCFG_FLED 0x00000040 /* Force FDPLXLED# active (low) */ 0475 0476 /* InterPacketGap0 Register. This 8-bit value is used as an extension 0477 * to the InterPacketGap1 Register. Specifically it contributes to the 0478 * timing of the RX-to-TX IPG. This value is ignored and presumed to 0479 * be zero for TX-to-TX IPG calculations and/or when the Enable IPG0 bit 0480 * is cleared in the TX MAC Configuration Register. 0481 * 0482 * This value in this register in terms of media byte time. 0483 * 0484 * Recommended value: 0x00 0485 */ 0486 0487 /* InterPacketGap1 Register. This 8-bit value defines the first 2/3 0488 * portion of the Inter Packet Gap. 0489 * 0490 * This value in this register in terms of media byte time. 0491 * 0492 * Recommended value: 0x08 0493 */ 0494 0495 /* InterPacketGap2 Register. This 8-bit value defines the second 1/3 0496 * portion of the Inter Packet Gap. 0497 * 0498 * This value in this register in terms of media byte time. 0499 * 0500 * Recommended value: 0x04 0501 */ 0502 0503 /* Slot Time Register. This 10-bit value specifies the slot time 0504 * parameter in units of media byte time. It determines the physical 0505 * span of the network. 0506 * 0507 * Recommended value: 0x40 0508 */ 0509 0510 /* Minimum Frame Size Register. This 10-bit register specifies the 0511 * smallest sized frame the TXMAC will send onto the medium, and the 0512 * RXMAC will receive from the medium. 0513 * 0514 * Recommended value: 0x40 0515 */ 0516 0517 /* Maximum Frame and Burst Size Register. 0518 * 0519 * This register specifies two things. First it specifies the maximum 0520 * sized frame the TXMAC will send and the RXMAC will recognize as 0521 * valid. Second, it specifies the maximum run length of a burst of 0522 * packets sent in half-duplex gigabit modes. 0523 * 0524 * Recommended value: 0x200005ee 0525 */ 0526 #define MAC_MAXFSZ_MFS 0x00007fff /* Max Frame Size */ 0527 #define MAC_MAXFSZ_MBS 0x7fff0000 /* Max Burst Size */ 0528 0529 /* PA Size Register. This 10-bit register specifies the number of preamble 0530 * bytes which will be transmitted at the beginning of each frame. A 0531 * value of two or greater should be programmed here. 0532 * 0533 * Recommended value: 0x07 0534 */ 0535 0536 /* Jam Size Register. This 4-bit register specifies the duration of 0537 * the jam in units of media byte time. 0538 * 0539 * Recommended value: 0x04 0540 */ 0541 0542 /* Attempts Limit Register. This 8-bit register specifies the number 0543 * of attempts that the TXMAC will make to transmit a frame, before it 0544 * resets its Attempts Counter. After reaching the Attempts Limit the 0545 * TXMAC may or may not drop the frame, as determined by the NGU 0546 * (Never Give Up) and NGUL (Never Give Up Limit) bits in the TXMAC 0547 * Configuration Register. 0548 * 0549 * Recommended value: 0x10 0550 */ 0551 0552 /* MAX Control Type Register. This 16-bit register specifies the 0553 * "type" field of a MAC Control frame. The TXMAC uses this field to 0554 * encapsulate the MAC Control frame for transmission, and the RXMAC 0555 * uses it for decoding valid MAC Control frames received from the 0556 * network. 0557 * 0558 * Recommended value: 0x8808 0559 */ 0560 0561 /* MAC Address Registers. Each of these registers specify the 0562 * ethernet MAC of the interface, 16-bits at a time. Register 0563 * 0 specifies bits [47:32], register 1 bits [31:16], and register 0564 * 2 bits [15:0]. 0565 * 0566 * Registers 3 through and including 5 specify an alternate 0567 * MAC address for the interface. 0568 * 0569 * Registers 6 through and including 8 specify the MAC Control 0570 * Address, which must be the reserved multicast address for MAC 0571 * Control frames. 0572 * 0573 * Example: To program primary station address a:b:c:d:e:f into 0574 * the chip. 0575 * MAC_Address_2 = (a << 8) | b 0576 * MAC_Address_1 = (c << 8) | d 0577 * MAC_Address_0 = (e << 8) | f 0578 */ 0579 0580 /* Address Filter Registers. Registers 0 through 2 specify bit 0581 * fields [47:32] through [15:0], respectively, of the address 0582 * filter. The Address Filter 2&1 Mask Register denotes the 8-bit 0583 * nibble mask for Address Filter Registers 2 and 1. The Address 0584 * Filter 0 Mask Register denotes the 16-bit mask for the Address 0585 * Filter Register 0. 0586 */ 0587 0588 /* Hash Table Registers. Registers 0 through 15 specify bit fields 0589 * [255:240] through [15:0], respectively, of the hash table. 0590 */ 0591 0592 /* Statistics Registers. All of these registers are 16-bits and 0593 * track occurrences of a specific event. GEM can be configured 0594 * to interrupt the host cpu when any of these counters overflow. 0595 * They should all be explicitly initialized to zero when the interface 0596 * is brought up. 0597 */ 0598 0599 /* Random Number Seed Register. This 10-bit value is used as the 0600 * RNG seed inside GEM for the CSMA/CD backoff algorithm. It is 0601 * recommended to program this register to the 10 LSB of the 0602 * interfaces MAC address. 0603 */ 0604 0605 /* Pause Timer, read-only. This 16-bit timer is used to time the pause 0606 * interval as indicated by a received pause flow control frame. 0607 * A non-zero value in this timer indicates that the MAC is currently in 0608 * the paused state. 0609 */ 0610 0611 /* MIF Registers */ 0612 #define MIF_BBCLK 0x6200UL /* MIF Bit-Bang Clock */ 0613 #define MIF_BBDATA 0x6204UL /* MIF Bit-Band Data */ 0614 #define MIF_BBOENAB 0x6208UL /* MIF Bit-Bang Output Enable */ 0615 #define MIF_FRAME 0x620CUL /* MIF Frame/Output Register */ 0616 #define MIF_CFG 0x6210UL /* MIF Configuration Register */ 0617 #define MIF_MASK 0x6214UL /* MIF Mask Register */ 0618 #define MIF_STATUS 0x6218UL /* MIF Status Register */ 0619 #define MIF_SMACHINE 0x621CUL /* MIF State Machine Register */ 0620 0621 /* MIF Bit-Bang Clock. This 1-bit register is used to generate the 0622 * MDC clock waveform on the MII Management Interface when the MIF is 0623 * programmed in the "Bit-Bang" mode. Writing a '1' after a '0' into 0624 * this register will create a rising edge on the MDC, while writing 0625 * a '0' after a '1' will create a falling edge. For every bit that 0626 * is transferred on the management interface, both edges have to be 0627 * generated. 0628 */ 0629 0630 /* MIF Bit-Bang Data. This 1-bit register is used to generate the 0631 * outgoing data (MDO) on the MII Management Interface when the MIF 0632 * is programmed in the "Bit-Bang" mode. The daa will be steered to the 0633 * appropriate MDIO based on the state of the PHY_Select bit in the MIF 0634 * Configuration Register. 0635 */ 0636 0637 /* MIF Big-Band Output Enable. THis 1-bit register is used to enable 0638 * ('1') or disable ('0') the I-directional driver on the MII when the 0639 * MIF is programmed in the "Bit-Bang" mode. The MDIO should be enabled 0640 * when data bits are transferred from the MIF to the transceiver, and it 0641 * should be disabled when the interface is idle or when data bits are 0642 * transferred from the transceiver to the MIF (data portion of a read 0643 * instruction). Only one MDIO will be enabled at a given time, depending 0644 * on the state of the PHY_Select bit in the MIF Configuration Register. 0645 */ 0646 0647 /* MIF Configuration Register. This 15-bit register controls the operation 0648 * of the MIF. 0649 */ 0650 #define MIF_CFG_PSELECT 0x00000001 /* Xcvr slct: 0=mdio0 1=mdio1 */ 0651 #define MIF_CFG_POLL 0x00000002 /* Enable polling mechanism */ 0652 #define MIF_CFG_BBMODE 0x00000004 /* 1=bit-bang 0=frame mode */ 0653 #define MIF_CFG_PRADDR 0x000000f8 /* Xcvr poll register address */ 0654 #define MIF_CFG_MDI0 0x00000100 /* MDIO_0 present or read-bit */ 0655 #define MIF_CFG_MDI1 0x00000200 /* MDIO_1 present or read-bit */ 0656 #define MIF_CFG_PPADDR 0x00007c00 /* Xcvr poll PHY address */ 0657 0658 /* MIF Frame/Output Register. This 32-bit register allows the host to 0659 * communicate with a transceiver in frame mode (as opposed to big-bang 0660 * mode). Writes by the host specify an instrution. After being issued 0661 * the host must poll this register for completion. Also, after 0662 * completion this register holds the data returned by the transceiver 0663 * if applicable. 0664 */ 0665 #define MIF_FRAME_ST 0xc0000000 /* STart of frame */ 0666 #define MIF_FRAME_OP 0x30000000 /* OPcode */ 0667 #define MIF_FRAME_PHYAD 0x0f800000 /* PHY ADdress */ 0668 #define MIF_FRAME_REGAD 0x007c0000 /* REGister ADdress */ 0669 #define MIF_FRAME_TAMSB 0x00020000 /* Turn Around MSB */ 0670 #define MIF_FRAME_TALSB 0x00010000 /* Turn Around LSB */ 0671 #define MIF_FRAME_DATA 0x0000ffff /* Instruction Payload */ 0672 0673 /* MIF Status Register. This register reports status when the MIF is 0674 * operating in the poll mode. The poll status field is auto-clearing 0675 * on read. 0676 */ 0677 #define MIF_STATUS_DATA 0xffff0000 /* Live image of XCVR reg */ 0678 #define MIF_STATUS_STAT 0x0000ffff /* Which bits have changed */ 0679 0680 /* MIF Mask Register. This 16-bit register is used when in poll mode 0681 * to say which bits of the polled register will cause an interrupt 0682 * when changed. 0683 */ 0684 0685 /* PCS/Serialink Registers */ 0686 #define PCS_MIICTRL 0x9000UL /* PCS MII Control Register */ 0687 #define PCS_MIISTAT 0x9004UL /* PCS MII Status Register */ 0688 #define PCS_MIIADV 0x9008UL /* PCS MII Advertisement Reg */ 0689 #define PCS_MIILP 0x900CUL /* PCS MII Link Partner Ability */ 0690 #define PCS_CFG 0x9010UL /* PCS Configuration Register */ 0691 #define PCS_SMACHINE 0x9014UL /* PCS State Machine Register */ 0692 #define PCS_ISTAT 0x9018UL /* PCS Interrupt Status Reg */ 0693 #define PCS_DMODE 0x9050UL /* Datapath Mode Register */ 0694 #define PCS_SCTRL 0x9054UL /* Serialink Control Register */ 0695 #define PCS_SOS 0x9058UL /* Shared Output Select Reg */ 0696 #define PCS_SSTATE 0x905CUL /* Serialink State Register */ 0697 0698 /* PCD MII Control Register. */ 0699 #define PCS_MIICTRL_SPD 0x00000040 /* Read as one, writes ignored */ 0700 #define PCS_MIICTRL_CT 0x00000080 /* Force COL signal active */ 0701 #define PCS_MIICTRL_DM 0x00000100 /* Duplex mode, forced low */ 0702 #define PCS_MIICTRL_RAN 0x00000200 /* Restart auto-neg, self clear */ 0703 #define PCS_MIICTRL_ISO 0x00000400 /* Read as zero, writes ignored */ 0704 #define PCS_MIICTRL_PD 0x00000800 /* Read as zero, writes ignored */ 0705 #define PCS_MIICTRL_ANE 0x00001000 /* Auto-neg enable */ 0706 #define PCS_MIICTRL_SS 0x00002000 /* Read as zero, writes ignored */ 0707 #define PCS_MIICTRL_WB 0x00004000 /* Wrapback, loopback at 10-bit 0708 * input side of Serialink 0709 */ 0710 #define PCS_MIICTRL_RST 0x00008000 /* Resets PCS, self clearing */ 0711 0712 /* PCS MII Status Register. */ 0713 #define PCS_MIISTAT_EC 0x00000001 /* Ext Capability: Read as zero */ 0714 #define PCS_MIISTAT_JD 0x00000002 /* Jabber Detect: Read as zero */ 0715 #define PCS_MIISTAT_LS 0x00000004 /* Link Status: 1=up 0=down */ 0716 #define PCS_MIISTAT_ANA 0x00000008 /* Auto-neg Ability, always 1 */ 0717 #define PCS_MIISTAT_RF 0x00000010 /* Remote Fault */ 0718 #define PCS_MIISTAT_ANC 0x00000020 /* Auto-neg complete */ 0719 #define PCS_MIISTAT_ES 0x00000100 /* Extended Status, always 1 */ 0720 0721 /* PCS MII Advertisement Register. */ 0722 #define PCS_MIIADV_FD 0x00000020 /* Advertise Full Duplex */ 0723 #define PCS_MIIADV_HD 0x00000040 /* Advertise Half Duplex */ 0724 #define PCS_MIIADV_SP 0x00000080 /* Advertise Symmetric Pause */ 0725 #define PCS_MIIADV_AP 0x00000100 /* Advertise Asymmetric Pause */ 0726 #define PCS_MIIADV_RF 0x00003000 /* Remote Fault */ 0727 #define PCS_MIIADV_ACK 0x00004000 /* Read-only */ 0728 #define PCS_MIIADV_NP 0x00008000 /* Next-page, forced low */ 0729 0730 /* PCS MII Link Partner Ability Register. This register is equivalent 0731 * to the Link Partnet Ability Register of the standard MII register set. 0732 * It's layout corresponds to the PCS MII Advertisement Register. 0733 */ 0734 0735 /* PCS Configuration Register. */ 0736 #define PCS_CFG_ENABLE 0x00000001 /* Must be zero while changing 0737 * PCS MII advertisement reg. 0738 */ 0739 #define PCS_CFG_SDO 0x00000002 /* Signal detect override */ 0740 #define PCS_CFG_SDL 0x00000004 /* Signal detect active low */ 0741 #define PCS_CFG_JS 0x00000018 /* Jitter-study: 0742 * 0 = normal operation 0743 * 1 = high-frequency test pattern 0744 * 2 = low-frequency test pattern 0745 * 3 = reserved 0746 */ 0747 #define PCS_CFG_TO 0x00000020 /* 10ms auto-neg timer override */ 0748 0749 /* PCS Interrupt Status Register. This register is self-clearing 0750 * when read. 0751 */ 0752 #define PCS_ISTAT_LSC 0x00000004 /* Link Status Change */ 0753 0754 /* Datapath Mode Register. */ 0755 #define PCS_DMODE_SM 0x00000001 /* 1 = use internal Serialink */ 0756 #define PCS_DMODE_ESM 0x00000002 /* External SERDES mode */ 0757 #define PCS_DMODE_MGM 0x00000004 /* MII/GMII mode */ 0758 #define PCS_DMODE_GMOE 0x00000008 /* GMII Output Enable */ 0759 0760 /* Serialink Control Register. 0761 * 0762 * NOTE: When in SERDES mode, the loopback bit has inverse logic. 0763 */ 0764 #define PCS_SCTRL_LOOP 0x00000001 /* Loopback enable */ 0765 #define PCS_SCTRL_ESCD 0x00000002 /* Enable sync char detection */ 0766 #define PCS_SCTRL_LOCK 0x00000004 /* Lock to reference clock */ 0767 #define PCS_SCTRL_EMP 0x00000018 /* Output driver emphasis */ 0768 #define PCS_SCTRL_STEST 0x000001c0 /* Self test patterns */ 0769 #define PCS_SCTRL_PDWN 0x00000200 /* Software power-down */ 0770 #define PCS_SCTRL_RXZ 0x00000c00 /* PLL input to Serialink */ 0771 #define PCS_SCTRL_RXP 0x00003000 /* PLL input to Serialink */ 0772 #define PCS_SCTRL_TXZ 0x0000c000 /* PLL input to Serialink */ 0773 #define PCS_SCTRL_TXP 0x00030000 /* PLL input to Serialink */ 0774 0775 /* Shared Output Select Register. For test and debug, allows multiplexing 0776 * test outputs into the PROM address pins. Set to zero for normal 0777 * operation. 0778 */ 0779 #define PCS_SOS_PADDR 0x00000003 /* PROM Address */ 0780 0781 /* PROM Image Space */ 0782 #define PROM_START 0x100000UL /* Expansion ROM run time access*/ 0783 #define PROM_SIZE 0x0fffffUL /* Size of ROM */ 0784 #define PROM_END 0x200000UL /* End of ROM */ 0785 0786 /* MII definitions missing from mii.h */ 0787 0788 #define BMCR_SPD2 0x0040 /* Gigabit enable? (bcm5411) */ 0789 #define LPA_PAUSE 0x0400 0790 0791 /* More PHY registers (specific to Broadcom models) */ 0792 0793 /* MII BCM5201 MULTIPHY interrupt register */ 0794 #define MII_BCM5201_INTERRUPT 0x1A 0795 #define MII_BCM5201_INTERRUPT_INTENABLE 0x4000 0796 0797 #define MII_BCM5201_AUXMODE2 0x1B 0798 #define MII_BCM5201_AUXMODE2_LOWPOWER 0x0008 0799 0800 #define MII_BCM5201_MULTIPHY 0x1E 0801 0802 /* MII BCM5201 MULTIPHY register bits */ 0803 #define MII_BCM5201_MULTIPHY_SERIALMODE 0x0002 0804 #define MII_BCM5201_MULTIPHY_SUPERISOLATE 0x0008 0805 0806 /* MII BCM5400 1000-BASET Control register */ 0807 #define MII_BCM5400_GB_CONTROL 0x09 0808 #define MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP 0x0200 0809 0810 /* MII BCM5400 AUXCONTROL register */ 0811 #define MII_BCM5400_AUXCONTROL 0x18 0812 #define MII_BCM5400_AUXCONTROL_PWR10BASET 0x0004 0813 0814 /* MII BCM5400 AUXSTATUS register */ 0815 #define MII_BCM5400_AUXSTATUS 0x19 0816 #define MII_BCM5400_AUXSTATUS_LINKMODE_MASK 0x0700 0817 #define MII_BCM5400_AUXSTATUS_LINKMODE_SHIFT 8 0818 0819 /* When it can, GEM internally caches 4 aligned TX descriptors 0820 * at a time, so that it can use full cacheline DMA reads. 0821 * 0822 * Note that unlike HME, there is no ownership bit in the descriptor 0823 * control word. The same functionality is obtained via the TX-Kick 0824 * and TX-Complete registers. As a result, GEM need not write back 0825 * updated values to the TX descriptor ring, it only performs reads. 0826 * 0827 * Since TX descriptors are never modified by GEM, the driver can 0828 * use the buffer DMA address as a place to keep track of allocated 0829 * DMA mappings for a transmitted packet. 0830 */ 0831 struct gem_txd { 0832 __le64 control_word; 0833 __le64 buffer; 0834 }; 0835 0836 #define TXDCTRL_BUFSZ 0x0000000000007fffULL /* Buffer Size */ 0837 #define TXDCTRL_CSTART 0x00000000001f8000ULL /* CSUM Start Offset */ 0838 #define TXDCTRL_COFF 0x000000001fe00000ULL /* CSUM Stuff Offset */ 0839 #define TXDCTRL_CENAB 0x0000000020000000ULL /* CSUM Enable */ 0840 #define TXDCTRL_EOF 0x0000000040000000ULL /* End of Frame */ 0841 #define TXDCTRL_SOF 0x0000000080000000ULL /* Start of Frame */ 0842 #define TXDCTRL_INTME 0x0000000100000000ULL /* "Interrupt Me" */ 0843 #define TXDCTRL_NOCRC 0x0000000200000000ULL /* No CRC Present */ 0844 0845 /* GEM requires that RX descriptors are provided four at a time, 0846 * aligned. Also, the RX ring may not wrap around. This means that 0847 * there will be at least 4 unused descriptor entries in the middle 0848 * of the RX ring at all times. 0849 * 0850 * Similar to HME, GEM assumes that it can write garbage bytes before 0851 * the beginning of the buffer and right after the end in order to DMA 0852 * whole cachelines. 0853 * 0854 * Unlike for TX, GEM does update the status word in the RX descriptors 0855 * when packets arrive. Therefore an ownership bit does exist in the 0856 * RX descriptors. It is advisory, GEM clears it but does not check 0857 * it in any way. So when buffers are posted to the RX ring (via the 0858 * RX Kick register) by the driver it must make sure the buffers are 0859 * truly ready and that the ownership bits are set properly. 0860 * 0861 * Even though GEM modifies the RX descriptors, it guarantees that the 0862 * buffer DMA address field will stay the same when it performs these 0863 * updates. Therefore it can be used to keep track of DMA mappings 0864 * by the host driver just as in the TX descriptor case above. 0865 */ 0866 struct gem_rxd { 0867 __le64 status_word; 0868 __le64 buffer; 0869 }; 0870 0871 #define RXDCTRL_TCPCSUM 0x000000000000ffffULL /* TCP Pseudo-CSUM */ 0872 #define RXDCTRL_BUFSZ 0x000000007fff0000ULL /* Buffer Size */ 0873 #define RXDCTRL_OWN 0x0000000080000000ULL /* GEM owns this entry */ 0874 #define RXDCTRL_HASHVAL 0x0ffff00000000000ULL /* Hash Value */ 0875 #define RXDCTRL_HPASS 0x1000000000000000ULL /* Passed Hash Filter */ 0876 #define RXDCTRL_ALTMAC 0x2000000000000000ULL /* Matched ALT MAC */ 0877 #define RXDCTRL_BAD 0x4000000000000000ULL /* Frame has bad CRC */ 0878 0879 #define RXDCTRL_FRESH(gp) \ 0880 ((((RX_BUF_ALLOC_SIZE(gp) - RX_OFFSET) << 16) & RXDCTRL_BUFSZ) | \ 0881 RXDCTRL_OWN) 0882 0883 #define TX_RING_SIZE 128 0884 #define RX_RING_SIZE 128 0885 0886 #if TX_RING_SIZE == 32 0887 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_32 0888 #elif TX_RING_SIZE == 64 0889 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_64 0890 #elif TX_RING_SIZE == 128 0891 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_128 0892 #elif TX_RING_SIZE == 256 0893 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_256 0894 #elif TX_RING_SIZE == 512 0895 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_512 0896 #elif TX_RING_SIZE == 1024 0897 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_1K 0898 #elif TX_RING_SIZE == 2048 0899 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_2K 0900 #elif TX_RING_SIZE == 4096 0901 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_4K 0902 #elif TX_RING_SIZE == 8192 0903 #define TXDMA_CFG_BASE TXDMA_CFG_RINGSZ_8K 0904 #else 0905 #error TX_RING_SIZE value is illegal... 0906 #endif 0907 0908 #if RX_RING_SIZE == 32 0909 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_32 0910 #elif RX_RING_SIZE == 64 0911 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_64 0912 #elif RX_RING_SIZE == 128 0913 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_128 0914 #elif RX_RING_SIZE == 256 0915 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_256 0916 #elif RX_RING_SIZE == 512 0917 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_512 0918 #elif RX_RING_SIZE == 1024 0919 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_1K 0920 #elif RX_RING_SIZE == 2048 0921 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_2K 0922 #elif RX_RING_SIZE == 4096 0923 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_4K 0924 #elif RX_RING_SIZE == 8192 0925 #define RXDMA_CFG_BASE RXDMA_CFG_RINGSZ_8K 0926 #else 0927 #error RX_RING_SIZE is illegal... 0928 #endif 0929 0930 #define NEXT_TX(N) (((N) + 1) & (TX_RING_SIZE - 1)) 0931 #define NEXT_RX(N) (((N) + 1) & (RX_RING_SIZE - 1)) 0932 0933 #define TX_BUFFS_AVAIL(GP) \ 0934 (((GP)->tx_old <= (GP)->tx_new) ? \ 0935 (GP)->tx_old + (TX_RING_SIZE - 1) - (GP)->tx_new : \ 0936 (GP)->tx_old - (GP)->tx_new - 1) 0937 0938 #define RX_OFFSET 2 0939 #define RX_BUF_ALLOC_SIZE(gp) ((gp)->rx_buf_sz + 28 + RX_OFFSET + 64) 0940 0941 #define RX_COPY_THRESHOLD 256 0942 0943 #if TX_RING_SIZE < 128 0944 #define INIT_BLOCK_TX_RING_SIZE 128 0945 #else 0946 #define INIT_BLOCK_TX_RING_SIZE TX_RING_SIZE 0947 #endif 0948 0949 #if RX_RING_SIZE < 128 0950 #define INIT_BLOCK_RX_RING_SIZE 128 0951 #else 0952 #define INIT_BLOCK_RX_RING_SIZE RX_RING_SIZE 0953 #endif 0954 0955 struct gem_init_block { 0956 struct gem_txd txd[INIT_BLOCK_TX_RING_SIZE]; 0957 struct gem_rxd rxd[INIT_BLOCK_RX_RING_SIZE]; 0958 }; 0959 0960 enum gem_phy_type { 0961 phy_mii_mdio0, 0962 phy_mii_mdio1, 0963 phy_serialink, 0964 phy_serdes, 0965 }; 0966 0967 enum link_state { 0968 link_down = 0, /* No link, will retry */ 0969 link_aneg, /* Autoneg in progress */ 0970 link_force_try, /* Try Forced link speed */ 0971 link_force_ret, /* Forced mode worked, retrying autoneg */ 0972 link_force_ok, /* Stay in forced mode */ 0973 link_up /* Link is up */ 0974 }; 0975 0976 struct gem { 0977 void __iomem *regs; 0978 int rx_new, rx_old; 0979 int tx_new, tx_old; 0980 0981 unsigned int has_wol : 1; /* chip supports wake-on-lan */ 0982 unsigned int asleep_wol : 1; /* was asleep with WOL enabled */ 0983 0984 int cell_enabled; 0985 u32 msg_enable; 0986 u32 status; 0987 0988 struct napi_struct napi; 0989 0990 int tx_fifo_sz; 0991 int rx_fifo_sz; 0992 int rx_pause_off; 0993 int rx_pause_on; 0994 int rx_buf_sz; 0995 u64 pause_entered; 0996 u16 pause_last_time_recvd; 0997 u32 mac_rx_cfg; 0998 u32 swrst_base; 0999 1000 int want_autoneg; 1001 int last_forced_speed; 1002 enum link_state lstate; 1003 struct timer_list link_timer; 1004 int timer_ticks; 1005 int wake_on_lan; 1006 struct work_struct reset_task; 1007 volatile int reset_task_pending; 1008 1009 enum gem_phy_type phy_type; 1010 struct mii_phy phy_mii; 1011 int mii_phy_addr; 1012 1013 struct gem_init_block *init_block; 1014 struct sk_buff *rx_skbs[RX_RING_SIZE]; 1015 struct sk_buff *tx_skbs[TX_RING_SIZE]; 1016 dma_addr_t gblock_dvma; 1017 1018 struct pci_dev *pdev; 1019 struct net_device *dev; 1020 #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC) 1021 struct device_node *of_node; 1022 #endif 1023 }; 1024 1025 #define found_mii_phy(gp) ((gp->phy_type == phy_mii_mdio0 || gp->phy_type == phy_mii_mdio1) && \ 1026 gp->phy_mii.def && gp->phy_mii.def->ops) 1027 1028 #endif /* _SUNGEM_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |