1 /* $NetBSD: mtd803reg.h,v 1.1 2002/11/07 21:56:59 martin Exp $ */ 2 3 /*- 4 * Copyright (c) 2002 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Peter Bex <Peter.Bex@student.kun.nl>. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 /* Command and Status Register */ 40 #define MTD_PAR0 0x00 /* Physical address 0-3 */ 41 #define MTD_PAR1 0x04 /* Physical address 4-5 */ 42 #define MTD_MAR0 0x08 /* Multicast address 0-3 */ 43 #define MTD_MAR1 0x0c /* Multicast address 4-7 */ 44 #define MTD_FAR0 0x10 /* Flowctrl address 0-3 */ 45 #define MTD_FAR1 0x14 /* Flowctrl address 4-5 */ 46 #define MTD_RXTXR 0x18 /* Receive-transmit config */ 47 #define MTD_BCR 0x1c /* Bus command */ 48 #define MTD_TXPDR 0x20 /* Transmit polling demand */ 49 #define MTD_RXPDR 0x24 /* Receive polling demand */ 50 #define MTD_RCWP 0x28 /* Receive word pointer */ 51 #define MTD_TXLBA 0x2c /* Transmit list base addr */ 52 #define MTD_RXLBA 0x30 /* Receive list base addr */ 53 #define MTD_ISR 0x34 /* Interrupt Status Register */ 54 #define MTD_IMR 0x38 /* Interrupt Mask Register */ 55 #define MTD_FHLT 0x3c /* Flow ctrl high/low thresh */ 56 #define MTD_MIIMGT 0x40 /* ROM and MII management */ 57 #define MTD_TALLY 0x44 /* Tally ctr for CRC & MPA */ 58 #define MTD_TSR 0x48 /* Tally ctr for TSR */ 59 #define MTD_PHYBASE 0x4c /* PHY status & control */ 60 #define MTD_OUI 0x50 /* OUI register */ 61 #define MTD_LPAR 0x54 /* Link Partner, Advertisment */ 62 #define MTD_WUECSR 0x5c /* Wake-up Events CSR */ 63 64 #define MTD_ALL_ADDR 0xffffffff /* Mask all addresses */ 65 #define MTD_TXPDR_DEMAND 0xffffffff /* Demand transmit polling */ 66 #define MTD_RXPDR_DEMAND 0xffffffff /* Demand receive polling */ 67 68 /* PHY registers */ 69 /* Basic mode control register */ 70 #define MTD_PHY_BMCR 0x00 71 72 /* Bus Command Register */ 73 #define MTD_BCR_RSRVD1 0xfffffc00 /* Bits [31:10] are reserved */ 74 #define MTD_BCR_PROG 0x00000200 /* Programming */ 75 #define MTD_BCR_RLE 0x00000100 /* Read Line command Enable */ 76 #define MTD_BCR_RME 0x00000080 /* Read Multiple cmd Enable */ 77 #define MTD_BCR_WIE 0x00000040 /* Write and Inval. cmd Enab. */ 78 #define MTD_BCR_BLEN1 0x00000000 /* 1 dword burst length */ 79 #define MTD_BCR_BLEN4 0x00000008 /* 4 dwords burst length */ 80 #define MTD_BCR_BLEN8 0x00000010 /* 8 dwords burst length */ 81 #define MTD_BCR_BLEN16 0x00000018 /* 16 dwords burst length */ 82 #define MTD_BCR_BLEN32 0x00000020 /* 32 dwords burst length */ 83 #define MTD_BCR_BLEN64 0x00000028 /* 64 dwords burst length */ 84 #define MTD_BCR_BLEN128 0x00000030 /* 128 dwords burst length */ 85 #define MTD_BCR_BLEN512 0x00000038 /* 512 dwords burst length */ 86 #define MTD_BCR_RSVRD0 0x00000006 /* Bits [2:1] are reserved */ 87 #define MTD_BCR_RESET 0x00000001 /* Software reset */ 88 89 #define MTD_TIMEOUT 1000 /* Timeout when resetting */ 90 91 /* Transmit configuration register */ 92 #define MTD_TX_RUN 0x80000000 /* Transmit running status */ 93 #define MTD_TX_RSRVD1 0x60000000 /* Bits [14:13] are reserved */ 94 #define MTD_TX_BACKOPT 0x10000000 /* Optional backoff */ 95 #define MTD_TX_FASTBACK 0x08000000 /* Fast back-off */ 96 #define MTD_TX_RSRVD0 0x04000000 /* Bit 10 is reserved */ 97 #define MTD_TX_ENH 0x02000000 /* Enhanced mode */ 98 #define MTD_TX_FCTL 0x01000000 /* Transmit fctl packet enable*/ 99 #define MTD_TX_64 0x00000000 /* 64 bytes */ 100 #define MTD_TX_32 0x00200000 /* 32 bytes */ 101 #define MTD_TX_128 0x00400000 /* 128 bytes */ 102 #define MTD_TX_256 0x00600000 /* 256 bytes */ 103 #define MTD_TX_512 0x00800000 /* 512 bytes */ 104 #define MTD_TX_768 0x00a00000 /* 768 bytes */ 105 #define MTD_TX_1024 0x00c00000 /* 1024 bytes */ 106 #define MTD_TX_STFWD 0x00e00000 /* Store and forward */ 107 #define MTD_TX_FDPLX 0x00100000 /* Full duplex mode */ 108 #define MTD_TX_SPD10 0x00080000 /* Port speed is 10M */ 109 #define MTD_TX_ENABLE 0x00040000 /* Transmit enable */ 110 #define MTD_TX_LPBACK 0x00020000 /* Loopback mode bit 1 */ 111 #define MTD_TX_LPBACKZERO 0x00010000 /* Loopback mode bit 0 */ 112 113 /* Receive configuration register */ 114 #define MTD_RX_RUN 0x00008000 /* Receive running status */ 115 #define MTD_RX_EARLY 0x00004000 /* Early interrupt enable */ 116 #define MTD_RX_FCTL 0x00002000 /* Receive fctl packet enable */ 117 #define MTD_RX_FANA 0x00001000 /* Fctl address undefined(n/a)*/ 118 #define MTD_RX_BLEN 0x00000800 /* Receive burst len enable */ 119 #define MTD_RX_512 0x00000700 /* 512 words */ 120 #define MTD_RX_128 0x00000600 /* 128 words */ 121 #define MTD_RX_64 0x00000500 /* 64 words */ 122 #define MTD_RX_32 0x00000400 /* 32 words */ 123 #define MTD_RX_16 0x00000300 /* 16 words */ 124 #define MTD_RX_8 0x00000200 /* 8 words */ 125 #define MTD_RX_4 0x00000100 /* 4 words */ 126 #define MTD_RX_1 0x00000000 /* 1 word */ 127 #define MTD_RX_PROM 0x00000080 /* Promiscuous mode */ 128 #define MTD_RX_ABROAD 0x00000040 /* Accept broadcast */ 129 #define MTD_RX_AMULTI 0x00000020 /* Accept multicast */ 130 #define MTD_RX_ARP 0x00000008 /* Receive runt packet */ 131 #define MTD_RX_ALP 0x00000004 /* Receive long packet */ 132 #define MTD_RX_ERRP 0x00000002 /* Receive error packet */ 133 #define MTD_RX_ENABLE 0x00000001 /* Receive enable */ 134 135 /* Interrupt Status Register */ 136 #define MTD_ISR_RSRVD1 0xfff80000 /* Bits [31:19] are reserved */ 137 #define MTD_ISR_PDF 0x00040000 /* Parallel Detection Fault */ 138 #define MTD_ISR_RFCON 0x00020000 /* Receive FCtl xON packet */ 139 #define MRD_ISR_RFCOFF 0x00010000 /* Receive FCtl xOFF packet */ 140 #define MTD_ISR_LSC 0x00008000 /* Link Status Change */ 141 #define MTD_ISR_ANC 0x00004000 /* Autonegotiation complete */ 142 #define MTD_ISR_FBUSERR 0x00002000 /* Fatal bus error */ 143 #define MTD_ISR_PARERR 0x00000000 /* Parity error */ 144 #define MTD_ISR_MASTERR 0x00000800 /* Master error */ 145 #define MTD_ISR_TARERR 0x00001000 /* Target error */ 146 #define MTD_ISR_TXUNDER 0x00000400 /* Transmit underflow */ 147 #define MTD_ISR_RXOVER 0x00000200 /* Receive overflow */ 148 #define MTD_ISR_TXEARLY 0x00000100 /* Transmit early int */ 149 #define MTD_ISR_RXEARLY 0x00000080 /* Receive early int */ 150 #define MTD_ISR_CTROVER 0x00000040 /* Counter overflow */ 151 #define MTD_ISR_RXBUN 0x00000020 /* Receive buffer n/a */ 152 #define MTD_ISR_TXBUN 0x00000010 /* Transmit buffer n/a */ 153 #define MTD_ISR_TXIRQ 0x00000008 /* Transmit interrupt */ 154 #define MTD_ISR_RXIRQ 0x00000004 /* Receive interrupt */ 155 #define MTD_ISR_RXERR 0x00000002 /* Receive error */ 156 #define MTD_ISR_RSRVD0 0x00000001 /* Bit 1 is reserved */ 157 158 #define MTD_ISR_MASK MTD_ISR_TXIRQ | MTD_ISR_RXIRQ | MTD_ISR_RXBUN \ 159 | MTD_ISR_RXERR | MTD_ISR_PDF \ 160 | MTD_ISR_FBUSERR | MTD_ISR_TXUNDER \ 161 | MTD_ISR_RXOVER | MTD_ISR_PARERR \ 162 | MTD_ISR_MASTERR | MTD_ISR_TARERR 163 164 #define MTD_ISR_ENABLE 0xffffffff /* Enable interrupts */ 165 166 /* Interrupt Mask Register. Essentially the same as ISR */ 167 #define MTD_IMR_RSRVD2 0xfff80000 /* Bits [31:19] are reserved */ 168 #define MTD_IMR_PDF 0x00040000 /* Parallel Detection Fault */ 169 #define MTD_IMR_RFCON 0x00020000 /* Receive FCtl xON packet */ 170 #define MRD_IMR_RFCOFF 0x00010000 /* Receive FCtl xOFF packet */ 171 #define MTD_IMR_LSC 0x00008000 /* Link Status Change */ 172 #define MTD_IMR_ANC 0x00004000 /* Autonegotiation complete */ 173 #define MTD_IMR_FBUSERR 0x00002000 /* Fatal bus error */ 174 #define MTD_IMR_RSRVD1 0x00001800 /* Bits [12:11] are reserved */ 175 #define MTD_IMR_TXUNDER 0x00000400 /* Transmit underflow */ 176 #define MTD_IMR_RXOVER 0x00000200 /* Receive overflow */ 177 #define MTD_IMR_TXEARLY 0x00000100 /* Transmit early int */ 178 #define MTD_IMR_RXEARLY 0x00000080 /* Receive early int */ 179 #define MTD_IMR_CTROVER 0x00000040 /* Counter overflow */ 180 #define MTD_IMR_RXBUN 0x00000020 /* Receive buffer n/a */ 181 #define MTD_IMR_TXBUN 0x00000010 /* Transmit buffer n/a */ 182 #define MTD_IMR_TXIRQ 0x00000008 /* Transmit interrupt */ 183 #define MTD_IMR_RXIRQ 0x00000004 /* Receive interrupt */ 184 #define MTD_IMR_RXERR 0x00000002 /* Receive error */ 185 #define MTD_IMR_RSRVD0 0x00000001 /* Bit 1 is reserved */ 186 187 #define MTD_IMR_MASK MTD_IMR_TXIRQ | MTD_IMR_RXIRQ | MTD_IMR_RXBUN \ 188 | MTD_IMR_RXERR | MTD_IMR_PDF \ 189 | MTD_IMR_FBUSERR | MTD_IMR_TXUNDER \ 190 | MTD_IMR_RXOVER \ 191 192 /* Tally counters for CRC and MPA */ 193 #define MTD_TALLY_CRCOVER 0x80000000 /* CRC tally ctr overflow */ 194 #define MTD_TALLY_NCRCERR 0x7fff0000 /* Number of CRC errors */ 195 #define MTD_TALLY_MPAOVER 0x00008000 /* MPA tally ctr overflow */ 196 #define MTD_TALLY_NMPAERR 0x00007fff /* Number of MPA errors */ 197 198 /* Tally counters for Transmit Status Report */ 199 #define MTD_TSR_NABORT 0xff000000 /* Number of aborted packets */ 200 #define MTD_TSR_NLCOL 0x00ff0000 /* Number of late collisions */ 201 #define MTD_TSR_NRETRY 0x0000ffff /* Number of transm. retries */ 202 203 /* Wake-Up Events Control and Status Register */ 204 #define MTD_WUECSR_RSRVD1 0xfffff000 /* Bits [31:12] are reserved */ 205 #define MTD_WUECSR_FRCWKUP 0x00000800 /* Force Wake Up LAN mode */ 206 #define MTD_WUECSR_STATCHG 0x00000400 /* Status Change enable */ 207 #define MTD_WUECSR_AGU 0x00000200 /* Accept Global Unicast */ 208 #define MTD_WUECSR_WUPOP 0x00000100 /* Wake Up Pin Output Pattern */ 209 #define MTD_WUECSR_WUPPROP 0x00000080 /* Wake Up Pin Property */ 210 #define MTD_WUECSR_LCD 0x00000040 /* Link Change Detected */ 211 #define MTD_WUECSR_MPR 0x00000020 /* Magic Packet Received */ 212 #define MTD_WUECSR_WUFR 0x00000010 /* Wake Up Frame Received */ 213 #define MTD_WUECSR_RSRVD0 0x00000008 /* Unspecified! */ 214 #define MTD_WUECSR_LCE 0x00000004 /* Link Change Enable */ 215 #define MTD_WUECSR_MPE 0x00000002 /* Magic Packet Enable */ 216 #define MTD_WUECSR_WUFE 0x00000001 /* Wake Up Frame Enable */ 217 218 219 /* 220 * Note: We should probably move the following info to a new PHY driver. 221 * Or maybe remove them anyway, but we might need them someday so leave them 222 * here for now. 223 */ 224 /* PHY Control and Status Register */ 225 #define MTD_PHY_T4 0x80000000 /* T4 operation capability */ 226 #define MTD_PHY_TXFD 0x40000000 /* 100-TX Full Duplex cap. */ 227 #define MTD_PHY_TXHD 0x20000000 /* 100-TX Half Duplex cap. */ 228 #define MTD_PHY_TPFD 0x10000000 /* 10-TP Full Duplex cap. */ 229 #define MTD_PHY_TPHD 0x08000000 /* 10-TP Half Duplex cap. */ 230 #define MTD_PHY_RSRVD2 0x07c00000 /* Bits [16:22] are reserved */ 231 #define MTD_PHY_ANC 0x00200000 /* Autonegotiation complete */ 232 #define MTD_PHY_RMTFAULT 0x00100000 /* Remote fault */ 233 #define MTD_PHY_AUTONEG 0x00080000 /* Autonegotiation */ 234 #define MTD_PHY_LINK 0x00040000 /* Link status */ 235 #define MTD_PHY_JABBER 0x00020000 /* Jabber detected */ 236 #define MTD_PHY_EXTREG 0x00010000 /* Extended register exists */ 237 #define MTD_PHY_RESET 0x00008000 /* Reset PHY registers */ 238 #define MTD_PHY_LPBACK 0x00004000 /* Loopback select */ 239 #define MTD_PHY_SPEED 0x00002000 /* Speed select */ 240 #define MTD_PHY_ANEN 0x00001000 /* Autoneg enable */ 241 #define MTD_PHY_POWDWN 0x00000800 /* Power-down */ 242 #define MTD_PHY_RSRVD1 0x00000400 /* Bit 10 is reserved */ 243 #define MTD_PHY_RESTAN 0x00000200 /* Restart Autoneg */ 244 #define MTD_PHY_DUPLEX 0x00000100 /* Duplex select */ 245 #define MTD_PHY_COLTST 0x00000080 /* Collision test enable */ 246 #define MTD_PHY_RSRVD0 0x0000007f /* Bits [6:0] are reserved */ 247 248 /* OUI register */ 249 #define MTD_OUI_HIGH 0xfc000000 /* OUI High register (0x34) */ 250 #define MTD_OUI_PARTNO 0x02f00000 /* Part number (0x0) */ 251 #define MTD_OUI_REVISION 0x000f0000 /* Revision number (0x0) */ 252 #define MTD_OUI_LOW 0x0000ffff /* OUI Low register (0x0302) */ 253 254 /* Link Partner Ability Register and Advertisment Register */ 255 #define MTD_LPAR_LP_NEXTPAGE 0x80000000 /* Next page */ 256 #define MTD_LPAR_LP_ACK 0x40000000 /* Acknowledge */ 257 #define MTD_LPAR_LP_RMTFAULT 0x20000000 /* Remote fault detected */ 258 #define MTD_LPAR_RSRVD1 0x1c000000 /* Bits [28:26] are reserved */ 259 #define MTD_LPAR_LP_T4 0x02000000 /* Capable of T4 operation */ 260 #define MTD_LPAR_LP_TXFD 0x01000000 /* Cap. of 100-TX Full Duplex */ 261 #define MTD_LPAR_LP_TXHD 0x00800000 /* Cap. of 100-TX Half Duplex */ 262 #define MTD_LPAR_LP_TPFD 0x00400000 /* Cap. of 10-TP Full Duplex */ 263 #define MTD_LPAR_LP_TPHD 0x00200000 /* Cap. of 10-TP Half Duplex */ 264 #define MTD_LPAR_SELECTOR1 0x001f0000 /* Selector field 1 */ 265 #define MTD_LPAR_AD_NEXTPAGE 0x00008000 /* Next page */ 266 #define MTD_LPAR_AD_ACK 0x00004000 /* Acknowledge */ 267 #define MTD_LPAR_AD_RMTFAULT 0x00002000 /* Remote fault detected */ 268 #define MTD_LPAR_RSRVD0 0x00001c00 /* Bits [12:10] are reserved */ 269 #define MTD_LPAR_AD_T4 0x00000200 /* Capable of T4 operation */ 270 #define MTD_LPAR_AD_TXFD 0x00000100 /* Cap. of 100-TX Full Duplex */ 271 #define MTD_LPAR_AD_TXHD 0x00000080 /* Cap. of 100-TX Half Duplex */ 272 #define MTD_LPAR_AD_TPFD 0x00000040 /* Cap. of 10-TP Full Duplex */ 273 #define MTD_LPAR_AD_TPHD 0x00000020 /* Cap. of 10-TP Half Duplex */ 274 #define MTD_LPAR_SELECTOR0 0x0000001f /* Selector field 0 */ 275