1*6833Sgd78059 /* 2*6833Sgd78059 * CDDL HEADER START 3*6833Sgd78059 * 4*6833Sgd78059 * The contents of this file are subject to the terms of the 5*6833Sgd78059 * Common Development and Distribution License (the "License"). 6*6833Sgd78059 * You may not use this file except in compliance with the License. 7*6833Sgd78059 * 8*6833Sgd78059 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*6833Sgd78059 * or http://www.opensolaris.org/os/licensing. 10*6833Sgd78059 * See the License for the specific language governing permissions 11*6833Sgd78059 * and limitations under the License. 12*6833Sgd78059 * 13*6833Sgd78059 * When distributing Covered Code, include this CDDL HEADER in each 14*6833Sgd78059 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*6833Sgd78059 * If applicable, add the following below this CDDL HEADER, with the 16*6833Sgd78059 * fields enclosed by brackets "[]" replaced with your own identifying 17*6833Sgd78059 * information: Portions Copyright [yyyy] [name of copyright owner] 18*6833Sgd78059 * 19*6833Sgd78059 * CDDL HEADER END 20*6833Sgd78059 */ 21*6833Sgd78059 /* 22*6833Sgd78059 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*6833Sgd78059 * Use is subject to license terms. 24*6833Sgd78059 */ 25*6833Sgd78059 26*6833Sgd78059 #ifndef _SYS_ERI_MAC_H 27*6833Sgd78059 #define _SYS_ERI_MAC_H 28*6833Sgd78059 29*6833Sgd78059 #pragma ident "%Z%%M% %I% %E% SMI" 30*6833Sgd78059 31*6833Sgd78059 #ifdef __cplusplus 32*6833Sgd78059 extern "C" { 33*6833Sgd78059 #endif 34*6833Sgd78059 35*6833Sgd78059 /* 36*6833Sgd78059 * HOST MEMORY DATA STRUCTURES 37*6833Sgd78059 * Transmit and Receive Descriptor Rings 38*6833Sgd78059 */ 39*6833Sgd78059 40*6833Sgd78059 /* The Descriptor Ring base Addresses must be 2K-byte aligned */ 41*6833Sgd78059 42*6833Sgd78059 #define ERI_GMDALIGN (2048) 43*6833Sgd78059 44*6833Sgd78059 /* 45*6833Sgd78059 * The transmit and receiver Descriptor Rings are organized as "wrap-around 46*6833Sgd78059 * descriptors and are of programmable size. 47*6833Sgd78059 * Each descriptor consists of two double-word entries: a control/status entry 48*6833Sgd78059 * and a pointer to a data buffer. 49*6833Sgd78059 * The no. of entries is programmable in binary increments, from 32 to 8192. 50*6833Sgd78059 * TBD: Even though the Receive Desriptor ring size is 8k, provide for a user 51*6833Sgd78059 * configurable variable to specify the max.no. of Rx buffers posted. 52*6833Sgd78059 */ 53*6833Sgd78059 54*6833Sgd78059 #define ERI_TMDMAX (4096) /* Transmit descriptor ring size */ 55*6833Sgd78059 #define ERI_RMDMAX (4096) /* Receive descriptor ring size */ 56*6833Sgd78059 57*6833Sgd78059 /* 58*6833Sgd78059 * ----------------------------- 59*6833Sgd78059 * Transmit descriptor structure 60*6833Sgd78059 * ----------------------------- 61*6833Sgd78059 */ 62*6833Sgd78059 63*6833Sgd78059 struct eri_tmd { 64*6833Sgd78059 uint64_t tmd_flags; /* INTME, SOP, EOP, cksum, bufsize */ 65*6833Sgd78059 uint64_t tmd_addr; /* buffer address */ 66*6833Sgd78059 }; 67*6833Sgd78059 68*6833Sgd78059 /* fields in the tmd_flags */ 69*6833Sgd78059 70*6833Sgd78059 #define ERI_TMD_BUFSIZE (0x7fff << 0) /* 0-14 : Tx Data buffer size */ 71*6833Sgd78059 /* valid values in range 0 - 17k */ 72*6833Sgd78059 #define ERI_TMD_CSSTART (0x3f << 15) /* 15-20 : Checksum start offset */ 73*6833Sgd78059 /* value must be even */ 74*6833Sgd78059 #define ERI_TMD_CSSTUFF (0xff << 21) /* 21-28 : Checksum stuff offset */ 75*6833Sgd78059 /* value must be even */ 76*6833Sgd78059 #define ERI_TMD_CSENABL (1 << 29) /* 29 : Enable checksum computation */ 77*6833Sgd78059 #define ERI_TMD_EOP (1 << 30) /* 30 : End Of Packet flag */ 78*6833Sgd78059 #define ERI_TMD_SOP ((uint64_t)1 << 31) /* 31 : Packet Start flag */ 79*6833Sgd78059 #define ERI_TMD_INTME ((uint64_t)1 << 32) /* 32 : Interrupt me now */ 80*6833Sgd78059 #define ERI_TMD_NOCRC ((uint64_t)1 << 33) /* 33 : Do not insert CRC */ 81*6833Sgd78059 82*6833Sgd78059 #define ERI_TMD_CSSTART_SHIFT 15 /* checksum start bit position */ 83*6833Sgd78059 #define ERI_TMD_CSSTUFF_SHIFT 21 /* checksum stuff bit position */ 84*6833Sgd78059 85*6833Sgd78059 /* 86*6833Sgd78059 * TCP Header offset within Ethernet Packet: 87*6833Sgd78059 * 14 Bytes Ethernet Header + 20 IP Header. 88*6833Sgd78059 */ 89*6833Sgd78059 90*6833Sgd78059 #define ERI_TCPHDR_OFFSET 34 91*6833Sgd78059 #define ERI_IPHDR_OFFSET 20 92*6833Sgd78059 93*6833Sgd78059 /* 94*6833Sgd78059 * TCP Checksum stuff offset within Ethernet packet: 95*6833Sgd78059 * 34 Bytes up to TCP Header + 16 Bytes within TCP header 96*6833Sgd78059 */ 97*6833Sgd78059 98*6833Sgd78059 #define ERI_TCPCSUM_OFFSET 50 99*6833Sgd78059 #define ERI_TMDCSUM_CTL (ERI_TMD_CSENABL | \ 100*6833Sgd78059 (ERI_TCPHDR_OFFSET << ERI_TMD_CSSTART_SHIFT) | \ 101*6833Sgd78059 (ERI_TCPCSUM_OFFSET << ERI_TMD_CSSTUFF_SHIFT)) 102*6833Sgd78059 /* 103*6833Sgd78059 * Programming Notes: 104*6833Sgd78059 * 105*6833Sgd78059 * 1. TX Kick Register is used to hand over TX descriptors to the hardware. 106*6833Sgd78059 * TX Completion Register is used by hardware to handover TX descriptors 107*6833Sgd78059 * back to the software. 108*6833Sgd78059 * 109*6833Sgd78059 * 2. ERI never writes back TX descriptors. 110*6833Sgd78059 * 111*6833Sgd78059 * 2. If a packet resides in more than one buffer, the Checksum_Enable, 112*6833Sgd78059 * Checksum_Stuff_Offset, Checksum_Start_Offset and Int_me fields need to 113*6833Sgd78059 * be set only in the first descriptor for the packet. 114*6833Sgd78059 * 115*6833Sgd78059 * 3. The hardware implementation relies on the fact that if a buffer 116*6833Sgd78059 * starts at an "odd" boundary, the DMA state machine can "rewind" 117*6833Sgd78059 * to the nearest burst boundary and execute a full DVMA burst Read. 118*6833Sgd78059 * 119*6833Sgd78059 * There is no other alignment restriction for the transmit data buffer. 120*6833Sgd78059 */ 121*6833Sgd78059 122*6833Sgd78059 /* 123*6833Sgd78059 * ----------------------------- 124*6833Sgd78059 * Receive Descriptor structure 125*6833Sgd78059 * ---------------------------- 126*6833Sgd78059 */ 127*6833Sgd78059 128*6833Sgd78059 struct rmd { 129*6833Sgd78059 uint64_t rmd_flags; 130*6833Sgd78059 /* hash_val, hash_pass, bad, OWN, buf/data size, cksum */ 131*6833Sgd78059 uint64_t rmd_addr; /* 8-byte aligned buffer address */ 132*6833Sgd78059 }; 133*6833Sgd78059 134*6833Sgd78059 /* 135*6833Sgd78059 * fields in the rmd_flags 136*6833Sgd78059 */ 137*6833Sgd78059 #define ERI_RMD_CKSUM (0xffff << 0) /* 0-15 : checksum computed */ 138*6833Sgd78059 #define ERI_RMD_BUFSIZE (0x7fff << 16) /* 16-30 : buffer/frame size */ 139*6833Sgd78059 #define ERI_RMD_OWN ((uint64_t)1 << 31) /* 31 : Ownership flag */ 140*6833Sgd78059 /* 0 - owned by software */ 141*6833Sgd78059 /* 1 - owned by hardware */ 142*6833Sgd78059 #define ERI_RMD_RESERVED1 ((uint64_t)0xfff << 32) /* 32-43 : Reserved */ 143*6833Sgd78059 #define ERI_RMD_HASHVAL ((uint64_t)0xffff << 44) /* 44-59 : hash value */ 144*6833Sgd78059 #define ERI_RMD_HASHPASS ((uint64_t)1 << 60) /* 60 : pass hash filter */ 145*6833Sgd78059 #define ERI_RMD_ALTERNATE ((uint64_t)1 << 61) 146*6833Sgd78059 /* 61 : matched alternate MAC adrs */ 147*6833Sgd78059 #define ERI_RMD_BAD ((uint64_t)1 << 62) /* 62 : bad CRC frame */ 148*6833Sgd78059 #define ERI_RMD_RESERVED2 ((uint64_t)1 << 63) /* 63 : Reserved */ 149*6833Sgd78059 150*6833Sgd78059 #define ERI_RMD_BUFSIZE_SHIFT 16 /* buffer/data size bit position */ 151*6833Sgd78059 152*6833Sgd78059 #define ERI__RMD_BUFALIGN 8 153*6833Sgd78059 154*6833Sgd78059 /* 155*6833Sgd78059 * ERI REGISTER SPACE 156*6833Sgd78059 * The comments are in the following format: 157*6833Sgd78059 * Addres_Offset R/W Default Actual_size(bits) Description 158*6833Sgd78059 */ 159*6833Sgd78059 160*6833Sgd78059 /* 161*6833Sgd78059 * Global Register Space : Paritally Modified for ERI 162*6833Sgd78059 */ 163*6833Sgd78059 struct global { 164*6833Sgd78059 uint32_t seb_state; /* 0x0000 RO 0x00000000 03 SEB State Register */ 165*6833Sgd78059 uint32_t config; /* 0x0004 RW 0x00000000 17 Configuration Register */ 166*6833Sgd78059 uint32_t reserved2; /* 0x0008 */ 167*6833Sgd78059 uint32_t status; /* 0x000C R-AC 0x00000000 25 Int. Status Register */ 168*6833Sgd78059 uint32_t intmask; /* 0x0010 RW 0xFFFFFFFF 12 Interrupt Mask Reg */ 169*6833Sgd78059 uint32_t intack; /* 0x0014 WO 0x00000000 06 Interrupt Ack Register */ 170*6833Sgd78059 uint32_t reserved3; /* 0x0018 */ 171*6833Sgd78059 uint32_t status_alias; /* 0x001C RO 0x00000000 25 Int. Stat Reg Alias */ 172*6833Sgd78059 uint32_t reserved4[1016]; /* To skip to 0x1000 */ 173*6833Sgd78059 uint32_t err_status; /* 0x1000 R-AC 0x00000000 03 PCI Error Status Reg. */ 174*6833Sgd78059 uint32_t reset; /* 0x1010 RW-AC 0x00 3 Software Reset Reg */ 175*6833Sgd78059 }; 176*6833Sgd78059 177*6833Sgd78059 /* 178*6833Sgd78059 * 179*6833Sgd78059 * SBus IO configuration (RW) 180*6833Sgd78059 * To configure parameters that define the DMA burst and internal arbitration. 181*6833Sgd78059 */ 182*6833Sgd78059 #define ERI_SIOCFG_BSIZE32 (0x1 << 0) /* 32 byte burst sizeb state */ 183*6833Sgd78059 #define ERI_SIOCFG_BSIZE64 (0x1 << 1) /* 64 byte burst sizeb state */ 184*6833Sgd78059 #define ERI_SIOCFG_BSIZE128 (0x1 << 2) /* 128 byte burst sizeb state */ 185*6833Sgd78059 #define ERI_SIOCFG_BMODE64 (0x1 << 3) /* Sbus 64 bit mode */ 186*6833Sgd78059 #define ERI_SIOCFG_PARITY (0x1 << 9) /* Sbus Parity enabled. */ 187*6833Sgd78059 188*6833Sgd78059 /* 189*6833Sgd78059 * SEB State Register (RO) 190*6833Sgd78059 * Reflects the internal state of the arbitration between TX and RX 191*6833Sgd78059 * DMA Channels. Used for diagnostics only 192*6833Sgd78059 */ 193*6833Sgd78059 #define ERI_SEB_ARBSTS (0x2 << 0) /* Arbiter state */ 194*6833Sgd78059 #define ERI_SEB_RXWON (1 << 2) /* RX won the arbitration */ 195*6833Sgd78059 196*6833Sgd78059 /* 197*6833Sgd78059 * Global Configuration Register (RW) 198*6833Sgd78059 * To configure parameters that define the DMA burst and internal arbitration. 199*6833Sgd78059 * TX/RX_DMA_LIMIT: No. of data transfers in 64-byte multiples 200*6833Sgd78059 * 0 - peririty changes at packet boundaries 201*6833Sgd78059 * default: 0x042 202*6833Sgd78059 */ 203*6833Sgd78059 #define ERI_G_CONFIG_BURST_SIZE (0x1 << 0) /* 0:infinite/64-byte burst */ 204*6833Sgd78059 #define ERI_G_CONFIG_TX_DMA_LIM (0x1f << 1) /* 5-1: TX_DMA_Limit */ 205*6833Sgd78059 #define ERI_G_CONFIG_RX_DMA_LIM (0x1f << 6) /* 10-6: RX_DMA_Limit */ 206*6833Sgd78059 207*6833Sgd78059 #define ERI_G_CONFIG_BURST_64 0x0 /* max burst size 64 */ 208*6833Sgd78059 #define ERI_G_CONFIG_BURST_INF 0x1 /* infinite burst for whole pkt len */ 209*6833Sgd78059 210*6833Sgd78059 #define ERI_G_CONFIG_TX_DMA_LIM_SHIFT 1 211*6833Sgd78059 #define ERI_G_CONFIG_RX_DMA_LIM_SHIFT 6 212*6833Sgd78059 213*6833Sgd78059 /* 214*6833Sgd78059 * Global Interrupt Status Register (R-AC) 215*6833Sgd78059 * size: 32 bits: 0-31 216*6833Sgd78059 * default: 0x00000000 217*6833Sgd78059 * This is the top level register used to communicate to the software events 218*6833Sgd78059 * that were detected by the hardware. 219*6833Sgd78059 * Top level bits 0-6 are automatically cleared to 0 when the Status Register 220*6833Sgd78059 * is read. 221*6833Sgd78059 * Second level interrupts reported by bits 13-18 are cleared at the source. 222*6833Sgd78059 * The value of the TX Completion Register is replicated in bits 19-31. 223*6833Sgd78059 */ 224*6833Sgd78059 #define ERI_G_STATUS_TX_INT_ME (1 << 0) 225*6833Sgd78059 /* 0 - set when a frame with INT_ME bit set is transferred to FIFO */ 226*6833Sgd78059 #define ERI_G_STATUS_TX_ALL (1 << 1) /* 1 - TX desc. ring empty */ 227*6833Sgd78059 #define ERI_G_STATUS_TX_DONE (1 << 2) /* 2 - from host to TX FIFO */ 228*6833Sgd78059 #define ERI_G_STATUS_RES1 (1 << 3) /* 3 - reserved */ 229*6833Sgd78059 #define ERI_G_STATUS_RX_DONE (1 << 4) /* 4 - from RXFIFO to host */ 230*6833Sgd78059 #define ERI_G_STATUS_RX_NO_BUF (1 << 5) /* 5 - no RX buff available */ 231*6833Sgd78059 #define ERI_G_STATUS_RX_TAG_ERR (1 << 6) /* 6 - RX tag error */ 232*6833Sgd78059 #define ERI_G_STATUS_PERR_INT (1 << 7) /* 7 - Parity Err sts reg */ 233*6833Sgd78059 #define ERI_G_STATUS_RES2 (0x3f << 7) /* 7-12 : reserved */ 234*6833Sgd78059 #define ERI_G_STATUS_PCS_INT (1 << 13) /* 13 - PCS Interrupt */ 235*6833Sgd78059 #define ERI_G_STATUS_TX_MAC_INT (1 << 14) /* 14 - TX MAC stat reg set */ 236*6833Sgd78059 #define ERI_G_STATUS_RX_MAC_INT (1 << 15) /* 15 - RX MAC stat reg set */ 237*6833Sgd78059 #define ERI_G_STATUS_MAC_CTRL_INT (1 << 16) /* 16 - MAC control reg */ 238*6833Sgd78059 #define ERI_G_STATUS_MIF_INT (1 << 17) /* 17 - MIF status reg set */ 239*6833Sgd78059 #define ERI_G_STATUS_BUS_ERR_INT (1 << 18) /* 18 - BUS Err sts reg */ 240*6833Sgd78059 #define ERI_G_STATUS_TX_COMPL (0xfff80000) /* 19-31: TX Completion reg */ 241*6833Sgd78059 242*6833Sgd78059 #define ERI_G_STATUS_INTR (0xffffffff & ~(ERI_G_STATUS_TX_DONE |\ 243*6833Sgd78059 ERI_G_STATUS_TX_ALL |\ 244*6833Sgd78059 ERI_G_STATUS_MAC_CTRL_INT | ERI_G_STATUS_TX_COMPL)) 245*6833Sgd78059 246*6833Sgd78059 #define ERI_G_STATUS_TX_INT (ERI_G_STATUS_TX_DONE | ERI_G_STATUS_TX_ALL) 247*6833Sgd78059 #define ERI_G_STATUS_RX_INT (~ERI_G_STATUS_TX_COMPL & ~ERI_G_STATUS_TX_INT) 248*6833Sgd78059 249*6833Sgd78059 #define ERI_G_STATUS_FATAL_ERR (ERI_G_STATUS_RX_TAG_ERR | \ 250*6833Sgd78059 ERI_G_STATUS_PERR_INT | \ 251*6833Sgd78059 ERI_G_STATUS_BUS_ERR_INT) 252*6833Sgd78059 253*6833Sgd78059 #define ERI_G_STATUS_NONFATAL_ERR (ERI_G_STATUS_TX_MAC_INT | \ 254*6833Sgd78059 ERI_G_STATUS_RX_MAC_INT | \ 255*6833Sgd78059 ERI_G_STATUS_MAC_CTRL_INT) 256*6833Sgd78059 257*6833Sgd78059 #define ERI_G_STATUS_TX_COMPL_SHIFT 19 258*6833Sgd78059 #define ERI_G_STATUS_TX_COMPL_MASK 0x1fff 259*6833Sgd78059 260*6833Sgd78059 /* 261*6833Sgd78059 * Global Interrupt Mask register (RW) 262*6833Sgd78059 * size: 32 bits 263*6833Sgd78059 * default: 0xFFFFFFFF 264*6833Sgd78059 * There is one-to-one correspondence between the bits in this register and 265*6833Sgd78059 * the Global Status register. 266*6833Sgd78059 * If a mask bit is 0, the corresponding event causes an interrupt. 267*6833Sgd78059 */ 268*6833Sgd78059 269*6833Sgd78059 270*6833Sgd78059 #define ERI_G_MASK_TX_INT_ME (1 << 0) 271*6833Sgd78059 /* 0 - set when a frame with INT_ME bit set is transferred to FIFO */ 272*6833Sgd78059 #define ERI_G_MASK_TX_ALL (1 << 1) /* 1 - TX desc. ring empty */ 273*6833Sgd78059 #define ERI_G_MASK_TX_DONE (1 << 2) /* 2 - from host to TX FIFO */ 274*6833Sgd78059 #define ERI_G_MASK_RES1 (1 << 3) /* 3 - reserved */ 275*6833Sgd78059 #define ERI_G_MASK_RX_DONE (1 << 4) /* 4 - from RXFIFO to host */ 276*6833Sgd78059 #define ERI_G_MASK_RX_NO_BUF (1 << 5) /* 5 - no RX bufer available */ 277*6833Sgd78059 #define ERI_G_MASK_RX_TAG_ERR (1 << 6) /* 6 - RX tag error */ 278*6833Sgd78059 #define ERI_G_MASK_RES2 (0x3f << 7) /* 7-13 : reserved */ 279*6833Sgd78059 #define ERI_G_MASK_PCS_INT (1 << 13) /* 13 - PCS Interrupt */ 280*6833Sgd78059 #define ERI_G_MASK_TX_MAC_INT (1 << 14) /* 14 - TX MAC status reg set */ 281*6833Sgd78059 #define ERI_G_MASK_RX_MAC_INT (1 << 15) /* 15 - RX MAC status reg set */ 282*6833Sgd78059 #define ERI_G_MASK_MAC_CTRL_INT (1 << 16) /* 16 - MAC control reg set */ 283*6833Sgd78059 #define ERI_G_MASK_MIF_INT (1 << 17) /* 17 - MIF status reg set */ 284*6833Sgd78059 #define ERI_G_MASK_BUS_ERR_INT (1 << 18) /* 18 - BUS Error sts reg set */ 285*6833Sgd78059 286*6833Sgd78059 #define ERI_G_MASK_INTR (~ERI_G_STATUS_INTR | ERI_G_MASK_PCS_INT) 287*6833Sgd78059 #define ERI_G_MASK_ALL (0xffffffffu) 288*6833Sgd78059 289*6833Sgd78059 290*6833Sgd78059 /* 291*6833Sgd78059 * Interrupt Ack Register (WO) 292*6833Sgd78059 * Its layout corresponds to the layout of the top level bits of the Interrupt 293*6833Sgd78059 * Status register. 294*6833Sgd78059 * Bit positions written high will be cleared, while bit positions written low 295*6833Sgd78059 * have no effect on the Interrupt Status Register. 296*6833Sgd78059 */ 297*6833Sgd78059 298*6833Sgd78059 /* 299*6833Sgd78059 * Status Register Alias (RO) 300*6833Sgd78059 * This location presents the same view as the Interrupt Status Register, except 301*6833Sgd78059 * that reading from this location does not automatically clear any of the 302*6833Sgd78059 * register bits. 303*6833Sgd78059 */ 304*6833Sgd78059 305*6833Sgd78059 /* 306*6833Sgd78059 * PCI Error Status Register (R-AC) 307*6833Sgd78059 * Other PCI bus errors : The specific error may be read from 308*6833Sgd78059 * the PCI Status Register in PCI Configuration space 309*6833Sgd78059 */ 310*6833Sgd78059 #define ERI_G_STS_BADACK (1 << 0) /* no ACK64# during ABS64 */ 311*6833Sgd78059 #define ERI_G_STS_DTRTO (1 << 1) /* Delayed trans timeout */ 312*6833Sgd78059 #define ERI_G_STS_OTHERS (1 << 2) 313*6833Sgd78059 314*6833Sgd78059 /* 315*6833Sgd78059 * PCI Error Mask Register (RW) 316*6833Sgd78059 * size: 32 bits 317*6833Sgd78059 * default: 0xffffffff 318*6833Sgd78059 * Same layout as the PCI Error Status Register 319*6833Sgd78059 */ 320*6833Sgd78059 #define ERI_G_PCI_ERROR_MASK 0x00 321*6833Sgd78059 322*6833Sgd78059 /* 323*6833Sgd78059 * BIF Configuration Register 324*6833Sgd78059 * default: 0x0 325*6833Sgd78059 * Used to configure specific system information for the BIF block to optimize. 326*6833Sgd78059 * Default values indicate no special knowledge is assumed by BIF. 327*6833Sgd78059 * M66EN is RO bit. 328*6833Sgd78059 * 66 MHz operation (RO) May be used by the driver to sense 329*6833Sgd78059 * whether ERI is operating in a 66MHz or 33 MHz PCI segment 330*6833Sgd78059 */ 331*6833Sgd78059 #define ERI_G_BIFCFG_SLOWCLK (1 << 0) /* for parity error timing */ 332*6833Sgd78059 #define ERI_G_BIFCFG_HOST_64 (1 << 1) /* 64-bit host */ 333*6833Sgd78059 #define ERI_G_BIFCFG_B64D_DIS (1 << 2) /* no 64-bit wide data */ 334*6833Sgd78059 #define ERI_G_BIFCFG_M66EN (1 << 3) 335*6833Sgd78059 336*6833Sgd78059 /* 337*6833Sgd78059 * BIF Diagnostic register (RW) 338*6833Sgd78059 * TBD 339*6833Sgd78059 */ 340*6833Sgd78059 341*6833Sgd78059 /* 342*6833Sgd78059 * Global Software Reset Register - RW-AC 343*6833Sgd78059 * The lower 2bits are used to perform an individual Software Reset to the 344*6833Sgd78059 * TX or RX functions (when the corresponding bit is set), or 345*6833Sgd78059 * a Global Software Reset to the ERI (when both bits are set). 346*6833Sgd78059 * These bits become "self cleared" after the corresponding reset command 347*6833Sgd78059 * has been executed. After a reset, the software must poll this register 348*6833Sgd78059 * till both the bits are read as 0's. 349*6833Sgd78059 * The third bit (RSTOUT) is not self clearing and is used to activate 350*6833Sgd78059 * the RSTOUT# pin, when set. When clear, RSTOUT# follows the level of the 351*6833Sgd78059 * PCI reset input pin. 352*6833Sgd78059 */ 353*6833Sgd78059 #define ERI_G_RESET_ETX (1 << 0) /* Reset ETX */ 354*6833Sgd78059 #define ERI_G_RESET_ERX (1 << 1) /* Reset ERX */ 355*6833Sgd78059 #define ERI_G_RESET_RSTOUT (1 << 2) /* force the RSTOUT# pin active */ 356*6833Sgd78059 #define ERI_G_CACHE_BIT 16 357*6833Sgd78059 #define ERI_G_CACHE_LINE_SIZE_16 16 /* cache line size of 64 bytes */ 358*6833Sgd78059 #define ERI_G_CACHE_LINE_SIZE_32 32 /* cache line size of 128 bytes */ 359*6833Sgd78059 #define ERI_G_CACHE_16 (ERI_G_CACHE_LINE_SIZE_16 << ERI_G_CACHE_BIT) 360*6833Sgd78059 #define ERI_G_CACHE_32 (ERI_G_CACHE_LINE_SIZE_32 << ERI_G_CACHE_BIT) 361*6833Sgd78059 362*6833Sgd78059 #define ERI_G_RESET_GLOBAL (ERI_G_RESET_ETX | ERI_G_RESET_ERX) 363*6833Sgd78059 364*6833Sgd78059 /* 365*6833Sgd78059 * Transmit DMA Register set 366*6833Sgd78059 * tx_kick and tx_completion registers are set to 0 when ETX is reset. 367*6833Sgd78059 */ 368*6833Sgd78059 369*6833Sgd78059 struct etx { 370*6833Sgd78059 uint32_t tx_kick; /* 0x2000 RW Transmit Kick Register */ 371*6833Sgd78059 uint32_t config; /* 0x2004 RW ETX Configuration Register */ 372*6833Sgd78059 uint32_t txring_lo; /* 0x2008 RW Transmit Descriptor Base Low */ 373*6833Sgd78059 uint32_t txring_hi; /* 0x200C RW Transmit Descriptor Base Low */ 374*6833Sgd78059 uint32_t reserved1; /* 0x2010 */ 375*6833Sgd78059 uint32_t txfifo_wr_ptr; /* 0x2014 RW TxFIFO Write Pointer */ 376*6833Sgd78059 uint32_t txfifo_sdwr_ptr; /* 0x2018 RW TxFIFO Shadow Write Pointer */ 377*6833Sgd78059 uint32_t txfifo_rd_ptr; /* 0x201C RW TxFIFO Read Pointer */ 378*6833Sgd78059 uint32_t txfifo_sdrd_ptr; /* 0x2020 RW TxFIFO Shadow Read Pointer */ 379*6833Sgd78059 uint32_t txfifo_pkt_cnt; /* 0x2024 RO TxFIFO Packet Counter */ 380*6833Sgd78059 uint32_t state_mach; /* 0x2028 RO ETX State Machine Reg */ 381*6833Sgd78059 uint32_t reserved2; /* 0x202C */ 382*6833Sgd78059 uint32_t txdata_ptr_lo; /* 0x2030 RO ETX State Machine Register */ 383*6833Sgd78059 uint32_t txdata_ptr_hi; /* 0x2034 RO ETX State Machine Register */ 384*6833Sgd78059 uint32_t reserved3[50]; /* 0x2038 - 0x20FC */ 385*6833Sgd78059 386*6833Sgd78059 uint32_t tx_completion; /* 0x2100 RO ETX Completion Register */ 387*6833Sgd78059 uint32_t txfifo_adrs; /* 0x2104 RW ETX FIFO address */ 388*6833Sgd78059 uint32_t txfifo_tag; /* 0x2108 RO ETX FIFO tag */ 389*6833Sgd78059 uint32_t txfifo_data_lo; /* 0x210C RW ETX FIFO data low */ 390*6833Sgd78059 uint32_t txfifo_data_hi_T1; /* 0x2110 RW ETX FIFO data high T1 */ 391*6833Sgd78059 uint32_t txfifo_data_hi_T0; /* 0x2114 RW ETX FIFO data high T0 */ 392*6833Sgd78059 uint32_t txfifo_size; /* 0x2118 RO ETX FIFO size */ 393*6833Sgd78059 394*6833Sgd78059 uint32_t reserved4[964]; /* 0x211C - 0x3024 */ 395*6833Sgd78059 396*6833Sgd78059 uint32_t txdebug; /* 0x3028 RW ETX Debug Register */ 397*6833Sgd78059 }; 398*6833Sgd78059 399*6833Sgd78059 400*6833Sgd78059 /* 401*6833Sgd78059 * TX Kick Register (RW) 402*6833Sgd78059 * size: 13-bits 403*6833Sgd78059 * default: 0x0 404*6833Sgd78059 * Written by the host CPU with the descriptor value that follows the last 405*6833Sgd78059 * valid Transmit descriptor. 406*6833Sgd78059 */ 407*6833Sgd78059 408*6833Sgd78059 /* 409*6833Sgd78059 * TX Completion Register 410*6833Sgd78059 * size: 13-bits 411*6833Sgd78059 * default: 0x0 412*6833Sgd78059 * This register stores the descriptor value that follows the last descriptor 413*6833Sgd78059 * already processed by ERI. 414*6833Sgd78059 * 415*6833Sgd78059 */ 416*6833Sgd78059 #define ETX_COMPLETION_MASK 0x1fff 417*6833Sgd78059 418*6833Sgd78059 /* 419*6833Sgd78059 * ETX Configuration Register 420*6833Sgd78059 * default: 0x118010 421*6833Sgd78059 * This register stores parameters that control the operation of the transmit 422*6833Sgd78059 * DMA channel. 423*6833Sgd78059 * If the desire is to buffer an entire standard Ethernet frame before its 424*6833Sgd78059 * transmission is enabled, the Tx-FIFO-Threshold field has to be programmed 425*6833Sgd78059 * to a value = > 0xC8. (CHECK). Default value is 0x460. 426*6833Sgd78059 * Matewos: Changed the above to 0x400. Getting FIFO Underflow in the 427*6833Sgd78059 * case if Giga bit speed. 428*6833Sgd78059 * Bit 21 is used to modify the functionality of the Tx_All interrupt. 429*6833Sgd78059 * If it is 0, Tx_All interrupt is generated after processing the last 430*6833Sgd78059 * transmit descriptor. 431*6833Sgd78059 * If it is 1, Tx_All interrupt is generated only after the entire 432*6833Sgd78059 * Transmit FIFO has been drained. 433*6833Sgd78059 */ 434*6833Sgd78059 435*6833Sgd78059 #define GET_CONFIG_TXDMA_EN (1 << 0) /* 0 - Enable Tx DMA */ 436*6833Sgd78059 #define GET_CONFIG_TXRING_SZ (0xf << 1) /* 1-4:Tx desc ring size */ 437*6833Sgd78059 #define GET_CONFIG_RESERVED (0x1f << 5) /* 5-9: Reserved */ 438*6833Sgd78059 #define GET_CONFIG_TXFIFOTH (0x7ff << 10) /* 10-20 :TX FIFO Threshold */ 439*6833Sgd78059 /* 440*6833Sgd78059 * RIO specific value: TXFIFO threshold needs to be set to 1518/8. 441*6833Sgd78059 * It was set to (0x4FF << 10) for GEM. 442*6833Sgd78059 * set it back to 0x4ff. 443*6833Sgd78059 * set it to 190 receive TXMAC underrun and hang 444*6833Sgd78059 * try 0x100 445*6833Sgd78059 * try 0x4ff 446*6833Sgd78059 * try 0x100 447*6833Sgd78059 */ 448*6833Sgd78059 #define ETX_ERI_THRESHOLD 0x100 449*6833Sgd78059 #define ETX_CONFIG_THRESHOLD (ETX_ERI_THRESHOLD << 10) 450*6833Sgd78059 451*6833Sgd78059 #define GET_CONFIG_PACED_MODE (1 << 21) /* 21 - TX_all_int mod */ 452*6833Sgd78059 453*6833Sgd78059 #define GET_CONFIG_THRESHOLD (0x400 << 10) /* For Ethernet Packets */ 454*6833Sgd78059 #define GET_CONFIG_RINGSZ (ERI_TMDMAX << 1) /* for 2048 descriptors */ 455*6833Sgd78059 /* 456*6833Sgd78059 * ETX TX ring size 457*6833Sgd78059 * This is a 4-bit value to determine the no. of descriptor entries in the 458*6833Sgd78059 * TX-ring. The number of entries can vary from 32 through 8192 in multiples 459*6833Sgd78059 * of 2. 460*6833Sgd78059 */ 461*6833Sgd78059 #define ERI_TX_RINGSZ_SHIFT 1 462*6833Sgd78059 463*6833Sgd78059 #define ETX_RINGSZ_32 0 464*6833Sgd78059 #define ETX_RINGSZ_64 1 465*6833Sgd78059 #define ETX_RINGSZ_128 2 466*6833Sgd78059 #define ETX_RINGSZ_256 3 467*6833Sgd78059 #define ETX_RINGSZ_512 4 468*6833Sgd78059 #define ETX_RINGSZ_1024 5 469*6833Sgd78059 #define ETX_RINGSZ_2048 6 470*6833Sgd78059 #define ETX_RINGSZ_4096 7 471*6833Sgd78059 #define ETX_RINGSZ_8192 8 472*6833Sgd78059 /* values 9-15 are reserved. */ 473*6833Sgd78059 474*6833Sgd78059 /* 475*6833Sgd78059 * Transmit Descriptor Base Low and High (RW) 476*6833Sgd78059 * The 53 most significant bits are used as the base address for the TX 477*6833Sgd78059 * descriptor ring. The 11 least significant bits are not stored and assumed 478*6833Sgd78059 * to be 0. 479*6833Sgd78059 * This register should be initialized to a 2KByte-aligned value after power-on 480*6833Sgd78059 * or Software Reset. 481*6833Sgd78059 */ 482*6833Sgd78059 483*6833Sgd78059 484*6833Sgd78059 /* 485*6833Sgd78059 * TX FIFO size (RO) 486*6833Sgd78059 * This 11-bit RO register indicates the size, in 64 byte multiples, of the 487*6833Sgd78059 * TX FIFO. 488*6833Sgd78059 * The value of this register is 0x90, indicating a 9Kbyte TX FIFO. 489*6833Sgd78059 */ 490*6833Sgd78059 491*6833Sgd78059 492*6833Sgd78059 /* 493*6833Sgd78059 * ERX Register Set 494*6833Sgd78059 */ 495*6833Sgd78059 496*6833Sgd78059 struct erx { 497*6833Sgd78059 uint32_t config; /* 0x4000 RW ERX Configuration Register */ 498*6833Sgd78059 uint32_t rxring_lo; /* 0x4004 RW Receive Descriptor Base low */ 499*6833Sgd78059 uint32_t rxring_hi; /* 0x4008 RW Receive Descriptor Base high */ 500*6833Sgd78059 uint32_t rxfifo_wr_ptr; /* 0x400C RW RxFIFO Write Pointer */ 501*6833Sgd78059 uint32_t rxfifo_sdwr_ptr; /* 0x4010 RW RxFIFO Shadow Write Pointer */ 502*6833Sgd78059 uint32_t rxfifo_rd_ptr; /* 0x4014 RW RxFIFO Read pointer */ 503*6833Sgd78059 uint32_t rxfifo_pkt_cnt; /* 0x4018 RO RxFIFO Packet Counter */ 504*6833Sgd78059 uint32_t state_mach; /* 0x401C RO ERX State Machine Register */ 505*6833Sgd78059 uint32_t rx_pause_threshold; /* 0x4020 RW ERX Pause thresholds */ 506*6833Sgd78059 uint32_t rxdata_ptr_lo; /* 0x4024 RO ERX Data Pointer low */ 507*6833Sgd78059 uint32_t rxdata_ptr_hi; /* 0x4028 RO ERX Data Pointer high */ 508*6833Sgd78059 uint32_t reserved1[53]; /* 0x402C - 0x40FC */ 509*6833Sgd78059 510*6833Sgd78059 uint32_t rx_kick; /* 0x4100 RW ERX Kick Register */ 511*6833Sgd78059 uint32_t rx_completion; /* 0x4104 RO ERX Completion Register */ 512*6833Sgd78059 uint32_t rx_blanking; /* 0x4108 RO ERX Blanking Register */ 513*6833Sgd78059 uint32_t rxfifo_adrs; /* 0x410C RW ERX FIFO address */ 514*6833Sgd78059 uint32_t rxfifo_tag; /* 0x4110 RO ERX FIFO tag */ 515*6833Sgd78059 uint32_t rxfifo_data_lo; /* 0x4114 RW ERX FIFO data low */ 516*6833Sgd78059 uint32_t rxfifo_data_hi_T0; /* 0x4118 RW ERX FIFO data high T0 */ 517*6833Sgd78059 uint32_t rxfifo_data_hi_T1; /* 0x411C RW ERX FIFO data high T1 */ 518*6833Sgd78059 uint32_t rxfifo_size; /* 0x4120 RW ERX FIFO size */ 519*6833Sgd78059 }; 520*6833Sgd78059 521*6833Sgd78059 /* 522*6833Sgd78059 * ERX Configuration Register - RW 523*6833Sgd78059 * This 27-bit register determines the ERX-specific parameters that control the 524*6833Sgd78059 * operation of the receive DMA channel. 525*6833Sgd78059 * Default : 0x1000010 526*6833Sgd78059 */ 527*6833Sgd78059 528*6833Sgd78059 #define GET_CONFIG_RXDMA_EN (1 << 0) /* 0 : Enable Rx DMA */ 529*6833Sgd78059 #define ERI_RX_CONFIG_RXRING_SZ (0xf << 1) /* 1-4 : RX ring size */ 530*6833Sgd78059 #define ERI_RX_CONFIG_BATDIS (1 << 5) /* Disable RX desc batching */ 531*6833Sgd78059 #define ERI_RX_CONFIG_RES1 (0xf << 6) /* 6-9 : reserverd */ 532*6833Sgd78059 #define ERI_RX_CONFIG_FBOFFSET (0x7 << 10) /* 10-12 : 1st Byte Offset */ 533*6833Sgd78059 #define ERI_RX_CONFIG_RX_CSSTART (0x7f << 13) /* 13-19:cksum start offset */ 534*6833Sgd78059 #define ERI_RX_CONFIG_RES2 (0xf << 20) /* 20-23 : reserve */ 535*6833Sgd78059 #define ERI_RX_CONFIG_RXFIFOTH (0x7 << 24) /* 24-26:RX DMA threshold */ 536*6833Sgd78059 537*6833Sgd78059 #define ERI_RX_RINGSZ_SHIFT 1 538*6833Sgd78059 #define ERI_RX_CONFIG_FBO_SHIFT 10 539*6833Sgd78059 #define ERI_RX_CONFIG_RX_CSSTART_SHIFT 13 540*6833Sgd78059 #define ERI_RX_CONFIG_RXFIFOTH_SHIFT 24 541*6833Sgd78059 542*6833Sgd78059 #define ERX_RINGSZ_32 0 543*6833Sgd78059 #define ERX_RINGSZ_64 1 544*6833Sgd78059 #define ERX_RINGSZ_128 2 545*6833Sgd78059 #define ERX_RINGSZ_256 3 546*6833Sgd78059 #define ERX_RINGSZ_512 4 547*6833Sgd78059 #define ERX_RINGSZ_1024 5 548*6833Sgd78059 #define ERX_RINGSZ_2048 6 549*6833Sgd78059 #define ERX_RINGSZ_4096 7 550*6833Sgd78059 #define ERX_RINGSZ_8192 8 551*6833Sgd78059 /* values 9-15 are reserved. */ 552*6833Sgd78059 553*6833Sgd78059 554*6833Sgd78059 #define ERI_RX_FIFOTH_64 0 555*6833Sgd78059 #define ERI_RX_FIFOTH_128 1 556*6833Sgd78059 #define ERI_RX_FIFOTH_256 2 557*6833Sgd78059 #define ERI_RX_FIFOTH_512 3 558*6833Sgd78059 #define ERI_RX_FIFOTH_1024 4 559*6833Sgd78059 #define ERI_RX_FIFOTH_2048 5 560*6833Sgd78059 /* 6 & 7 are reserved values */ 561*6833Sgd78059 562*6833Sgd78059 /* 563*6833Sgd78059 * Receive Descriptor Base Low and High (RW) 564*6833Sgd78059 * The 53 most significant bits are used as the base address for the RX 565*6833Sgd78059 * descriptor ring. The 11 least significant bits are not stored and assumed 566*6833Sgd78059 * to be 0. 567*6833Sgd78059 * This register should be initialized to a 2KByte-aligned value after power-on 568*6833Sgd78059 * or Software Reset. 569*6833Sgd78059 */ 570*6833Sgd78059 571*6833Sgd78059 572*6833Sgd78059 /* 573*6833Sgd78059 * Pause Thresholds Register (RW) 574*6833Sgd78059 * default: 0x000f8 575*6833Sgd78059 * Two PAUSE thresholds are used to define when PAUSE flow control frames are 576*6833Sgd78059 * emitted by ERI. The granularity of these thresholds is in 64 byte increments. 577*6833Sgd78059 * XOFF PAUSE frames use the pause_time value pre-programmed in the 578*6833Sgd78059 * Send PAUSE MAC Register. 579*6833Sgd78059 * XON PAUSE frames use a pause_time of 0. 580*6833Sgd78059 */ 581*6833Sgd78059 582*6833Sgd78059 #define ERI_RX_PTH_OFFTH (0x1ff << 0) 583*6833Sgd78059 /* 584*6833Sgd78059 * 0-8: XOFF PAUSE emitted when RX FIFO 585*6833Sgd78059 * occupancy rises above this value (times 64 bytes) 586*6833Sgd78059 */ 587*6833Sgd78059 #define ERI_RX_PTH_RES (0x7 << 9) /* 9-11: reserved */ 588*6833Sgd78059 #define ERI_RX_PTH_ONTH (0x1ff << 12) 589*6833Sgd78059 /* 590*6833Sgd78059 * 12-20: XON PAUSE emitted when RX FIFO 591*6833Sgd78059 * occupancy falls below this value (times 64 bytes) 592*6833Sgd78059 */ 593*6833Sgd78059 594*6833Sgd78059 #define ERI_RX_PTH_ONTH_SHIFT 12 595*6833Sgd78059 596*6833Sgd78059 /* 597*6833Sgd78059 * ------------------------------------------------------------------------ 598*6833Sgd78059 * RX Kick Register (RW) 599*6833Sgd78059 * This is a 13-bit register written by the host CPU. 600*6833Sgd78059 * The last valid RX descriptor is the one right before the value of the 601*6833Sgd78059 * register. 602*6833Sgd78059 * Initially set to 0 on reset. 603*6833Sgd78059 * RX descriptors must be posted in multiples of 4. 604*6833Sgd78059 * The first descriptor should be cache-line aligned for best performance. 605*6833Sgd78059 * ------------------------------------------------------------------------- 606*6833Sgd78059 */ 607*6833Sgd78059 608*6833Sgd78059 /* 609*6833Sgd78059 * RX Completion Register (RO) 610*6833Sgd78059 * This 13-bit register indicates which descriptors are already used by ERI 611*6833Sgd78059 * for receive frames. 612*6833Sgd78059 * All descriptors upto but excluding the register value are ready to be 613*6833Sgd78059 * processed by the host. 614*6833Sgd78059 */ 615*6833Sgd78059 616*6833Sgd78059 /* 617*6833Sgd78059 * RX Blanking Register (RW) 618*6833Sgd78059 * Defines the values used for receive interrupt blanking. 619*6833Sgd78059 * For INTR_TIME field, every count is 2048 PCI clock time. For 66 Mhz, each 620*6833Sgd78059 * count is about 16 us. 621*6833Sgd78059 */ 622*6833Sgd78059 #define ERI_RX_BLNK_INTR_PACKETS (0x1ff << 0) 623*6833Sgd78059 /* 624*6833Sgd78059 * 0-8:no.of pkts to be recvd since the last RX_DONE 625*6833Sgd78059 * interrupt, before a new interrupt 626*6833Sgd78059 */ 627*6833Sgd78059 #define ERI_RX_BLNK_RESERVED (0x7 << 9) /* 9-11 : reserved */ 628*6833Sgd78059 #define ERI_RX_BLNK_INTR_TIME (0xff << 12) 629*6833Sgd78059 /* 630*6833Sgd78059 * 12-19 : no. of clocks to be counted since the last 631*6833Sgd78059 * RX_DONE interrupt, before a new interrupt 632*6833Sgd78059 */ 633*6833Sgd78059 634*6833Sgd78059 #define ERI_RX_BLNK_INTR_TIME_SHIFT 12 635*6833Sgd78059 636*6833Sgd78059 /* 637*6833Sgd78059 * RX FIFO Size (RO) 638*6833Sgd78059 * This 11-bit RO register indicates the size, in 64-bit multiples, of the 639*6833Sgd78059 * RX FIFO. Software should use it to properly configure the PAUSE thresholds. 640*6833Sgd78059 * The value read is 0x140, indicating a 20kbyte RX FIFO. 641*6833Sgd78059 */ 642*6833Sgd78059 643*6833Sgd78059 644*6833Sgd78059 /* 645*6833Sgd78059 * Declarations and definitions specific to the ERI MAC functional block. 646*6833Sgd78059 * 647*6833Sgd78059 * The ERI MAC block will provide the MAC functons for 10 or 100 Mbps or 648*6833Sgd78059 * 1 Gbps CSMA/CD-protocol-based or full-duplex interface. 649*6833Sgd78059 */ 650*6833Sgd78059 651*6833Sgd78059 /* 652*6833Sgd78059 * ERI MAC Register Set. 653*6833Sgd78059 * ERI MAC addresses map on a word boundry. So all registers are 654*6833Sgd78059 * declared for a size of 32 bits. Registers that use fewer than 32 655*6833Sgd78059 * bits will return 0 in the bits not used. 656*6833Sgd78059 * TBD: Define the constant values which should be used for initializing 657*6833Sgd78059 * these registers. 658*6833Sgd78059 */ 659*6833Sgd78059 struct bmac { 660*6833Sgd78059 uint32_t txrst; /* 0x6000 tx software reset (RW) */ 661*6833Sgd78059 uint32_t rxrst; /* 0x6004 rx software reset Reg (RW) */ 662*6833Sgd78059 uint32_t spcmd; /* 0x6008 Send Pause Command Reg (RW) */ 663*6833Sgd78059 uint32_t res1; /* 0x600C reserved */ 664*6833Sgd78059 uint32_t txsts; /* 0x6010 tx MAC status reg (R-AC) */ 665*6833Sgd78059 uint32_t rxsts; /* 0x6014 rx MAC status reg (R-AC) */ 666*6833Sgd78059 uint32_t macctl_sts; /* 0x6018 MAC Control Stat Reg (R-AC) */ 667*6833Sgd78059 uint32_t res2; /* 0x601C reserved */ 668*6833Sgd78059 uint32_t txmask; /* 0x6020 tx MAC Mask Register (RW) */ 669*6833Sgd78059 uint32_t rxmask; /* 0x6024 rx MAC Mask register (RW) */ 670*6833Sgd78059 uint32_t macctl_mask; /* 0x6028 MAC Control Mask Reg (RW) */ 671*6833Sgd78059 uint32_t res3; /* 0x602C reserved */ 672*6833Sgd78059 uint32_t txcfg; /* 0x6030 tx config reg [8-0] (RW) */ 673*6833Sgd78059 uint32_t rxcfg; /* 0x6034 rx config reg [7-0] (RW) */ 674*6833Sgd78059 uint32_t macctl_cfg; /* 0x6038 MAC Control Config Reg (RW) */ 675*6833Sgd78059 uint32_t xifc; /* 0x603C XIF Config. reg [7-0] (RW) */ 676*6833Sgd78059 uint32_t ipg0; /* 0x6040 Inter pkt Gap 0 [7-0] (RW) */ 677*6833Sgd78059 uint32_t ipg1; /* 0x6044 Inter pkt Gap 1 [7-0] (RW) */ 678*6833Sgd78059 uint32_t ipg2; /* 0x6048 Inter pkt Gap 2 [7-0] (RW) */ 679*6833Sgd78059 uint32_t slot; /* 0x604C slot time reg [7-0] (RW) */ 680*6833Sgd78059 uint32_t macmin; /* 0x6050 MAC min frame sze [9-0](RW) */ 681*6833Sgd78059 uint32_t macmax; /* 0x6054 MAC max pkt sze [14-0] (RW) */ 682*6833Sgd78059 uint32_t palen; /* 0x6058 preamble len reg [9-0] (RW) */ 683*6833Sgd78059 uint32_t jam; /* 0x605C jam size reg [3-0] (RW) */ 684*6833Sgd78059 uint32_t alimit; /* 0x6060 attempt limit reg [7-0](RW) */ 685*6833Sgd78059 uint32_t macctl_type; /* 0x6064 MAC Control Type Reg (RW) */ 686*6833Sgd78059 uint32_t res4[6]; /* reserved 0x6068 - 0x607C */ 687*6833Sgd78059 uint32_t madd0; /* 0x6080 Norm MAC adrs 0 [15-0] (RW) */ 688*6833Sgd78059 uint32_t madd1; /* 0x6084 Norm MAC adrs 1 [31-16](RW) */ 689*6833Sgd78059 uint32_t madd2; /* 0x6088 Norm MAC adrs 2 [47-32](RW) */ 690*6833Sgd78059 uint32_t madd3; /* 0x608C Alt. MAC adrs 0 [15-0](RW) */ 691*6833Sgd78059 uint32_t madd4; /* 0x6090 Alt. MAC adrs 1 [31-16](RW) */ 692*6833Sgd78059 uint32_t madd5; /* 0x6094 Alt. MAC adrs 2 [47-32](RW) */ 693*6833Sgd78059 uint32_t madd6; /* 0x6098 Control MAC adrs 0 [15-0](RW) */ 694*6833Sgd78059 uint32_t madd7; /* 0x609C Control MAC adrs 1 [31-16](RW) */ 695*6833Sgd78059 uint32_t madd8; /* 0x60A0 Control MAC adrs 2 [47-32](RW) */ 696*6833Sgd78059 uint32_t afr0; /* 0x60A4 addr filt reg 0_0 [15-0](RW) */ 697*6833Sgd78059 uint32_t afr1; /* 0x60A8 addr filt reg 0_1 [15-0](RW) */ 698*6833Sgd78059 uint32_t afr2; /* 0x60AC addr filt reg 0_2 [15-0](RW) */ 699*6833Sgd78059 uint32_t afmr1_2; /* 0x60B0 addr filt msk reg 1,2 [8-0](RW) */ 700*6833Sgd78059 uint32_t afmr0; /* 0x60B4 addr filt msk reg 0 [15-0](RW) */ 701*6833Sgd78059 uint32_t res5[2]; /* 0x60B8 - 0x60BC Reserved */ 702*6833Sgd78059 uint32_t hash0; /* 0x60C0 h-table 0 [15-0] (RW) */ 703*6833Sgd78059 uint32_t hash1; /* 0x60C4 h-table 1 [31-16] (RW) */ 704*6833Sgd78059 uint32_t hash2; /* 0x60C8 h-table 2 [47-32] (RW) */ 705*6833Sgd78059 uint32_t hash3; /* 0x60CC h-table 3 [63-48] (RW) */ 706*6833Sgd78059 uint32_t hash4; /* 0x60D0 h-table 4 [79-64] (RW) */ 707*6833Sgd78059 uint32_t hash5; /* 0x60D4 h-table 5 [95-80] (RW) */ 708*6833Sgd78059 uint32_t hash6; /* 0x60D8 h-table 6 [111-96] (RW) */ 709*6833Sgd78059 uint32_t hash7; /* 0x60DC h-table 7 [127-112] (RW) */ 710*6833Sgd78059 uint32_t hash8; /* 0x60E0 h-table 8 [143-128] (RW) */ 711*6833Sgd78059 uint32_t hash9; /* 0x60E4 h-table 9 [159-144] (RW) */ 712*6833Sgd78059 uint32_t hash10; /* 0x60E8 h-table 10 [175-160] (RW) */ 713*6833Sgd78059 uint32_t hash11; /* 0x60EC h-table 11 [191-176] (RW) */ 714*6833Sgd78059 uint32_t hash12; /* 0x60F0 h-table 12 [207-192] (RW) */ 715*6833Sgd78059 uint32_t hash13; /* 0x60F4 h-table 13 [223-208] (RW) */ 716*6833Sgd78059 uint32_t hash14; /* 0x60F8 h-table 14 [239-224] (RW) */ 717*6833Sgd78059 uint32_t hash15; /* 0x60FC h-table 15 [255-240] (RW) */ 718*6833Sgd78059 uint32_t nccnt; /* 0x6100 normal coll cnt [15-0] (RW) */ 719*6833Sgd78059 uint32_t fccnt; /* 0x6104 1st succes coll [15-0] (RW) */ 720*6833Sgd78059 uint32_t excnt; /* 0x6108 excess coll cnt[15-0] (RW) */ 721*6833Sgd78059 uint32_t ltcnt; /* 0x610C late coll cnt [15-0] (RW) */ 722*6833Sgd78059 uint32_t dcnt; /* 0x6110 defer timer cnt [15-0] (RW) */ 723*6833Sgd78059 uint32_t pattempts; /* 0x6114 peak attempt reg [7-0] (RW) */ 724*6833Sgd78059 uint32_t frcnt; /* 0x6118 rcv frame cnt [15-0] (RW) */ 725*6833Sgd78059 uint32_t lecnt; /* 0x611C rx len err cnt [15-0] (RW) */ 726*6833Sgd78059 uint32_t aecnt; /* 0x6120 rx align err cnt[15-0] (RW) */ 727*6833Sgd78059 uint32_t fecnt; /* 0x6124 rcv crc err cnt [15-0] (RW) */ 728*6833Sgd78059 uint32_t rxcv; /* 0x6128 rx code viol reg [15-0](RW) */ 729*6833Sgd78059 uint32_t res6; /* 0x612C Reserved */ 730*6833Sgd78059 uint32_t rseed; /* 0x6130 random num seed [9-0] (RW) */ 731*6833Sgd78059 uint32_t macsm; /* 0x6134 MAC state mach reg [7-0](R) */ 732*6833Sgd78059 }; 733*6833Sgd78059 734*6833Sgd78059 #define BMAC_OVERFLOW_STATE 0x03800000 735*6833Sgd78059 736*6833Sgd78059 /* 737*6833Sgd78059 * Constants used for initializing the MAC registers 738*6833Sgd78059 */ 739*6833Sgd78059 740*6833Sgd78059 #define BMAC_SEND_PAUSE_CMD 0x1BF0 741*6833Sgd78059 #define BMAC_IPG0 0x00 742*6833Sgd78059 #define BMAC_IPG1 0x08 743*6833Sgd78059 #define BMAC_IPG2 0x04 744*6833Sgd78059 #define BMAC_SLOT_TIME 0x40 745*6833Sgd78059 #define BMAC_EXT_SLOT_TIME 0x200 746*6833Sgd78059 #define BMAC_MIN_FRAME_SIZE 0x40 747*6833Sgd78059 #define BMAC_MAX_FRAME_SIZE (ETHERMTU + 18 + 4) /* enet + vlan */ 748*6833Sgd78059 749*6833Sgd78059 /* 750*6833Sgd78059 * Hardware bug: set MAC_FRAME_SIZE to 0x7fff to 751*6833Sgd78059 * get around the problem of tag errors 752*6833Sgd78059 */ 753*6833Sgd78059 #ifdef ERI_RX_TAG_ERROR_WORKAROUND 754*6833Sgd78059 #define BMAC_MAX_FRAME_SIZE_TAG 0x7fff 755*6833Sgd78059 #endif 756*6833Sgd78059 757*6833Sgd78059 #define BMAC_MAX_BURST (0x2000 << 16) 758*6833Sgd78059 #define BMAC_PREAMBLE_SIZE 0x07 759*6833Sgd78059 #define BMAC_JAM_SIZE 0x04 760*6833Sgd78059 #define BMAC_ATTEMPT_LIMIT 0x10 761*6833Sgd78059 #define BMAC_CONTROL_TYPE 0x8808 762*6833Sgd78059 #define BMAC_ADDRESS_3 0x0000 763*6833Sgd78059 #define BMAC_ADDRESS_4 0x0000 764*6833Sgd78059 #define BMAC_ADDRESS_5 0x0000 765*6833Sgd78059 #define BMAC_ADDRESS_6 0x0001 766*6833Sgd78059 #define BMAC_ADDRESS_7 0xC200 767*6833Sgd78059 #define BMAC_ADDRESS_8 0x0180 768*6833Sgd78059 #define BMAC_AF_0 0x0000 769*6833Sgd78059 #define BMAC_AF_1 0x0000 770*6833Sgd78059 #define BMAC_AF_2 0x0000 771*6833Sgd78059 #define BMAC_AF21_MASK 0x00 772*6833Sgd78059 #define BMAC_AF0_MASK 0x0000 773*6833Sgd78059 #define BMAC_COUNTER 0x0000 /* for all MAC Counters */ 774*6833Sgd78059 775*6833Sgd78059 /* 776*6833Sgd78059 * ERI MAC Register Bit Masks. 777*6833Sgd78059 */ 778*6833Sgd78059 779*6833Sgd78059 /* 780*6833Sgd78059 * TX_MAC Software Reset Command Register (RW) 781*6833Sgd78059 * This bit is set to 1 when a PIO write is done. This bit becomes self-cleared. 782*6833Sgd78059 * after the command has been executed. 783*6833Sgd78059 */ 784*6833Sgd78059 785*6833Sgd78059 #define BMAC_TX_RESET (1 << 0) /* TX_MAC Reset Command */ 786*6833Sgd78059 787*6833Sgd78059 788*6833Sgd78059 /* 789*6833Sgd78059 * RX_MAC Software Reset Command Register (RW) 790*6833Sgd78059 * This bit is set to 1 when a PIO write is done. This bit becomes self-cleared. 791*6833Sgd78059 * after the command has been executed. 792*6833Sgd78059 */ 793*6833Sgd78059 794*6833Sgd78059 #define BMAC_RX_RESET (1 << 0) /* RX_MAC Reset Command */ 795*6833Sgd78059 796*6833Sgd78059 /* 797*6833Sgd78059 * Send Pause Command Register (RW) 798*6833Sgd78059 * This command register executes a Pause Flow Control frame transmission. 799*6833Sgd78059 * Pause_Time_Sent field indicates to the MAC the value of the pause_time 800*6833Sgd78059 * operand that should be sent on the network using either the Send_Pause 801*6833Sgd78059 * Command bit or the flow control handshake on the RxDMA < - > MAC interface. 802*6833Sgd78059 * The pause-time is interpreted in terms of Slot times. 803*6833Sgd78059 */ 804*6833Sgd78059 805*6833Sgd78059 /* 806*6833Sgd78059 * 0-15: value of pause_time operand 807*6833Sgd78059 * in terms of slot time 808*6833Sgd78059 */ 809*6833Sgd78059 810*6833Sgd78059 #define ERI_MCTLSP_TIME (0xffff << 0) 811*6833Sgd78059 #define ERI_MCTLSP_SEND (1 << 16) /* send Pause flow control frame */ 812*6833Sgd78059 813*6833Sgd78059 814*6833Sgd78059 /* 815*6833Sgd78059 * TX_MAC Status Register (R-AC) 816*6833Sgd78059 */ 817*6833Sgd78059 818*6833Sgd78059 #define BMAC_TXSTS_XMIT_DONE (1 << 0) /* Frame transmitted */ 819*6833Sgd78059 #define BMAC_TXSTS_TX_URUN (1 << 1) /* TX MAC Underrun */ 820*6833Sgd78059 #define BMAC_TXSTS_MAXPKT_ERR (1 << 2) /* packet len exceeds max len */ 821*6833Sgd78059 #define BMAC_TXSTS_NCC_EXP (1 << 3) /* Normal Collision cnt exp */ 822*6833Sgd78059 #define BMAC_TXSTS_ECC_EXP (1 << 4) /* Excess Collision cnt exp */ 823*6833Sgd78059 #define BMAC_TXSTS_LCC_EXP (1 << 5) /* Late Collision cnt exp */ 824*6833Sgd78059 #define BMAC_TXSTS_FCC_EXP (1 << 6) /* First Collision cnt exp */ 825*6833Sgd78059 #define BMAC_TXSTS_DEFER_EXP (1 << 7) /* Defer Timer exp */ 826*6833Sgd78059 #define BMAC_TXSTS_PEAK_EXP (1 << 8) /* Peak attempts cnt exp */ 827*6833Sgd78059 828*6833Sgd78059 /* 829*6833Sgd78059 * TX_MAC Mask Register (RW) 830*6833Sgd78059 */ 831*6833Sgd78059 832*6833Sgd78059 #define BMAC_TXMASK_XMIT_DONE (1 << 0) /* Frame transmitted */ 833*6833Sgd78059 #define BMAC_TXMASK_TX_URUN (1 << 1) /* TX MAC Underrun */ 834*6833Sgd78059 #define BMAC_TXMASK_MAXPKT_ERR (1 << 2) /* packet len exceeds max len */ 835*6833Sgd78059 #define BMAC_TXMASK_NCC_EXP (1 << 3) /* Normal Collision cnt exp */ 836*6833Sgd78059 #define BMAC_TXMASK_ECC_EXP (1 << 4) /* Excess Collision cnt exp */ 837*6833Sgd78059 #define BMAC_TXMASK_LCC_EXP (1 << 5) /* Late Collision cnt exp */ 838*6833Sgd78059 #define BMAC_TXMASK_FCC_EXP (1 << 6) /* First Collision cnt exp */ 839*6833Sgd78059 #define BMAC_TXMASK_DEFER_EXP (1 << 7) /* Defer Timer exp */ 840*6833Sgd78059 #define BMAC_TXMASK_PEAK_EXP (1 << 8) /* Peak attempts cnt exp */ 841*6833Sgd78059 /* Matewos added defer counter */ 842*6833Sgd78059 #define BMAC_TXINTR_MASK (BMAC_TXMASK_XMIT_DONE | BMAC_TXMASK_DEFER_EXP) 843*6833Sgd78059 844*6833Sgd78059 /* 845*6833Sgd78059 * RX_MAC Status Register (R-AC) 846*6833Sgd78059 */ 847*6833Sgd78059 #define BMAC_RXSTS_RX_DONE (1 << 0) /* Frame Received */ 848*6833Sgd78059 #define BMAC_RXSTS_RX_OVF (1 << 1) /* RX MAC data path overflow */ 849*6833Sgd78059 #define BMAC_RXSTS_FRMCNT_EXP (1 << 2) /* RX Frame counter exp */ 850*6833Sgd78059 #define BMAC_RXSTS_ALE_EXP (1 << 3) /* RX Alignment error cnt exp */ 851*6833Sgd78059 #define BMAC_RXSTS_CRC_EXP (1 << 4) /* RX CRC error cnt exp */ 852*6833Sgd78059 #define BMAC_RXSTS_LEN_EXP (1 << 5) /* RX Length error cnt exp */ 853*6833Sgd78059 #define BMAC_RXSTS_CVI_EXP (1 << 6) /* RX Code violate err cnt exp */ 854*6833Sgd78059 855*6833Sgd78059 /* 856*6833Sgd78059 * RX_MAC Mask Register (R-AC) 857*6833Sgd78059 */ 858*6833Sgd78059 #define BMAC_RXMASK_RX_DONE (1 << 0) /* Frame Received */ 859*6833Sgd78059 #define BMAC_RXMASK_RX_OVF (1 << 1) /* RX MAC data path overflow */ 860*6833Sgd78059 #define BMAC_RXMASK_FRMCNT_EXP (1 << 2) /* RX Frame counter exp */ 861*6833Sgd78059 #define BMAC_RXMASK_ALE_EXP (1 << 3) /* RX Alignment error cnt exp */ 862*6833Sgd78059 #define BMAC_RXMASK_CRC_EXP (1 << 4) /* RX CRC error cnt exp */ 863*6833Sgd78059 #define BMAC_RXMASK_LEN_EXP (1 << 5) /* RX Length error cnt exp */ 864*6833Sgd78059 #define BMAC_RXMASK_CVI_EXP (1 << 6) /* RX Code violate err cnt exp */ 865*6833Sgd78059 866*6833Sgd78059 #define BMAC_RXINTR_MASK (BMAC_RXMASK_RX_DONE | BMAC_RXMASK_FRMCNT_EXP) 867*6833Sgd78059 868*6833Sgd78059 /* 869*6833Sgd78059 * MAC Control Status Register (R-AC) 870*6833Sgd78059 */ 871*6833Sgd78059 #define ERI_MCTLSTS_PAUSE_RCVD (1 << 0) /* PAUSE received */ 872*6833Sgd78059 #define ERI_MCTLSTS_PAUSE_STATE (1 << 1) /* transition to PAUSE state */ 873*6833Sgd78059 #define ERI_MCTLSTS_NONPAUSE (1 << 2) /* change to non-PAUSE state */ 874*6833Sgd78059 #define ERI_MCTLSTS_RESERVED (0x1fff << 3) /* 3-15: reserved */ 875*6833Sgd78059 #define ERI_MCTLSTS_PAUSE_TIME (0xffff0000) /* 16-31: Pause time recvd */ 876*6833Sgd78059 877*6833Sgd78059 #define ERI_MCTLSTS_PAUSE_TIME_SHIFT 16 878*6833Sgd78059 879*6833Sgd78059 /* 880*6833Sgd78059 * MAC Control Mask Register (RW) 881*6833Sgd78059 * pause time is in slot-time units. 882*6833Sgd78059 */ 883*6833Sgd78059 #define ERI_MCTLMASK_PAUSE_RCVD (1 << 0) /* PAUSE received */ 884*6833Sgd78059 #define ERI_MCTLMASK_PAUSE_STATE (1 << 1) /* transition to PAUSE state */ 885*6833Sgd78059 #define ERI_MCTLMASK_NONPAUSE (1 << 2) /* change to non-PAUSE state */ 886*6833Sgd78059 #define ERI_MCTLMASK_RESERVED (0x1fff << 3) /* 3-15: reserved */ 887*6833Sgd78059 #define ERI_MCTLMASK_PAUSE_TIME (0xffff << 16) /* 16-31: Pause time recvd */ 888*6833Sgd78059 889*6833Sgd78059 #define ERI_MACCTL_INTR_MASK 0x00000000 890*6833Sgd78059 891*6833Sgd78059 /* 892*6833Sgd78059 * XIF Configuration Register 893*6833Sgd78059 * This register determines the parameters that control the operation of the 894*6833Sgd78059 * transceiver interface. 895*6833Sgd78059 * The Disable-echo bit should be 0 for full-duplex mode. 896*6833Sgd78059 * Default: 0x00 897*6833Sgd78059 */ 898*6833Sgd78059 899*6833Sgd78059 #define BMAC_XIFC_TX_MII_OE (1 << 0) /* Enable XIF output drivers */ 900*6833Sgd78059 #define BMAC_XIFC_MIILPBK (1 << 1) /* Enable MII Loopback mode */ 901*6833Sgd78059 #define BMAC_XIFC_DIS_ECHO (1 << 2) /* Disable echo */ 902*6833Sgd78059 #define BMAC_XIFC_MII_MODE (1 << 3) /* Selects GMII/MII mode */ 903*6833Sgd78059 #define BMAC_XIFC_MIIBUF_OE (1 << 4) /* Enable MII Recv Buffers */ 904*6833Sgd78059 #define BMAC_XIFC_LINK_LED (1 << 5) /* force LINKLED# active */ 905*6833Sgd78059 #define BMAC_XIFC_FDPLX_LED (1 << 6) /* force FDPLXLED# active */ 906*6833Sgd78059 907*6833Sgd78059 /* 908*6833Sgd78059 * TX_MAC Configuration Register 909*6833Sgd78059 * Ignore_Carrier_Sense should be set to 1 for full-duplex operation and 910*6833Sgd78059 * cleared to 0 for half-duplex operation.. 911*6833Sgd78059 * Ignore_collisions should be set to 1 for full-duplex operation and cleared 912*6833Sgd78059 * to 0 for half-duplex operation.. 913*6833Sgd78059 * To Ensure proper operation of the TX_MAC, the TX_MAC_Enable bit must always 914*6833Sgd78059 * be cleared to 0 and a delay imposed before a PIO write to any of the other 915*6833Sgd78059 * bits in the TX_MAC Configuration register or any of the MAC parameter 916*6833Sgd78059 * registers is done. 917*6833Sgd78059 * The amount of delay required depends on the time required to transmit a max. 918*6833Sgd78059 * size frame. 919*6833Sgd78059 * Default: TBD 920*6833Sgd78059 */ 921*6833Sgd78059 922*6833Sgd78059 #define BMACTXRSTDELAY (125) /* 125 us wait period */ 923*6833Sgd78059 /* CHECK */ 924*6833Sgd78059 925*6833Sgd78059 #define BMAC_TXCFG_ENAB (1 << 0) /* tx enable */ 926*6833Sgd78059 #define BMAC_TXCFG_IGNCS (1 << 1) /* Ignore carrier sense */ 927*6833Sgd78059 #define BMAC_TXCFG_IGCOLL (1 << 2) /* Ignore collisions */ 928*6833Sgd78059 #define BMAC_TXCFG_ENIPG0 (1 << 3) /* Extend Rx-to-Tx IPG */ 929*6833Sgd78059 #define BMAC_TXCFG_NGU (1 << 4) /* Never Give Up */ 930*6833Sgd78059 #define BMAC_TXCFG_NGU_LIMIT (1 << 5) /* Never Give Up limit */ 931*6833Sgd78059 #define BMAC_TXCFG_NBKOFF (1 << 6) /* No Backoff */ 932*6833Sgd78059 #define BMAC_TXCFG_SLOWDOWN (1 << 7) /* Slow down */ 933*6833Sgd78059 #define BMAC_TXCFG_NFCS (1 << 8) /* no FCS will be generated */ 934*6833Sgd78059 #define BMAC_TXCFG_CARR_EXT (1 << 9) 935*6833Sgd78059 /* 936*6833Sgd78059 * Enable TX Carrier Extension Carrier Extension is 937*6833Sgd78059 * required for half-duplex operation at Gbps 938*6833Sgd78059 */ 939*6833Sgd78059 940*6833Sgd78059 #define BMAC_TXCFG_FDX (BMAC_TXCFG_IGNCS | BMAC_TXCFG_IGCOLL) 941*6833Sgd78059 942*6833Sgd78059 /* 943*6833Sgd78059 * RX_MAC Configuration Register 944*6833Sgd78059 * A delay of 3.2 ms should be allowed after clearing Rx_MAC_Enable or 945*6833Sgd78059 * Hash_Filter_enable or Address_Filter_Enable bits. 946*6833Sgd78059 * Default: TBD 947*6833Sgd78059 */ 948*6833Sgd78059 /* CHECK 3ms or us */ 949*6833Sgd78059 /* GEM specification: 3.2msec (3200 usec) */ 950*6833Sgd78059 951*6833Sgd78059 #define BMACRXRSTDELAY (3200) /* 3.2 ms wait period */ 952*6833Sgd78059 953*6833Sgd78059 #define BMAC_RXCFG_ENAB (1 << 0) /* rx enable */ 954*6833Sgd78059 #define BMAC_RXCFG_STRIP_PAD (1 << 1) /* rx strip pad bytes */ 955*6833Sgd78059 #define BMAC_RXCFG_STRIP_CRC (1 << 2) /* rx enable CRC stripping */ 956*6833Sgd78059 #define BMAC_RXCFG_PROMIS (1 << 3) /* rx enable promiscous */ 957*6833Sgd78059 #define BMAC_RXCFG_GRPROM (1 << 4) /* rx promiscuous group mode */ 958*6833Sgd78059 #define BMAC_RXCFG_HASH (1 << 5) /* rx enable hash filter */ 959*6833Sgd78059 #define BMAC_RXCFG_ADDR (1 << 6) /* rx enable address filter */ 960*6833Sgd78059 #define BMAC_RXCFG_ERR (1 << 7) /* rx disable error checking */ 961*6833Sgd78059 #define BMAC_RXCFG_CARR_EXT (1 << 8) 962*6833Sgd78059 /* 963*6833Sgd78059 * Enable RX Carrier Extension. 964*6833Sgd78059 * Enables the reception of packet bursts 965*6833Sgd78059 * generated by Carrier Extension with 966*6833Sgd78059 * packet bursting senders 967*6833Sgd78059 */ 968*6833Sgd78059 969*6833Sgd78059 /* 970*6833Sgd78059 * MAC Control Configuration Register (RW) 971*6833Sgd78059 * Default: 0x00 972*6833Sgd78059 */ 973*6833Sgd78059 974*6833Sgd78059 #define ERI_MCTLCFG_TXPAUSE (1 << 0) /* Send_PAUSE Enable */ 975*6833Sgd78059 #define ERI_MCTLCFG_RXPAUSE (1 << 1) /* Receive_PAUSE Enable */ 976*6833Sgd78059 #define ERI_MCTLCFG_PASSPAUSE (1 << 2) /* Pass PAUSE up */ 977*6833Sgd78059 978*6833Sgd78059 /* 979*6833Sgd78059 * MAC Control Type Register (RW) 980*6833Sgd78059 * This 16-bit register specifies the "type" field for the MAC Control frame. 981*6833Sgd78059 * Default: 0x8808 982*6833Sgd78059 */ 983*6833Sgd78059 984*6833Sgd78059 985*6833Sgd78059 /* 986*6833Sgd78059 * MAC Address Registers 0, 1, 2 987*6833Sgd78059 * Station's Normal peririty MAC address which must be a unicast address. 988*6833Sgd78059 * 0 - [15:0], 1 - [31:16], 2 - [47:32] 989*6833Sgd78059 */ 990*6833Sgd78059 991*6833Sgd78059 /* 992*6833Sgd78059 * MAC Address Registers 3, 4, 5 993*6833Sgd78059 * Station's Alternate MAC address which may be a unicast or multicast address. 994*6833Sgd78059 * 3 - [15:0], 4 - [31:16], 5 - [47:32] 995*6833Sgd78059 */ 996*6833Sgd78059 997*6833Sgd78059 /* 998*6833Sgd78059 * MAC Address Registers 6, 7, 8 999*6833Sgd78059 * Station's Control MAC address which must be the reserved multicast 1000*6833Sgd78059 * address for MAC Control frames. 1001*6833Sgd78059 * 6 - [15:0], 7 - [31:16], 8 - [47:32] 1002*6833Sgd78059 */ 1003*6833Sgd78059 1004*6833Sgd78059 /* 1005*6833Sgd78059 * MII Transceiver Interface 1006*6833Sgd78059 * 1007*6833Sgd78059 * The Management Interface (MIF) allows the host to program and collect status 1008*6833Sgd78059 * from two transceivers connected to the MII. MIF supports three modes of 1009*6833Sgd78059 * operation: 1010*6833Sgd78059 * 1. Bit-Bang Mode 1011*6833Sgd78059 * This mode is imlemented using three 1-bit registers: data, clock, 1012*6833Sgd78059 * and output_enable. 1013*6833Sgd78059 * 1014*6833Sgd78059 * 2. Frame Mode 1015*6833Sgd78059 * This mode is supported using one 32-bit register: Frame register. 1016*6833Sgd78059 * The software loads the Frame Register with avalid instaruction 1017*6833Sgd78059 * ("frame"), and polls the Valid Bit for completion. 1018*6833Sgd78059 * 1019*6833Sgd78059 * 3. Polling Mode 1020*6833Sgd78059 * The Polling mechanism is used for detecting a status change in the 1021*6833Sgd78059 * transceiver. When this mode is enabled, the MIF will continuously 1022*6833Sgd78059 * poll a specified transceiver register and generate a maskable 1023*6833Sgd78059 * interrupt when a status change is detected. This mode of operation 1024*6833Sgd78059 * can only be used when the MIF is in the "Frame mode". 1025*6833Sgd78059 * 1026*6833Sgd78059 */ 1027*6833Sgd78059 1028*6833Sgd78059 struct mif { 1029*6833Sgd78059 uint32_t mif_bbclk; /* 0x6200 (RW) MIF Bit Bang Clock */ 1030*6833Sgd78059 uint32_t mif_bbdata; /* 0x6204 (RW) MIF Bit Bang Data */ 1031*6833Sgd78059 uint32_t mif_bbopenb; /* 0x6208 (RW) MIF Bit Bang Output Enable */ 1032*6833Sgd78059 uint32_t mif_frame; /* 0x620C (RW) MIF Frame - ctl and data */ 1033*6833Sgd78059 uint32_t mif_cfg; /* 0x6210 (RW) MIF Configuration */ 1034*6833Sgd78059 uint32_t mif_imask; /* 0x6214 (RW) MIF Interrupt mask */ 1035*6833Sgd78059 uint32_t mif_bsts; /* 0x6218 (R-AC) MIF Basic/Status register */ 1036*6833Sgd78059 uint32_t mif_fsm; /* 0x621C (RO) MIF State machine register */ 1037*6833Sgd78059 }; 1038*6833Sgd78059 1039*6833Sgd78059 /* 1040*6833Sgd78059 * mif_bbclk - Bit Bang Clock register 1041*6833Sgd78059 */ 1042*6833Sgd78059 #define ERI_MIF_BBCLK (1 << 0); /* Bit Babg Clock */ 1043*6833Sgd78059 1044*6833Sgd78059 #define ERI_BBCLK_LOW 0 1045*6833Sgd78059 #define ERI_BBCLK_HIGH 1 1046*6833Sgd78059 1047*6833Sgd78059 /* mif_bbdata - bit Bang Data register */ 1048*6833Sgd78059 #define ERI_MIF_BBDATA (1 << 0); /* Bit Bang Data */ 1049*6833Sgd78059 1050*6833Sgd78059 /* mif_bbopenb - Bit Bang oOutput Enable register */ 1051*6833Sgd78059 #define ERI_MIF_BBOPENB (1 << 0); /* Bit Bang output Enable */ 1052*6833Sgd78059 1053*6833Sgd78059 /* 1054*6833Sgd78059 * Management Frame Structure: 1055*6833Sgd78059 * <IDLE> <ST><OP><PHYAD><REGAD><TA> <DATA> <IDLE> 1056*6833Sgd78059 * READ: <01><10><AAAAA><RRRRR><Z0><DDDDDDDDDDDDDDDD> 1057*6833Sgd78059 * WRITE: <01><01><AAAAA><RRRRR><10><DDDDDDDDDDDDDDDD> 1058*6833Sgd78059 */ 1059*6833Sgd78059 1060*6833Sgd78059 /* 1061*6833Sgd78059 * mif_frame - MIF control and data register 1062*6833Sgd78059 */ 1063*6833Sgd78059 #define ERI_MIF_FRDATA (0xffff << 0) /* 0-15 : data bits */ 1064*6833Sgd78059 #define ERI_MIF_FRTA0 (0x1 << 16) /* 16 : TA bit, 1 for completion */ 1065*6833Sgd78059 #define ERI_MIF_FRTA1 (0x1 << 17) /* 16-17 : TA bits */ 1066*6833Sgd78059 #define ERI_MIF_FRREGAD (0x1f << 18) /* 18-22 : register address bits */ 1067*6833Sgd78059 #define ERI_MIF_FRPHYAD (0x1f << 23) /* 23-27 : PHY ad, should be 0 */ 1068*6833Sgd78059 #define ERI_MIF_FROP (0x3 << 28) /* 28-29 : Operation - Write/Read */ 1069*6833Sgd78059 #define ERI_MIF_FRST (0xc0000000) /* 30-31 : START bits */ 1070*6833Sgd78059 1071*6833Sgd78059 #define ERI_MIF_FRREGAD_SHIFT 18 1072*6833Sgd78059 #define ERI_MIF_FRPHYAD_SHIFT 23 1073*6833Sgd78059 #define ERI_MIF_FRREAD 0x60020000 1074*6833Sgd78059 #define ERI_MIF_FRWRITE 0x50020000 1075*6833Sgd78059 1076*6833Sgd78059 /* 1077*6833Sgd78059 * maximum delay for MIF Register Read/Write operation 1078*6833Sgd78059 */ 1079*6833Sgd78059 #define ERI_MAX_MIF_DELAY (100) 1080*6833Sgd78059 1081*6833Sgd78059 /* 1082*6833Sgd78059 * maximum delay for Transceiver Reset 1083*6833Sgd78059 */ 1084*6833Sgd78059 #define ERI_PHYRST_MAXDELAY (500) 1085*6833Sgd78059 #define ERI_PCS_PHYRST_MAXDELAY (500) 1086*6833Sgd78059 1087*6833Sgd78059 /* 1088*6833Sgd78059 * mif_cfg - MIF Configuration Register 1089*6833Sgd78059 */ 1090*6833Sgd78059 #define ERI_MIF_CFGPS (1 << 0) /* PHY Select */ 1091*6833Sgd78059 #define ERI_MIF_CFGPE (1 << 1) /* Poll Enable */ 1092*6833Sgd78059 #define ERI_MIF_CFGBB (1 << 2) /* Bit Bang Enable */ 1093*6833Sgd78059 #define ERI_MIF_CFGPR (0x1f << 3) /* Poll Register address */ 1094*6833Sgd78059 #define ERI_MIF_CFGM0 (1 << 8) /* MDIO_0 Data / MDIO_0 attached */ 1095*6833Sgd78059 #define ERI_MIF_CFGM1 (1 << 9) /* MDIO_1 Data / MDIO_1 attached */ 1096*6833Sgd78059 #define ERI_MIF_CFGPD (0x1f << 10) /* Poll Device PHY address */ 1097*6833Sgd78059 1098*6833Sgd78059 #define ERI_MIF_CFGPR_SHIFT 3 1099*6833Sgd78059 #define ERI_MIF_CFGPD_SHIFT 10 1100*6833Sgd78059 #define ERI_MIF_POLL_DELAY 200 1101*6833Sgd78059 1102*6833Sgd78059 /* 1103*6833Sgd78059 * MDIO_0 corresponds to the On Board Transceiver. 1104*6833Sgd78059 * MDIO_1 corresponds to the External Transceiver. 1105*6833Sgd78059 * The PHYAD for both is 0. 1106*6833Sgd78059 */ 1107*6833Sgd78059 #define ERI_INTERNAL_PHYAD 1 /* PHY address for int. transceiver */ 1108*6833Sgd78059 #define ERI_EXTERNAL_PHYAD 0 /* PHY address for ext. transceiver */ 1109*6833Sgd78059 #define ERI_NOXCVR_PHYAD 99 /* PHY address for no transceiver */ 1110*6833Sgd78059 1111*6833Sgd78059 1112*6833Sgd78059 /* mif_imask - MIF Interrupt Mask Register */ 1113*6833Sgd78059 /* 1114*6833Sgd78059 * This register is bit-to-bit same as Basic/Status Register 1115*6833Sgd78059 */ 1116*6833Sgd78059 #define ERI_MIF_INTMASK (0xffff << 0) /* 0-15 : Interrupt mask */ 1117*6833Sgd78059 1118*6833Sgd78059 /* mif_bassts - MIF Basic - Status register */ 1119*6833Sgd78059 /* 1120*6833Sgd78059 * The Basic portion of this register indicates the last value of the register 1121*6833Sgd78059 * read indicated in the POLL REG field of the Configuration Register. 1122*6833Sgd78059 * The Status portion indicates bit(s) that have changed. 1123*6833Sgd78059 * The MIF Mask register is corresponding to this register in terms of the 1124*6833Sgd78059 * bit(s) that need to be masked for generating interrupt on the MIF Interrupt 1125*6833Sgd78059 * Bit of the Global Status Rgister. 1126*6833Sgd78059 */ 1127*6833Sgd78059 1128*6833Sgd78059 #define ERI_MIF_STATUS (0xffff << 0) /* 0-15 : Status */ 1129*6833Sgd78059 #define ERI_MIF_BASIC (0xffff << 16) /* 16-31 : Basic register */ 1130*6833Sgd78059 1131*6833Sgd78059 /* mif_fsm - MIF State Machine register */ 1132*6833Sgd78059 1133*6833Sgd78059 #define ERI_MIF_FSM (0x3ff << 0) /* 0-9 : MIF state */ 1134*6833Sgd78059 1135*6833Sgd78059 /* 1136*6833Sgd78059 * ERI PCS/Serial-Link 1137*6833Sgd78059 */ 1138*6833Sgd78059 struct pcslink { 1139*6833Sgd78059 uint32_t pcs_ctl; /* 0x9000 (RW) PCS MII Control Reg */ 1140*6833Sgd78059 uint32_t pcs_sts; /* 0x9004 (RO) PCS MII Status Register */ 1141*6833Sgd78059 uint32_t pcs_anar; /* 0x9008 (RW) PCS MII Avertisement Reg */ 1142*6833Sgd78059 uint32_t pcs_anlpar; /* 0x900C (RW) PCS MII LP Ability Reg */ 1143*6833Sgd78059 uint32_t pcs_cfg; /* 0x9010 (RW) PCS Configuration Register */ 1144*6833Sgd78059 uint32_t pcs_smr; /* 0x9014 (RW) PCS State Machine Reg */ 1145*6833Sgd78059 uint32_t pcs_intsts; /* 0x9018 (R-AC) PCS Interrupt Status Reg */ 1146*6833Sgd78059 uint32_t res1[13]; /* 0x901C - 0x904C Reserved */ 1147*6833Sgd78059 uint32_t pcs_dmode; /* 0x9050 (RW) Datapath mode register */ 1148*6833Sgd78059 uint32_t slink_ctl; /* 0x9054 (RW) Serial Link Control register */ 1149*6833Sgd78059 uint32_t pcs_opsel; /* 0x9058 (RW) Shared Output Select register */ 1150*6833Sgd78059 uint32_t slink_sts; /* 0x905C (RO) Serial Link Status register */ 1151*6833Sgd78059 }; 1152*6833Sgd78059 1153*6833Sgd78059 /* 1154*6833Sgd78059 * PCS MII Basic Mode Control Register 1155*6833Sgd78059 * Auto-Negotiation should always be used for 802.3z 8B/10B 1156*6833Sgd78059 * link configuration. May be cleared for diagnostic purposes, or 1157*6833Sgd78059 * as a workaround for possible early product interoperability problems. 1158*6833Sgd78059 */ 1159*6833Sgd78059 1160*6833Sgd78059 #define PCS_BMCR_RESET (1 << 15) /* Resets the PCS when set */ 1161*6833Sgd78059 #define PCS_BMCR_LPBK (1 << 14) /* Loopback of the 10-bit i/f */ 1162*6833Sgd78059 #define PCS_BMCR_1000M (1 << 13) /* Speed selection, always 0 */ 1163*6833Sgd78059 #define PCS_BMCR_ANE (1 << 12) /* Auto Negotiation Enabled when set */ 1164*6833Sgd78059 #define PCS_BMCR_PWRDN (1 << 11) /* Power down, always 0 */ 1165*6833Sgd78059 #define PCS_BMCR_ISOLATE (1 << 10) /* Isolate PHY from MII, always 0 */ 1166*6833Sgd78059 #define PCS_BMCR_RAN (1 << 9) /* Set to Restart Auto Negotiation */ 1167*6833Sgd78059 #define PCS_BMCR_FDX (1 << 8) /* Full Duplex, always 0 */ 1168*6833Sgd78059 #define PCS_BMCR_COLTST (1 << 7) /* Collision Test */ 1169*6833Sgd78059 #define PCS_BMCR_RES1 (0x7f << 0) /* 0-6 Reserved */ 1170*6833Sgd78059 1171*6833Sgd78059 #define PCS_AUTONEG_DISABLE 0 1172*6833Sgd78059 1173*6833Sgd78059 /* 1174*6833Sgd78059 * ------------------------------------------------------------------------ 1175*6833Sgd78059 * PCS MII Basic Mode Status Register 1176*6833Sgd78059 * ------------------------------------------------------------------------- 1177*6833Sgd78059 */ 1178*6833Sgd78059 1179*6833Sgd78059 1180*6833Sgd78059 #define PCS_BMSR_RES2 (0x1f << 11) /* 11-15 reserved, always 0 */ 1181*6833Sgd78059 #define PCS_BMSR_GBFDX (1 << 10) /* PCS able to perform GBit FDX */ 1182*6833Sgd78059 #define PCS_BMSR_GBHDX (1 << 9) /* PCS able to perform Gbit HDX */ 1183*6833Sgd78059 #define PCS_BMSR_RES1 (0x7 << 6) /* 6-8 reserved */ 1184*6833Sgd78059 #define PCS_BMSR_ANC (1 << 5) /* Auto Negotiation Completed */ 1185*6833Sgd78059 #define PCS_BMSR_REMFLT (1 << 4) /* Remote Fault detected */ 1186*6833Sgd78059 #define PCS_BMSR_ACFG (1 << 3) /* Able to do Auto Link Negotiation,1 */ 1187*6833Sgd78059 #define PCS_BMSR_LNKSTS (1 << 2) /* Link Status */ 1188*6833Sgd78059 #define PCS_BMSR_JABDET (1 << 1) /* Jabber Condition Detected, 0 */ 1189*6833Sgd78059 #define PCS_BMSR_EXTCAP (1 << 0) /* Extended Register Capability, 0 */ 1190*6833Sgd78059 1191*6833Sgd78059 #define PCS_CAPABILITY_MASK (PCS_BMSR_GBFDX | PCS_BMSR_GBHDX) 1192*6833Sgd78059 1193*6833Sgd78059 1194*6833Sgd78059 /* 1195*6833Sgd78059 * ------------------------------------------------------------------------ 1196*6833Sgd78059 * PCS MII Auto-Negotiation Advertisement Register (nway1Reg) 1197*6833Sgd78059 * This register will hold the different modes of operation to be advertised to 1198*6833Sgd78059 * the far-end PHY. 1199*6833Sgd78059 * ------------------------------------------------------------------------- 1200*6833Sgd78059 */ 1201*6833Sgd78059 1202*6833Sgd78059 #define PCS_ANAR_NP (1 << 15) /* Next Page bit, RO, always 0 */ 1203*6833Sgd78059 #define PCS_ANAR_ACK (1 << 14) /* Acks reception of Link Partner */ 1204*6833Sgd78059 /* Capability word */ 1205*6833Sgd78059 #define PCS_ANAR_RF (0x2 << 12) /* Advertise Remote Fault det. cap. */ 1206*6833Sgd78059 #define PCS_ANAR_RES1 (0x7 << 9) /* 9-11 reserved */ 1207*6833Sgd78059 #define PCS_ANAR_PTX (1 << 8) /* Pause TX */ 1208*6833Sgd78059 #define PCS_ANAR_PRX (1 << 7) /* Pause RX */ 1209*6833Sgd78059 #define PCS_ANAR_PAUSE (1 << 7) /* Pause */ 1210*6833Sgd78059 #define PCS_ANAR_ASM_DIR (1 << 8) /* Asymetric Direction */ 1211*6833Sgd78059 #define PCS_ANAR_GBFDX (1 << 5) /* Advertise Gbit FDX Capability */ 1212*6833Sgd78059 #define PCS_ANAR_GBHDX (1 << 6) /* Advertise Gbit HDX Capability */ 1213*6833Sgd78059 #define PCS_ANAR_RES (0x1f << 0) /* 0-5 Reserved */ 1214*6833Sgd78059 1215*6833Sgd78059 1216*6833Sgd78059 /* ************************************************************************ */ 1217*6833Sgd78059 /* 1218*6833Sgd78059 * PCS MII Auto-Negotiation Link Partner Ability Reg 1219*6833Sgd78059 * This register contains the Link Partners capabilities after NWay 1220*6833Sgd78059 * Auto-Negotiation is complete. 1221*6833Sgd78059 */ 1222*6833Sgd78059 1223*6833Sgd78059 #define PCS_ANLPAR_NP (1 << 15) /* Next Page bit, RO, always 0 */ 1224*6833Sgd78059 #define PCS_ANLPAR_ACK (1 << 14) /* Acks reception of Link Partner */ 1225*6833Sgd78059 /* Capability word */ 1226*6833Sgd78059 #define PCS_ANLPAR_RF (0x2 << 12) /* Advertise Remote Fault det. cap. */ 1227*6833Sgd78059 #define PCS_ANLPAR_RES1 (0x7 << 9) /* 9-11 reserved */ 1228*6833Sgd78059 #define PCS_ANLPAR_PTX (1 << 8) /* Pause TX */ 1229*6833Sgd78059 #define PCS_ANLPAR_PRX (1 << 7) /* Pause RX */ 1230*6833Sgd78059 #define PCS_ANLPAR_GBFDX (1 << 5) /* Advertise Gbit FDX Capability */ 1231*6833Sgd78059 #define PCS_ANLPAR_GBHDX (1 << 6) /* Advertise Gbit HDX Capability */ 1232*6833Sgd78059 #define PCS_ANLPAR_RES (0x1f << 0) /* 0-5 Reserved */ 1233*6833Sgd78059 1234*6833Sgd78059 1235*6833Sgd78059 /* 1236*6833Sgd78059 * ------------------------------------------------------------------------ 1237*6833Sgd78059 * PCS Configuration Register 1238*6833Sgd78059 * Default = 0x8 1239*6833Sgd78059 * ------------------------------------------------------------------------- 1240*6833Sgd78059 */ 1241*6833Sgd78059 1242*6833Sgd78059 #define PCS_CFG_RES (0xfff << 4) /* 4-15 Reserved */ 1243*6833Sgd78059 #define PCS_CFG_TIMER (0x7 << 1) 1244*6833Sgd78059 /* Timer values used for the 802.3z Clause 36 Link Monitor s/m timers */ 1245*6833Sgd78059 #define PCS_CFG_ENABLE (1 << 0) /* Enable PCS, when set to 1 */ 1246*6833Sgd78059 1247*6833Sgd78059 1248*6833Sgd78059 /* 1249*6833Sgd78059 * ------------------------------------------------------------------------ 1250*6833Sgd78059 * PCS Interrupt State Register 1251*6833Sgd78059 * Presently only one bit is implemented, reflecting transitions on the link 1252*6833Sgd78059 * status. Note that there is no mask register at this level. 1253*6833Sgd78059 * THe PCS_INT bit may be masked at the Interrupt Status Register level. 1254*6833Sgd78059 * ------------------------------------------------------------------------- 1255*6833Sgd78059 */ 1256*6833Sgd78059 1257*6833Sgd78059 #define PCS_STS_LNKSTS 2 /* Link Status Change */ 1258*6833Sgd78059 1259*6833Sgd78059 1260*6833Sgd78059 /* 1261*6833Sgd78059 * ------------------------------------------------------------------------ 1262*6833Sgd78059 * Datapath Mode Register (RW) 1263*6833Sgd78059 * This register controls which network interface is used. 1264*6833Sgd78059 * Only one bit should be set in this register. 1265*6833Sgd78059 * Default: 0x1 1266*6833Sgd78059 * ------------------------------------------------------------------------- 1267*6833Sgd78059 */ 1268*6833Sgd78059 /* 1269*6833Sgd78059 * Select MII/GMII and not PCS. 1270*6833Sgd78059 * Selection between MII and GMII is 1271*6833Sgd78059 * controlled by the XIF register 1272*6833Sgd78059 */ 1273*6833Sgd78059 #define ERI_PCS_MII (1 << 2) 1274*6833Sgd78059 /* 1275*6833Sgd78059 * Applicable only in Serial Mode 1276*6833Sgd78059 * When set, makes the 10-bit Xmit data 1277*6833Sgd78059 * visible at the GMII 1278*6833Sgd78059 */ 1279*6833Sgd78059 #define ERI_PCS_GMIIOUTEN (1 << 3) 1280*6833Sgd78059 1281*6833Sgd78059 1282*6833Sgd78059 /* 1283*6833Sgd78059 * ------------------------------------------------------------------------ 1284*6833Sgd78059 * Serial Link Control register (RW) 1285*6833Sgd78059 * This register controls the Serial link 1286*6833Sgd78059 * Default: 0x000 1287*6833Sgd78059 * ------------------------------------------------------------------------- 1288*6833Sgd78059 */ 1289*6833Sgd78059 #define ERI_SLC_LOOPBACK (1 << 0) /* Enables loopback at the SL o/p */ 1290*6833Sgd78059 #define ERI_SLC_ENSYNCDT (1 << 1) /* Enable Sync char detection */ 1291*6833Sgd78059 #define ERI_SLC_LOCKREF (1 << 2) /* Lock to reference clock */ 1292*6833Sgd78059 #define ERI_SLC_EMP (0x2 << 3) /* Control o/p driver emphasis */ 1293*6833Sgd78059 #define ERI_SLC_RES (1 << 5) /* Reserved */ 1294*6833Sgd78059 #define ERI_SLC_SELFTEST (0x7 << 6) /* To select built-in self tests */ 1295*6833Sgd78059 #define ERI_SLC_SW_PDOWN (1 << 9) /* Power down Serial link block */ 1296*6833Sgd78059 1297*6833Sgd78059 /* 1298*6833Sgd78059 * ------------------------------------------------------------------------ 1299*6833Sgd78059 * Shared Output Select Register (RW) 1300*6833Sgd78059 * Default: 0x00 1301*6833Sgd78059 * ------------------------------------------------------------------------- 1302*6833Sgd78059 */ 1303*6833Sgd78059 1304*6833Sgd78059 /* 1305*6833Sgd78059 * ------------------------------------------------------------------------ 1306*6833Sgd78059 * Serial Link State Register (RO) 1307*6833Sgd78059 * Indicates the progress of the Serial link boot up 1308*6833Sgd78059 * 00 - Undergoing test 1309*6833Sgd78059 * 01 - Waiting 500us while lockrefn is asserted 1310*6833Sgd78059 * 10 - Waiting for comma detect 1311*6833Sgd78059 * 11 - Receive Data is synchronized 1312*6833Sgd78059 * ------------------------------------------------------------------------- 1313*6833Sgd78059 */ 1314*6833Sgd78059 #define ERI_SLS_STATE (0x2 << 0) /* state */ 1315*6833Sgd78059 1316*6833Sgd78059 1317*6833Sgd78059 1318*6833Sgd78059 /* ************************************************************************ */ 1319*6833Sgd78059 /* 1320*6833Sgd78059 * Definition for the time required to wait after a software 1321*6833Sgd78059 * reset has been issued. 1322*6833Sgd78059 */ 1323*6833Sgd78059 #define ERI_MAX_RST_DELAY (200) 1324*6833Sgd78059 #define ERI_PERIOD (20) /* period to wait */ 1325*6833Sgd78059 #define ERI_WAITPERIOD ERI_PERIOD 1326*6833Sgd78059 1327*6833Sgd78059 #define ERI_DELAY(c, n) \ 1328*6833Sgd78059 { \ 1329*6833Sgd78059 register int N = n / ERI_WAITPERIOD; \ 1330*6833Sgd78059 while (--N > 0) { \ 1331*6833Sgd78059 if (c) \ 1332*6833Sgd78059 break; \ 1333*6833Sgd78059 drv_usecwait(ERI_WAITPERIOD); \ 1334*6833Sgd78059 } \ 1335*6833Sgd78059 } 1336*6833Sgd78059 1337*6833Sgd78059 #define MIF_ERIDELAY(n, phyad, regad) \ 1338*6833Sgd78059 { \ 1339*6833Sgd78059 register int N = n / ERI_WAITPERIOD; \ 1340*6833Sgd78059 PUT_MIFREG(mif_frame, \ 1341*6833Sgd78059 (ERI_MIF_FRREAD | (phyad << ERI_MIF_FRPHYAD_SHIFT) | \ 1342*6833Sgd78059 (regad << ERI_MIF_FRREGAD_SHIFT))); \ 1343*6833Sgd78059 while (--N > 0) { \ 1344*6833Sgd78059 if (GET_MIFREG(mif_frame) & ERI_MIF_FRTA0) \ 1345*6833Sgd78059 break; \ 1346*6833Sgd78059 drv_usecwait(ERI_WAITPERIOD); \ 1347*6833Sgd78059 } \ 1348*6833Sgd78059 } 1349*6833Sgd78059 1350*6833Sgd78059 1351*6833Sgd78059 #ifdef __cplusplus 1352*6833Sgd78059 } 1353*6833Sgd78059 #endif 1354*6833Sgd78059 1355*6833Sgd78059 #endif /* _SYS_ERI_MAC_H */ 1356