11ccea77eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 2b955f6caSJeff Kirsher /* 3b955f6caSJeff Kirsher * Advanced Micro Devices Inc. AMD8111E Linux Network Driver 4b955f6caSJeff Kirsher * Copyright (C) 2003 Advanced Micro Devices 5b955f6caSJeff Kirsher * 6b955f6caSJeff Kirsher 7b955f6caSJeff Kirsher Module Name: 8b955f6caSJeff Kirsher 9b955f6caSJeff Kirsher amd8111e.h 10b955f6caSJeff Kirsher 11b955f6caSJeff Kirsher Abstract: 12b955f6caSJeff Kirsher 13b955f6caSJeff Kirsher AMD8111 based 10/100 Ethernet Controller driver definitions. 14b955f6caSJeff Kirsher 15b955f6caSJeff Kirsher Environment: 16b955f6caSJeff Kirsher 17b955f6caSJeff Kirsher Kernel Mode 18b955f6caSJeff Kirsher 19b955f6caSJeff Kirsher Revision History: 20b955f6caSJeff Kirsher 3.0.0 21b955f6caSJeff Kirsher Initial Revision. 22b955f6caSJeff Kirsher 3.0.1 23b955f6caSJeff Kirsher */ 24b955f6caSJeff Kirsher 25b955f6caSJeff Kirsher #ifndef _AMD811E_H 26b955f6caSJeff Kirsher #define _AMD811E_H 27b955f6caSJeff Kirsher 28b955f6caSJeff Kirsher /* Command style register access 29b955f6caSJeff Kirsher 30b955f6caSJeff Kirsher Registers CMD0, CMD2, CMD3,CMD7 and INTEN0 uses a write access technique called command style access. It allows the write to selected bits of this register without altering the bits that are not selected. Command style registers are divided into 4 bytes that can be written independently. Higher order bit of each byte is the value bit that specifies the value that will be written into the selected bits of register. 31b955f6caSJeff Kirsher 32b955f6caSJeff Kirsher eg., if the value 10011010b is written into the least significant byte of a command style register, bits 1,3 and 4 of the register will be set to 1, and the other bits will not be altered. If the value 00011010b is written into the same byte, bits 1,3 and 4 will be cleared to 0 and the other bits will not be altered. 33b955f6caSJeff Kirsher 34b955f6caSJeff Kirsher */ 35b955f6caSJeff Kirsher 36b955f6caSJeff Kirsher /* Offset for Memory Mapped Registers. */ 37b955f6caSJeff Kirsher /* 32 bit registers */ 38b955f6caSJeff Kirsher 39b955f6caSJeff Kirsher #define ASF_STAT 0x00 /* ASF status register */ 40ad61dd30SStephen Boyd #define CHIPID 0x04 /* Chip ID register */ 41b955f6caSJeff Kirsher #define MIB_DATA 0x10 /* MIB data register */ 42b955f6caSJeff Kirsher #define MIB_ADDR 0x14 /* MIB address register */ 43b955f6caSJeff Kirsher #define STAT0 0x30 /* Status0 register */ 44b955f6caSJeff Kirsher #define INT0 0x38 /* Interrupt0 register */ 45b955f6caSJeff Kirsher #define INTEN0 0x40 /* Interrupt0 enable register*/ 46b955f6caSJeff Kirsher #define CMD0 0x48 /* Command0 register */ 47b955f6caSJeff Kirsher #define CMD2 0x50 /* Command2 register */ 48b955f6caSJeff Kirsher #define CMD3 0x54 /* Command3 resiter */ 49b955f6caSJeff Kirsher #define CMD7 0x64 /* Command7 register */ 50b955f6caSJeff Kirsher 51b955f6caSJeff Kirsher #define CTRL1 0x6C /* Control1 register */ 52b955f6caSJeff Kirsher #define CTRL2 0x70 /* Control2 register */ 53b955f6caSJeff Kirsher 54b955f6caSJeff Kirsher #define XMT_RING_LIMIT 0x7C /* Transmit ring limit register */ 55b955f6caSJeff Kirsher 56b955f6caSJeff Kirsher #define AUTOPOLL0 0x88 /* Auto-poll0 register */ 57b955f6caSJeff Kirsher #define AUTOPOLL1 0x8A /* Auto-poll1 register */ 58b955f6caSJeff Kirsher #define AUTOPOLL2 0x8C /* Auto-poll2 register */ 59b955f6caSJeff Kirsher #define AUTOPOLL3 0x8E /* Auto-poll3 register */ 60b955f6caSJeff Kirsher #define AUTOPOLL4 0x90 /* Auto-poll4 register */ 61b955f6caSJeff Kirsher #define AUTOPOLL5 0x92 /* Auto-poll5 register */ 62b955f6caSJeff Kirsher 63b955f6caSJeff Kirsher #define AP_VALUE 0x98 /* Auto-poll value register */ 64b955f6caSJeff Kirsher #define DLY_INT_A 0xA8 /* Group A delayed interrupt register */ 65b955f6caSJeff Kirsher #define DLY_INT_B 0xAC /* Group B delayed interrupt register */ 66b955f6caSJeff Kirsher 67b955f6caSJeff Kirsher #define FLOW_CONTROL 0xC8 /* Flow control register */ 68b955f6caSJeff Kirsher #define PHY_ACCESS 0xD0 /* PHY access register */ 69b955f6caSJeff Kirsher 70b955f6caSJeff Kirsher #define STVAL 0xD8 /* Software timer value register */ 71b955f6caSJeff Kirsher 72b955f6caSJeff Kirsher #define XMT_RING_BASE_ADDR0 0x100 /* Transmit ring0 base addr register */ 73b955f6caSJeff Kirsher #define XMT_RING_BASE_ADDR1 0x108 /* Transmit ring1 base addr register */ 74b955f6caSJeff Kirsher #define XMT_RING_BASE_ADDR2 0x110 /* Transmit ring2 base addr register */ 75b955f6caSJeff Kirsher #define XMT_RING_BASE_ADDR3 0x118 /* Transmit ring2 base addr register */ 76b955f6caSJeff Kirsher 77b955f6caSJeff Kirsher #define RCV_RING_BASE_ADDR0 0x120 /* Transmit ring0 base addr register */ 78b955f6caSJeff Kirsher 79b955f6caSJeff Kirsher #define PMAT0 0x190 /* OnNow pattern register0 */ 80b955f6caSJeff Kirsher #define PMAT1 0x194 /* OnNow pattern register1 */ 81b955f6caSJeff Kirsher 82b955f6caSJeff Kirsher /* 16bit registers */ 83b955f6caSJeff Kirsher 84b955f6caSJeff Kirsher #define XMT_RING_LEN0 0x140 /* Transmit Ring0 length register */ 85b955f6caSJeff Kirsher #define XMT_RING_LEN1 0x144 /* Transmit Ring1 length register */ 86b955f6caSJeff Kirsher #define XMT_RING_LEN2 0x148 /* Transmit Ring2 length register */ 87b955f6caSJeff Kirsher #define XMT_RING_LEN3 0x14C /* Transmit Ring3 length register */ 88b955f6caSJeff Kirsher 89b955f6caSJeff Kirsher #define RCV_RING_LEN0 0x150 /* Receive Ring0 length register */ 90b955f6caSJeff Kirsher 91b955f6caSJeff Kirsher #define SRAM_SIZE 0x178 /* SRAM size register */ 92b955f6caSJeff Kirsher #define SRAM_BOUNDARY 0x17A /* SRAM boundary register */ 93b955f6caSJeff Kirsher 94b955f6caSJeff Kirsher /* 48bit register */ 95b955f6caSJeff Kirsher 96b955f6caSJeff Kirsher #define PADR 0x160 /* Physical address register */ 97b955f6caSJeff Kirsher 98b955f6caSJeff Kirsher #define IFS1 0x18C /* Inter-frame spacing Part1 register */ 99b955f6caSJeff Kirsher #define IFS 0x18D /* Inter-frame spacing register */ 100b955f6caSJeff Kirsher #define IPG 0x18E /* Inter-frame gap register */ 101b955f6caSJeff Kirsher /* 64bit register */ 102b955f6caSJeff Kirsher 103b955f6caSJeff Kirsher #define LADRF 0x168 /* Logical address filter register */ 104b955f6caSJeff Kirsher 105b955f6caSJeff Kirsher 106b955f6caSJeff Kirsher /* Register Bit Definitions */ 107b955f6caSJeff Kirsher typedef enum { 108b955f6caSJeff Kirsher 109b955f6caSJeff Kirsher ASF_INIT_DONE = (1 << 1), 110b955f6caSJeff Kirsher ASF_INIT_PRESENT = (1 << 0), 111b955f6caSJeff Kirsher 112b955f6caSJeff Kirsher }STAT_ASF_BITS; 113b955f6caSJeff Kirsher 114b955f6caSJeff Kirsher typedef enum { 115b955f6caSJeff Kirsher 116b955f6caSJeff Kirsher MIB_CMD_ACTIVE = (1 << 15 ), 117b955f6caSJeff Kirsher MIB_RD_CMD = (1 << 13 ), 118b955f6caSJeff Kirsher MIB_CLEAR = (1 << 12 ), 119b955f6caSJeff Kirsher MIB_ADDRESS = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)| 120b955f6caSJeff Kirsher (1 << 4) | (1 << 5), 121b955f6caSJeff Kirsher }MIB_ADDR_BITS; 122b955f6caSJeff Kirsher 123b955f6caSJeff Kirsher 124b955f6caSJeff Kirsher typedef enum { 125b955f6caSJeff Kirsher 126b955f6caSJeff Kirsher PMAT_DET = (1 << 12), 127b955f6caSJeff Kirsher MP_DET = (1 << 11), 128b955f6caSJeff Kirsher LC_DET = (1 << 10), 129b955f6caSJeff Kirsher SPEED_MASK = (1 << 9)|(1 << 8)|(1 << 7), 130b955f6caSJeff Kirsher FULL_DPLX = (1 << 6), 131b955f6caSJeff Kirsher LINK_STATS = (1 << 5), 132b955f6caSJeff Kirsher AUTONEG_COMPLETE = (1 << 4), 133b955f6caSJeff Kirsher MIIPD = (1 << 3), 134b955f6caSJeff Kirsher RX_SUSPENDED = (1 << 2), 135b955f6caSJeff Kirsher TX_SUSPENDED = (1 << 1), 136b955f6caSJeff Kirsher RUNNING = (1 << 0), 137b955f6caSJeff Kirsher 138b955f6caSJeff Kirsher }STAT0_BITS; 139b955f6caSJeff Kirsher 140b955f6caSJeff Kirsher #define PHY_SPEED_10 0x2 141b955f6caSJeff Kirsher #define PHY_SPEED_100 0x3 142b955f6caSJeff Kirsher 143b955f6caSJeff Kirsher /* INT0 0x38, 32bit register */ 144b955f6caSJeff Kirsher typedef enum { 145b955f6caSJeff Kirsher 146b955f6caSJeff Kirsher INTR = (1 << 31), 147b955f6caSJeff Kirsher PCSINT = (1 << 28), 148b955f6caSJeff Kirsher LCINT = (1 << 27), 149b955f6caSJeff Kirsher APINT5 = (1 << 26), 150b955f6caSJeff Kirsher APINT4 = (1 << 25), 151b955f6caSJeff Kirsher APINT3 = (1 << 24), 152b955f6caSJeff Kirsher TINT_SUM = (1 << 23), 153b955f6caSJeff Kirsher APINT2 = (1 << 22), 154b955f6caSJeff Kirsher APINT1 = (1 << 21), 155b955f6caSJeff Kirsher APINT0 = (1 << 20), 156b955f6caSJeff Kirsher MIIPDTINT = (1 << 19), 157b955f6caSJeff Kirsher MCCINT = (1 << 17), 158b955f6caSJeff Kirsher MREINT = (1 << 16), 159b955f6caSJeff Kirsher RINT_SUM = (1 << 15), 160b955f6caSJeff Kirsher SPNDINT = (1 << 14), 161b955f6caSJeff Kirsher MPINT = (1 << 13), 162b955f6caSJeff Kirsher SINT = (1 << 12), 163b955f6caSJeff Kirsher TINT3 = (1 << 11), 164b955f6caSJeff Kirsher TINT2 = (1 << 10), 165b955f6caSJeff Kirsher TINT1 = (1 << 9), 166b955f6caSJeff Kirsher TINT0 = (1 << 8), 167b955f6caSJeff Kirsher UINT = (1 << 7), 168b955f6caSJeff Kirsher STINT = (1 << 4), 169b955f6caSJeff Kirsher RINT0 = (1 << 0), 170b955f6caSJeff Kirsher 171b955f6caSJeff Kirsher }INT0_BITS; 172b955f6caSJeff Kirsher 173b955f6caSJeff Kirsher typedef enum { 174b955f6caSJeff Kirsher 175b955f6caSJeff Kirsher VAL3 = (1 << 31), /* VAL bit for byte 3 */ 176b955f6caSJeff Kirsher VAL2 = (1 << 23), /* VAL bit for byte 2 */ 177b955f6caSJeff Kirsher VAL1 = (1 << 15), /* VAL bit for byte 1 */ 178b955f6caSJeff Kirsher VAL0 = (1 << 7), /* VAL bit for byte 0 */ 179b955f6caSJeff Kirsher 180b955f6caSJeff Kirsher }VAL_BITS; 181b955f6caSJeff Kirsher 182b955f6caSJeff Kirsher typedef enum { 183b955f6caSJeff Kirsher 184b955f6caSJeff Kirsher /* VAL3 */ 185b955f6caSJeff Kirsher LCINTEN = (1 << 27), 186b955f6caSJeff Kirsher APINT5EN = (1 << 26), 187b955f6caSJeff Kirsher APINT4EN = (1 << 25), 188b955f6caSJeff Kirsher APINT3EN = (1 << 24), 189b955f6caSJeff Kirsher /* VAL2 */ 190b955f6caSJeff Kirsher APINT2EN = (1 << 22), 191b955f6caSJeff Kirsher APINT1EN = (1 << 21), 192b955f6caSJeff Kirsher APINT0EN = (1 << 20), 193b955f6caSJeff Kirsher MIIPDTINTEN = (1 << 19), 194b955f6caSJeff Kirsher MCCIINTEN = (1 << 18), 195b955f6caSJeff Kirsher MCCINTEN = (1 << 17), 196b955f6caSJeff Kirsher MREINTEN = (1 << 16), 197b955f6caSJeff Kirsher /* VAL1 */ 198b955f6caSJeff Kirsher SPNDINTEN = (1 << 14), 199b955f6caSJeff Kirsher MPINTEN = (1 << 13), 200b955f6caSJeff Kirsher TINTEN3 = (1 << 11), 201b955f6caSJeff Kirsher SINTEN = (1 << 12), 202b955f6caSJeff Kirsher TINTEN2 = (1 << 10), 203b955f6caSJeff Kirsher TINTEN1 = (1 << 9), 204b955f6caSJeff Kirsher TINTEN0 = (1 << 8), 205b955f6caSJeff Kirsher /* VAL0 */ 206b955f6caSJeff Kirsher STINTEN = (1 << 4), 207b955f6caSJeff Kirsher RINTEN0 = (1 << 0), 208b955f6caSJeff Kirsher 209b955f6caSJeff Kirsher INTEN0_CLEAR = 0x1F7F7F1F, /* Command style register */ 210b955f6caSJeff Kirsher 211b955f6caSJeff Kirsher }INTEN0_BITS; 212b955f6caSJeff Kirsher 213b955f6caSJeff Kirsher typedef enum { 214b955f6caSJeff Kirsher /* VAL2 */ 215b955f6caSJeff Kirsher RDMD0 = (1 << 16), 216b955f6caSJeff Kirsher /* VAL1 */ 217b955f6caSJeff Kirsher TDMD3 = (1 << 11), 218b955f6caSJeff Kirsher TDMD2 = (1 << 10), 219b955f6caSJeff Kirsher TDMD1 = (1 << 9), 220b955f6caSJeff Kirsher TDMD0 = (1 << 8), 221b955f6caSJeff Kirsher /* VAL0 */ 222b955f6caSJeff Kirsher UINTCMD = (1 << 6), 223b955f6caSJeff Kirsher RX_FAST_SPND = (1 << 5), 224b955f6caSJeff Kirsher TX_FAST_SPND = (1 << 4), 225b955f6caSJeff Kirsher RX_SPND = (1 << 3), 226b955f6caSJeff Kirsher TX_SPND = (1 << 2), 227b955f6caSJeff Kirsher INTREN = (1 << 1), 228b955f6caSJeff Kirsher RUN = (1 << 0), 229b955f6caSJeff Kirsher 230b955f6caSJeff Kirsher CMD0_CLEAR = 0x000F0F7F, /* Command style register */ 231b955f6caSJeff Kirsher 232b955f6caSJeff Kirsher }CMD0_BITS; 233b955f6caSJeff Kirsher 234b955f6caSJeff Kirsher typedef enum { 235b955f6caSJeff Kirsher 236b955f6caSJeff Kirsher /* VAL3 */ 237b955f6caSJeff Kirsher CONDUIT_MODE = (1 << 29), 238b955f6caSJeff Kirsher /* VAL2 */ 239b955f6caSJeff Kirsher RPA = (1 << 19), 240b955f6caSJeff Kirsher DRCVPA = (1 << 18), 241b955f6caSJeff Kirsher DRCVBC = (1 << 17), 242b955f6caSJeff Kirsher PROM = (1 << 16), 243b955f6caSJeff Kirsher /* VAL1 */ 244b955f6caSJeff Kirsher ASTRP_RCV = (1 << 13), 245b955f6caSJeff Kirsher RCV_DROP0 = (1 << 12), 246b955f6caSJeff Kirsher EMBA = (1 << 11), 247b955f6caSJeff Kirsher DXMT2PD = (1 << 10), 248b955f6caSJeff Kirsher LTINTEN = (1 << 9), 249b955f6caSJeff Kirsher DXMTFCS = (1 << 8), 250b955f6caSJeff Kirsher /* VAL0 */ 251b955f6caSJeff Kirsher APAD_XMT = (1 << 6), 252b955f6caSJeff Kirsher DRTY = (1 << 5), 253b955f6caSJeff Kirsher INLOOP = (1 << 4), 254b955f6caSJeff Kirsher EXLOOP = (1 << 3), 255b955f6caSJeff Kirsher REX_RTRY = (1 << 2), 256b955f6caSJeff Kirsher REX_UFLO = (1 << 1), 257b955f6caSJeff Kirsher REX_LCOL = (1 << 0), 258b955f6caSJeff Kirsher 259b955f6caSJeff Kirsher CMD2_CLEAR = 0x3F7F3F7F, /* Command style register */ 260b955f6caSJeff Kirsher 261b955f6caSJeff Kirsher }CMD2_BITS; 262b955f6caSJeff Kirsher 263b955f6caSJeff Kirsher typedef enum { 264b955f6caSJeff Kirsher 265b955f6caSJeff Kirsher /* VAL3 */ 266b955f6caSJeff Kirsher ASF_INIT_DONE_ALIAS = (1 << 29), 267b955f6caSJeff Kirsher /* VAL2 */ 268b955f6caSJeff Kirsher JUMBO = (1 << 21), 269b955f6caSJeff Kirsher VSIZE = (1 << 20), 270b955f6caSJeff Kirsher VLONLY = (1 << 19), 271b955f6caSJeff Kirsher VL_TAG_DEL = (1 << 18), 272b955f6caSJeff Kirsher /* VAL1 */ 273b955f6caSJeff Kirsher EN_PMGR = (1 << 14), 274b955f6caSJeff Kirsher INTLEVEL = (1 << 13), 275b955f6caSJeff Kirsher FORCE_FULL_DUPLEX = (1 << 12), 276b955f6caSJeff Kirsher FORCE_LINK_STATUS = (1 << 11), 277b955f6caSJeff Kirsher APEP = (1 << 10), 278b955f6caSJeff Kirsher MPPLBA = (1 << 9), 279b955f6caSJeff Kirsher /* VAL0 */ 280b955f6caSJeff Kirsher RESET_PHY_PULSE = (1 << 2), 281b955f6caSJeff Kirsher RESET_PHY = (1 << 1), 282b955f6caSJeff Kirsher PHY_RST_POL = (1 << 0), 283b955f6caSJeff Kirsher 284b955f6caSJeff Kirsher }CMD3_BITS; 285b955f6caSJeff Kirsher 286b955f6caSJeff Kirsher 287b955f6caSJeff Kirsher typedef enum { 288b955f6caSJeff Kirsher 289b955f6caSJeff Kirsher /* VAL0 */ 290b955f6caSJeff Kirsher PMAT_SAVE_MATCH = (1 << 4), 291b955f6caSJeff Kirsher PMAT_MODE = (1 << 3), 292b955f6caSJeff Kirsher MPEN_SW = (1 << 1), 293b955f6caSJeff Kirsher LCMODE_SW = (1 << 0), 294b955f6caSJeff Kirsher 295b955f6caSJeff Kirsher CMD7_CLEAR = 0x0000001B /* Command style register */ 296b955f6caSJeff Kirsher 297b955f6caSJeff Kirsher }CMD7_BITS; 298b955f6caSJeff Kirsher 299b955f6caSJeff Kirsher 300b955f6caSJeff Kirsher typedef enum { 301b955f6caSJeff Kirsher 302b955f6caSJeff Kirsher RESET_PHY_WIDTH = (0xF << 16) | (0xF<< 20), /* 0x00FF0000 */ 303b955f6caSJeff Kirsher XMTSP_MASK = (1 << 9) | (1 << 8), /* 9:8 */ 304b955f6caSJeff Kirsher XMTSP_128 = (1 << 9), /* 9 */ 305b955f6caSJeff Kirsher XMTSP_64 = (1 << 8), 306b955f6caSJeff Kirsher CACHE_ALIGN = (1 << 4), 307b955f6caSJeff Kirsher BURST_LIMIT_MASK = (0xF << 0 ), 308b955f6caSJeff Kirsher CTRL1_DEFAULT = 0x00010111, 309b955f6caSJeff Kirsher 310b955f6caSJeff Kirsher }CTRL1_BITS; 311b955f6caSJeff Kirsher 312b955f6caSJeff Kirsher typedef enum { 313b955f6caSJeff Kirsher 314b955f6caSJeff Kirsher FMDC_MASK = (1 << 9)|(1 << 8), /* 9:8 */ 315b955f6caSJeff Kirsher XPHYRST = (1 << 7), 316b955f6caSJeff Kirsher XPHYANE = (1 << 6), 317b955f6caSJeff Kirsher XPHYFD = (1 << 5), 318b955f6caSJeff Kirsher XPHYSP = (1 << 4) | (1 << 3), /* 4:3 */ 319b955f6caSJeff Kirsher APDW_MASK = (1 << 2) | (1 << 1) | (1 << 0), /* 2:0 */ 320b955f6caSJeff Kirsher 321b955f6caSJeff Kirsher }CTRL2_BITS; 322b955f6caSJeff Kirsher 323b955f6caSJeff Kirsher /* XMT_RING_LIMIT 0x7C, 32bit register */ 324b955f6caSJeff Kirsher typedef enum { 325b955f6caSJeff Kirsher 326b955f6caSJeff Kirsher XMT_RING2_LIMIT = (0xFF << 16), /* 23:16 */ 327b955f6caSJeff Kirsher XMT_RING1_LIMIT = (0xFF << 8), /* 15:8 */ 328b955f6caSJeff Kirsher XMT_RING0_LIMIT = (0xFF << 0), /* 7:0 */ 329b955f6caSJeff Kirsher 330b955f6caSJeff Kirsher }XMT_RING_LIMIT_BITS; 331b955f6caSJeff Kirsher 332b955f6caSJeff Kirsher typedef enum { 333b955f6caSJeff Kirsher 334b955f6caSJeff Kirsher AP_REG0_EN = (1 << 15), 335b955f6caSJeff Kirsher AP_REG0_ADDR_MASK = (0xF << 8) |(1 << 12),/* 12:8 */ 336b955f6caSJeff Kirsher AP_PHY0_ADDR_MASK = (0xF << 0) |(1 << 4),/* 4:0 */ 337b955f6caSJeff Kirsher 338b955f6caSJeff Kirsher }AUTOPOLL0_BITS; 339b955f6caSJeff Kirsher 340b955f6caSJeff Kirsher /* AUTOPOLL1 0x8A, 16bit register */ 341b955f6caSJeff Kirsher typedef enum { 342b955f6caSJeff Kirsher 343b955f6caSJeff Kirsher AP_REG1_EN = (1 << 15), 344b955f6caSJeff Kirsher AP_REG1_ADDR_MASK = (0xF << 8) |(1 << 12),/* 12:8 */ 345b955f6caSJeff Kirsher AP_PRE_SUP1 = (1 << 6), 346b955f6caSJeff Kirsher AP_PHY1_DFLT = (1 << 5), 347b955f6caSJeff Kirsher AP_PHY1_ADDR_MASK = (0xF << 0) |(1 << 4),/* 4:0 */ 348b955f6caSJeff Kirsher 349b955f6caSJeff Kirsher }AUTOPOLL1_BITS; 350b955f6caSJeff Kirsher 351b955f6caSJeff Kirsher 352b955f6caSJeff Kirsher typedef enum { 353b955f6caSJeff Kirsher 354b955f6caSJeff Kirsher AP_REG2_EN = (1 << 15), 355b955f6caSJeff Kirsher AP_REG2_ADDR_MASK = (0xF << 8) |(1 << 12),/* 12:8 */ 356b955f6caSJeff Kirsher AP_PRE_SUP2 = (1 << 6), 357b955f6caSJeff Kirsher AP_PHY2_DFLT = (1 << 5), 358b955f6caSJeff Kirsher AP_PHY2_ADDR_MASK = (0xF << 0) |(1 << 4),/* 4:0 */ 359b955f6caSJeff Kirsher 360b955f6caSJeff Kirsher }AUTOPOLL2_BITS; 361b955f6caSJeff Kirsher 362b955f6caSJeff Kirsher typedef enum { 363b955f6caSJeff Kirsher 364b955f6caSJeff Kirsher AP_REG3_EN = (1 << 15), 365b955f6caSJeff Kirsher AP_REG3_ADDR_MASK = (0xF << 8) |(1 << 12),/* 12:8 */ 366b955f6caSJeff Kirsher AP_PRE_SUP3 = (1 << 6), 367b955f6caSJeff Kirsher AP_PHY3_DFLT = (1 << 5), 368b955f6caSJeff Kirsher AP_PHY3_ADDR_MASK = (0xF << 0) |(1 << 4),/* 4:0 */ 369b955f6caSJeff Kirsher 370b955f6caSJeff Kirsher }AUTOPOLL3_BITS; 371b955f6caSJeff Kirsher 372b955f6caSJeff Kirsher 373b955f6caSJeff Kirsher typedef enum { 374b955f6caSJeff Kirsher 375b955f6caSJeff Kirsher AP_REG4_EN = (1 << 15), 376b955f6caSJeff Kirsher AP_REG4_ADDR_MASK = (0xF << 8) |(1 << 12),/* 12:8 */ 377b955f6caSJeff Kirsher AP_PRE_SUP4 = (1 << 6), 378b955f6caSJeff Kirsher AP_PHY4_DFLT = (1 << 5), 379b955f6caSJeff Kirsher AP_PHY4_ADDR_MASK = (0xF << 0) |(1 << 4),/* 4:0 */ 380b955f6caSJeff Kirsher 381b955f6caSJeff Kirsher }AUTOPOLL4_BITS; 382b955f6caSJeff Kirsher 383b955f6caSJeff Kirsher 384b955f6caSJeff Kirsher typedef enum { 385b955f6caSJeff Kirsher 386b955f6caSJeff Kirsher AP_REG5_EN = (1 << 15), 387b955f6caSJeff Kirsher AP_REG5_ADDR_MASK = (0xF << 8) |(1 << 12),/* 12:8 */ 388b955f6caSJeff Kirsher AP_PRE_SUP5 = (1 << 6), 389b955f6caSJeff Kirsher AP_PHY5_DFLT = (1 << 5), 390b955f6caSJeff Kirsher AP_PHY5_ADDR_MASK = (0xF << 0) |(1 << 4),/* 4:0 */ 391b955f6caSJeff Kirsher 392b955f6caSJeff Kirsher }AUTOPOLL5_BITS; 393b955f6caSJeff Kirsher 394b955f6caSJeff Kirsher 395b955f6caSJeff Kirsher 396b955f6caSJeff Kirsher 397b955f6caSJeff Kirsher /* AP_VALUE 0x98, 32bit ragister */ 398b955f6caSJeff Kirsher typedef enum { 399b955f6caSJeff Kirsher 400b955f6caSJeff Kirsher AP_VAL_ACTIVE = (1 << 31), 401b955f6caSJeff Kirsher AP_VAL_RD_CMD = ( 1 << 29), 402b955f6caSJeff Kirsher AP_ADDR = (1 << 18)|(1 << 17)|(1 << 16), /* 18:16 */ 403b955f6caSJeff Kirsher AP_VAL = (0xF << 0) | (0xF << 4) |( 0xF << 8) | 404b955f6caSJeff Kirsher (0xF << 12), /* 15:0 */ 405b955f6caSJeff Kirsher 406b955f6caSJeff Kirsher }AP_VALUE_BITS; 407b955f6caSJeff Kirsher 408b955f6caSJeff Kirsher typedef enum { 409b955f6caSJeff Kirsher 410b955f6caSJeff Kirsher DLY_INT_A_R3 = (1 << 31), 411b955f6caSJeff Kirsher DLY_INT_A_R2 = (1 << 30), 412b955f6caSJeff Kirsher DLY_INT_A_R1 = (1 << 29), 413b955f6caSJeff Kirsher DLY_INT_A_R0 = (1 << 28), 414b955f6caSJeff Kirsher DLY_INT_A_T3 = (1 << 27), 415b955f6caSJeff Kirsher DLY_INT_A_T2 = (1 << 26), 416b955f6caSJeff Kirsher DLY_INT_A_T1 = (1 << 25), 417b955f6caSJeff Kirsher DLY_INT_A_T0 = ( 1 << 24), 418b955f6caSJeff Kirsher EVENT_COUNT_A = (0xF << 16) | (0x1 << 20),/* 20:16 */ 419b955f6caSJeff Kirsher MAX_DELAY_TIME_A = (0xF << 0) | (0xF << 4) | (1 << 8)| 420b955f6caSJeff Kirsher (1 << 9) | (1 << 10), /* 10:0 */ 421b955f6caSJeff Kirsher 422b955f6caSJeff Kirsher }DLY_INT_A_BITS; 423b955f6caSJeff Kirsher 424b955f6caSJeff Kirsher typedef enum { 425b955f6caSJeff Kirsher 426b955f6caSJeff Kirsher DLY_INT_B_R3 = (1 << 31), 427b955f6caSJeff Kirsher DLY_INT_B_R2 = (1 << 30), 428b955f6caSJeff Kirsher DLY_INT_B_R1 = (1 << 29), 429b955f6caSJeff Kirsher DLY_INT_B_R0 = (1 << 28), 430b955f6caSJeff Kirsher DLY_INT_B_T3 = (1 << 27), 431b955f6caSJeff Kirsher DLY_INT_B_T2 = (1 << 26), 432b955f6caSJeff Kirsher DLY_INT_B_T1 = (1 << 25), 433b955f6caSJeff Kirsher DLY_INT_B_T0 = ( 1 << 24), 434b955f6caSJeff Kirsher EVENT_COUNT_B = (0xF << 16) | (0x1 << 20),/* 20:16 */ 435b955f6caSJeff Kirsher MAX_DELAY_TIME_B = (0xF << 0) | (0xF << 4) | (1 << 8)| 436b955f6caSJeff Kirsher (1 << 9) | (1 << 10), /* 10:0 */ 437b955f6caSJeff Kirsher }DLY_INT_B_BITS; 438b955f6caSJeff Kirsher 439b955f6caSJeff Kirsher 440b955f6caSJeff Kirsher /* FLOW_CONTROL 0xC8, 32bit register */ 441b955f6caSJeff Kirsher typedef enum { 442b955f6caSJeff Kirsher 443b955f6caSJeff Kirsher PAUSE_LEN_CHG = (1 << 30), 444b955f6caSJeff Kirsher FTPE = (1 << 22), 445b955f6caSJeff Kirsher FRPE = (1 << 21), 446b955f6caSJeff Kirsher NAPA = (1 << 20), 447b955f6caSJeff Kirsher NPA = (1 << 19), 448b955f6caSJeff Kirsher FIXP = ( 1 << 18), 449b955f6caSJeff Kirsher FCCMD = ( 1 << 16), 450b955f6caSJeff Kirsher PAUSE_LEN = (0xF << 0) | (0xF << 4) |( 0xF << 8) | (0xF << 12), /* 15:0 */ 451b955f6caSJeff Kirsher 452b955f6caSJeff Kirsher }FLOW_CONTROL_BITS; 453b955f6caSJeff Kirsher 454b955f6caSJeff Kirsher /* PHY_ ACCESS 0xD0, 32bit register */ 455b955f6caSJeff Kirsher typedef enum { 456b955f6caSJeff Kirsher 457b955f6caSJeff Kirsher PHY_CMD_ACTIVE = (1 << 31), 458b955f6caSJeff Kirsher PHY_WR_CMD = (1 << 30), 459b955f6caSJeff Kirsher PHY_RD_CMD = (1 << 29), 460b955f6caSJeff Kirsher PHY_RD_ERR = (1 << 28), 461b955f6caSJeff Kirsher PHY_PRE_SUP = (1 << 27), 462b955f6caSJeff Kirsher PHY_ADDR = (1 << 21) | (1 << 22) | (1 << 23)| 463b955f6caSJeff Kirsher (1 << 24) |(1 << 25),/* 25:21 */ 464b955f6caSJeff Kirsher PHY_REG_ADDR = (1 << 16) | (1 << 17) | (1 << 18)| (1 << 19) | (1 << 20),/* 20:16 */ 465b955f6caSJeff Kirsher PHY_DATA = (0xF << 0)|(0xF << 4) |(0xF << 8)| 466b955f6caSJeff Kirsher (0xF << 12),/* 15:0 */ 467b955f6caSJeff Kirsher 468b955f6caSJeff Kirsher }PHY_ACCESS_BITS; 469b955f6caSJeff Kirsher 470b955f6caSJeff Kirsher 471b955f6caSJeff Kirsher /* PMAT0 0x190, 32bit register */ 472b955f6caSJeff Kirsher typedef enum { 473b955f6caSJeff Kirsher PMR_ACTIVE = (1 << 31), 474b955f6caSJeff Kirsher PMR_WR_CMD = (1 << 30), 475b955f6caSJeff Kirsher PMR_RD_CMD = (1 << 29), 476b955f6caSJeff Kirsher PMR_BANK = (1 <<28), 477b955f6caSJeff Kirsher PMR_ADDR = (0xF << 16)|(1 << 20)|(1 << 21)| 478b955f6caSJeff Kirsher (1 << 22),/* 22:16 */ 479b955f6caSJeff Kirsher PMR_B4 = (0xF << 0) | (0xF << 4),/* 15:0 */ 480b955f6caSJeff Kirsher }PMAT0_BITS; 481b955f6caSJeff Kirsher 482b955f6caSJeff Kirsher 483b955f6caSJeff Kirsher /* PMAT1 0x194, 32bit register */ 484b955f6caSJeff Kirsher typedef enum { 485b955f6caSJeff Kirsher PMR_B3 = (0xF << 24) | (0xF <<28),/* 31:24 */ 486b955f6caSJeff Kirsher PMR_B2 = (0xF << 16) |(0xF << 20),/* 23:16 */ 487b955f6caSJeff Kirsher PMR_B1 = (0xF << 8) | (0xF <<12), /* 15:8 */ 488b955f6caSJeff Kirsher PMR_B0 = (0xF << 0)|(0xF << 4),/* 7:0 */ 489b955f6caSJeff Kirsher }PMAT1_BITS; 490b955f6caSJeff Kirsher 491b955f6caSJeff Kirsher /************************************************************************/ 492b955f6caSJeff Kirsher /* */ 493b955f6caSJeff Kirsher /* MIB counter definitions */ 494b955f6caSJeff Kirsher /* */ 495b955f6caSJeff Kirsher /************************************************************************/ 496b955f6caSJeff Kirsher 497b955f6caSJeff Kirsher #define rcv_miss_pkts 0x00 498b955f6caSJeff Kirsher #define rcv_octets 0x01 499b955f6caSJeff Kirsher #define rcv_broadcast_pkts 0x02 500b955f6caSJeff Kirsher #define rcv_multicast_pkts 0x03 501b955f6caSJeff Kirsher #define rcv_undersize_pkts 0x04 502b955f6caSJeff Kirsher #define rcv_oversize_pkts 0x05 503b955f6caSJeff Kirsher #define rcv_fragments 0x06 504b955f6caSJeff Kirsher #define rcv_jabbers 0x07 505b955f6caSJeff Kirsher #define rcv_unicast_pkts 0x08 506b955f6caSJeff Kirsher #define rcv_alignment_errors 0x09 507b955f6caSJeff Kirsher #define rcv_fcs_errors 0x0A 508b955f6caSJeff Kirsher #define rcv_good_octets 0x0B 509b955f6caSJeff Kirsher #define rcv_mac_ctrl 0x0C 510b955f6caSJeff Kirsher #define rcv_flow_ctrl 0x0D 511b955f6caSJeff Kirsher #define rcv_pkts_64_octets 0x0E 512b955f6caSJeff Kirsher #define rcv_pkts_65to127_octets 0x0F 513b955f6caSJeff Kirsher #define rcv_pkts_128to255_octets 0x10 514b955f6caSJeff Kirsher #define rcv_pkts_256to511_octets 0x11 515b955f6caSJeff Kirsher #define rcv_pkts_512to1023_octets 0x12 516b955f6caSJeff Kirsher #define rcv_pkts_1024to1518_octets 0x13 517b955f6caSJeff Kirsher #define rcv_unsupported_opcode 0x14 518b955f6caSJeff Kirsher #define rcv_symbol_errors 0x15 519b955f6caSJeff Kirsher #define rcv_drop_pkts_ring1 0x16 520b955f6caSJeff Kirsher #define rcv_drop_pkts_ring2 0x17 521b955f6caSJeff Kirsher #define rcv_drop_pkts_ring3 0x18 522b955f6caSJeff Kirsher #define rcv_drop_pkts_ring4 0x19 523b955f6caSJeff Kirsher #define rcv_jumbo_pkts 0x1A 524b955f6caSJeff Kirsher 525b955f6caSJeff Kirsher #define xmt_underrun_pkts 0x20 526b955f6caSJeff Kirsher #define xmt_octets 0x21 527b955f6caSJeff Kirsher #define xmt_packets 0x22 528b955f6caSJeff Kirsher #define xmt_broadcast_pkts 0x23 529b955f6caSJeff Kirsher #define xmt_multicast_pkts 0x24 530b955f6caSJeff Kirsher #define xmt_collisions 0x25 531b955f6caSJeff Kirsher #define xmt_unicast_pkts 0x26 532b955f6caSJeff Kirsher #define xmt_one_collision 0x27 533b955f6caSJeff Kirsher #define xmt_multiple_collision 0x28 534b955f6caSJeff Kirsher #define xmt_deferred_transmit 0x29 535b955f6caSJeff Kirsher #define xmt_late_collision 0x2A 536b955f6caSJeff Kirsher #define xmt_excessive_defer 0x2B 537b955f6caSJeff Kirsher #define xmt_loss_carrier 0x2C 538b955f6caSJeff Kirsher #define xmt_excessive_collision 0x2D 539b955f6caSJeff Kirsher #define xmt_back_pressure 0x2E 540b955f6caSJeff Kirsher #define xmt_flow_ctrl 0x2F 541b955f6caSJeff Kirsher #define xmt_pkts_64_octets 0x30 542b955f6caSJeff Kirsher #define xmt_pkts_65to127_octets 0x31 543b955f6caSJeff Kirsher #define xmt_pkts_128to255_octets 0x32 544b955f6caSJeff Kirsher #define xmt_pkts_256to511_octets 0x33 545b955f6caSJeff Kirsher #define xmt_pkts_512to1023_octets 0x34 546b955f6caSJeff Kirsher #define xmt_pkts_1024to1518_octet 0x35 547b955f6caSJeff Kirsher #define xmt_oversize_pkts 0x36 548b955f6caSJeff Kirsher #define xmt_jumbo_pkts 0x37 549b955f6caSJeff Kirsher 550b955f6caSJeff Kirsher 551b955f6caSJeff Kirsher /* Driver definitions */ 552b955f6caSJeff Kirsher 553b955f6caSJeff Kirsher #define PCI_VENDOR_ID_AMD 0x1022 554b955f6caSJeff Kirsher #define PCI_DEVICE_ID_AMD8111E_7462 0x7462 555b955f6caSJeff Kirsher 556b955f6caSJeff Kirsher #define MAX_UNITS 8 /* Maximum number of devices possible */ 557b955f6caSJeff Kirsher 558b955f6caSJeff Kirsher #define NUM_TX_BUFFERS 32 /* Number of transmit buffers */ 559b955f6caSJeff Kirsher #define NUM_RX_BUFFERS 32 /* Number of receive buffers */ 560b955f6caSJeff Kirsher 561b955f6caSJeff Kirsher #define TX_BUFF_MOD_MASK 31 /* (NUM_TX_BUFFERS -1) */ 562b955f6caSJeff Kirsher #define RX_BUFF_MOD_MASK 31 /* (NUM_RX_BUFFERS -1) */ 563b955f6caSJeff Kirsher 564b955f6caSJeff Kirsher #define NUM_TX_RING_DR 32 565b955f6caSJeff Kirsher #define NUM_RX_RING_DR 32 566b955f6caSJeff Kirsher 567b955f6caSJeff Kirsher #define TX_RING_DR_MOD_MASK 31 /* (NUM_TX_RING_DR -1) */ 568b955f6caSJeff Kirsher #define RX_RING_DR_MOD_MASK 31 /* (NUM_RX_RING_DR -1) */ 569b955f6caSJeff Kirsher 570b955f6caSJeff Kirsher #define MAX_FILTER_SIZE 64 /* Maximum multicast address */ 571b955f6caSJeff Kirsher #define AMD8111E_MIN_MTU 60 572b955f6caSJeff Kirsher #define AMD8111E_MAX_MTU 9000 573b955f6caSJeff Kirsher 574b955f6caSJeff Kirsher #define PKT_BUFF_SZ 1536 575b955f6caSJeff Kirsher #define MIN_PKT_LEN 60 576b955f6caSJeff Kirsher 577b955f6caSJeff Kirsher #define AMD8111E_TX_TIMEOUT (3 * HZ)/* 3 sec */ 578b955f6caSJeff Kirsher #define SOFT_TIMER_FREQ 0xBEBC /* 0.5 sec */ 579b955f6caSJeff Kirsher #define DELAY_TIMER_CONV 50 /* msec to 10 usec conversion. 580b955f6caSJeff Kirsher Only 500 usec resolution */ 581b955f6caSJeff Kirsher #define OPTION_VLAN_ENABLE 0x0001 582b955f6caSJeff Kirsher #define OPTION_JUMBO_ENABLE 0x0002 583b955f6caSJeff Kirsher #define OPTION_MULTICAST_ENABLE 0x0004 584b955f6caSJeff Kirsher #define OPTION_WOL_ENABLE 0x0008 585b955f6caSJeff Kirsher #define OPTION_WAKE_MAGIC_ENABLE 0x0010 586b955f6caSJeff Kirsher #define OPTION_WAKE_PHY_ENABLE 0x0020 587b955f6caSJeff Kirsher #define OPTION_INTR_COAL_ENABLE 0x0040 588b955f6caSJeff Kirsher #define OPTION_DYN_IPG_ENABLE 0x0080 589b955f6caSJeff Kirsher 590b955f6caSJeff Kirsher #define PHY_REG_ADDR_MASK 0x1f 591b955f6caSJeff Kirsher 592b955f6caSJeff Kirsher /* ipg parameters */ 593b955f6caSJeff Kirsher #define DEFAULT_IPG 0x60 594b955f6caSJeff Kirsher #define IFS1_DELTA 36 595b955f6caSJeff Kirsher #define IPG_CONVERGE_JIFFIES (HZ/2) 596b955f6caSJeff Kirsher #define IPG_STABLE_TIME 5 597b955f6caSJeff Kirsher #define MIN_IPG 96 598b955f6caSJeff Kirsher #define MAX_IPG 255 599b955f6caSJeff Kirsher #define IPG_STEP 16 600b955f6caSJeff Kirsher #define CSTATE 1 601b955f6caSJeff Kirsher #define SSTATE 2 602b955f6caSJeff Kirsher 603*7c13f442SGuofeng Yue /* Assume controller gets data 10 times the maximum processing time */ 604b955f6caSJeff Kirsher #define REPEAT_CNT 10 605b955f6caSJeff Kirsher 606dbedd44eSJoe Perches /* amd8111e descriptor flag definitions */ 607b955f6caSJeff Kirsher typedef enum { 608b955f6caSJeff Kirsher 609b955f6caSJeff Kirsher OWN_BIT = (1 << 15), 610b955f6caSJeff Kirsher ADD_FCS_BIT = (1 << 13), 611b955f6caSJeff Kirsher LTINT_BIT = (1 << 12), 612b955f6caSJeff Kirsher STP_BIT = (1 << 9), 613b955f6caSJeff Kirsher ENP_BIT = (1 << 8), 614b955f6caSJeff Kirsher KILL_BIT = (1 << 6), 615b955f6caSJeff Kirsher TCC_VLAN_INSERT = (1 << 1), 616b955f6caSJeff Kirsher TCC_VLAN_REPLACE = (1 << 1) |( 1<< 0), 617b955f6caSJeff Kirsher 618b955f6caSJeff Kirsher }TX_FLAG_BITS; 619b955f6caSJeff Kirsher 620b955f6caSJeff Kirsher typedef enum { 621b955f6caSJeff Kirsher ERR_BIT = (1 << 14), 622b955f6caSJeff Kirsher FRAM_BIT = (1 << 13), 623b955f6caSJeff Kirsher OFLO_BIT = (1 << 12), 624b955f6caSJeff Kirsher CRC_BIT = (1 << 11), 625b955f6caSJeff Kirsher PAM_BIT = (1 << 6), 626b955f6caSJeff Kirsher LAFM_BIT = (1 << 5), 627b955f6caSJeff Kirsher BAM_BIT = (1 << 4), 628b955f6caSJeff Kirsher TT_VLAN_TAGGED = (1 << 3) |(1 << 2),/* 0x000 */ 629b955f6caSJeff Kirsher TT_PRTY_TAGGED = (1 << 3),/* 0x0008 */ 630b955f6caSJeff Kirsher 631b955f6caSJeff Kirsher }RX_FLAG_BITS; 632b955f6caSJeff Kirsher 633b955f6caSJeff Kirsher #define RESET_RX_FLAGS 0x0000 634b955f6caSJeff Kirsher #define TT_MASK 0x000c 635b955f6caSJeff Kirsher #define TCC_MASK 0x0003 636b955f6caSJeff Kirsher 637b955f6caSJeff Kirsher /* driver ioctl parameters */ 638b955f6caSJeff Kirsher #define AMD8111E_REG_DUMP_LEN 13*sizeof(u32) 639b955f6caSJeff Kirsher 640ad61dd30SStephen Boyd /* amd8111e descriptor format */ 641b955f6caSJeff Kirsher 642b955f6caSJeff Kirsher struct amd8111e_tx_dr{ 643b955f6caSJeff Kirsher 644b955f6caSJeff Kirsher __le16 buff_count; /* Size of the buffer pointed by this descriptor */ 645b955f6caSJeff Kirsher 646b955f6caSJeff Kirsher __le16 tx_flags; 647b955f6caSJeff Kirsher 648b955f6caSJeff Kirsher __le16 tag_ctrl_info; 649b955f6caSJeff Kirsher 650b955f6caSJeff Kirsher __le16 tag_ctrl_cmd; 651b955f6caSJeff Kirsher 652b955f6caSJeff Kirsher __le32 buff_phy_addr; 653b955f6caSJeff Kirsher 654b955f6caSJeff Kirsher __le32 reserved; 655b955f6caSJeff Kirsher }; 656b955f6caSJeff Kirsher 657b955f6caSJeff Kirsher struct amd8111e_rx_dr{ 658b955f6caSJeff Kirsher 659b955f6caSJeff Kirsher __le32 reserved; 660b955f6caSJeff Kirsher 661b955f6caSJeff Kirsher __le16 msg_count; /* Received message len */ 662b955f6caSJeff Kirsher 663b955f6caSJeff Kirsher __le16 tag_ctrl_info; 664b955f6caSJeff Kirsher 665b955f6caSJeff Kirsher __le16 buff_count; /* Len of the buffer pointed by descriptor. */ 666b955f6caSJeff Kirsher 667b955f6caSJeff Kirsher __le16 rx_flags; 668b955f6caSJeff Kirsher 669b955f6caSJeff Kirsher __le32 buff_phy_addr; 670b955f6caSJeff Kirsher 671b955f6caSJeff Kirsher }; 672b955f6caSJeff Kirsher struct amd8111e_link_config{ 673b955f6caSJeff Kirsher 674b955f6caSJeff Kirsher #define SPEED_INVALID 0xffff 675b955f6caSJeff Kirsher #define DUPLEX_INVALID 0xff 676b955f6caSJeff Kirsher #define AUTONEG_INVALID 0xff 677b955f6caSJeff Kirsher 678b955f6caSJeff Kirsher unsigned long orig_phy_option; 679b955f6caSJeff Kirsher u16 speed; 680b955f6caSJeff Kirsher u8 duplex; 681b955f6caSJeff Kirsher u8 autoneg; 682b955f6caSJeff Kirsher u8 reserved; /* 32bit alignment */ 683b955f6caSJeff Kirsher }; 684b955f6caSJeff Kirsher 685b955f6caSJeff Kirsher enum coal_type{ 686b955f6caSJeff Kirsher 687b955f6caSJeff Kirsher NO_COALESCE, 688b955f6caSJeff Kirsher LOW_COALESCE, 689b955f6caSJeff Kirsher MEDIUM_COALESCE, 690b955f6caSJeff Kirsher HIGH_COALESCE, 691b955f6caSJeff Kirsher 692b955f6caSJeff Kirsher }; 693b955f6caSJeff Kirsher 694b955f6caSJeff Kirsher enum coal_mode{ 695b955f6caSJeff Kirsher RX_INTR_COAL, 696b955f6caSJeff Kirsher TX_INTR_COAL, 697b955f6caSJeff Kirsher DISABLE_COAL, 698b955f6caSJeff Kirsher ENABLE_COAL, 699b955f6caSJeff Kirsher 700b955f6caSJeff Kirsher }; 701b955f6caSJeff Kirsher #define MAX_TIMEOUT 40 702b955f6caSJeff Kirsher #define MAX_EVENT_COUNT 31 703b955f6caSJeff Kirsher struct amd8111e_coalesce_conf{ 704b955f6caSJeff Kirsher 705b955f6caSJeff Kirsher unsigned int rx_timeout; 706b955f6caSJeff Kirsher unsigned int rx_event_count; 707b955f6caSJeff Kirsher unsigned long rx_packets; 708b955f6caSJeff Kirsher unsigned long rx_prev_packets; 709b955f6caSJeff Kirsher unsigned long rx_bytes; 710b955f6caSJeff Kirsher unsigned long rx_prev_bytes; 711b955f6caSJeff Kirsher unsigned int rx_coal_type; 712b955f6caSJeff Kirsher 713b955f6caSJeff Kirsher unsigned int tx_timeout; 714b955f6caSJeff Kirsher unsigned int tx_event_count; 715b955f6caSJeff Kirsher unsigned long tx_packets; 716b955f6caSJeff Kirsher unsigned long tx_prev_packets; 717b955f6caSJeff Kirsher unsigned long tx_bytes; 718b955f6caSJeff Kirsher unsigned long tx_prev_bytes; 719b955f6caSJeff Kirsher unsigned int tx_coal_type; 720b955f6caSJeff Kirsher 721b955f6caSJeff Kirsher }; 722b955f6caSJeff Kirsher struct ipg_info{ 723b955f6caSJeff Kirsher 724b955f6caSJeff Kirsher unsigned int ipg_state; 725b955f6caSJeff Kirsher unsigned int ipg; 726b955f6caSJeff Kirsher unsigned int current_ipg; 727b955f6caSJeff Kirsher unsigned int col_cnt; 728b955f6caSJeff Kirsher unsigned int diff_col_cnt; 729b955f6caSJeff Kirsher unsigned int timer_tick; 730b955f6caSJeff Kirsher unsigned int prev_ipg; 731b955f6caSJeff Kirsher struct timer_list ipg_timer; 732b955f6caSJeff Kirsher }; 733b955f6caSJeff Kirsher 734b955f6caSJeff Kirsher struct amd8111e_priv{ 735b955f6caSJeff Kirsher 736b955f6caSJeff Kirsher struct amd8111e_tx_dr* tx_ring; 737b955f6caSJeff Kirsher struct amd8111e_rx_dr* rx_ring; 738b955f6caSJeff Kirsher dma_addr_t tx_ring_dma_addr; /* tx descriptor ring base address */ 739b955f6caSJeff Kirsher dma_addr_t rx_ring_dma_addr; /* rx descriptor ring base address */ 740b955f6caSJeff Kirsher const char *name; 741b955f6caSJeff Kirsher struct pci_dev *pci_dev; /* Ptr to the associated pci_dev */ 742b955f6caSJeff Kirsher struct net_device* amd8111e_net_dev; /* ptr to associated net_device */ 743f1870559SGeert Uytterhoeven /* Transmit and receive skbs */ 744b955f6caSJeff Kirsher struct sk_buff *tx_skbuff[NUM_TX_BUFFERS]; 745b955f6caSJeff Kirsher struct sk_buff *rx_skbuff[NUM_RX_BUFFERS]; 746b955f6caSJeff Kirsher /* Transmit and receive dma mapped addr */ 747b955f6caSJeff Kirsher dma_addr_t tx_dma_addr[NUM_TX_BUFFERS]; 748b955f6caSJeff Kirsher dma_addr_t rx_dma_addr[NUM_RX_BUFFERS]; 749b955f6caSJeff Kirsher /* Reg memory mapped address */ 750b955f6caSJeff Kirsher void __iomem *mmio; 751b955f6caSJeff Kirsher 752b955f6caSJeff Kirsher struct napi_struct napi; 753b955f6caSJeff Kirsher 754b955f6caSJeff Kirsher spinlock_t lock; /* Guard lock */ 755b955f6caSJeff Kirsher unsigned long rx_idx, tx_idx; /* The next free ring entry */ 756b955f6caSJeff Kirsher unsigned long tx_complete_idx; 757b955f6caSJeff Kirsher unsigned long tx_ring_complete_idx; 758b955f6caSJeff Kirsher unsigned long tx_ring_idx; 759b955f6caSJeff Kirsher unsigned int rx_buff_len; /* Buffer length of rx buffers */ 760b955f6caSJeff Kirsher int options; /* Options enabled/disabled for the device */ 761b955f6caSJeff Kirsher 762b955f6caSJeff Kirsher unsigned long ext_phy_option; 763b955f6caSJeff Kirsher int ext_phy_addr; 764b955f6caSJeff Kirsher u32 ext_phy_id; 765b955f6caSJeff Kirsher 766b955f6caSJeff Kirsher struct amd8111e_link_config link_config; 767b955f6caSJeff Kirsher int pm_cap; 768b955f6caSJeff Kirsher 769b955f6caSJeff Kirsher struct net_device *next; 770b955f6caSJeff Kirsher int mii; 771b955f6caSJeff Kirsher struct mii_if_info mii_if; 772b955f6caSJeff Kirsher char opened; 773b955f6caSJeff Kirsher unsigned int drv_rx_errors; 774b955f6caSJeff Kirsher struct amd8111e_coalesce_conf coal_conf; 775b955f6caSJeff Kirsher 776b955f6caSJeff Kirsher struct ipg_info ipg_data; 777b955f6caSJeff Kirsher 778b955f6caSJeff Kirsher }; 779b955f6caSJeff Kirsher 780b955f6caSJeff Kirsher /* kernel provided writeq does not write 64 bits into the amd8111e device register instead writes only higher 32bits data into lower 32bits of the register. 781b955f6caSJeff Kirsher BUG? */ 782b955f6caSJeff Kirsher #define amd8111e_writeq(_UlData,_memMap) \ 783b955f6caSJeff Kirsher writel(*(u32*)(&_UlData), _memMap); \ 784b955f6caSJeff Kirsher writel(*(u32*)((u8*)(&_UlData)+4), _memMap+4) 785b955f6caSJeff Kirsher 786b955f6caSJeff Kirsher /* maps the external speed options to internal value */ 787b955f6caSJeff Kirsher typedef enum { 788b955f6caSJeff Kirsher SPEED_AUTONEG, 789b955f6caSJeff Kirsher SPEED10_HALF, 790b955f6caSJeff Kirsher SPEED10_FULL, 791b955f6caSJeff Kirsher SPEED100_HALF, 792b955f6caSJeff Kirsher SPEED100_FULL, 793b955f6caSJeff Kirsher }EXT_PHY_OPTION; 794b955f6caSJeff Kirsher 795b955f6caSJeff Kirsher static int card_idx; 796b955f6caSJeff Kirsher static int speed_duplex[MAX_UNITS] = { 0, }; 797eb939922SRusty Russell static bool coalesce[MAX_UNITS] = { [ 0 ... MAX_UNITS-1] = true }; 798eb939922SRusty Russell static bool dynamic_ipg[MAX_UNITS] = { [ 0 ... MAX_UNITS-1] = false }; 799b955f6caSJeff Kirsher static unsigned int chip_version; 800b955f6caSJeff Kirsher 801b955f6caSJeff Kirsher #endif /* _AMD8111E_H */ 802b955f6caSJeff Kirsher 803