1433d6423SLionel Sambuc /* 2433d6423SLionel Sambuc ibm/fxp.h 3433d6423SLionel Sambuc 4433d6423SLionel Sambuc Registers and datastructures of the Intel 82557, 82558, 82559, 82550, 5433d6423SLionel Sambuc and 82562 fast ethernet controllers. 6433d6423SLionel Sambuc 7433d6423SLionel Sambuc Created: Nov 2004 by Philip Homburg <philip@f-mnx.phicoh.com> 8433d6423SLionel Sambuc */ 9433d6423SLionel Sambuc 10433d6423SLionel Sambuc #ifndef _FXP_FXP_H 11433d6423SLionel Sambuc #define _FXP_FXP_H 12433d6423SLionel Sambuc 13433d6423SLionel Sambuc #define VERBOSE 0 /* display output during intialization */ 14433d6423SLionel Sambuc 15433d6423SLionel Sambuc /* Revisions in PCI_REV */ 16433d6423SLionel Sambuc #define FXP_REV_82557A 0x01 17433d6423SLionel Sambuc #define FXP_REV_82557B 0x02 18433d6423SLionel Sambuc #define FXP_REV_82557C 0x03 19433d6423SLionel Sambuc #define FXP_REV_82558A 0x04 20433d6423SLionel Sambuc #define FXP_REV_82558B 0x05 21433d6423SLionel Sambuc #define FXP_REV_82559A 0x06 22433d6423SLionel Sambuc #define FXP_REV_82559B 0x07 23433d6423SLionel Sambuc #define FXP_REV_82559C 0x08 24433d6423SLionel Sambuc #define FXP_REV_82559ERA 0x09 25433d6423SLionel Sambuc #define FXP_REV_82550_1 0x0C 26433d6423SLionel Sambuc #define FXP_REV_82550_2 0x0D 27433d6423SLionel Sambuc #define FXP_REV_82550_3 0x0E 28433d6423SLionel Sambuc #define FXP_REV_82551_1 0x0F 29433d6423SLionel Sambuc #define FXP_REV_82551_2 0x10 30433d6423SLionel Sambuc #define FXP_REV_82801CAM 0x42 31433d6423SLionel Sambuc #define FXP_REV_82801DB 0x81 32433d6423SLionel Sambuc #define FXP_REV_82550_4 0x83 33433d6423SLionel Sambuc 34433d6423SLionel Sambuc /* Control/Status Registers (CSR). The first 8 bytes are called 35433d6423SLionel Sambuc * System Control Block (SCB) 36433d6423SLionel Sambuc */ 37433d6423SLionel Sambuc #define SCB_STATUS 0x00 /* Lower half of the SCB status word. CU and 38433d6423SLionel Sambuc * RU status. 39433d6423SLionel Sambuc */ 40433d6423SLionel Sambuc #define SS_CUS_MASK 0xC0 /* CU Status */ 41433d6423SLionel Sambuc #define SS_CU_IDLE 0x00 /* Idle */ 42433d6423SLionel Sambuc #define SS_CU_SUSP 0x40 /* Suspended */ 43433d6423SLionel Sambuc #define SS_CU_LPQA 0x80 /* LPQ Active */ 44433d6423SLionel Sambuc #define SS_CU_HQPA 0xC0 /* HQP Active */ 45433d6423SLionel Sambuc #define SS_RUS_MASK 0x3C /* RU Status */ 46433d6423SLionel Sambuc #define SS_RU_IDLE 0x00 /* Idle */ 47433d6423SLionel Sambuc #define SS_RU_SUSP 0x04 /* Suspended */ 48433d6423SLionel Sambuc #define SS_RU_NORES 0x08 /* No Resources */ 49433d6423SLionel Sambuc #define SS_RU_READY 0x10 /* Ready */ 50433d6423SLionel Sambuc /* Other values are reserved */ 51433d6423SLionel Sambuc #define SS_RESERVED 0x03 /* Reserved */ 52433d6423SLionel Sambuc #define SCB_INT_STAT 0x01 /* Upper half of the SCB status word. 53433d6423SLionel Sambuc * Interrupt status. Also used to acknoledge 54433d6423SLionel Sambuc * interrupts. 55433d6423SLionel Sambuc */ 56433d6423SLionel Sambuc #define SIS_CX 0x80 /* CU command with interrupt bit set. On 57433d6423SLionel Sambuc * 82557 also TNO Interrupt. 58433d6423SLionel Sambuc */ 59433d6423SLionel Sambuc #define SIS_FR 0x40 /* Frame Received */ 60433d6423SLionel Sambuc #define SIS_CNA 0x20 /* CU Not Active */ 61433d6423SLionel Sambuc #define SIS_RNR 0x10 /* RU Not Ready */ 62433d6423SLionel Sambuc #define SIS_MDI 0x08 /* MDI read/write cycle completed */ 63433d6423SLionel Sambuc #define SIS_SWI 0x04 /* Software Interrupt */ 64433d6423SLionel Sambuc #define SIS_RES 0x02 /* Reserved */ 65433d6423SLionel Sambuc #define SIS_FCP 0x01 /* Flow Control Pause Interrupt (82558 and 66433d6423SLionel Sambuc * later, reserved on 82557) 67433d6423SLionel Sambuc */ 68433d6423SLionel Sambuc #define SCB_CMD 0x02 /* Lower half of the SCB command word. CU and 69433d6423SLionel Sambuc * RU commands. 70433d6423SLionel Sambuc */ 71433d6423SLionel Sambuc #define SC_CUC_MASK 0xF0 72433d6423SLionel Sambuc #define SC_CU_NOP 0x00 /* NOP */ 73433d6423SLionel Sambuc #define SC_CU_START 0x10 /* Start CU */ 74433d6423SLionel Sambuc #define SC_CU_RESUME 0x20 /* Resume CU */ 75433d6423SLionel Sambuc #define SC_CU_LOAD_DCA 0x40 /* Load Dump Counters Address */ 76433d6423SLionel Sambuc #define SC_CU_DUMP_SC 0x50 /* Dump Statistical Counters */ 77433d6423SLionel Sambuc #define SC_CU_LOAD_BASE 0x60 /* Load CU Base */ 78433d6423SLionel Sambuc #define SC_CU_DUMP_RSET_SC 0x70 /* Dump and Reset Counters */ 79433d6423SLionel Sambuc #define SC_CU_STATIC_RESUME 0xA0 /* Static Resume, 82558 and 80433d6423SLionel Sambuc * above 81433d6423SLionel Sambuc */ 82433d6423SLionel Sambuc #define SC_RESERVED 0x08 /* Reserved */ 83433d6423SLionel Sambuc #define SC_RUC_MASK 0x07 /* RU Command Mask */ 84433d6423SLionel Sambuc #define SC_RU_NOP 0x00 /* NOP */ 85433d6423SLionel Sambuc #define SC_RU_START 0x01 /* Start RU */ 86433d6423SLionel Sambuc #define SC_RU_RESUME 0x02 /* Resume RU */ 87433d6423SLionel Sambuc #define SC_RU_DMA_REDIR 0x03 /* DMA Redirect */ 88433d6423SLionel Sambuc #define SC_RU_ABORT 0x04 /* Abort RU */ 89433d6423SLionel Sambuc #define SC_RU_LOAD_HDR 0x05 /* Load Header Data Size */ 90433d6423SLionel Sambuc #define SC_RU_LOAD_BASE 0x06 /* Load RU Base */ 91433d6423SLionel Sambuc #define SCB_INT_MASK 0x03 /* Upper half of the SCB command word. 92433d6423SLionel Sambuc * Interrupt mask. Can also be used to 93433d6423SLionel Sambuc * generate a 'software' interrupt. 94433d6423SLionel Sambuc */ 95433d6423SLionel Sambuc /* The following 6 mask bits are not valid on 96433d6423SLionel Sambuc * the 82557. 97433d6423SLionel Sambuc */ 98433d6423SLionel Sambuc #define SIM_CX 0x80 /* Mask CX */ 99433d6423SLionel Sambuc #define SIM_FR 0x40 /* Mask FR */ 100433d6423SLionel Sambuc #define SIM_CNA 0x20 /* Mask CNA */ 101433d6423SLionel Sambuc #define SIM_RNR 0x10 /* Mask RNR */ 102433d6423SLionel Sambuc #define SIM_ER 0x08 /* Mask ER */ 103433d6423SLionel Sambuc #define SIM_FCP 0x04 /* Mask FCP */ 104433d6423SLionel Sambuc #define SIM_SI 0x02 /* Generate Software Interrupt */ 105433d6423SLionel Sambuc #define SIM_M 0x01 /* Mask all interrupts */ 106433d6423SLionel Sambuc #define SCB_POINTER 0x04 /* A 32-bit (pointer) argument for CU and RU 107433d6423SLionel Sambuc * commands. 108433d6423SLionel Sambuc */ 109433d6423SLionel Sambuc #define CSR_PORT 0x08 /* Control functions that bypass the SCB */ 110433d6423SLionel Sambuc #define CP_PTR_MASK 0xFFFFFFF0 /* Argument pointer */ 111433d6423SLionel Sambuc #define CP_CMD_MASK 0x0000000F /* Commands bits */ 112433d6423SLionel Sambuc #define CP_CMD_SOFT_RESET 0x00000000 /* Software reset */ 113433d6423SLionel Sambuc #define CSR_PORT_RESET_DELAY 10 /* Wait for reset to 114433d6423SLionel Sambuc * complete. In micro 115433d6423SLionel Sambuc * seconds. 116433d6423SLionel Sambuc */ 117433d6423SLionel Sambuc #define CP_CMD_SELF_TEST 0x00000001 /* Self test */ 118433d6423SLionel Sambuc #define CP_CMD_SEL_RESET 0x00000002 /* Selective reset */ 119433d6423SLionel Sambuc #define CP_CMD_DUMP 0x00000003 /* Dump */ 120433d6423SLionel Sambuc #define CP_CMD_DUMP_WAKEUP 0x00000007 /* Dump and wake-up, 121433d6423SLionel Sambuc * 82559 and later. 122433d6423SLionel Sambuc */ 123433d6423SLionel Sambuc #define CSR_RESERVED 0x0C /* reserved, 16-bits */ 124433d6423SLionel Sambuc #define CSR_EEPROM 0x0E /* EEPROM Control Register */ 125433d6423SLionel Sambuc #define CE_RESERVED 0xF0 /* Reserved */ 126433d6423SLionel Sambuc #define CE_EEDO 0x08 /* Serial Data Out (of the EEPROM) */ 127433d6423SLionel Sambuc #define CE_EEDI 0x04 /* Serial Data In (to the EEPROM) */ 128433d6423SLionel Sambuc #define CE_EECS 0x02 /* Chip Select */ 129433d6423SLionel Sambuc #define CE_EESK 0x01 /* Serial Clock */ 130433d6423SLionel Sambuc #define CSR_RESERVED1 0x0F /* Reserved */ 131433d6423SLionel Sambuc #define CSR_MDI_CTL 0x10 /* MDI Control Register, 32-bits */ 132433d6423SLionel Sambuc #define CM_RESERVED 0xC0000000 /* Reserved */ 133433d6423SLionel Sambuc #define CM_IE 0x20000000 /* Enable Interrupt */ 134433d6423SLionel Sambuc #define CM_READY 0x10000000 /* Command completed */ 135433d6423SLionel Sambuc #define CM_OPCODE_MASK 0x0C000000 /* Opcode */ 136433d6423SLionel Sambuc #define CM_WRITE 0x04000000 /* Write */ 137433d6423SLionel Sambuc #define CM_READ 0x08000000 /* Read */ 138433d6423SLionel Sambuc #define CM_PHYADDR_MASK 0x03E00000 /* Which PHY */ 139433d6423SLionel Sambuc #define CM_PHYADDR_SHIFT 21 140433d6423SLionel Sambuc #define CM_REG_MASK 0x001F0000 /* Which register in the PHY */ 141433d6423SLionel Sambuc #define CM_REG_SHIFT 16 142433d6423SLionel Sambuc #define CM_DATA_MASK 0x0000FFFF /* Data to be read or written */ 143433d6423SLionel Sambuc 144433d6423SLionel Sambuc /* Control Block List (CBL) commands */ 145433d6423SLionel Sambuc #define CBL_NOP 0 /* No-operation */ 146433d6423SLionel Sambuc #define CBL_AIS 1 /* Individual Address Setup */ 147433d6423SLionel Sambuc #define CBL_CONF 2 /* Configure NIC */ 148433d6423SLionel Sambuc #define CBL_MAS 3 /* Multicast Address Setup */ 149433d6423SLionel Sambuc #define CBL_XMIT 4 /* Transmit */ 150433d6423SLionel Sambuc #define CBL_LM 5 /* Load Microcode */ 151433d6423SLionel Sambuc #define CBL_DUMP 6 /* Dump Internal Registers */ 152433d6423SLionel Sambuc #define CBL_DIAG 7 /* Diagnose Command */ 153433d6423SLionel Sambuc 154433d6423SLionel Sambuc /* Common command fields */ 155433d6423SLionel Sambuc #define CBL_C_CMD_MASK 0x0007 /* Command bits */ 156433d6423SLionel Sambuc #define CBL_C_EL 0x8000 /* End of CBL */ 157433d6423SLionel Sambuc #define CBL_C_S 0x4000 /* Suspend after the completion of the CB */ 158433d6423SLionel Sambuc #define CBL_C_I 0x2000 /* Request CX Interrupt */ 159433d6423SLionel Sambuc #define CBL_C_RES 0x1FF8 /* Reserved */ 160433d6423SLionel Sambuc 161433d6423SLionel Sambuc /* Command flags */ 162433d6423SLionel Sambuc #define CBL_F_C 0x8000 /* Command has completed */ 163433d6423SLionel Sambuc #define CBL_F_RES1 0x4000 /* Reserved */ 164433d6423SLionel Sambuc #define CBL_F_OK 0x2000 /* Command was executed without errors */ 165433d6423SLionel Sambuc #define CBL_F_RES0 0x1FFF /* Reserved */ 166433d6423SLionel Sambuc 167433d6423SLionel Sambuc /* Individual Address Setup (1) */ 168433d6423SLionel Sambuc struct ias 169433d6423SLionel Sambuc { 170433d6423SLionel Sambuc u16_t ias_status; 171433d6423SLionel Sambuc u16_t ias_command; 172433d6423SLionel Sambuc u32_t ias_linkaddr; 173433d6423SLionel Sambuc u8_t ias_ethaddr[6]; 174433d6423SLionel Sambuc u8_t ias_reserved[2]; 175433d6423SLionel Sambuc }; 176433d6423SLionel Sambuc 177433d6423SLionel Sambuc /* Configure (2) */ 178433d6423SLionel Sambuc #define CC_BYTES_NR 22 /* Number of configuration bytes */ 179433d6423SLionel Sambuc struct cbl_conf 180433d6423SLionel Sambuc { 181433d6423SLionel Sambuc u16_t cc_status; 182433d6423SLionel Sambuc u16_t cc_command; 183433d6423SLionel Sambuc u32_t cc_linkaddr; 184433d6423SLionel Sambuc u8_t cc_bytes[CC_BYTES_NR]; 185433d6423SLionel Sambuc }; 186433d6423SLionel Sambuc 187433d6423SLionel Sambuc /* Byte 0 */ 188433d6423SLionel Sambuc #define CCB0_RES 0xC0 /* Reserved (0) */ 189433d6423SLionel Sambuc #define CCB0_BYTECOUNT 0x3F /* Byte Count (typically either 8 or 22) */ 190433d6423SLionel Sambuc 191433d6423SLionel Sambuc /* Byte 1 */ 192433d6423SLionel Sambuc #define CCB1_RES 0x80 /* Reserved (0) */ 193433d6423SLionel Sambuc #define CCB1_TXFIFO_LIM 0x70 /* Transmit FIFO Limit, in DWORDS */ 194433d6423SLionel Sambuc #define CTL_DEFAULT 0x00 /* 0 bytes */ 195433d6423SLionel Sambuc #define CCB1_RXFIFO_LIM 0x0F /* Receive FIFO Limit */ 196433d6423SLionel Sambuc #define CRL_DEFAULT 0x08 /* 32 bytes on 82557, 64 bytes on 197433d6423SLionel Sambuc * 82558/82559. 198433d6423SLionel Sambuc */ 199433d6423SLionel Sambuc 200433d6423SLionel Sambuc /* Byte 2 */ 201433d6423SLionel Sambuc #define CCB2_AIFS 0xFF /* Adaptive IFS */ 202433d6423SLionel Sambuc #define CAI_DEFAULT 0 203433d6423SLionel Sambuc 204433d6423SLionel Sambuc /* Byte 3 */ 205433d6423SLionel Sambuc /* Reserved (must be 0) on 82557 */ 206433d6423SLionel Sambuc #define CCB3_RES 0xF0 /* Reserved (0) */ 207433d6423SLionel Sambuc #define CCB3_TWCL 0x08 /* Terminate Write on Cache Line */ 208433d6423SLionel Sambuc #define CCB3_RAE 0x04 /* Read Alignment Enable */ 209433d6423SLionel Sambuc #define CCB3_TE 0x02 /* Type Enable??? */ 210433d6423SLionel Sambuc #define CCB3_MWIE 0x01 /* Memory Write and Invalidate (MWI) Enable 211433d6423SLionel Sambuc * Additionally the MWI bit in the PCI 212433d6423SLionel Sambuc * command register has to be set. 213433d6423SLionel Sambuc * Recommended by Intel. 214433d6423SLionel Sambuc */ 215433d6423SLionel Sambuc 216433d6423SLionel Sambuc /* Byte 4 */ 217433d6423SLionel Sambuc #define CCB4_RES 0x80 /* Reserved (0) */ 218433d6423SLionel Sambuc #define CCB4_RXDMA_MAX 0x7F /* Receive DMA Maximum Byte Count */ 219433d6423SLionel Sambuc 220433d6423SLionel Sambuc /* Byte 5 */ 221433d6423SLionel Sambuc #define CCB5_DMBCE 0x80 /* DMA Maximum Byte Count Enable */ 222433d6423SLionel Sambuc #define CCB5_TXDMA_MAX 0x7F /* Transmit DMA Maximum Byte Count */ 223433d6423SLionel Sambuc 224433d6423SLionel Sambuc /* Byte 6 */ 225433d6423SLionel Sambuc #define CCB6_SBF 0x80 /* Save Bad Frames */ 226433d6423SLionel Sambuc #define CCB6_DORF 0x40 /* (Do not) Discard Overrun Receive Frame, 227433d6423SLionel Sambuc * Set this bit to keep them. 228433d6423SLionel Sambuc */ 229433d6423SLionel Sambuc #define CCB6_ESC 0x20 /* Extended Statistical Counter. Reserved 230433d6423SLionel Sambuc * on 82557, must be set to 1. 231433d6423SLionel Sambuc * Clear this bit to get more counters. 232433d6423SLionel Sambuc */ 233433d6423SLionel Sambuc #define CCB6_ETCB 0x10 /* Extended Transmit CB. Reserved on 82557, 234433d6423SLionel Sambuc * must be set to 1. 235433d6423SLionel Sambuc * Clear this bit to use Extended TxCBs. 236433d6423SLionel Sambuc */ 237433d6423SLionel Sambuc #define CCB6_CI_INT 0x08 /* CPU Idle (CI) Interrupt. Generate a 238433d6423SLionel Sambuc * CI Int (bit set) or a CNA Int (bit clear) 239433d6423SLionel Sambuc * when the CU goes to the idle state (or 240433d6423SLionel Sambuc * to suspended for CNA). 241433d6423SLionel Sambuc */ 242433d6423SLionel Sambuc #define CCB6_TNO_INT 0x04 /* Enable TNO Interrupt (82557 only) */ 243433d6423SLionel Sambuc #define CCB6_TCOSC 0x04 /* TCO Statistical Counter (82559 only) */ 244433d6423SLionel Sambuc #define CCB6_RES 0x02 /* Reserved, must be set to 1. Called "disable 245433d6423SLionel Sambuc * direct rcv dma mode" by the FreeBSD 246433d6423SLionel Sambuc * driver. 247433d6423SLionel Sambuc */ 248433d6423SLionel Sambuc #define CCB6_LSCB 0x01 /* Late SCB Update. Only on 82557. */ 249433d6423SLionel Sambuc 250433d6423SLionel Sambuc /* Byte 7 */ 251433d6423SLionel Sambuc #define CCB7_DTBD 0x80 /* Dynamic TBD. Reserved on 82557, should be 252433d6423SLionel Sambuc * be set to 0. 253433d6423SLionel Sambuc */ 254433d6423SLionel Sambuc #define CCB7_2FFIFO 0x40 /* (At Most) Two Frames in FIFO. Reserved on 255433d6423SLionel Sambuc * 82557, should be set to 0. 256433d6423SLionel Sambuc */ 257433d6423SLionel Sambuc #define CCB7_RES 0x38 /* Reserved (0) */ 258433d6423SLionel Sambuc #define CCB7_UR 0x06 /* Underrun Retry */ 259433d6423SLionel Sambuc #define CUR_0 0x00 /* No re-transmission */ 260433d6423SLionel Sambuc #define CUR_1 0x02 /* One re-transmission */ 261433d6423SLionel Sambuc #define CUR_2 0x04 /* Two re-transmissions, 1st retry with 262433d6423SLionel Sambuc * 512 bytes. 263433d6423SLionel Sambuc */ 264433d6423SLionel Sambuc #define CUR_3 0x06 /* Tree re-transmissions, 1st retry 265433d6423SLionel Sambuc * with 512 bytes, 2nd retry with 1024. 266433d6423SLionel Sambuc */ 267433d6423SLionel Sambuc #define CCB7_DSRF 0x01 /* Discard Short Receive Frames. */ 268433d6423SLionel Sambuc 269433d6423SLionel Sambuc /* Byte 8 */ 270433d6423SLionel Sambuc #define CCB8_CSMAD 0x80 /* CSMA Disable. Reserved on 82557, should be 271433d6423SLionel Sambuc * set to zero. 272433d6423SLionel Sambuc */ 273433d6423SLionel Sambuc #define CCB8_RES 0x7E /* Reserved (0) */ 274433d6423SLionel Sambuc #define CCB8_503_MII 0x01 /* 503 mode or MII mode. Reserved on 82558 275433d6423SLionel Sambuc * and 82559, should be set to 1. 276433d6423SLionel Sambuc */ 277433d6423SLionel Sambuc 278433d6423SLionel Sambuc /* Byte 9 */ 279433d6423SLionel Sambuc #define CCB9_MMWE 0x80 /* Multicast Match Wake Enable. 82558 B-step 280433d6423SLionel Sambuc * only, should be set to zero on other 281433d6423SLionel Sambuc * devices. 282433d6423SLionel Sambuc */ 283433d6423SLionel Sambuc #define CCB9_AWE 0x40 /* ARP Wake-up Enable. 82558 B-step only, 284433d6423SLionel Sambuc * should be set to zero on other devices. 285433d6423SLionel Sambuc */ 286433d6423SLionel Sambuc #define CCB9_LSCWE 0x20 /* Link Status Change Wake Enable. Available 287433d6423SLionel Sambuc * on 82558 B-step and 82559. Should be 288433d6423SLionel Sambuc * set to zero on 82557 and 82558 A-step 289433d6423SLionel Sambuc */ 290433d6423SLionel Sambuc #define CCB9_VARP 0x10 /* VLAN ARP (82558 B-step) or VLAN TCO (82559). 291433d6423SLionel Sambuc * Should be zero on 82557 and 82558 A-step 292433d6423SLionel Sambuc */ 293433d6423SLionel Sambuc #define CCB9_RES 0x0E /* Reserved (0) */ 294433d6423SLionel Sambuc #define CCB9_TUC 0x01 /* TCP/UDP Checksum. 82559 only, should be 295433d6423SLionel Sambuc * zero on other devices. 296433d6423SLionel Sambuc */ 297433d6423SLionel Sambuc 298433d6423SLionel Sambuc /* Byte 10 */ 299433d6423SLionel Sambuc #define CCB10_LOOPBACK 0xC0 /* Loopback mode */ 300433d6423SLionel Sambuc #define CLB_NORMAL 0x00 /* Normal operation */ 301433d6423SLionel Sambuc #define CLB_INTERNAL 0x40 /* Internal loopback */ 302433d6423SLionel Sambuc #define CLB_RESERVED 0x80 /* Reserved */ 303433d6423SLionel Sambuc #define CLB_EXTERNAL 0xC0 /* External loopback */ 304433d6423SLionel Sambuc #define CCB10_PAL 0x30 /* Pre-amble length */ 305433d6423SLionel Sambuc #define CPAL_1 0x00 /* 1 byte */ 306433d6423SLionel Sambuc #define CPAL_3 0x10 /* 3 bytes */ 307433d6423SLionel Sambuc #define CPAL_7 0x20 /* 7 bytes */ 308433d6423SLionel Sambuc #define CPAL_15 0x30 /* 15 bytes */ 309433d6423SLionel Sambuc #define CPAL_DEFAULT CPAL_7 310433d6423SLionel Sambuc #define CCB10_NSAI 0x08 /* No Source Address Insertion */ 311433d6423SLionel Sambuc #define CCB10_RES1 0x06 /* Reserved, should be set to 1 */ 312433d6423SLionel Sambuc #define CCB10_RES0 0x01 /* Reserved (0) */ 313433d6423SLionel Sambuc 314433d6423SLionel Sambuc /* Byte 11 */ 315433d6423SLionel Sambuc #define CCB11_RES 0xF8 /* Reserved (0) */ 316433d6423SLionel Sambuc #define CCB11_LINPRIO 0x07 /* Linear Priority. 82557 only, 317433d6423SLionel Sambuc * should be zero on other devices. 318433d6423SLionel Sambuc */ 319433d6423SLionel Sambuc 320433d6423SLionel Sambuc /* Byte 12 */ 321433d6423SLionel Sambuc #define CCB12_IS 0xF0 /* Interframe spacing in multiples of 322433d6423SLionel Sambuc * 16 bit times. 323433d6423SLionel Sambuc */ 324433d6423SLionel Sambuc #define CIS_DEFAULT 0x60 /* 96 (6 in register) */ 325433d6423SLionel Sambuc #define CCB12_RES 0x0E /* Reserved (0) */ 326433d6423SLionel Sambuc #define CCB12_LPM 0x01 /* Linear Priority Mode. 82557 only, 327433d6423SLionel Sambuc * should be zero on other devices. 328433d6423SLionel Sambuc */ 329433d6423SLionel Sambuc 330433d6423SLionel Sambuc /* Byte 13, 4th byte of IP address for ARP frame filtering. Only valid on 331433d6423SLionel Sambuc * 82558 B-step. Should be 0 on other devices. 332433d6423SLionel Sambuc */ 333433d6423SLionel Sambuc #define CCB13_DEFAULT 0x00 334433d6423SLionel Sambuc /* Byte 14, 3rd byte of IP address for ARP fram efiltering. Only valid on 335433d6423SLionel Sambuc * 82558 B-step. Should be 0xF2 on other devices. 336433d6423SLionel Sambuc */ 337433d6423SLionel Sambuc #define CCB14_DEFAULT 0xF2 338433d6423SLionel Sambuc 339433d6423SLionel Sambuc /* Byte 15 */ 340433d6423SLionel Sambuc #define CCB15_CRSCDT 0x80 /* CRS or CDT. */ 341433d6423SLionel Sambuc #define CCB15_RES1 0x40 /* Reserved, should be set to one. */ 342433d6423SLionel Sambuc #define CCB15_CRC16 0x20 /* 16-bit CRC. Only on 82559, 343433d6423SLionel Sambuc * should be zero on other devices 344433d6423SLionel Sambuc */ 345433d6423SLionel Sambuc #define CCB15_IUL 0x10 /* Ignore U/L. Reserved on 82557 and 346433d6423SLionel Sambuc * should be set to zero. 347433d6423SLionel Sambuc */ 348433d6423SLionel Sambuc #define CCB15_RES2 0x08 /* Reserved, should be set to one. */ 349433d6423SLionel Sambuc #define CCB15_WAW 0x04 /* Wait After Win. Reserved on 82557, 350433d6423SLionel Sambuc * should be set to zero. 351433d6423SLionel Sambuc */ 352433d6423SLionel Sambuc #define CCB15_BD 0x02 /* Broadcast disable */ 353433d6423SLionel Sambuc #define CCB15_PM 0x01 /* Promiscuous mode */ 354433d6423SLionel Sambuc 355433d6423SLionel Sambuc /* Byte 16. FC Delay Least Significant Byte. Reserved on the 82557 and 356433d6423SLionel Sambuc * should be set to zero. 357433d6423SLionel Sambuc */ 358433d6423SLionel Sambuc #define CCB16_DEFAULT 0x00 359433d6423SLionel Sambuc 360433d6423SLionel Sambuc /* Byte 17. FC Delay Most Significant Byte. This byte is reserved on the 361433d6423SLionel Sambuc * 82557 and should be set to 0x40. 362433d6423SLionel Sambuc */ 363433d6423SLionel Sambuc #define CCB17_DEFAULT 0x40 364433d6423SLionel Sambuc 365433d6423SLionel Sambuc /* Byte 18 */ 366433d6423SLionel Sambuc #define CCB18_RES1 0x80 /* Reserved, should be set to 1 */ 367433d6423SLionel Sambuc #define CCB18_PFCT 0x70 /* Priority Flow Control Threshold. 368433d6423SLionel Sambuc * Reserved on the 82557 and should 369433d6423SLionel Sambuc * be set to 1. All bits 1 (disabled) 370433d6423SLionel Sambuc * is the recommended default. 371433d6423SLionel Sambuc */ 372433d6423SLionel Sambuc #define CCB18_LROK 0x08 /* Long Receive OK. Reserved on the 373433d6423SLionel Sambuc * 82557 and should be set to zero. 374433d6423SLionel Sambuc * Required for VLANs. 375433d6423SLionel Sambuc */ 376433d6423SLionel Sambuc #define CCB18_RCRCT 0x04 /* Receive CRC Transfer */ 377433d6423SLionel Sambuc #define CCB18_PE 0x02 /* Padding Enable */ 378433d6423SLionel Sambuc #define CCB18_SE 0x01 /* Stripping Enable */ 379433d6423SLionel Sambuc 380433d6423SLionel Sambuc /* Byte 19 */ 381433d6423SLionel Sambuc #define CCB19_FDPE 0x80 /* Full Duplex Pin Enable */ 382433d6423SLionel Sambuc #define CCB19_FFD 0x40 /* Force Full Duplex */ 383433d6423SLionel Sambuc #define CCB19_RFC 0x20 /* Reject FC. Reserved on the 82557 384433d6423SLionel Sambuc * and should be set to zero. 385433d6423SLionel Sambuc */ 386433d6423SLionel Sambuc #define CCB19_FDRSTAFC 0x10 /* Full Duplex Restart Flow Control. 387433d6423SLionel Sambuc * Reserved on the 82557 and should be 388433d6423SLionel Sambuc * set to zero. 389433d6423SLionel Sambuc */ 390433d6423SLionel Sambuc #define CCB19_FDRSTOFC 0x08 /* Full Duplex Restop Flow Control. 391433d6423SLionel Sambuc * Reserved on the 82557 and should be 392433d6423SLionel Sambuc * set to zero. 393433d6423SLionel Sambuc */ 394433d6423SLionel Sambuc #define CCB19_FDTFCD 0x04 /* Full Duplex Transmit Flow Control 395433d6423SLionel Sambuc * Disable. Reserved on the 82557 and 396433d6423SLionel Sambuc * should be set to zero. 397433d6423SLionel Sambuc */ 398433d6423SLionel Sambuc #define CCB19_MPWD 0x02 /* Magic Packet Wake-up Disable. 399433d6423SLionel Sambuc * Reserved on the 82557 and 82559ER 400433d6423SLionel Sambuc * and should be set to zero. 401433d6423SLionel Sambuc */ 402433d6423SLionel Sambuc #define CCB19_AW 0x01 /* Address Wake-up (82558 A-step) and 403433d6423SLionel Sambuc * IA Match Wake Enable (82558 B-step) 404433d6423SLionel Sambuc * Reserved on the 82557 and 82559 and 405433d6423SLionel Sambuc * should be set to zero. 406433d6423SLionel Sambuc */ 407433d6423SLionel Sambuc 408433d6423SLionel Sambuc /* Byte 20 */ 409433d6423SLionel Sambuc #define CCB20_RES 0x80 /* Reserved (0) */ 410433d6423SLionel Sambuc #define CCB20_MIA 0x40 /* Multiple IA */ 411433d6423SLionel Sambuc #define CCB20_PFCL 0x20 /* Priority FC Location. Reserved on 412433d6423SLionel Sambuc * the 82557 and should be set to 1. 413433d6423SLionel Sambuc */ 414433d6423SLionel Sambuc #define CCB20_RES1 0x1F /* Reserved, should be set to 1 */ 415433d6423SLionel Sambuc 416433d6423SLionel Sambuc /* Byte 21 */ 417433d6423SLionel Sambuc #define CCB21_RES 0xF0 /* Reserved (0) */ 418433d6423SLionel Sambuc #define CCB21_MA 0x08 /* Multicast All */ 419433d6423SLionel Sambuc #define CCB21_RES1_MASK 0x07 /* Reserved, should be set to 5 */ 420433d6423SLionel Sambuc #define CCB21_RES21 0x05 421433d6423SLionel Sambuc 422433d6423SLionel Sambuc /* Transmit (4) */ 423433d6423SLionel Sambuc struct tx 424433d6423SLionel Sambuc { 425433d6423SLionel Sambuc u16_t tx_status; 426433d6423SLionel Sambuc u16_t tx_command; 427433d6423SLionel Sambuc u32_t tx_linkaddr; 428433d6423SLionel Sambuc u32_t tx_tbda; 429433d6423SLionel Sambuc u16_t tx_size; 430433d6423SLionel Sambuc u8_t tx_tthresh; 431433d6423SLionel Sambuc u8_t tx_ntbd; 432*f7df02e7SDavid van Moolenbroek u8_t tx_buf[NDEV_ETH_PACKET_MAX_TAGGED]; 433433d6423SLionel Sambuc }; 434433d6423SLionel Sambuc 435433d6423SLionel Sambuc #define TXS_C 0x8000 /* Transmit DMA has completed */ 436433d6423SLionel Sambuc #define TXS_RES 0x4000 /* Reserved */ 437433d6423SLionel Sambuc #define TXS_OK 0x2000 /* Command was executed without error */ 438433d6423SLionel Sambuc #define TXS_U 0x1000 /* This or previous frame encoutered underrun */ 439433d6423SLionel Sambuc #define TXS_RES1 0x0FFF /* Reserved (0) */ 440433d6423SLionel Sambuc 441433d6423SLionel Sambuc #define TXC_EL 0x8000 /* End of List */ 442433d6423SLionel Sambuc #define TXC_S 0x4000 /* Suspend after this CB */ 443433d6423SLionel Sambuc #define TXC_I 0x2000 /* Interrupt after this CB */ 444433d6423SLionel Sambuc #define TXC_CID_MASK 0x1F00 /* CNA Interrupt Delay */ 445433d6423SLionel Sambuc #define TXC_RES 0x00E0 /* Reserved (0) */ 446433d6423SLionel Sambuc #define TXC_NC 0x0010 /* No CRC and Source Address Insertion */ 447433d6423SLionel Sambuc #define TXC_SF 0x0008 /* Not in Simplified Mode */ 448433d6423SLionel Sambuc #define TXC_CMD 0x0007 /* Command */ 449433d6423SLionel Sambuc 450433d6423SLionel Sambuc #define TXSZ_EOF 0x8000 /* End of Frame */ 451433d6423SLionel Sambuc #define TXSZ_RES 0x4000 /* Reserved (0) */ 452433d6423SLionel Sambuc #define TXSZ_COUNT 0x3FFF /* Transmit Byte Count */ 453433d6423SLionel Sambuc 454433d6423SLionel Sambuc #define TX_TBDA_NIL 0xFFFFFFFF /* Null Pointer for TBD Array */ 455433d6423SLionel Sambuc 456433d6423SLionel Sambuc #define TXTT_MIN 0x01 /* Minimum for Transmit Threshold */ 457433d6423SLionel Sambuc #define TXTT_MAX 0xE0 /* Maximum for Transmit Threshold */ 458433d6423SLionel Sambuc 459433d6423SLionel Sambuc /* Statistical Counters */ 460433d6423SLionel Sambuc struct sc 461433d6423SLionel Sambuc { 462433d6423SLionel Sambuc u32_t sc_tx_good; /* Transmit Good Frames */ 463433d6423SLionel Sambuc u32_t sc_tx_maxcol; /* Transmit Maximum Collisions errors */ 464433d6423SLionel Sambuc u32_t sc_tx_latecol; /* Transmit Late Collisions errors */ 465433d6423SLionel Sambuc u32_t sc_tx_underrun; /* Transmit Underrun errors */ 466433d6423SLionel Sambuc u32_t sc_tx_crs; /* Transmit Lost Carrier Sense */ 467433d6423SLionel Sambuc u32_t sc_tx_defered; /* Transmit Defered */ 468433d6423SLionel Sambuc u32_t sc_tx_scol; /* Transmit Single Collision */ 469433d6423SLionel Sambuc u32_t sc_tx_mcol; /* Transmit Multiple Collisions */ 470433d6423SLionel Sambuc u32_t sc_tx_totcol; /* Transmit Total Collisions */ 471433d6423SLionel Sambuc u32_t sc_rx_good; /* Receive Good Frames */ 472433d6423SLionel Sambuc u32_t sc_rx_crc; /* Receive CRC errors */ 473433d6423SLionel Sambuc u32_t sc_rx_align; /* Receive Alignment errors */ 474433d6423SLionel Sambuc u32_t sc_rx_resource; /* Receive Resource errors */ 475433d6423SLionel Sambuc u32_t sc_rx_overrun; /* Receive Overrun errors */ 476433d6423SLionel Sambuc u32_t sc_rx_cd; /* Receive Collision Detect errors */ 477433d6423SLionel Sambuc u32_t sc_rx_short; /* Receive Short Frame errors */ 478433d6423SLionel Sambuc 479433d6423SLionel Sambuc /* Short form ends here. The magic number will 480433d6423SLionel Sambuc * be stored in the next field. 481433d6423SLionel Sambuc */ 482433d6423SLionel Sambuc 483433d6423SLionel Sambuc u32_t sc_tx_fcp; /* Transmit Flow Control Pause */ 484433d6423SLionel Sambuc u32_t sc_rx_fcp; /* Receive Flow Control Pause */ 485433d6423SLionel Sambuc u32_t sc_rx_fcu; /* Receive Flow Control Unsupported */ 486433d6423SLionel Sambuc 487433d6423SLionel Sambuc /* Longer form (82558 and later) ends here. 488433d6423SLionel Sambuc * The magic number will be stored in the 489433d6423SLionel Sambuc * next field. 490433d6423SLionel Sambuc */ 491433d6423SLionel Sambuc 492433d6423SLionel Sambuc u32_t sc_tx_tco; /* Transmit TCO frames */ 493433d6423SLionel Sambuc u32_t sc_rx_tco; /* Receive TCO frames */ 494433d6423SLionel Sambuc u32_t sc_magic; /* Dump of counters completed */ 495433d6423SLionel Sambuc }; 496433d6423SLionel Sambuc 497433d6423SLionel Sambuc #define SCM_DSC 0x0000A005 /* Magic for SC_CU_DUMP_SC command */ 498433d6423SLionel Sambuc #define SCM_DRSC 0x0000A007 /* Magic for SC_CU_DUMP_RSET_SC cmd */ 499433d6423SLionel Sambuc 500433d6423SLionel Sambuc /* Receive Frame Descriptor (RFD) */ 501433d6423SLionel Sambuc struct rfd 502433d6423SLionel Sambuc { 503433d6423SLionel Sambuc u16_t rfd_status; 504433d6423SLionel Sambuc u16_t rfd_command; 505433d6423SLionel Sambuc u32_t rfd_linkaddr; 506433d6423SLionel Sambuc u32_t rfd_reserved; 507433d6423SLionel Sambuc u16_t rfd_res; 508433d6423SLionel Sambuc u16_t rfd_size; 509*f7df02e7SDavid van Moolenbroek u8_t rfd_buf[NDEV_ETH_PACKET_MAX_TAGGED]; 510433d6423SLionel Sambuc }; 511433d6423SLionel Sambuc 512433d6423SLionel Sambuc #define RFDS_C 0x8000 /* Frame Reception Completed */ 513433d6423SLionel Sambuc #define RFDS_RES 0x4000 /* Reserved (0) */ 514433d6423SLionel Sambuc #define RFDS_OK 0x2000 /* Frame received without any errors */ 515433d6423SLionel Sambuc #define RFDS_RES1 0x1000 /* Reserved */ 516433d6423SLionel Sambuc #define RFDS_CRCERR 0x0800 /* CRC error */ 517433d6423SLionel Sambuc #define RFDS_ALIGNERR 0x0400 /* Alignment error */ 518433d6423SLionel Sambuc #define RFDS_OUTOFBUF 0x0200 /* Ran out of buffer space (frame is frager 519433d6423SLionel Sambuc * than supplied buffer). 520433d6423SLionel Sambuc */ 521433d6423SLionel Sambuc #define RFDS_DMAOVR 0x0100 /* DMA overrun failure */ 522433d6423SLionel Sambuc #define RFDS_TOOSHORT 0x0080 /* Frame Too Short */ 523433d6423SLionel Sambuc #define RFDS_RES2 0x0040 /* Reserved */ 524433d6423SLionel Sambuc #define RFDS_TYPED 0x0020 /* Frame Is Typed (Type/Length field is 0 or 525433d6423SLionel Sambuc * >1500) 526433d6423SLionel Sambuc */ 527433d6423SLionel Sambuc #define RFDS_RXERR 0x0010 /* Receive Error */ 528433d6423SLionel Sambuc #define RFDS_RES3 0x0008 /* Reserved */ 529433d6423SLionel Sambuc #define RFDS_NOAM 0x0004 /* No Address Match */ 530433d6423SLionel Sambuc #define RFDS_NOAIAM 0x0002 /* No IA Address Match */ 531433d6423SLionel Sambuc #define RFDS_RXCOL 0x0001 /* Collition Detected During Reception (82557 532433d6423SLionel Sambuc * and 82558 only) 533433d6423SLionel Sambuc */ 534433d6423SLionel Sambuc #define RFDS_TCO 0x0001 /* TCO Packet (82559 and later) */ 535433d6423SLionel Sambuc 536433d6423SLionel Sambuc #define RFDC_EL 0x8000 /* End of List */ 537433d6423SLionel Sambuc #define RFDC_S 0x4000 /* Suspend */ 538433d6423SLionel Sambuc #define RFDC_RES 0x3FE0 /* Reserved (0) */ 539433d6423SLionel Sambuc #define RFDC_H 0x0010 /* Header RFD */ 540433d6423SLionel Sambuc #define RFDC_SF 0x0008 /* (Not) Simplified Mode */ 541433d6423SLionel Sambuc #define RFDC_RES1 0x0007 /* Reserved (0) */ 542433d6423SLionel Sambuc 543433d6423SLionel Sambuc #define RFDR_EOF 0x8000 /* End of Frame (all data is in the buffer) */ 544433d6423SLionel Sambuc #define RFDR_F 0x4000 /* Finished updating the count field */ 545433d6423SLionel Sambuc #define RFDR_COUNT 0x3FFF /* Actual Count */ 546433d6423SLionel Sambuc 547433d6423SLionel Sambuc #define RFDSZ_RES 0xC000 /* Reserved (0) */ 548433d6423SLionel Sambuc #define RFDSZ_SIZE 0x3FFF /* Buffer Size */ 549433d6423SLionel Sambuc 550433d6423SLionel Sambuc /* EEPROM commands */ 551433d6423SLionel Sambuc #define EEPROM_READ_PREFIX 0x6 /* Read command */ 552433d6423SLionel Sambuc #define EEPROM_PREFIX_LEN 3 /* Start bit and two command bits */ 553433d6423SLionel Sambuc 554433d6423SLionel Sambuc /* EEPROM timing parameters */ 555433d6423SLionel Sambuc #define EECS_DELAY 1 /* Keep EECS low for at least EECS_DELAY 556433d6423SLionel Sambuc * microseconds 557433d6423SLionel Sambuc */ 558433d6423SLionel Sambuc #define EESK_PERIOD 4 /* A cycle of driving EESK high followed by 559433d6423SLionel Sambuc * driving EESK low should take at least 560433d6423SLionel Sambuc * EESK_PERIOD microseconds 561433d6423SLionel Sambuc */ 562433d6423SLionel Sambuc 563433d6423SLionel Sambuc /* Special registers in the 82555 (and compatible) PHYs. Should be moved 564433d6423SLionel Sambuc * to a separate file if other drivers need this too. 565433d6423SLionel Sambuc */ 566433d6423SLionel Sambuc #define MII_SCR 0x10 /* Status and Control Register */ 567433d6423SLionel Sambuc #define MII_SCR_FC 0x8000 /* Flow Control */ 568433d6423SLionel Sambuc #define MII_SCR_T4E 0x4000 /* Enable T4 unless auto-negotiation */ 569433d6423SLionel Sambuc #define MII_SCR_CRSDC 0x2000 /* RX100 CRS Disconnect */ 570433d6423SLionel Sambuc #define MII_SCR_RES 0x1000 /* Reserved */ 571433d6423SLionel Sambuc #define MII_SCR_RCVSYNC 0x0800 /* RCV De-Serializer in sync */ 572433d6423SLionel Sambuc #define MII_SCR_100DOWN 0x0400 /* 100Base-T Power Down */ 573433d6423SLionel Sambuc #define MII_SCR_10DOWN 0x0200 /* 10Base-T Power Down */ 574433d6423SLionel Sambuc #define MII_SCR_POLARITY 0x0100 /* 10Base-T Polarity */ 575433d6423SLionel Sambuc #define MII_SCR_RES_1 0x00F8 /* Reserved */ 576433d6423SLionel Sambuc #define MII_SCR_T4 0x0004 /* 100Base-T4 negotiated */ 577433d6423SLionel Sambuc #define MII_SCR_100 0x0002 /* 100 Mbps negotiated */ 578433d6423SLionel Sambuc #define MII_SCR_FD 0x0001 /* Full Duplex negotiated */ 579433d6423SLionel Sambuc 580433d6423SLionel Sambuc /* 581433d6423SLionel Sambuc * $PchId: fxp.h,v 1.1 2004/11/23 14:34:03 philip Exp $ 582433d6423SLionel Sambuc */ 583433d6423SLionel Sambuc 584433d6423SLionel Sambuc #endif 585