1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef __DRIVERS_NET_MPC52XX_FEC_H__
15 #define __DRIVERS_NET_MPC52XX_FEC_H__
16
17 #include <linux/phy.h>
18
19
20
21 #define FEC_RX_BUFFER_SIZE 1522
22 #define FEC_RX_NUM_BD 256
23 #define FEC_TX_NUM_BD 64
24
25 #define FEC_RESET_DELAY 50
26
27 #define FEC_WATCHDOG_TIMEOUT ((400*HZ)/1000)
28
29
30
31
32
33 struct mpc52xx_fec {
34 u32 fec_id;
35 u32 ievent;
36 u32 imask;
37
38 u32 reserved0[1];
39 u32 r_des_active;
40 u32 x_des_active;
41 u32 r_des_active_cl;
42 u32 x_des_active_cl;
43 u32 ivent_set;
44 u32 ecntrl;
45
46 u32 reserved1[6];
47 u32 mii_data;
48 u32 mii_speed;
49 u32 mii_status;
50
51 u32 reserved2[5];
52 u32 mib_data;
53 u32 mib_control;
54
55 u32 reserved3[6];
56 u32 r_activate;
57 u32 r_cntrl;
58 u32 r_hash;
59 u32 r_data;
60 u32 ar_done;
61 u32 r_test;
62 u32 r_mib;
63 u32 r_da_low;
64 u32 r_da_high;
65
66 u32 reserved4[7];
67 u32 x_activate;
68 u32 x_cntrl;
69 u32 backoff;
70 u32 x_data;
71 u32 x_status;
72 u32 x_mib;
73 u32 x_test;
74 u32 fdxfc_da1;
75 u32 fdxfc_da2;
76 u32 paddr1;
77 u32 paddr2;
78 u32 op_pause;
79
80 u32 reserved5[4];
81 u32 instr_reg;
82 u32 context_reg;
83 u32 test_cntrl;
84 u32 acc_reg;
85 u32 ones;
86 u32 zeros;
87 u32 iaddr1;
88 u32 iaddr2;
89 u32 gaddr1;
90 u32 gaddr2;
91 u32 random;
92 u32 rand1;
93 u32 tmp;
94
95 u32 reserved6[3];
96 u32 fifo_id;
97 u32 x_wmrk;
98 u32 fcntrl;
99 u32 r_bound;
100 u32 r_fstart;
101 u32 r_count;
102 u32 r_lag;
103 u32 r_read;
104 u32 r_write;
105 u32 x_count;
106 u32 x_lag;
107 u32 x_retry;
108 u32 x_write;
109 u32 x_read;
110
111 u32 reserved7[2];
112 u32 fm_cntrl;
113 u32 rfifo_data;
114 u32 rfifo_status;
115 u32 rfifo_cntrl;
116 u32 rfifo_lrf_ptr;
117 u32 rfifo_lwf_ptr;
118 u32 rfifo_alarm;
119 u32 rfifo_rdptr;
120 u32 rfifo_wrptr;
121 u32 tfifo_data;
122 u32 tfifo_status;
123 u32 tfifo_cntrl;
124 u32 tfifo_lrf_ptr;
125 u32 tfifo_lwf_ptr;
126 u32 tfifo_alarm;
127 u32 tfifo_rdptr;
128 u32 tfifo_wrptr;
129
130 u32 reset_cntrl;
131 u32 xmit_fsm;
132
133 u32 reserved8[3];
134 u32 rdes_data0;
135 u32 rdes_data1;
136 u32 r_length;
137 u32 x_length;
138 u32 x_addr;
139 u32 cdes_data;
140 u32 status;
141 u32 dma_control;
142 u32 des_cmnd;
143 u32 data;
144
145 u32 rmon_t_drop;
146 u32 rmon_t_packets;
147 u32 rmon_t_bc_pkt;
148 u32 rmon_t_mc_pkt;
149 u32 rmon_t_crc_align;
150 u32 rmon_t_undersize;
151 u32 rmon_t_oversize;
152 u32 rmon_t_frag;
153 u32 rmon_t_jab;
154 u32 rmon_t_col;
155 u32 rmon_t_p64;
156 u32 rmon_t_p65to127;
157 u32 rmon_t_p128to255;
158 u32 rmon_t_p256to511;
159 u32 rmon_t_p512to1023;
160 u32 rmon_t_p1024to2047;
161 u32 rmon_t_p_gte2048;
162 u32 rmon_t_octets;
163 u32 ieee_t_drop;
164 u32 ieee_t_frame_ok;
165 u32 ieee_t_1col;
166 u32 ieee_t_mcol;
167 u32 ieee_t_def;
168 u32 ieee_t_lcol;
169 u32 ieee_t_excol;
170 u32 ieee_t_macerr;
171 u32 ieee_t_cserr;
172 u32 ieee_t_sqe;
173 u32 t_fdxfc;
174 u32 ieee_t_octets_ok;
175
176 u32 reserved9[2];
177 u32 rmon_r_drop;
178 u32 rmon_r_packets;
179 u32 rmon_r_bc_pkt;
180 u32 rmon_r_mc_pkt;
181 u32 rmon_r_crc_align;
182 u32 rmon_r_undersize;
183 u32 rmon_r_oversize;
184 u32 rmon_r_frag;
185 u32 rmon_r_jab;
186
187 u32 rmon_r_resvd_0;
188
189 u32 rmon_r_p64;
190 u32 rmon_r_p65to127;
191 u32 rmon_r_p128to255;
192 u32 rmon_r_p256to511;
193 u32 rmon_r_p512to1023;
194 u32 rmon_r_p1024to2047;
195 u32 rmon_r_p_gte2048;
196 u32 rmon_r_octets;
197 u32 ieee_r_drop;
198 u32 ieee_r_frame_ok;
199 u32 ieee_r_crc;
200 u32 ieee_r_align;
201 u32 r_macerr;
202 u32 r_fdxfc;
203 u32 ieee_r_octets_ok;
204
205 u32 reserved10[7];
206
207 u32 reserved11[64];
208 };
209
210 #define FEC_MIB_DISABLE 0x80000000
211
212 #define FEC_IEVENT_HBERR 0x80000000
213 #define FEC_IEVENT_BABR 0x40000000
214 #define FEC_IEVENT_BABT 0x20000000
215 #define FEC_IEVENT_GRA 0x10000000
216 #define FEC_IEVENT_TFINT 0x08000000
217 #define FEC_IEVENT_MII 0x00800000
218 #define FEC_IEVENT_LATE_COL 0x00200000
219 #define FEC_IEVENT_COL_RETRY_LIM 0x00100000
220 #define FEC_IEVENT_XFIFO_UN 0x00080000
221 #define FEC_IEVENT_XFIFO_ERROR 0x00040000
222 #define FEC_IEVENT_RFIFO_ERROR 0x00020000
223
224 #define FEC_IMASK_HBERR 0x80000000
225 #define FEC_IMASK_BABR 0x40000000
226 #define FEC_IMASK_BABT 0x20000000
227 #define FEC_IMASK_GRA 0x10000000
228 #define FEC_IMASK_MII 0x00800000
229 #define FEC_IMASK_LATE_COL 0x00200000
230 #define FEC_IMASK_COL_RETRY_LIM 0x00100000
231 #define FEC_IMASK_XFIFO_UN 0x00080000
232 #define FEC_IMASK_XFIFO_ERROR 0x00040000
233 #define FEC_IMASK_RFIFO_ERROR 0x00020000
234
235
236 #define FEC_IMASK_ENABLE (FEC_IMASK_HBERR | FEC_IMASK_BABR | \
237 FEC_IMASK_BABT | FEC_IMASK_GRA | FEC_IMASK_LATE_COL | \
238 FEC_IMASK_COL_RETRY_LIM | FEC_IMASK_XFIFO_UN | \
239 FEC_IMASK_XFIFO_ERROR | FEC_IMASK_RFIFO_ERROR)
240
241 #define FEC_RCNTRL_MAX_FL_SHIFT 16
242 #define FEC_RCNTRL_LOOP 0x01
243 #define FEC_RCNTRL_DRT 0x02
244 #define FEC_RCNTRL_MII_MODE 0x04
245 #define FEC_RCNTRL_PROM 0x08
246 #define FEC_RCNTRL_BC_REJ 0x10
247 #define FEC_RCNTRL_FCE 0x20
248
249 #define FEC_TCNTRL_GTS 0x00000001
250 #define FEC_TCNTRL_HBC 0x00000002
251 #define FEC_TCNTRL_FDEN 0x00000004
252 #define FEC_TCNTRL_TFC_PAUSE 0x00000008
253 #define FEC_TCNTRL_RFC_PAUSE 0x00000010
254
255 #define FEC_ECNTRL_RESET 0x00000001
256 #define FEC_ECNTRL_ETHER_EN 0x00000002
257
258 #define FEC_MII_DATA_ST 0x40000000
259 #define FEC_MII_DATA_OP_RD 0x20000000
260 #define FEC_MII_DATA_OP_WR 0x10000000
261 #define FEC_MII_DATA_PA_MSK 0x0f800000
262 #define FEC_MII_DATA_RA_MSK 0x007c0000
263 #define FEC_MII_DATA_TA 0x00020000
264 #define FEC_MII_DATA_DATAMSK 0x0000ffff
265
266 #define FEC_MII_READ_FRAME (FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA)
267 #define FEC_MII_WRITE_FRAME (FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR | FEC_MII_DATA_TA)
268
269 #define FEC_MII_DATA_RA_SHIFT 0x12
270 #define FEC_MII_DATA_PA_SHIFT 0x17
271
272 #define FEC_PADDR2_TYPE 0x8808
273
274 #define FEC_OP_PAUSE_OPCODE 0x00010000
275
276 #define FEC_FIFO_WMRK_256B 0x3
277
278 #define FEC_FIFO_STATUS_ERR 0x00400000
279 #define FEC_FIFO_STATUS_UF 0x00200000
280 #define FEC_FIFO_STATUS_OF 0x00100000
281
282 #define FEC_FIFO_CNTRL_FRAME 0x08000000
283 #define FEC_FIFO_CNTRL_LTG_7 0x07000000
284
285 #define FEC_RESET_CNTRL_RESET_FIFO 0x02000000
286 #define FEC_RESET_CNTRL_ENABLE_IS_RESET 0x01000000
287
288 #define FEC_XMIT_FSM_APPEND_CRC 0x02000000
289 #define FEC_XMIT_FSM_ENABLE_CRC 0x01000000
290
291
292 extern struct platform_driver mpc52xx_fec_mdio_driver;
293
294 #endif