Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | /* qualcomm fast Ethernet controller HW description */ |
| 14 | |
| 15 | #ifndef _QFEC_EMAC_H_ |
| 16 | # define _QFEC_EMAC_H_ |
| 17 | |
| 18 | # ifndef __KERNEL__ |
| 19 | # include "stdint.h" |
| 20 | # endif |
| 21 | |
| 22 | # define MskBits(nBits, pos) (((1 << nBits)-1)<<pos) |
| 23 | |
| 24 | /* Rx/Tx Ethernet Buffer Descriptors |
| 25 | * status contains the ownership, status and receive length bits |
| 26 | * ctl contains control and size bits for two buffers |
| 27 | * p_buf contains a ptr to the data buffer |
| 28 | * MAC writes timestamp low into p_buf |
| 29 | * next contains either ptr to 2nd buffer or next buffer-desc |
| 30 | * MAC writes timestamp high into next |
| 31 | * |
| 32 | * status/ctl bit definition depend on RX or TX usage |
| 33 | */ |
| 34 | |
| 35 | |
| 36 | struct qfec_buf_desc { |
| 37 | uint32_t status; |
| 38 | uint32_t ctl; |
| 39 | void *p_buf; |
| 40 | void *next; |
| 41 | }; |
| 42 | |
| 43 | /* ownership bit operations */ |
| 44 | # define BUF_OWN 0x80000000 /* DMA owns buffer */ |
| 45 | # define BUF_OWN_DMA BUF_OWN |
| 46 | |
| 47 | /* RX buffer status bits */ |
| 48 | # define BUF_RX_AFM 0x40000000 /* dest addr filt fail */ |
| 49 | |
| 50 | # define BUF_RX_FL 0x3fff0000 /* frame length */ |
| 51 | # define BUF_RX_FL_GET(p) ((p.status & BUF_RX_FL) >> 16) |
| 52 | # define BUF_RX_FL_SET(p, x) \ |
| 53 | (p.status = (p.status & ~BUF_RX_FL) | ((x << 16) & BUF_RX_FL)) |
| 54 | # define BUF_RX_FL_GET_FROM_STATUS(status) \ |
| 55 | (((status) & BUF_RX_FL) >> 16) |
| 56 | |
| 57 | # define BUF_RX_ES 0x00008000 /* error summary */ |
| 58 | # define BUF_RX_DE 0x00004000 /* error descriptor (es) */ |
| 59 | # define BUF_RX_SAF 0x00002000 /* source addr filt fail */ |
| 60 | # define BUF_RX_LE 0x00001000 /* length error */ |
| 61 | |
| 62 | # define BUF_RX_OE 0x00000800 /* overflow error (es) */ |
| 63 | # define BUF_RX_VLAN 0x00000400 /* vlan tag */ |
| 64 | # define BUF_RX_FS 0x00000200 /* first descriptor */ |
| 65 | # define BUF_RX_LS 0x00000100 /* last descriptor */ |
| 66 | |
| 67 | # define BUF_RX_IPC 0x00000080 /* cksum-err/giant-frame (es) */ |
| 68 | # define BUF_RX_LC 0x00000040 /* late collision (es) */ |
| 69 | # define BUF_RX_FT 0x00000020 /* frame type */ |
| 70 | # define BUF_RX_RWT 0x00000010 /* rec watchdog timeout (es) */ |
| 71 | |
| 72 | # define BUF_RX_RE 0x00000008 /* rec error (es) */ |
| 73 | # define BUF_RX_DBE 0x00000004 /* dribble bit err */ |
| 74 | # define BUF_RX_CE 0x00000002 /* crc err (es) */ |
| 75 | # define BUF_RX_CSE 0x00000001 /* checksum err */ |
| 76 | |
| 77 | # define BUF_RX_ERRORS \ |
| 78 | (BUF_RX_DE | BUF_RX_SAF | BUF_RX_LE | BUF_RX_OE \ |
| 79 | | BUF_RX_IPC | BUF_RX_LC | BUF_RX_RWT | BUF_RX_RE \ |
| 80 | | BUF_RX_DBE | BUF_RX_CE | BUF_RX_CSE) |
| 81 | |
| 82 | /* RX buffer control bits */ |
| 83 | # define BUF_RX_DI 0x80000000 /* disable intrp on compl */ |
| 84 | # define BUF_RX_RER 0x02000000 /* rec end of ring */ |
| 85 | # define BUF_RX_RCH 0x01000000 /* 2nd addr chained */ |
| 86 | |
| 87 | # define BUF_RX_SIZ2 0x003ff800 /* buffer 2 size */ |
| 88 | # define BUF_RX_SIZ2_GET(p) ((p.control&BUF_RX_SIZ2) >> 11) |
| 89 | |
| 90 | # define BUF_RX_SIZ 0x000007ff /* rx buf 1 size */ |
| 91 | # define BUF_RX_SIZ_GET(p) (p.ctl&BUF_RX_SIZ) |
| 92 | |
| 93 | /* TX buffer status bits */ |
| 94 | # define BUF_TX_TTSS 0x00020000 /* time stamp status */ |
| 95 | # define BUF_TX_IHE 0x00010000 /* IP hdr err */ |
| 96 | |
| 97 | # define BUF_TX_ES 0x00008000 /* error summary */ |
| 98 | # define BUF_TX_JT 0x00004000 /* jabber timeout (es) */ |
| 99 | # define BUF_TX_FF 0x00002000 /* frame flushed (es) */ |
| 100 | # define BUF_TX_PCE 0x00001000 /* payld cksum err */ |
| 101 | |
| 102 | # define BUF_TX_LOC 0x00000800 /* loss carrier (es) */ |
| 103 | # define BUF_TX_NC 0x00000400 /* no carrier (es) */ |
| 104 | # define BUF_TX_LC 0x00000200 /* late collision (es) */ |
| 105 | # define BUF_TX_EC 0x00000100 /* excessive collision (es) */ |
| 106 | |
| 107 | # define BUF_TX_VLAN 0x00000080 /* VLAN frame */ |
| 108 | # define BUF_TX_CC MskBits(4, 3) /* collision count */ |
| 109 | # define BUF_TX_CC_GET(p) ((p.status&BUF_TX_CC)>>3) |
| 110 | |
| 111 | # define BUF_TX_ED 0x00000004 /* excessive deferral (es) */ |
| 112 | # define BUF_TX_UF 0x00000002 /* underflow err (es) */ |
| 113 | # define BUF_TX_DB 0x00000001 /* deferred bit */ |
| 114 | |
| 115 | /* TX buffer control bits */ |
| 116 | # define BUF_TX_IC 0x80000000 /* intrpt on compl */ |
| 117 | # define BUF_TX_LS 0x40000000 /* last segment */ |
| 118 | # define BUF_TX_FS 0x20000000 /* first segment */ |
| 119 | # define BUF_TX_CIC 0x18000000 /* cksum insert control */ |
| 120 | # define BUF_TX_CIC_SET(n) (BUF_TX_CIC&(n<<27)) |
| 121 | |
| 122 | # define BUF_TX_DC 0x04000000 /* disable CRC */ |
| 123 | # define BUF_TX_TER 0x02000000 /* end of ring */ |
| 124 | # define BUF_TX_TCH 0x01000000 /* 2nd addr chained */ |
| 125 | |
| 126 | # define BUF_TX_DP 0x00800000 /* disable padding */ |
| 127 | # define BUF_TX_TTSE 0x00400000 /* timestamp enable */ |
| 128 | |
| 129 | # define BUF_TX_SIZ2 0x003ff800 /* buffer 2 size */ |
| 130 | # define BUF_TX_SIZ2_SET(n) (BUF_TX_SIZ2(n<<11)) |
| 131 | |
| 132 | # define BUF_TX_SIZ 0x000007ff /* buffer 1 size */ |
| 133 | # define BUF_TX_SIZ_SET(n) (BUF_TX_SI1 & n) |
| 134 | |
| 135 | |
| 136 | /* Ethernet Controller Registers */ |
| 137 | # define BUS_MODE_REG 0x1000 |
| 138 | |
| 139 | # define BUS_MODE_MB 0x04000000 /* mixed burst */ |
| 140 | # define BUS_MODE_AAL 0x02000000 /* address alignment beats */ |
| 141 | # define BUS_MODE_8XPBL 0x01000000 /* */ |
| 142 | |
| 143 | # define BUS_MODE_USP 0x00800000 /* use separate PBL */ |
| 144 | # define BUS_MODE_RPBL 0x007e0000 /* rxDMA PBL */ |
| 145 | # define BUS_MODE_FB 0x00010000 /* fixed burst */ |
| 146 | |
| 147 | # define BUS_MODE_PR 0x0000c000 /* tx/rx priority */ |
| 148 | # define BUS_MODE_PR4 0x0000c000 /* tx/rx priority 4:1 */ |
| 149 | # define BUS_MODE_PR3 0x00008000 /* tx/rx priority 3:1 */ |
| 150 | # define BUS_MODE_PR2 0x00004000 /* tx/rx priority 2:1 */ |
| 151 | # define BUS_MODE_PR1 0x00000000 /* tx/rx priority 1:1 */ |
| 152 | |
| 153 | # define BUS_MODE_PBL 0x00003f00 /* programmable burst length */ |
| 154 | # define BUS_MODE_PBLSET(n) (BUS_MODE_PBL&(n<<8)) |
| 155 | |
| 156 | # define BUS_MODE_DSL 0x0000007c /* descriptor skip length */ |
| 157 | # define BUS_MODE_DSL_SET(n) (BUS_MODE_DSL & (n << 2)) |
| 158 | |
| 159 | # define BUS_MODE_DA 0x00000002 /* DMA arbitration scheme */ |
| 160 | # define BUS_MODE_SWR 0x00000001 /* software reset */ |
| 161 | |
| 162 | #define BUS_MODE_REG_DEFAULT (BUS_MODE_FB \ |
| 163 | | BUS_MODE_AAL \ |
| 164 | | BUS_MODE_PBLSET(16) \ |
| 165 | | BUS_MODE_DA \ |
| 166 | | BUS_MODE_DSL_SET(0)) |
| 167 | |
| 168 | # define TX_POLL_DEM_REG 0x1004 /* transmit poll demand */ |
| 169 | # define RX_POLL_DEM_REG 0x1008 /* receive poll demand */ |
| 170 | |
| 171 | # define RX_DES_LST_ADR_REG 0x100c /* receive buffer descriptor */ |
| 172 | # define TX_DES_LST_ADR_REG 0x1010 /* transmit buffer descriptor */ |
| 173 | |
| 174 | # define STATUS_REG 0x1014 |
| 175 | |
| 176 | # define STATUS_REG_RSVRD_1 0xc0000000 /* reserved */ |
| 177 | # define STATUS_REG_TTI 0x20000000 /* time-stamp trigger intrpt */ |
| 178 | # define STATUS_REG_GPI 0x10000000 /* gmac PMT interrupt */ |
| 179 | |
| 180 | # define STATUS_REG_GMI 0x08000000 /* gmac MMC interrupt */ |
| 181 | # define STATUS_REG_GLI 0x04000000 /* gmac line interface intrpt */ |
| 182 | |
| 183 | # define STATUS_REG_EB 0x03800000 /* error bits */ |
| 184 | # define STATUS_REG_EB_DATA 0x00800000 /* error during data transfer */ |
| 185 | # define STATUS_REG_EB_RDWR 0x01000000 /* error during rd/wr transfer */ |
| 186 | # define STATUS_REG_EB_DESC 0x02000000 /* error during desc access */ |
| 187 | |
| 188 | # define STATUS_REG_TS 0x00700000 /* transmit process state */ |
| 189 | |
| 190 | # define STATUS_REG_TS_STOP 0x00000000 /* stopped */ |
| 191 | # define STATUS_REG_TS_FETCH_DESC 0x00100000 /* fetching descriptor */ |
| 192 | # define STATUS_REG_TS_WAIT 0x00200000 /* waiting for status */ |
| 193 | # define STATUS_REG_TS_READ 0x00300000 /* reading host memory */ |
| 194 | # define STATUS_REG_TS_TIMESTAMP 0x00400000 /* timestamp write status */ |
| 195 | # define STATUS_REG_TS_RSVRD 0x00500000 /* reserved */ |
| 196 | # define STATUS_REG_TS_SUSPEND 0x00600000 /* desc-unavail/buffer-unflw */ |
| 197 | # define STATUS_REG_TS_CLOSE 0x00700000 /* closing desc */ |
| 198 | |
| 199 | # define STATUS_REG_RS 0x000e0000 /* receive process state */ |
| 200 | |
| 201 | # define STATUS_REG_RS_STOP 0x00000000 /* stopped */ |
| 202 | # define STATUS_REG_RS_FETCH_DESC 0x00020000 /* fetching descriptor */ |
| 203 | # define STATUS_REG_RS_RSVRD_1 0x00040000 /* reserved */ |
| 204 | # define STATUS_REG_RS_WAIT 0x00060000 /* waiting for packet */ |
| 205 | # define STATUS_REG_RS_SUSPEND 0x00080000 /* desc unavail */ |
| 206 | # define STATUS_REG_RS_CLOSE 0x000a0000 /* closing desc */ |
| 207 | # define STATUS_REG_RS_TIMESTAMP 0x000c0000 /* timestamp write status */ |
| 208 | # define STATUS_REG_RS_RSVRD_2 0x000e0000 /* writing host memory */ |
| 209 | |
| 210 | # define STATUS_REG_NIS 0x00010000 /* normal intrpt 14|6|2|0 */ |
| 211 | # define STATUS_REG_AIS 0x00008000 /* intrpts 13|10|9|8|7|5|4|3|1 */ |
| 212 | |
| 213 | # define STATUS_REG_ERI 0x00004000 /* early receive interrupt */ |
| 214 | # define STATUS_REG_FBI 0x00002000 /* fatal bus error interrupt */ |
| 215 | # define STATUS_REG_RSVRD_2 0x00001800 /* reserved */ |
| 216 | |
| 217 | # define STATUS_REG_ETI 0x00000400 /* early transmit interrupt */ |
| 218 | # define STATUS_REG_RWT 0x00000200 /* receive watchdog timeout */ |
| 219 | # define STATUS_REG_RPS 0x00000100 /* receive process stopped */ |
| 220 | |
| 221 | # define STATUS_REG_RU 0x00000080 /* receive buffer unavailable */ |
| 222 | # define STATUS_REG_RI 0x00000040 /* receive interrupt */ |
| 223 | # define STATUS_REG_UNF 0x00000020 /* transmit underflow */ |
| 224 | # define STATUS_REG_OVF 0x00000010 /* receive overflow */ |
| 225 | |
| 226 | # define STATUS_REG_TJT 0x00000008 /* transmit jabber timeout */ |
| 227 | # define STATUS_REG_TU 0x00000004 /* transmit buffer unavailable */ |
| 228 | # define STATUS_REG_TPS 0x00000002 /* transmit process stopped */ |
| 229 | # define STATUS_REG_TI 0x00000001 /* transmit interrupt */ |
| 230 | |
| 231 | # define STATUS_REG_AIS_BITS (STATUS_REG_FBI | STATUS_REG_ETI \ |
| 232 | | STATUS_REG_RWT | STATUS_REG_RPS \ |
| 233 | | STATUS_REG_RU | STATUS_REG_UNF \ |
| 234 | | STATUS_REG_OVF | STATUS_REG_TJT \ |
| 235 | | STATUS_REG_TPS | STATUS_REG_AIS) |
| 236 | |
| 237 | # define OPER_MODE_REG 0x1018 |
| 238 | |
| 239 | # define OPER_MODE_REG_DT 0x04000000 /* disab drop ip cksum err fr */ |
| 240 | # define OPER_MODE_REG_RSF 0x02000000 /* rec store and forward */ |
| 241 | # define OPER_MODE_REG_DFF 0x01000000 /* disable flush of rec frames */ |
| 242 | |
| 243 | # define OPER_MODE_REG_RFA2 0x00800000 /* thresh MSB for act flow-ctl */ |
| 244 | # define OPER_MODE_REG_RFD2 0x00400000 /* thresh MSB deAct flow-ctl */ |
| 245 | # define OPER_MODE_REG_TSF 0x00200000 /* tx store and forward */ |
| 246 | # define OPER_MODE_REG_FTF 0x00100000 /* flush tx FIFO */ |
| 247 | |
| 248 | # define OPER_MODE_REG_RSVD1 0x000e0000 /* reserved */ |
| 249 | # define OPER_MODE_REG_TTC 0x0001c000 /* transmit threshold control */ |
| 250 | # define OPER_MODE_REG_TTC_SET(x) (OPER_MODE_REG_TTC & (x << 14)) |
| 251 | # define OPER_MODE_REG_ST 0x00002000 /* start/stop transmission cmd */ |
| 252 | |
| 253 | # define OPER_MODE_REG_RFD 0x00001800 /* thresh for deAct flow-ctl */ |
| 254 | # define OPER_MODE_REG_RFA 0x00000600 /* threshold for act flow-ctl */ |
| 255 | # define OPER_MODE_REG_EFC 0x00000100 /* enable HW flow-ctl */ |
| 256 | |
| 257 | # define OPER_MODE_REG_FEF 0x00000080 /* forward error frames */ |
| 258 | # define OPER_MODE_REG_FUF 0x00000040 /* forward undersize good fr */ |
| 259 | # define OPER_MODE_REG_RSVD2 0x00000020 /* reserved */ |
| 260 | # define OPER_MODE_REG_RTC 0x00000018 /* receive threshold control */ |
| 261 | # define OPER_MODE_REG_RTC_SET(x) (OPER_MODE_REG_RTC & (x << 3)) |
| 262 | |
| 263 | # define OPER_MODE_REG_OSF 0x00000004 /* operate on second frame */ |
| 264 | # define OPER_MODE_REG_SR 0x00000002 /* start/stop receive */ |
| 265 | # define OPER_MODE_REG_RSVD3 0x00000001 /* reserved */ |
| 266 | |
| 267 | |
| 268 | #define OPER_MODE_REG_DEFAULT (OPER_MODE_REG_RSF \ |
| 269 | | OPER_MODE_REG_TSF \ |
| 270 | | OPER_MODE_REG_TTC_SET(5) \ |
| 271 | | OPER_MODE_REG_RTC_SET(1) \ |
| 272 | | OPER_MODE_REG_OSF) |
| 273 | |
| 274 | # define INTRP_EN_REG 0x101c |
| 275 | |
| 276 | # define INTRP_EN_REG_RSVD1 0xfffc0000 /* */ |
| 277 | # define INTRP_EN_REG_NIE 0x00010000 /* normal intrpt summ enable */ |
| 278 | |
| 279 | # define INTRP_EN_REG_AIE 0x00008000 /* abnormal intrpt summary en */ |
| 280 | # define INTRP_EN_REG_ERE 0x00004000 /* early receive intrpt enable */ |
| 281 | # define INTRP_EN_REG_FBE 0x00002000 /* fatal bus error enable */ |
| 282 | |
| 283 | # define INTRP_EN_REG_RSVD2 0x00001800 /* */ |
| 284 | |
| 285 | # define INTRP_EN_REG_ETE 0x00000400 /* early tx intrpt enable */ |
| 286 | # define INTRP_EN_REG_RWE 0x00000200 /* rx watchdog timeout enable */ |
| 287 | # define INTRP_EN_REG_RSE 0x00000100 /* rx stopped enable */ |
| 288 | |
| 289 | # define INTRP_EN_REG_RUE 0x00000080 /* rx buf unavailable enable */ |
| 290 | # define INTRP_EN_REG_RIE 0x00000040 /* rx interrupt enable */ |
| 291 | # define INTRP_EN_REG_UNE 0x00000020 /* underflow interrupt enable */ |
| 292 | # define INTRP_EN_REG_OVE 0x00000010 /* overflow interrupt enable */ |
| 293 | |
| 294 | # define INTRP_EN_REG_TJE 0x00000008 /* tx jabber timeout enable */ |
| 295 | # define INTRP_EN_REG_TUE 0x00000004 /* tx buf unavailable enable */ |
| 296 | # define INTRP_EN_REG_TSE 0x00000002 /* tx stopped enable */ |
| 297 | # define INTRP_EN_REG_TIE 0x00000001 /* tx interrupt enable */ |
| 298 | |
| 299 | # define INTRP_EN_REG_All (~(INTRP_EN_REG_RSVD1)) |
| 300 | |
| 301 | # define MIS_FR_REG 0x1020 |
| 302 | |
| 303 | # define MIS_FR_REG_FIFO_OVFL 0x10000000 /* fifo overflow */ |
| 304 | # define MIS_FR_REG_FIFO_CNT 0x0FFE0000 /* fifo cnt */ |
| 305 | |
| 306 | # define MIS_FR_REG_MISS_OVFL 0x00010000 /* missed-frame overflow */ |
| 307 | # define MIS_FR_REG_MISS_CNT 0x0000FFFF /* missed-frame cnt */ |
| 308 | |
| 309 | # define RX_INTRP_WTCHDOG_REG 0x1024 |
| 310 | # define AXI_BUS_MODE_REG 0x1028 |
| 311 | |
| 312 | # define AXI_BUS_MODE_EN_LPI 0x80000000 /* enable low power interface */ |
| 313 | # define AXI_BUS_MODE_UNLK_MGC_PKT 0x40000000 /* unlock-magic-pkt/rem-wk-up */ |
| 314 | # define AXI_BUS_MODE_WR_OSR_LMT 0x00F00000 /* max wr out stndg req limit */ |
| 315 | # define AXI_BUS_MODE_RD_OSR_LMT 0x000F0000 /* max rd out stndg req limit */ |
| 316 | # define AXI_BUS_MODE_AXI_AAL 0x00001000 /* address aligned beats */ |
| 317 | # define AXI_BUS_MODE_BLEN256 0x00000080 /* axi burst length 256 */ |
| 318 | # define AXI_BUS_MODE_BLEN128 0x00000040 /* axi burst length 128 */ |
| 319 | # define AXI_BUS_MODE_BLEN64 0x00000020 /* axi burst length 64 */ |
| 320 | # define AXI_BUS_MODE_BLEN32 0x00000010 /* axi burst length 32 */ |
| 321 | # define AXI_BUS_MODE_BLEN16 0x00000008 /* axi burst length 16 */ |
| 322 | # define AXI_BUS_MODE_BLEN8 0x00000004 /* axi burst length 8 */ |
| 323 | # define AXI_BUS_MODE_BLEN4 0x00000002 /* axi burst length 4 */ |
| 324 | # define AXI_BUS_MODE_UNDEF 0x00000001 /* axi undef burst length */ |
| 325 | |
| 326 | #define AXI_BUS_MODE_DEFAULT (AXI_BUS_MODE_WR_OSR_LMT \ |
| 327 | | AXI_BUS_MODE_RD_OSR_LMT \ |
| 328 | | AXI_BUS_MODE_BLEN16 \ |
| 329 | | AXI_BUS_MODE_BLEN8 \ |
| 330 | | AXI_BUS_MODE_BLEN4) |
| 331 | |
| 332 | # define AXI_STATUS_REG 0x102c |
| 333 | |
| 334 | /* 0x1030-0x1044 reserved */ |
| 335 | # define CUR_HOST_TX_DES_REG 0x1048 |
| 336 | # define CUR_HOST_RX_DES_REG 0x104c |
| 337 | # define CUR_HOST_TX_BU_ADR_REG 0x1050 |
| 338 | # define CUR_HOST_RX_BU_ADR_REG 0x1054 |
| 339 | |
| 340 | # define HW_FEATURE_REG 0x1058 |
| 341 | |
| 342 | # define MAC_CONFIG_REG 0x0000 |
| 343 | |
| 344 | # define MAC_CONFIG_REG_RSVD1 0xf8000000 /* */ |
| 345 | |
| 346 | # define MAC_CONFIG_REG_SFTERR 0x04000000 /* smii force tx error */ |
| 347 | # define MAC_CONFIG_REG_CST 0x02000000 /* crc strip for type frame */ |
| 348 | # define MAC_CONFIG_REG_TC 0x01000000 /* tx cfg in rgmii/sgmii/smii */ |
| 349 | |
| 350 | # define MAC_CONFIG_REG_WD 0x00800000 /* watchdog disable */ |
| 351 | # define MAC_CONFIG_REG_JD 0x00400000 /* jabber disable */ |
| 352 | # define MAC_CONFIG_REG_BE 0x00200000 /* frame burst enable */ |
| 353 | # define MAC_CONFIG_REG_JE 0x00100000 /* jumbo frame enable */ |
| 354 | |
| 355 | # define MAC_CONFIG_REG_IFG 0x000e0000 /* inter frame gap, 96-(8*n) */ |
| 356 | # define MAC_CONFIG_REG_DCRS 0x00010000 /* dis carrier sense during tx */ |
| 357 | |
| 358 | # define MAC_CONFIG_REG_PS 0x00008000 /* port select: 0/1 g/(10/100) */ |
| 359 | # define MAC_CONFIG_REG_FES 0x00004000 /* speed 100 mbps */ |
| 360 | # define MAC_CONFIG_REG_SPD (MAC_CONFIG_REG_PS | MAC_CONFIG_REG_FES) |
| 361 | # define MAC_CONFIG_REG_SPD_1G (0) |
| 362 | # define MAC_CONFIG_REG_SPD_100 (MAC_CONFIG_REG_PS | MAC_CONFIG_REG_FES) |
| 363 | # define MAC_CONFIG_REG_SPD_10 (MAC_CONFIG_REG_PS) |
| 364 | # define MAC_CONFIG_REG_SPD_SET(x) (MAC_CONFIG_REG_PS_FES & (x << 14)) |
| 365 | |
| 366 | # define MAC_CONFIG_REG_DO 0x00002000 /* disable receive own */ |
| 367 | # define MAC_CONFIG_REG_LM 0x00001000 /* loopback mode */ |
| 368 | |
| 369 | # define MAC_CONFIG_REG_DM 0x00000800 /* (full) duplex mode */ |
| 370 | # define MAC_CONFIG_REG_IPC 0x00000400 /* checksum offload */ |
| 371 | # define MAC_CONFIG_REG_DR 0x00000200 /* disable retry */ |
| 372 | # define MAC_CONFIG_REG_LUD 0x00000100 /* link up/down */ |
| 373 | |
| 374 | # define MAC_CONFIG_REG_ACS 0x00000080 /* auto pad/crc stripping */ |
| 375 | # define MAC_CONFIG_REG_BL 0x00000060 /* back-off limit */ |
| 376 | # define MAC_CONFIG_REG_BL_10 0x00000000 /* 10 */ |
| 377 | # define MAC_CONFIG_REG_BL_8 0x00000020 /* 8 */ |
| 378 | # define MAC_CONFIG_REG_BL_4 0x00000040 /* 4 */ |
| 379 | # define MAC_CONFIG_REG_BL_1 0x00000060 /* 1 */ |
| 380 | # define MAC_CONFIG_REG_DC 0x00000010 /* deferral check */ |
| 381 | |
| 382 | # define MAC_CONFIG_REG_TE 0x00000008 /* transmitter enable */ |
| 383 | # define MAC_CONFIG_REG_RE 0x00000004 /* receiver enable */ |
| 384 | # define MAC_CONFIG_REG_RSVD2 0x00000003 /* */ |
| 385 | |
| 386 | # define MAC_FR_FILTER_REG 0x0004 |
| 387 | |
| 388 | # define MAC_FR_FILTER_RA 0x80000000 /* receive all */ |
| 389 | |
| 390 | # define MAC_FR_FILTER_HPF 0x00000400 /* hash or perfect filter */ |
| 391 | # define MAC_FR_FILTER_SAF 0x00000200 /* source addr filt en */ |
| 392 | # define MAC_FR_FILTER_SAIF 0x00000100 /* SA inverse filter */ |
| 393 | # define MAC_FR_FILTER_PCF_MASK 0x000000c0 /* pass control frames */ |
| 394 | # define MAC_FR_FILTER_PCF_0 0x00000000 /* */ |
| 395 | # define MAC_FR_FILTER_PCF_1 0x00000040 /* */ |
| 396 | # define MAC_FR_FILTER_PCF_2 0x00000080 /* */ |
| 397 | # define MAC_FR_FILTER_PCF_3 0x000000c0 /* */ |
| 398 | # define MAC_FR_FILTER_DBF 0x00000020 /* disable broadcast frames */ |
| 399 | # define MAC_FR_FILTER_PM 0x00000010 /* pass all multicast */ |
| 400 | # define MAC_FR_FILTER_DAIF 0x00000008 /* DA inverse filtering */ |
| 401 | # define MAC_FR_FILTER_HMC 0x00000004 /* hash multicast */ |
| 402 | # define MAC_FR_FILTER_HUC 0x00000002 /* hash unicast */ |
| 403 | # define MAC_FR_FILTER_PR 0x00000001 /* promiscuous mode */ |
| 404 | |
| 405 | # define HASH_TABLE_HIGH_REG 0x0008 |
| 406 | # define HASH_TABLE_LOW_REG 0x000c |
| 407 | |
| 408 | # define GMII_ADR_REG 0x0010 |
| 409 | |
| 410 | # define GMII_ADR_REG_PA 0x0000f800 /* addr bits */ |
| 411 | # define GMII_ADR_REG_GR 0x000007c0 /* addr bits */ |
| 412 | # define GMII_ADR_REG_RSVRD1 0x00000020 /* */ |
| 413 | # define GMII_ADR_REG_CR 0x0000001c /* csr clock range */ |
| 414 | # define GMII_ADR_REG_GW 0x00000002 /* gmii write */ |
| 415 | # define GMII_ADR_REG_GB 0x00000001 /* gmii busy */ |
| 416 | |
| 417 | # define GMII_ADR_REG_ADR_SET(x) (GMII_ADR_REG_PA & (x << 11)) |
| 418 | # define GMII_ADR_REG_ADR_GET(x) ((x & GMII_ADR_REG_PA) >> 11) |
| 419 | |
| 420 | # define GMII_ADR_REG_REG_SET(x) (GMII_ADR_REG_GR & (x << 6)) |
| 421 | # define GMII_ADR_REG_REG_GET(x) (((x & GMII_ADR_REG_GR) >> 6) |
| 422 | |
| 423 | # define GMII_ADR_REG_CSR_SET(x) (GMII_ADR_REG_CR & (x << 2)) |
| 424 | # define GMII_ADR_REG_CSR_GET(x) (((x & GMII_ADR_REG_CR) >> 2) |
| 425 | |
| 426 | # define GMII_DATA_REG 0x0014 |
| 427 | |
| 428 | # define GMII_DATA_REG_DATA 0x0000ffff /* gmii data */ |
| 429 | |
| 430 | # define FLOW_CONTROL_REG 0x0018 |
| 431 | |
| 432 | # define FLOW_CONTROL_PT 0xFFFF0000 /* pause time */ |
| 433 | # define FLOW_CONTROL_DZPQ 0x00000080 /* disable zero-quanta pause */ |
| 434 | # define FLOW_CONTROL_PLT 0x00000030 /* pause level threshold */ |
| 435 | |
| 436 | # define FLOW_CONTROL_UP 0x00000008 /* unicast pause frame detect */ |
| 437 | # define FLOW_CONTROL_RFE 0x00000004 /* receive flow control enable */ |
| 438 | # define FLOW_CONTROL_TFE 0x00000002 /* transmit flow control enable */ |
| 439 | # define FLOW_CONTROL_FCB 0x00000001 /* flow control busy (BPA) */ |
| 440 | |
| 441 | # define VLAN_TAG_REG 0x001c |
| 442 | |
| 443 | # define VERSION_REG 0x0020 |
| 444 | |
| 445 | /* don't define these until HW if finished */ |
| 446 | /* # define VERSION_USER 0x10 */ |
| 447 | /* # define VERSION_QFEC 0x36 */ |
| 448 | |
| 449 | # define VERSION_REG_USER(x) (0xFF & (x >> 8)) |
| 450 | # define VERSION_REG_QFEC(x) (0xFF & x) |
| 451 | |
| 452 | # define DEBUG_REG 0x0024 |
| 453 | |
| 454 | # define DEBUG_REG_RSVD1 0xfc000000 /* */ |
| 455 | # define DEBUG_REG_TX_FIFO_FULL 0x02000000 /* Tx fifo full */ |
| 456 | # define DEBUG_REG_TX_FIFO_NEMP 0x01000000 /* Tx fifo not empty */ |
| 457 | |
| 458 | # define DEBUG_REG_RSVD2 0x00800000 /* */ |
| 459 | # define DEBUG_REG_TX_WR_ACTIVE 0x00400000 /* Tx fifo write ctrl active */ |
| 460 | |
| 461 | # define DEBUG_REG_TX_RD_STATE 0x00300000 /* Tx fifo rd ctrl state */ |
| 462 | # define DEBUG_REG_TX_RD_IDLE 0x00000000 /* idle */ |
| 463 | # define DEBUG_REG_TX_RD_WAIT 0x00100000 /* waiting for status */ |
| 464 | # define DEBUG_REG_TX_RD_PASUE 0x00200000 /* generating pause */ |
| 465 | # define DEBUG_REG_TX_RD_WRTG 0x00300000 /* wr stat flush fifo */ |
| 466 | |
| 467 | # define DEBUG_REG_TX_PAUSE 0x00080000 /* Tx in pause condition */ |
| 468 | |
| 469 | # define DEBUG_REG_TX_CTRL_STATE 0x00060000 /* Tx frame controller state */ |
| 470 | # define DEBUG_REG_TX_CTRL_IDLE 0x00090000 /* idle */ |
| 471 | # define DEBUG_REG_TX_CTRL_WAIT 0x00020000 /* waiting for status*/ |
| 472 | # define DEBUG_REG_TX_CTRL_PAUSE 0x00040000 /* generating pause */ |
| 473 | # define DEBUG_REG_TX_CTRL_XFER 0x00060000 /* transferring input */ |
| 474 | |
| 475 | # define DEBUG_REG_TX_ACTIVE 0x00010000 /* Tx actively transmitting */ |
| 476 | # define DEBUG_REG_RSVD3 0x0000fc00 /* */ |
| 477 | |
| 478 | # define DEBUG_REG_RX_STATE 0x00000300 /* Rx fifo state */ |
| 479 | # define DEBUG_REG_RX_EMPTY 0x00000000 /* empty */ |
| 480 | # define DEBUG_REG_RX_LOW 0x00000100 /* below threshold */ |
| 481 | # define DEBUG_REG_RX_HIGH 0x00000200 /* above threshold */ |
| 482 | # define DEBUG_REG_RX_FULL 0x00000300 /* full */ |
| 483 | |
| 484 | # define DEBUG_REG_RSVD4 0x00000080 /* */ |
| 485 | |
| 486 | # define DEBUG_REG_RX_RD_STATE 0x00000060 /* Rx rd ctrl state */ |
| 487 | # define DEBUG_REG_RX_RD_IDLE 0x00000000 /* idle */ |
| 488 | # define DEBUG_REG_RX_RD_RDG_FR 0x00000020 /* reading frame data */ |
| 489 | # define DEBUG_REG_RX_RD_RDG_STA 0x00000040 /* reading status */ |
| 490 | # define DEBUG_REG_RX_RD_FLUSH 0x00000060 /* flush fr data/stat */ |
| 491 | |
| 492 | # define DEBUG_REG_RX_ACTIVE 0x00000010 /* Rx wr ctlr active */ |
| 493 | |
| 494 | # define DEBUG_REG_RSVD5 0x00000008 /* */ |
| 495 | # define DEBUG_REG_SM_FIFO_RW_STA 0x00000006 /* small fifo rd/wr state */ |
| 496 | # define DEBUG_REG_RX_RECVG 0x00000001 /* Rx actively receiving data */ |
| 497 | |
| 498 | # define REM_WAKEUP_FR_REG 0x0028 |
| 499 | # define PMT_CTRL_STAT_REG 0x002c |
| 500 | /* 0x0030-0x0034 reserved */ |
| 501 | |
| 502 | # define INTRP_STATUS_REG 0x0038 |
| 503 | |
| 504 | # define INTRP_STATUS_REG_RSVD1 0x0000fc00 /* */ |
| 505 | # define INTRP_STATUS_REG_TSI 0x00000200 /* time stamp int stat */ |
| 506 | # define INTRP_STATUS_REG_RSVD2 0x00000100 /* */ |
| 507 | |
| 508 | # define INTRP_STATUS_REG_RCOI 0x00000080 /* rec checksum offload int */ |
| 509 | # define INTRP_STATUS_REG_TI 0x00000040 /* tx int stat */ |
| 510 | # define INTRP_STATUS_REG_RI 0x00000020 /* rx int stat */ |
| 511 | # define INTRP_STATUS_REG_NI 0x00000010 /* normal int summary */ |
| 512 | |
| 513 | # define INTRP_STATUS_REG_PMTI 0x00000008 /* PMT int */ |
| 514 | # define INTRP_STATUS_REG_ANC 0x00000004 /* auto negotiation complete */ |
| 515 | # define INTRP_STATUS_REG_LSC 0x00000002 /* link status change */ |
| 516 | # define INTRP_STATUS_REG_MII 0x00000001 /* rgMii/sgMii int */ |
| 517 | |
| 518 | # define INTRP_MASK_REG 0x003c |
| 519 | |
| 520 | # define INTRP_MASK_REG_RSVD1 0xfc00 /* */ |
| 521 | # define INTRP_MASK_REG_TSIM 0x0200 /* time stamp int mask */ |
| 522 | # define INTRP_MASK_REG_RSVD2 0x01f0 /* */ |
| 523 | |
| 524 | # define INTRP_MASK_REG_PMTIM 0x0000 /* PMT int mask */ |
| 525 | # define INTRP_MASK_REG_ANCM 0x0000 /* auto negotiation compl mask */ |
| 526 | # define INTRP_MASK_REG_LSCM 0x0000 /* link status change mask */ |
| 527 | # define INTRP_MASK_REG_MIIM 0x0000 /* rgMii/sgMii int mask */ |
| 528 | |
| 529 | # define MAC_ADR_0_HIGH_REG 0x0040 |
| 530 | # define MAC_ADR_0_LOW_REG 0x0044 |
| 531 | /* additional pairs of registers for MAC addresses 1-15 */ |
| 532 | |
| 533 | # define AN_CONTROL_REG 0x00c0 |
| 534 | |
| 535 | # define AN_CONTROL_REG_RSVRD1 0xfff80000 /* */ |
| 536 | # define AN_CONTROL_REG_SGM_RAL 0x00040000 /* sgmii ral control */ |
| 537 | # define AN_CONTROL_REG_LR 0x00020000 /* lock to reference */ |
| 538 | # define AN_CONTROL_REG_ECD 0x00010000 /* enable comma detect */ |
| 539 | |
| 540 | # define AN_CONTROL_REG_RSVRD2 0x00008000 /* */ |
| 541 | # define AN_CONTROL_REG_ELE 0x00004000 /* external loopback enable */ |
| 542 | # define AN_CONTROL_REG_RSVRD3 0x00002000 /* */ |
| 543 | # define AN_CONTROL_REG_ANE 0x00001000 /* auto negotiation enable */ |
| 544 | |
| 545 | # define AN_CONTROL_REG_RSRVD4 0x00000c00 /* */ |
| 546 | # define AN_CONTROL_REG_RAN 0x00000200 /* restart auto negotiation */ |
| 547 | # define AN_CONTROL_REG_RSVRD5 0x000001ff /* */ |
| 548 | |
| 549 | # define AN_STATUS_REG 0x00c4 |
| 550 | |
| 551 | # define AN_STATUS_REG_RSVRD1 0xfffffe00 /* */ |
| 552 | # define AN_STATUS_REG_ES 0x00000100 /* extended status */ |
| 553 | # define AN_STATUS_REG_RSVRD2 0x000000c0 /* */ |
| 554 | # define AN_STATUS_REG_ANC 0x00000020 /* auto-negotiation complete */ |
| 555 | # define AN_STATUS_REG_RSVRD3 0x00000010 /* */ |
| 556 | # define AN_STATUS_REG_ANA 0x00000008 /* auto-negotiation ability */ |
| 557 | # define AN_STATUS_REG_LS 0x00000004 /* link status */ |
| 558 | # define AN_STATUS_REG_RSVRD4 0x00000003 /* */ |
| 559 | |
| 560 | # define AN_ADVERTISE_REG 0x00c8 |
| 561 | # define AN_LNK_PRTNR_ABIL_REG 0x00cc |
| 562 | # define AN_EXPANDSION_REG 0x00d0 |
| 563 | # define TBI_EXT_STATUS_REG 0x00d4 |
| 564 | |
| 565 | # define SG_RG_SMII_STATUS_REG 0x00d8 |
| 566 | |
| 567 | # define LINK_STATUS_REG 0x00d8 |
| 568 | |
| 569 | # define LINK_STATUS_REG_RSVRD1 0xffffffc0 /* */ |
| 570 | # define LINK_STATUS_REG_FCD 0x00000020 /* false carrier detect */ |
| 571 | # define LINK_STATUS_REG_JT 0x00000010 /* jabber timeout */ |
| 572 | # define LINK_STATUS_REG_UP 0x00000008 /* link status */ |
| 573 | |
| 574 | # define LINK_STATUS_REG_SPD 0x00000006 /* link speed */ |
| 575 | # define LINK_STATUS_REG_SPD_2_5 0x00000000 /* 10M 2.5M * 4 */ |
| 576 | # define LINK_STATUS_REG_SPD_25 0x00000002 /* 100M 25M * 4 */ |
| 577 | # define LINK_STATUS_REG_SPD_125 0x00000004 /* 1G 125M * 8 */ |
| 578 | |
| 579 | # define LINK_STATUS_REG_F_DUPLEX 0x00000001 /* full duplex */ |
| 580 | |
| 581 | /* 0x00dc-0x00fc reserved */ |
| 582 | |
| 583 | /* MMC Register Map is from 0x0100-0x02fc */ |
| 584 | # define MMC_CNTRL_REG 0x0100 |
| 585 | # define MMC_INTR_RX_REG 0x0104 |
| 586 | # define MMC_INTR_TX_REG 0x0108 |
| 587 | # define MMC_INTR_MASK_RX_REG 0x010C |
| 588 | # define MMC_INTR_MASK_TX_REG 0x0110 |
| 589 | |
| 590 | /* 0x0300-0x06fc reserved */ |
| 591 | |
| 592 | /* precision time protocol time stamp registers */ |
| 593 | |
| 594 | # define TS_CTL_REG 0x0700 |
| 595 | |
| 596 | # define TS_CTL_ATSFC 0x00080000 |
| 597 | # define TS_CTL_TSENMAC 0x00040000 |
| 598 | |
| 599 | # define TS_CTL_TSCLKTYPE 0x00030000 |
| 600 | # define TS_CTL_TSCLK_ORD 0x00000000 |
| 601 | # define TS_CTL_TSCLK_BND 0x00010000 |
| 602 | # define TS_CTL_TSCLK_ETE 0x00020000 |
| 603 | # define TS_CTL_TSCLK_PTP 0x00030000 |
| 604 | |
| 605 | # define TS_CTL_TSMSTRENA 0x00008000 |
| 606 | # define TS_CTL_TSEVNTENA 0x00004000 |
| 607 | # define TS_CTL_TSIPV4ENA 0x00002000 |
| 608 | # define TS_CTL_TSIPV6ENA 0x00001000 |
| 609 | |
| 610 | # define TS_CTL_TSIPENA 0x00000800 |
| 611 | # define TS_CTL_TSVER2ENA 0x00000400 |
| 612 | # define TS_CTL_TSCTRLSSR 0x00000200 |
| 613 | # define TS_CTL_TSENALL 0x00000100 |
| 614 | |
| 615 | # define TS_CTL_TSADDREG 0x00000020 |
| 616 | # define TS_CTL_TSTRIG 0x00000010 |
| 617 | |
| 618 | # define TS_CTL_TSUPDT 0x00000008 |
| 619 | # define TS_CTL_TSINIT 0x00000004 |
| 620 | # define TS_CTL_TSCFUPDT 0x00000002 |
| 621 | # define TS_CTL_TSENA 0x00000001 |
| 622 | |
| 623 | |
| 624 | # define TS_SUB_SEC_INCR_REG 0x0704 |
| 625 | # define TS_HIGH_REG 0x0708 |
| 626 | # define TS_LOW_REG 0x070c |
| 627 | # define TS_HI_UPDT_REG 0x0710 |
| 628 | # define TS_LO_UPDT_REG 0x0714 |
| 629 | # define TS_APPEND_REG 0x0718 |
| 630 | # define TS_TARG_TIME_HIGH_REG 0x071c |
| 631 | # define TS_TARG_TIME_LOW_REG 0x0720 |
| 632 | # define TS_HIGHER_WD_REG 0x0724 |
| 633 | # define TS_STATUS_REG 0x072c |
| 634 | |
| 635 | /* 0x0730-0x07fc reserved */ |
| 636 | |
| 637 | # define MAC_ADR16_HIGH_REG 0x0800 |
| 638 | # define MAC_ADR16_LOW_REG 0x0804 |
| 639 | /* additional pairs of registers for MAC addresses 17-31 */ |
| 640 | |
| 641 | # define MAC_ADR_MAX 32 |
| 642 | |
| 643 | |
| 644 | # define QFEC_INTRP_SETUP (INTRP_EN_REG_AIE \ |
| 645 | | INTRP_EN_REG_FBE \ |
| 646 | | INTRP_EN_REG_RWE \ |
| 647 | | INTRP_EN_REG_RSE \ |
| 648 | | INTRP_EN_REG_RUE \ |
| 649 | | INTRP_EN_REG_UNE \ |
| 650 | | INTRP_EN_REG_OVE \ |
| 651 | | INTRP_EN_REG_TJE \ |
| 652 | | INTRP_EN_REG_TSE \ |
| 653 | | INTRP_EN_REG_NIE \ |
| 654 | | INTRP_EN_REG_RIE \ |
| 655 | | INTRP_EN_REG_TIE) |
| 656 | |
| 657 | /* |
| 658 | * ASIC Ethernet clock register definitions: |
| 659 | * address offsets and some register definitions |
| 660 | */ |
| 661 | |
| 662 | # define EMAC_CLK_REG_BASE 0x94020000 |
| 663 | |
| 664 | /* |
| 665 | * PHY clock PLL register locations |
| 666 | */ |
| 667 | # define ETH_MD_REG 0x02A4 |
| 668 | # define ETH_NS_REG 0x02A8 |
| 669 | |
| 670 | /* definitions of NS_REG control bits |
| 671 | */ |
| 672 | # define ETH_NS_SRC_SEL 0x0007 |
| 673 | |
| 674 | # define ETH_NS_PRE_DIV_MSK 0x0018 |
| 675 | # define ETH_NS_PRE_DIV(x) (ETH_NS_PRE_DIV_MSK & (x << 3)) |
| 676 | |
| 677 | # define ETH_NS_MCNTR_MODE_MSK 0x0060 |
| 678 | # define ETH_NS_MCNTR_MODE_BYPASS 0x0000 |
| 679 | # define ETH_NS_MCNTR_MODE_SWALLOW 0x0020 |
| 680 | # define ETH_NS_MCNTR_MODE_DUAL 0x0040 |
| 681 | # define ETH_NS_MCNTR_MODE_SINGLE 0x0060 |
| 682 | |
| 683 | # define ETH_NS_MCNTR_RST 0x0080 |
| 684 | # define ETH_NS_MCNTR_EN 0x0100 |
| 685 | |
| 686 | # define EMAC_PTP_NS_CLK_EN 0x0200 |
| 687 | # define EMAC_PTP_NS_CLK_INV 0x0400 |
| 688 | # define EMAC_PTP_NS_ROOT_EN 0x0800 |
| 689 | |
| 690 | /* clock sources |
| 691 | */ |
| 692 | # define CLK_SRC_TCXO 0x0 |
| 693 | # define CLK_SRC_PLL_GLOBAL 0x1 |
| 694 | # define CLK_SRC_PLL_ARM 0x2 |
| 695 | # define CLK_SRC_PLL_QDSP6 0x3 |
| 696 | # define CLK_SRC_PLL_EMAC 0x4 |
| 697 | # define CLK_SRC_EXT_CLK2 0x5 |
| 698 | # define CLK_SRC_EXT_CLK1 0x6 |
| 699 | # define CLK_SRC_CORE_TEST 0x7 |
| 700 | |
| 701 | # define ETH_MD_M(x) (x << 16) |
| 702 | # define ETH_MD_2D_N(x) ((~(x) & 0xffff)) |
| 703 | # define ETH_NS_NM(x) ((~(x) << 16) & 0xffff0000) |
| 704 | |
| 705 | /* |
| 706 | * PHY interface clock divider |
| 707 | */ |
| 708 | # define ETH_X_EN_NS_REG 0x02AC |
| 709 | |
| 710 | # define ETH_RX_CLK_FB_INV 0x80 |
| 711 | # define ETH_RX_CLK_FB_EN 0x40 |
| 712 | # define ETH_TX_CLK_FB_INV 0x20 |
| 713 | # define ETH_TX_CLK_FB_EN 0x10 |
| 714 | # define ETH_RX_CLK_INV 0x08 |
| 715 | # define ETH_RX_CLK_EN 0x04 |
| 716 | # define ETH_TX_CLK_INV 0x02 |
| 717 | # define ETH_TX_CLK_EN 0x01 |
| 718 | |
| 719 | # define ETH_X_EN_NS_DEFAULT \ |
| 720 | (ETH_RX_CLK_FB_EN | ETH_TX_CLK_FB_EN | ETH_RX_CLK_EN | ETH_TX_CLK_EN) |
| 721 | |
| 722 | # define EMAC_PTP_MD_REG 0x02B0 |
| 723 | |
| 724 | /* PTP clock divider |
| 725 | */ |
| 726 | # define EMAC_PTP_NS_REG 0x02B4 |
| 727 | |
| 728 | /* |
| 729 | * clock interface pin controls |
| 730 | */ |
| 731 | # define EMAC_NS_REG 0x02B8 |
| 732 | |
| 733 | # define EMAC_RX_180_CLK_INV 0x2000 |
| 734 | # define EMAC_RX_180_CLK_EN 0x1000 |
| 735 | # define EMAC_RX_180_CLK_EN_INV (EMAC_RX_180_CLK_INV | EMAC_RX_180_CLK_EN) |
| 736 | |
| 737 | # define EMAC_TX_180_CLK_INV 0x0800 |
| 738 | # define EMAC_TX_180_CLK_EN 0x0400 |
| 739 | # define EMAC_TX_180_CLK_EN_INV (EMAC_TX_180_CLK_INV | EMAC_TX_180_CLK_EN) |
| 740 | |
| 741 | # define EMAC_REVMII_RX_CLK_INV 0x0200 |
| 742 | # define EMAC_REVMII_RX_CLK_EN 0x0100 |
| 743 | |
| 744 | # define EMAC_RX_CLK_INV 0x0080 |
| 745 | # define EMAC_RX_CLK_EN 0x0040 |
| 746 | |
| 747 | # define EMAC_REVMII_TX_CLK_INV 0x0020 |
| 748 | # define EMAC_REVMII_TX_CLK_EN 0x0010 |
| 749 | |
| 750 | # define EMAC_TX_CLK_INV 0x0008 |
| 751 | # define EMAC_TX_CLK_EN 0x0004 |
| 752 | |
| 753 | # define EMAC_RX_R_CLK_EN 0x0002 |
| 754 | # define EMAC_TX_R_CLK_EN 0x0001 |
| 755 | |
| 756 | # define EMAC_NS_DEFAULT \ |
| 757 | (EMAC_RX_180_CLK_EN_INV | EMAC_TX_180_CLK_EN_INV \ |
| 758 | | EMAC_REVMII_RX_CLK_EN | EMAC_REVMII_TX_CLK_EN \ |
| 759 | | EMAC_RX_CLK_EN | EMAC_TX_CLK_EN \ |
| 760 | | EMAC_RX_R_CLK_EN | EMAC_TX_R_CLK_EN) |
| 761 | |
| 762 | /* |
| 763 | * |
| 764 | */ |
| 765 | # define EMAC_TX_FS_REG 0x02BC |
| 766 | # define EMAC_RX_FS_REG 0x02C0 |
| 767 | |
| 768 | /* |
| 769 | * Ethernet controller PHY interface select |
| 770 | */ |
| 771 | # define EMAC_PHY_INTF_SEL_REG 0x18030 |
| 772 | |
| 773 | # define EMAC_PHY_INTF_SEL_MII 0x0 |
| 774 | # define EMAC_PHY_INTF_SEL_RGMII 0x1 |
| 775 | # define EMAC_PHY_INTF_SEL_REVMII 0x7 |
| 776 | # define EMAC_PHY_INTF_SEL_MASK 0x7 |
| 777 | |
| 778 | /* |
| 779 | * MDIO addresses |
| 780 | */ |
| 781 | # define EMAC_PHY_ADDR_REG 0x18034 |
| 782 | # define EMAC_REVMII_PHY_ADDR_REG 0x18038 |
| 783 | |
| 784 | /* |
| 785 | * clock routing |
| 786 | */ |
| 787 | # define EMAC_CLKMUX_SEL_REG 0x1803c |
| 788 | |
| 789 | # define EMAC_CLKMUX_SEL_0 0x1 |
| 790 | # define EMAC_CLKMUX_SEL_1 0x2 |
| 791 | |
| 792 | |
| 793 | #endif |