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