1
2
3#ifndef _VSC7321_REG_H_
4#define _VSC7321_REG_H_
5
6
7
8
9
10
11
12
13
14#define CRA(blk,sub,adr) ((((blk) & 0x7) << 13) | (((sub) & 0xf) << 9) | (((adr) & 0xff) << 1))
15
16
17#define REG_CHIP_ID CRA(0x7,0xf,0x00)
18#define REG_BLADE_ID CRA(0x7,0xf,0x01)
19#define REG_SW_RESET CRA(0x7,0xf,0x02)
20#define REG_MEM_BIST CRA(0x7,0xf,0x04)
21#define REG_IFACE_MODE CRA(0x7,0xf,0x07)
22#define REG_MSCH CRA(0x7,0x2,0x06)
23#define REG_CRC_CNT CRA(0x7,0x2,0x0a)
24#define REG_CRC_CFG CRA(0x7,0x2,0x0b)
25#define REG_SI_TRANSFER_SEL CRA(0x7,0xf,0x18)
26#define REG_PLL_CLK_SPEED CRA(0x7,0xf,0x19)
27#define REG_SYS_CLK_SELECT CRA(0x7,0xf,0x1c)
28#define REG_GPIO_CTRL CRA(0x7,0xf,0x1d)
29#define REG_GPIO_OUT CRA(0x7,0xf,0x1e)
30#define REG_GPIO_IN CRA(0x7,0xf,0x1f)
31#define REG_CPU_TRANSFER_SEL CRA(0x7,0xf,0x20)
32#define REG_LOCAL_DATA CRA(0x7,0xf,0xfe)
33#define REG_LOCAL_STATUS CRA(0x7,0xf,0xff)
34
35
36#define REG_AGGR_SETUP CRA(0x7,0x1,0x00)
37#define REG_PMAP_TABLE CRA(0x7,0x1,0x01)
38#define REG_MPLS_BIT0 CRA(0x7,0x1,0x08)
39#define REG_MPLS_BIT1 CRA(0x7,0x1,0x09)
40#define REG_MPLS_BIT2 CRA(0x7,0x1,0x0a)
41#define REG_MPLS_BIT3 CRA(0x7,0x1,0x0b)
42#define REG_MPLS_BITMASK CRA(0x7,0x1,0x0c)
43#define REG_PRE_BIT0POS CRA(0x7,0x1,0x10)
44#define REG_PRE_BIT1POS CRA(0x7,0x1,0x11)
45#define REG_PRE_BIT2POS CRA(0x7,0x1,0x12)
46#define REG_PRE_BIT3POS CRA(0x7,0x1,0x13)
47#define REG_PRE_ERR_CNT CRA(0x7,0x1,0x14)
48
49
50
51
52#define REG_RAM_BIST_CMD CRA(0x7,0x1,0x00)
53#define REG_RAM_BIST_RESULT CRA(0x7,0x1,0x01)
54#define BIST_PORT_SELECT 0x00
55#define BIST_COMMAND 0x01
56#define BIST_STATUS 0x02
57#define BIST_ERR_CNT_LSB 0x03
58#define BIST_ERR_CNT_MSB 0x04
59#define BIST_ERR_SEL_LSB 0x05
60#define BIST_ERR_SEL_MSB 0x06
61#define BIST_ERROR_STATE 0x07
62#define BIST_ERR_ADR0 0x08
63#define BIST_ERR_ADR1 0x09
64#define BIST_ERR_ADR2 0x0a
65#define BIST_ERR_ADR3 0x0b
66
67
68
69
70
71#define REG_TEST(ie,fn) CRA(0x2,ie&1,0x00+fn)
72#define REG_TOP_BOTTOM(ie,fn) CRA(0x2,ie&1,0x10+fn)
73#define REG_TAIL(ie,fn) CRA(0x2,ie&1,0x20+fn)
74#define REG_HEAD(ie,fn) CRA(0x2,ie&1,0x30+fn)
75#define REG_HIGH_LOW_WM(ie,fn) CRA(0x2,ie&1,0x40+fn)
76#define REG_CT_THRHLD(ie,fn) CRA(0x2,ie&1,0x50+fn)
77#define REG_FIFO_DROP_CNT(ie,fn) CRA(0x2,ie&1,0x60+fn)
78#define REG_DEBUG_BUF_CNT(ie,fn) CRA(0x2,ie&1,0x70+fn)
79#define REG_BUCKI(fn) CRA(0x2,2,0x20+fn)
80#define REG_BUCKE(fn) CRA(0x2,3,0x20+fn)
81
82
83
84
85
86
87#define REG_TRAFFIC_SHAPER_BUCKET(ie,bn) CRA(0x2,ie&1,0x0a + (bn>7) | ((bn&7)<<4))
88#define REG_TRAFFIC_SHAPER_CONTROL(ie) CRA(0x2,ie&1,0x3b)
89
90#define REG_SRAM_ADR(ie) CRA(0x2,ie&1,0x0e)
91#define REG_SRAM_WR_STRB(ie) CRA(0x2,ie&1,0x1e)
92#define REG_SRAM_RD_STRB(ie) CRA(0x2,ie&1,0x2e)
93#define REG_SRAM_DATA_0(ie) CRA(0x2,ie&1,0x3e)
94#define REG_SRAM_DATA_1(ie) CRA(0x2,ie&1,0x4e)
95#define REG_SRAM_DATA_2(ie) CRA(0x2,ie&1,0x5e)
96#define REG_SRAM_DATA_3(ie) CRA(0x2,ie&1,0x6e)
97#define REG_SRAM_DATA_BLK_TYPE(ie) CRA(0x2,ie&1,0x7e)
98
99#define REG_CONTROL(ie) CRA(0x2,ie&1,0x0f)
100#define REG_ING_CONTROL CRA(0x2,0x0,0x0f)
101#define REG_EGR_CONTROL CRA(0x2,0x1,0x0f)
102#define REG_AGE_TIMER(ie) CRA(0x2,ie&1,0x1f)
103#define REG_AGE_INC(ie) CRA(0x2,ie&1,0x2f)
104#define DEBUG_OUT(ie) CRA(0x2,ie&1,0x3f)
105#define DEBUG_CNT(ie) CRA(0x2,ie&1,0x4f)
106
107
108#define REG_SPI4_MISC CRA(0x5,0x0,0x00)
109#define REG_SPI4_STATUS CRA(0x5,0x0,0x01)
110#define REG_SPI4_ING_SETUP0 CRA(0x5,0x0,0x02)
111#define REG_SPI4_ING_SETUP1 CRA(0x5,0x0,0x03)
112#define REG_SPI4_ING_SETUP2 CRA(0x5,0x0,0x04)
113#define REG_SPI4_EGR_SETUP0 CRA(0x5,0x0,0x05)
114#define REG_SPI4_DBG_CNT(n) CRA(0x5,0x0,0x10+n)
115#define REG_SPI4_DBG_SETUP CRA(0x5,0x0,0x1A)
116#define REG_SPI4_TEST CRA(0x5,0x0,0x20)
117#define REG_TPGEN_UP0 CRA(0x5,0x0,0x21)
118#define REG_TPGEN_UP1 CRA(0x5,0x0,0x22)
119#define REG_TPCHK_UP0 CRA(0x5,0x0,0x23)
120#define REG_TPCHK_UP1 CRA(0x5,0x0,0x24)
121#define REG_TPSAM_P0 CRA(0x5,0x0,0x25)
122#define REG_TPSAM_P1 CRA(0x5,0x0,0x26)
123#define REG_TPERR_CNT CRA(0x5,0x0,0x27)
124#define REG_SPI4_STICKY CRA(0x5,0x0,0x30)
125#define REG_SPI4_DBG_INH CRA(0x5,0x0,0x31)
126#define REG_SPI4_DBG_STATUS CRA(0x5,0x0,0x32)
127#define REG_SPI4_DBG_GRANT CRA(0x5,0x0,0x33)
128
129#define REG_SPI4_DESKEW CRA(0x5,0x0,0x43)
130
131
132
133
134
135
136
137
138
139
140
141#define REG_MISC_10G CRA(0x1,0xa,0x00)
142#define REG_PAUSE_10G CRA(0x1,0xa,0x01)
143#define REG_NORMALIZER_10G CRA(0x1,0xa,0x05)
144#define REG_STICKY_RX CRA(0x1,0xa,0x06)
145#define REG_DENORM_10G CRA(0x1,0xa,0x07)
146#define REG_STICKY_TX CRA(0x1,0xa,0x08)
147#define REG_MAX_RXHIGH CRA(0x1,0xa,0x0a)
148#define REG_MAX_RXLOW CRA(0x1,0xa,0x0b)
149#define REG_MAC_TX_STICKY CRA(0x1,0xa,0x0c)
150#define REG_MAC_TX_RUNNING CRA(0x1,0xa,0x0d)
151#define REG_TX_ABORT_AGE CRA(0x1,0xa,0x14)
152#define REG_TX_ABORT_SHORT CRA(0x1,0xa,0x15)
153#define REG_TX_ABORT_TAXI CRA(0x1,0xa,0x16)
154#define REG_TX_ABORT_UNDERRUN CRA(0x1,0xa,0x17)
155#define REG_TX_DENORM_DISCARD CRA(0x1,0xa,0x18)
156#define REG_XAUI_STAT_A CRA(0x1,0xa,0x20)
157#define REG_XAUI_STAT_B CRA(0x1,0xa,0x21)
158#define REG_XAUI_STAT_C CRA(0x1,0xa,0x22)
159#define REG_XAUI_CONF_A CRA(0x1,0xa,0x23)
160#define REG_XAUI_CONF_B CRA(0x1,0xa,0x24)
161#define REG_XAUI_CODE_GRP_CNT CRA(0x1,0xa,0x25)
162#define REG_XAUI_CONF_TEST_A CRA(0x1,0xa,0x26)
163#define REG_PDERRCNT CRA(0x1,0xa,0x27)
164
165
166
167#define REG_MAX_LEN(pn) CRA(0x1,pn,0x02)
168#define REG_MAC_HIGH_ADDR(pn) CRA(0x1,pn,0x03)
169#define REG_MAC_LOW_ADDR(pn) CRA(0x1,pn,0x04)
170
171
172
173
174#define REG_MODE_CFG(pn) CRA(0x1,pn,0x00)
175#define REG_PAUSE_CFG(pn) CRA(0x1,pn,0x01)
176#define REG_NORMALIZER(pn) CRA(0x1,pn,0x05)
177#define REG_TBI_STATUS(pn) CRA(0x1,pn,0x06)
178#define REG_PCS_STATUS_DBG(pn) CRA(0x1,pn,0x07)
179#define REG_PCS_CTRL(pn) CRA(0x1,pn,0x08)
180#define REG_TBI_CONFIG(pn) CRA(0x1,pn,0x09)
181#define REG_STICK_BIT(pn) CRA(0x1,pn,0x0a)
182#define REG_DEV_SETUP(pn) CRA(0x1,pn,0x0b)
183#define REG_DROP_CNT(pn) CRA(0x1,pn,0x0c)
184#define REG_PORT_POS(pn) CRA(0x1,pn,0x0d)
185#define REG_PORT_FAIL(pn) CRA(0x1,pn,0x0e)
186#define REG_SERDES_CONF(pn) CRA(0x1,pn,0x0f)
187#define REG_SERDES_TEST(pn) CRA(0x1,pn,0x10)
188#define REG_SERDES_STAT(pn) CRA(0x1,pn,0x11)
189#define REG_SERDES_COM_CNT(pn) CRA(0x1,pn,0x12)
190#define REG_DENORM(pn) CRA(0x1,pn,0x15)
191#define REG_DBG(pn) CRA(0x1,pn,0x16)
192#define REG_TX_IFG(pn) CRA(0x1,pn,0x18)
193#define REG_HDX(pn) CRA(0x1,pn,0x19)
194
195
196
197
198
199
200enum {
201 RxInBytes = 0x00,
202 RxSymbolCarrier = 0x01,
203 RxPause = 0x02,
204 RxUnsupOpcode = 0x03,
205 RxOkBytes = 0x04,
206 RxBadBytes = 0x05,
207 RxUnicast = 0x06,
208 RxMulticast = 0x07,
209 RxBroadcast = 0x08,
210 Crc = 0x09,
211 RxAlignment = 0x0a,
212 RxUndersize = 0x0b,
213 RxFragments = 0x0c,
214 RxInRangeLengthError = 0x0d,
215 RxOutOfRangeError = 0x0e,
216 RxOversize = 0x0f,
217 RxJabbers = 0x10,
218 RxSize64 = 0x11,
219 RxSize65To127 = 0x12,
220 RxSize128To255 = 0x13,
221 RxSize256To511 = 0x14,
222 RxSize512To1023 = 0x15,
223 RxSize1024To1518 = 0x16,
224 RxSize1519ToMax = 0x17,
225
226 TxOutBytes = 0x18,
227 TxPause = 0x19,
228 TxOkBytes = 0x1a,
229 TxUnicast = 0x1b,
230 TxMulticast = 0x1c,
231 TxBroadcast = 0x1d,
232 TxMultipleColl = 0x1e,
233 TxLateColl = 0x1f,
234 TxXcoll = 0x20,
235 TxDefer = 0x21,
236 TxXdefer = 0x22,
237 TxCsense = 0x23,
238 TxSize64 = 0x24,
239 TxSize65To127 = 0x25,
240 TxSize128To255 = 0x26,
241 TxSize256To511 = 0x27,
242 TxSize512To1023 = 0x28,
243 TxSize1024To1518 = 0x29,
244 TxSize1519ToMax = 0x2a,
245 TxSingleColl = 0x2b,
246 TxBackoff2 = 0x2c,
247 TxBackoff3 = 0x2d,
248 TxBackoff4 = 0x2e,
249 TxBackoff5 = 0x2f,
250 TxBackoff6 = 0x30,
251 TxBackoff7 = 0x31,
252 TxBackoff8 = 0x32,
253 TxBackoff9 = 0x33,
254 TxBackoff10 = 0x34,
255 TxBackoff11 = 0x35,
256 TxBackoff12 = 0x36,
257 TxBackoff13 = 0x37,
258 TxBackoff14 = 0x38,
259 TxBackoff15 = 0x39,
260 TxUnderrun = 0x3a,
261
262 RxIpgShrink = 0x3c,
263
264 StatSticky1G = 0x3e,
265 StatInit = 0x3f
266};
267
268#define REG_RX_XGMII_PROT_ERR CRA(0x4,0xa,0x3b)
269#define REG_STAT_STICKY10G CRA(0x4,0xa,StatSticky1G)
270
271#define REG_RX_OK_BYTES(pn) CRA(0x4,pn,RxOkBytes)
272#define REG_RX_BAD_BYTES(pn) CRA(0x4,pn,RxBadBytes)
273#define REG_TX_OK_BYTES(pn) CRA(0x4,pn,TxOkBytes)
274
275
276
277
278
279
280
281#define REG_MIIM_STATUS CRA(0x3,0x0,0x00)
282#define REG_MIIM_CMD CRA(0x3,0x0,0x01)
283#define REG_MIIM_DATA CRA(0x3,0x0,0x02)
284#define REG_MIIM_PRESCALE CRA(0x3,0x0,0x03)
285
286#define REG_ING_FFILT_UM_EN CRA(0x2, 0, 0xd)
287#define REG_ING_FFILT_BE_EN CRA(0x2, 0, 0x1d)
288#define REG_ING_FFILT_VAL0 CRA(0x2, 0, 0x2d)
289#define REG_ING_FFILT_VAL1 CRA(0x2, 0, 0x3d)
290#define REG_ING_FFILT_MASK0 CRA(0x2, 0, 0x4d)
291#define REG_ING_FFILT_MASK1 CRA(0x2, 0, 0x5d)
292#define REG_ING_FFILT_MASK2 CRA(0x2, 0, 0x6d)
293#define REG_ING_FFILT_ETYPE CRA(0x2, 0, 0x7d)
294
295
296
297
298#endif
299