ns_gige_reg.h revision 1730
12207SN/A/* 25254Sksewell@umich.edu * Copyright (c) 2004 The Regents of The University of Michigan 35254Sksewell@umich.edu * All rights reserved. 42207SN/A * 55254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 65254Sksewell@umich.edu * modification, are permitted provided that the following conditions are 75254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 85254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 95254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 105254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 115254Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 125254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 135254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 145254Sksewell@umich.edu * this software without specific prior written permission. 152207SN/A * 165254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu */ 285254Sksewell@umich.edu 295254Sksewell@umich.edu/** @file 305254Sksewell@umich.edu * Ethernet device register definitions for the National 312207SN/A * Semiconductor DP83820 Ethernet controller 322207SN/A */ 3311793Sbrandon.potter@amd.com 3411793Sbrandon.potter@amd.com#ifndef __DEV_NS_GIGE_REG_H__ 352474SN/A#define __DEV_NS_GIGE_REG_H__ 368229Snate@binkert.org 372454SN/A/* Device Register Address Map */ 3812334Sgabeblack@google.com#define CR 0x00 392680Sktlim@umich.edu#define CFGR 0x04 408232Snate@binkert.org#define MEAR 0x08 416650Sksewell@umich.edu#define PTSCR 0x0c 4211854Sbrandon.potter@amd.com#define ISR 0x10 436650Sksewell@umich.edu#define IMR 0x14 446650Sksewell@umich.edu#define IER 0x18 4511800Sbrandon.potter@amd.com#define IHR 0x1c 462474SN/A#define TXDP 0x20 472207SN/A#define TXDP_HI 0x24 482447SN/A#define TX_CFG 0x28 492474SN/A#define GPIOR 0x2c 502447SN/A#define RXDP 0x30 5111851Sbrandon.potter@amd.com#define RXDP_HI 0x34 5211851Sbrandon.potter@amd.com#define RX_CFG 0x38 532474SN/A#define PQCR 0x3c 542686Sksewell@umich.edu#define WCSR 0x40 552686Sksewell@umich.edu#define PCR 0x44 5611905SBrandon.Potter@amd.com#define RFCR 0x48 5711905SBrandon.Potter@amd.com#define RFDR 0x4c 5811905SBrandon.Potter@amd.com#define BRAR 0x50 592474SN/A#define BRDR 0x54 602474SN/A#define SRR 0x58 6111905SBrandon.Potter@amd.com#define MIBC 0x5c 622474SN/A#define MIB_START 0x60 632686Sksewell@umich.edu#define MIB_END 0x88 6411905SBrandon.Potter@amd.com#define VRCR 0xbc 6511905SBrandon.Potter@amd.com#define VTCR 0xc0 6611905SBrandon.Potter@amd.com#define VDR 0xc4 672686Sksewell@umich.edu#define CCSR 0xcc 686811SMatt DeVuyst#define TBICR 0xe0 6911905SBrandon.Potter@amd.com#define TBISR 0xe4 7011905SBrandon.Potter@amd.com#define TANAR 0xe8 7111905SBrandon.Potter@amd.com#define TANLPAR 0xec 7211905SBrandon.Potter@amd.com#define TANER 0xf0 732474SN/A#define TESR 0xf4 742474SN/A#define M5REG 0xf8 752474SN/A#define LAST 0xf8 7611851Sbrandon.potter@amd.com#define RESERVED 0xfc 772474SN/A 7811851Sbrandon.potter@amd.com/* Chip Command Register */ 796650Sksewell@umich.edu#define CR_TXE 0x00000001 8010318Sandreas.hansson@arm.com#define CR_TXD 0x00000002 812474SN/A#define CR_RXE 0x00000004 825958Sgblack@eecs.umich.edu#define CR_RXD 0x00000008 836811SMatt DeVuyst#define CR_TXR 0x00000010 846650Sksewell@umich.edu#define CR_RXR 0x00000020 8511851Sbrandon.potter@amd.com#define CR_SWI 0x00000080 866650Sksewell@umich.edu#define CR_RST 0x00000100 876811SMatt DeVuyst 886811SMatt DeVuyst/* configuration register */ 8911389Sbrandon.potter@amd.com#define CFGR_LNKSTS 0x80000000 9011389Sbrandon.potter@amd.com#define CFGR_SPDSTS 0x60000000 9111389Sbrandon.potter@amd.com#define CFGR_SPDSTS1 0x40000000 926650Sksewell@umich.edu#define CFGR_SPDSTS0 0x20000000 936650Sksewell@umich.edu#define CFGR_DUPSTS 0x10000000 946650Sksewell@umich.edu#define CFGR_TBI_EN 0x01000000 956811SMatt DeVuyst#define CFGR_RESERVED 0x0e000000 966811SMatt DeVuyst#define CFGR_MODE_1000 0x00400000 976811SMatt DeVuyst#define CFGR_AUTO_1000 0x00200000 986811SMatt DeVuyst#define CFGR_PINT_CTL 0x001c0000 996811SMatt DeVuyst#define CFGR_PINT_DUPSTS 0x00100000 1006811SMatt DeVuyst#define CFGR_PINT_LNKSTS 0x00080000 1016811SMatt DeVuyst#define CFGR_PINT_SPDSTS 0x00040000 10210318Sandreas.hansson@arm.com#define CFGR_TMRTEST 0x00020000 1036811SMatt DeVuyst#define CFGR_MRM_DIS 0x00010000 1046811SMatt DeVuyst#define CFGR_MWI_DIS 0x00008000 1056811SMatt DeVuyst#define CFGR_T64ADDR 0x00004000 1066811SMatt DeVuyst#define CFGR_PCI64_DET 0x00002000 1076811SMatt DeVuyst#define CFGR_DATA64_EN 0x00001000 1086811SMatt DeVuyst#define CFGR_M64ADDR 0x00000800 1096811SMatt DeVuyst#define CFGR_PHY_RST 0x00000400 1106811SMatt DeVuyst#define CFGR_PHY_DIS 0x00000200 1116811SMatt DeVuyst#define CFGR_EXTSTS_EN 0x00000100 1126811SMatt DeVuyst#define CFGR_REQALG 0x00000080 1136811SMatt DeVuyst#define CFGR_SB 0x00000040 11411389Sbrandon.potter@amd.com#define CFGR_POW 0x00000020 11511389Sbrandon.potter@amd.com#define CFGR_EXD 0x00000010 11611389Sbrandon.potter@amd.com#define CFGR_PESEL 0x00000008 11711389Sbrandon.potter@amd.com#define CFGR_BROM_DIS 0x00000004 1186811SMatt DeVuyst#define CFGR_EXT_125 0x00000002 1196811SMatt DeVuyst#define CFGR_BEM 0x00000001 1206811SMatt DeVuyst 1216811SMatt DeVuyst/* EEPROM access register */ 1226811SMatt DeVuyst#define MEAR_EEDI 0x00000001 1236811SMatt DeVuyst#define MEAR_EEDO 0x00000002 1246811SMatt DeVuyst#define MEAR_EECLK 0x00000004 1256811SMatt DeVuyst#define MEAR_EESEL 0x00000008 1266811SMatt DeVuyst#define MEAR_MDIO 0x00000010 1276811SMatt DeVuyst#define MEAR_MDDIR 0x00000020 1286650Sksewell@umich.edu#define MEAR_MDC 0x00000040 1296650Sksewell@umich.edu 1306811SMatt DeVuyst/* PCI test control register */ 1316811SMatt DeVuyst#define PTSCR_EEBIST_FAIL 0x00000001 1326650Sksewell@umich.edu#define PTSCR_EEBIST_EN 0x00000002 1336650Sksewell@umich.edu#define PTSCR_EELOAD_EN 0x00000004 1346650Sksewell@umich.edu#define PTSCR_RBIST_FAIL 0x000001b8 1356650Sksewell@umich.edu#define PTSCR_RBIST_DONE 0x00000200 1366650Sksewell@umich.edu#define PTSCR_RBIST_EN 0x00000400 1376650Sksewell@umich.edu#define PTSCR_RBIST_RST 0x00002000 1386650Sksewell@umich.edu#define PTSCR_RBIST_RDONLY 0x000003f9 1396650Sksewell@umich.edu 1406650Sksewell@umich.edu/* interrupt status register */ 1416650Sksewell@umich.edu#define ISR_RESERVE 0x80000000 1426811SMatt DeVuyst#define ISR_TXDESC3 0x40000000 1436811SMatt DeVuyst#define ISR_TXDESC2 0x20000000 1446811SMatt DeVuyst#define ISR_TXDESC1 0x10000000 1456811SMatt DeVuyst#define ISR_TXDESC0 0x08000000 1466811SMatt DeVuyst#define ISR_RXDESC3 0x04000000 1476650Sksewell@umich.edu#define ISR_RXDESC2 0x02000000 1486650Sksewell@umich.edu#define ISR_RXDESC1 0x01000000 14911905SBrandon.Potter@amd.com#define ISR_RXDESC0 0x00800000 1506650Sksewell@umich.edu#define ISR_TXRCMP 0x00400000 15111905SBrandon.Potter@amd.com#define ISR_RXRCMP 0x00200000 15211905SBrandon.Potter@amd.com#define ISR_DPERR 0x00100000 1536650Sksewell@umich.edu#define ISR_SSERR 0x00080000 15411905SBrandon.Potter@amd.com#define ISR_RMABT 0x00040000 15511905SBrandon.Potter@amd.com#define ISR_RTABT 0x00020000 1566650Sksewell@umich.edu#define ISR_RXSOVR 0x00010000 15711905SBrandon.Potter@amd.com#define ISR_HIBINT 0x00008000 15811905SBrandon.Potter@amd.com#define ISR_PHY 0x00004000 1596811SMatt DeVuyst#define ISR_PME 0x00002000 1606811SMatt DeVuyst#define ISR_SWI 0x00001000 1616811SMatt DeVuyst#define ISR_MIB 0x00000800 1626811SMatt DeVuyst#define ISR_TXURN 0x00000400 1636650Sksewell@umich.edu#define ISR_TXIDLE 0x00000200 1646650Sksewell@umich.edu#define ISR_TXERR 0x00000100 1656811SMatt DeVuyst#define ISR_TXDESC 0x00000080 1666650Sksewell@umich.edu#define ISR_TXOK 0x00000040 1676811SMatt DeVuyst#define ISR_RXORN 0x00000020 1686650Sksewell@umich.edu#define ISR_RXIDLE 0x00000010 16911905SBrandon.Potter@amd.com#define ISR_RXEARLY 0x00000008 1706650Sksewell@umich.edu#define ISR_RXERR 0x00000004 1716650Sksewell@umich.edu#define ISR_RXDESC 0x00000002 1726650Sksewell@umich.edu#define ISR_RXOK 0x00000001 1736650Sksewell@umich.edu#define ISR_ALL 0x7FFFFFFF 1746650Sksewell@umich.edu#define ISR_NODELAY (ISR_ALL & ~(ISR_RXOK|ISR_RXDESC|ISR_TXOK|ISR_TXDESC)) 1756811SMatt DeVuyst#define ISR_NOIMPL (~(ISR_SWI|ISR_TXIDLE|ISR_TXDESC|ISR_TXOK|ISR_RXORN| \ 1766811SMatt DeVuyst ISR_RXIDLE|ISR_RXDESC|ISR_RXOK)) 1778852Sandreas.hansson@arm.com 1786811SMatt DeVuyst/* transmit configuration register */ 1798852Sandreas.hansson@arm.com#define TX_CFG_CSI 0x80000000 1806811SMatt DeVuyst#define TX_CFG_HBI 0x40000000 1816811SMatt DeVuyst#define TX_CFG_MLB 0x20000000 1826811SMatt DeVuyst#define TX_CFG_ATP 0x10000000 1836811SMatt DeVuyst#define TX_CFG_ECRETRY 0x00800000 1846811SMatt DeVuyst#define TX_CFG_BRST_DIS 0x00080000 1856811SMatt DeVuyst#define TX_CFG_MXDMA1024 0x00000000 1866811SMatt DeVuyst#define TX_CFG_MXDMA512 0x00700000 1878852Sandreas.hansson@arm.com#define TX_CFG_MXDMA256 0x00600000 1886811SMatt DeVuyst#define TX_CFG_MXDMA128 0x00500000 1896811SMatt DeVuyst#define TX_CFG_MXDMA64 0x00400000 1906650Sksewell@umich.edu#define TX_CFG_MXDMA32 0x00300000 1916650Sksewell@umich.edu#define TX_CFG_MXDMA16 0x00200000 1926650Sksewell@umich.edu#define TX_CFG_MXDMA8 0x00100000 1936650Sksewell@umich.edu#define TX_CFG_MXDMA 0x00700000 19411905SBrandon.Potter@amd.com 1956650Sksewell@umich.edu#define TX_CFG_FLTH_MASK 0x0000ff00 19611389Sbrandon.potter@amd.com#define TX_CFG_DRTH_MASK 0x000000ff 1976650Sksewell@umich.edu 1986650Sksewell@umich.edu/*general purpose I/O control register */ 1996650Sksewell@umich.edu#define GPIOR_GP5_OE 0x00000200 2005958Sgblack@eecs.umich.edu#define GPIOR_GP4_OE 0x00000100 20111851Sbrandon.potter@amd.com#define GPIOR_GP3_OE 0x00000080 2025958Sgblack@eecs.umich.edu#define GPIOR_GP2_OE 0x00000040 2035958Sgblack@eecs.umich.edu#define GPIOR_GP1_OE 0x00000020 2046701Sgblack@eecs.umich.edu#define GPIOR_GP3_OUT 0x00000004 2055958Sgblack@eecs.umich.edu#define GPIOR_GP1_OUT 0x00000001 2065958Sgblack@eecs.umich.edu 2075958Sgblack@eecs.umich.edu/* receive configuration register */ 20811851Sbrandon.potter@amd.com#define RX_CFG_AEP 0x80000000 2095958Sgblack@eecs.umich.edu#define RX_CFG_ARP 0x40000000 2105958Sgblack@eecs.umich.edu#define RX_CFG_STRIPCRC 0x20000000 2115958Sgblack@eecs.umich.edu#define RX_CFG_RX_FD 0x10000000 2125958Sgblack@eecs.umich.edu#define RX_CFG_ALP 0x08000000 2135958Sgblack@eecs.umich.edu#define RX_CFG_AIRL 0x04000000 2145958Sgblack@eecs.umich.edu#define RX_CFG_MXDMA512 0x00700000 21511851Sbrandon.potter@amd.com#define RX_CFG_MXDMA 0x00700000 2165958Sgblack@eecs.umich.edu#define RX_CFG_DRTH 0x0000003e 21710223Ssteve.reinhardt@amd.com#define RX_CFG_DRTH0 0x00000002 2185958Sgblack@eecs.umich.edu 2195958Sgblack@eecs.umich.edu/* pause control status register */ 22010223Ssteve.reinhardt@amd.com#define PCR_PSEN (1 << 31) 2215958Sgblack@eecs.umich.edu#define PCR_PS_MCAST (1 << 30) 2225958Sgblack@eecs.umich.edu#define PCR_PS_DA (1 << 29) 2235958Sgblack@eecs.umich.edu#define PCR_STHI_8 (3 << 23) 22410223Ssteve.reinhardt@amd.com#define PCR_STLO_4 (1 << 23) 2255958Sgblack@eecs.umich.edu#define PCR_FFHI_8K (3 << 21) 2265958Sgblack@eecs.umich.edu#define PCR_FFLO_4K (1 << 21) 227#define PCR_PAUSE_CNT 0xFFFE 228 229/*receive filter/match control register */ 230#define RFCR_RFEN 0x80000000 231#define RFCR_AAB 0x40000000 232#define RFCR_AAM 0x20000000 233#define RFCR_AAU 0x10000000 234#define RFCR_APM 0x08000000 235#define RFCR_APAT 0x07800000 236#define RFCR_APAT3 0x04000000 237#define RFCR_APAT2 0x02000000 238#define RFCR_APAT1 0x01000000 239#define RFCR_APAT0 0x00800000 240#define RFCR_AARP 0x00400000 241#define RFCR_MHEN 0x00200000 242#define RFCR_UHEN 0x00100000 243#define RFCR_ULM 0x00080000 244#define RFCR_RFADDR 0x000003ff 245 246/* receive filter/match data register */ 247#define RFDR_BMASK 0x00030000 248#define RFDR_RFDATA0 0x000000ff 249#define RFDR_RFDATA1 0x0000ff00 250 251/* management information base control register */ 252#define MIBC_MIBS 0x00000008 253#define MIBC_ACLR 0x00000004 254#define MIBC_FRZ 0x00000002 255#define MIBC_WRN 0x00000001 256 257/* VLAN/IP receive control register */ 258#define VRCR_RUDPE 0x00000080 259#define VRCR_RTCPE 0x00000040 260#define VRCR_RIPE 0x00000020 261#define VRCR_IPEN 0x00000010 262#define VRCR_DUTF 0x00000008 263#define VRCR_DVTF 0x00000004 264#define VRCR_VTREN 0x00000002 265#define VRCR_VTDEN 0x00000001 266 267/* VLAN/IP transmit control register */ 268#define VTCR_PPCHK 0x00000008 269#define VTCR_GCHK 0x00000004 270#define VTCR_VPPTI 0x00000002 271#define VTCR_VGTI 0x00000001 272 273/* Clockrun Control/Status Register */ 274#define CCSR_CLKRUN_EN 0x00000001 275 276/* TBI control register */ 277#define TBICR_MR_LOOPBACK 0x00004000 278#define TBICR_MR_AN_ENABLE 0x00001000 279#define TBICR_MR_RESTART_AN 0x00000200 280 281/* TBI status register */ 282#define TBISR_MR_LINK_STATUS 0x00000020 283#define TBISR_MR_AN_COMPLETE 0x00000004 284 285/* TBI auto-negotiation advertisement register */ 286#define TANAR_PS2 0x00000100 287#define TANAR_PS1 0x00000080 288#define TANAR_HALF_DUP 0x00000040 289#define TANAR_FULL_DUP 0x00000020 290 291/* 292 * descriptor format currently assuming link and bufptr 293 * are set for 32 bits,( may be wrong ) ASSUME32 294 */ 295struct ns_desc { 296 uint32_t link; /* link field to next descriptor in linked list */ 297 uint32_t bufptr; /* pointer to the first fragment or buffer */ 298 uint32_t cmdsts; /* command/status field */ 299 uint32_t extsts; /* extended status field for VLAN and IP info */ 300}; 301 302/* cmdsts flags for descriptors */ 303#define CMDSTS_OWN 0x80000000 304#define CMDSTS_MORE 0x40000000 305#define CMDSTS_INTR 0x20000000 306#define CMDSTS_ERR 0x10000000 307#define CMDSTS_OK 0x08000000 308#define CMDSTS_LEN_MASK 0x0000ffff 309 310#define CMDSTS_DEST_MASK 0x01800000 311#define CMDSTS_DEST_SELF 0x00800000 312#define CMDSTS_DEST_MULTI 0x01000000 313 314/* extended flags for descriptors */ 315#define EXTSTS_UDPERR 0x00400000 316#define EXTSTS_UDPPKT 0x00200000 317#define EXTSTS_TCPERR 0x00100000 318#define EXTSTS_TCPPKT 0x00080000 319#define EXTSTS_IPERR 0x00040000 320#define EXTSTS_IPPKT 0x00020000 321 322 323/* speed status */ 324#define SPDSTS_POLARITY (CFGR_SPDSTS1 | CFGR_SPDSTS0 | CFGR_DUPSTS | (lnksts ? CFGR_LNKSTS : 0)) 325 326#endif /* __DEV_NS_GIGE_REG_H__ */ 327