Go to the documentation of this file.
27 #ifndef LPC17XX_EMAC_H_
28 #define LPC17XX_EMAC_H_
50 #define EMAC_PHY_STAT_LINK (0)
51 #define EMAC_PHY_STAT_SPEED (1)
52 #define EMAC_PHY_STAT_DUP (2)
55 #define EMAC_MODE_AUTO (0)
56 #define EMAC_MODE_10M_FULL (1)
57 #define EMAC_MODE_10M_HALF (2)
58 #define EMAC_MODE_100M_FULL (3)
59 #define EMAC_MODE_100M_HALF (4)
71 #define EMAC_NUM_RX_FRAG 4
72 #define EMAC_NUM_TX_FRAG 3
73 #define EMAC_ETH_MAX_FLEN 1536
74 #define EMAC_TX_FRAME_TOUT 0x00100000
80 #define EMAC_MAC1_REC_EN 0x00000001
81 #define EMAC_MAC1_PASS_ALL 0x00000002
82 #define EMAC_MAC1_RX_FLOWC 0x00000004
83 #define EMAC_MAC1_TX_FLOWC 0x00000008
84 #define EMAC_MAC1_LOOPB 0x00000010
85 #define EMAC_MAC1_RES_TX 0x00000100
86 #define EMAC_MAC1_RES_MCS_TX 0x00000200
87 #define EMAC_MAC1_RES_RX 0x00000400
88 #define EMAC_MAC1_RES_MCS_RX 0x00000800
89 #define EMAC_MAC1_SIM_RES 0x00004000
90 #define EMAC_MAC1_SOFT_RES 0x00008000
95 #define EMAC_MAC2_FULL_DUP 0x00000001
96 #define EMAC_MAC2_FRM_LEN_CHK 0x00000002
97 #define EMAC_MAC2_HUGE_FRM_EN 0x00000004
98 #define EMAC_MAC2_DLY_CRC 0x00000008
99 #define EMAC_MAC2_CRC_EN 0x00000010
100 #define EMAC_MAC2_PAD_EN 0x00000020
101 #define EMAC_MAC2_VLAN_PAD_EN 0x00000040
102 #define EMAC_MAC2_ADET_PAD_EN 0x00000080
103 #define EMAC_MAC2_PPREAM_ENF 0x00000100
104 #define EMAC_MAC2_LPREAM_ENF 0x00000200
105 #define EMAC_MAC2_NO_BACKOFF 0x00001000
106 #define EMAC_MAC2_BACK_PRESSURE 0x00002000
107 #define EMAC_MAC2_EXCESS_DEF 0x00004000
114 #define EMAC_IPGT_BBIPG(n) (n&0x7F)
118 #define EMAC_IPGT_FULL_DUP (EMAC_IPGT_BBIPG(0x15))
122 #define EMAC_IPGT_HALF_DUP (EMAC_IPGT_BBIPG(0x12))
128 #define EMAC_IPGR_NBBIPG_P2(n) (n&0x7F)
130 #define EMAC_IPGR_P2_DEF (EMAC_IPGR_NBBIPG_P2(0x12))
133 #define EMAC_IPGR_NBBIPG_P1(n) ((n&0x7F)<<8)
135 #define EMAC_IPGR_P1_DEF EMAC_IPGR_NBBIPG_P1(0x0C)
142 #define EMAC_CLRT_MAX_RETX(n) (n&0x0F)
145 #define EMAC_CLRT_COLL(n) ((n&0x3F)<<8)
147 #define EMAC_CLRT_DEF ((EMAC_CLRT_MAX_RETX(0x0F))|(EMAC_CLRT_COLL(0x37)))
153 #define EMAC_MAXF_MAXFRMLEN(n) (n&0xFFFF)
158 #define EMAC_SUPP_SPEED 0x00000100
159 #define EMAC_SUPP_RES_RMII 0x00000800
164 #define EMAC_TEST_SHCUT_PQUANTA 0x00000001
165 #define EMAC_TEST_TST_PAUSE 0x00000002
166 #define EMAC_TEST_TST_BACKP 0x00000004
171 #define EMAC_MCFG_SCAN_INC 0x00000001
172 #define EMAC_MCFG_SUPP_PREAM 0x00000002
173 #define EMAC_MCFG_CLK_SEL(n) ((n&0x0F)<<2)
174 #define EMAC_MCFG_RES_MII 0x00008000
175 #define EMAC_MCFG_MII_MAXCLK 2500000UL
180 #define EMAC_MCMD_READ 0x00000001
181 #define EMAC_MCMD_SCAN 0x00000002
183 #define EMAC_MII_WR_TOUT 0x00050000
184 #define EMAC_MII_RD_TOUT 0x00050000
189 #define EMAC_MADR_REG_ADR(n) (n&0x1F)
190 #define EMAC_MADR_PHY_ADR(n) ((n&0x1F)<<8)
195 #define EMAC_MWTD_DATA(n) (n&0xFFFF)
200 #define EMAC_MRDD_DATA(n) (n&0xFFFF)
205 #define EMAC_MIND_BUSY 0x00000001
206 #define EMAC_MIND_SCAN 0x00000002
207 #define EMAC_MIND_NOT_VAL 0x00000004
208 #define EMAC_MIND_MII_LINK_FAIL 0x00000008
219 #define EMAC_CR_RX_EN 0x00000001
220 #define EMAC_CR_TX_EN 0x00000002
221 #define EMAC_CR_REG_RES 0x00000008
222 #define EMAC_CR_TX_RES 0x00000010
223 #define EMAC_CR_RX_RES 0x00000020
224 #define EMAC_CR_PASS_RUNT_FRM 0x00000040
225 #define EMAC_CR_PASS_RX_FILT 0x00000080
226 #define EMAC_CR_TX_FLOW_CTRL 0x00000100
227 #define EMAC_CR_RMII 0x00000200
228 #define EMAC_CR_FULL_DUP 0x00000400
233 #define EMAC_SR_RX_EN 0x00000001
234 #define EMAC_SR_TX_EN 0x00000002
239 #define EMAC_TSV0_CRC_ERR 0x00000001
240 #define EMAC_TSV0_LEN_CHKERR 0x00000002
241 #define EMAC_TSV0_LEN_OUTRNG 0x00000004
242 #define EMAC_TSV0_DONE 0x00000008
243 #define EMAC_TSV0_MCAST 0x00000010
244 #define EMAC_TSV0_BCAST 0x00000020
245 #define EMAC_TSV0_PKT_DEFER 0x00000040
246 #define EMAC_TSV0_EXC_DEFER 0x00000080
247 #define EMAC_TSV0_EXC_COLL 0x00000100
248 #define EMAC_TSV0_LATE_COLL 0x00000200
249 #define EMAC_TSV0_GIANT 0x00000400
250 #define EMAC_TSV0_UNDERRUN 0x00000800
251 #define EMAC_TSV0_BYTES 0x0FFFF000
252 #define EMAC_TSV0_CTRL_FRAME 0x10000000
253 #define EMAC_TSV0_PAUSE 0x20000000
254 #define EMAC_TSV0_BACK_PRESS 0x40000000
255 #define EMAC_TSV0_VLAN 0x80000000
260 #define EMAC_TSV1_BYTE_CNT 0x0000FFFF
261 #define EMAC_TSV1_COLL_CNT 0x000F0000
266 #define EMAC_RSV_BYTE_CNT 0x0000FFFF
267 #define EMAC_RSV_PKT_IGNORED 0x00010000
268 #define EMAC_RSV_RXDV_SEEN 0x00020000
269 #define EMAC_RSV_CARR_SEEN 0x00040000
270 #define EMAC_RSV_REC_CODEV 0x00080000
271 #define EMAC_RSV_CRC_ERR 0x00100000
272 #define EMAC_RSV_LEN_CHKERR 0x00200000
273 #define EMAC_RSV_LEN_OUTRNG 0x00400000
274 #define EMAC_RSV_REC_OK 0x00800000
275 #define EMAC_RSV_MCAST 0x01000000
276 #define EMAC_RSV_BCAST 0x02000000
277 #define EMAC_RSV_DRIB_NIBB 0x04000000
278 #define EMAC_RSV_CTRL_FRAME 0x08000000
279 #define EMAC_RSV_PAUSE 0x10000000
280 #define EMAC_RSV_UNSUPP_OPC 0x20000000
281 #define EMAC_RSV_VLAN 0x40000000
286 #define EMAC_FCC_MIRR_CNT(n) (n&0xFFFF)
287 #define EMAC_FCC_PAUSE_TIM(n) ((n&0xFFFF)<<16)
292 #define EMAC_FCS_MIRR_CNT(n) (n&0xFFFF)
299 #define EMAC_RFC_UCAST_EN 0x00000001
300 #define EMAC_RFC_BCAST_EN 0x00000002
301 #define EMAC_RFC_MCAST_EN 0x00000004
302 #define EMAC_RFC_UCAST_HASH_EN 0x00000008
303 #define EMAC_RFC_MCAST_HASH_EN 0x00000010
304 #define EMAC_RFC_PERFECT_EN 0x00000020
305 #define EMAC_RFC_MAGP_WOL_EN 0x00001000
306 #define EMAC_RFC_PFILT_WOL_EN 0x00002000
311 #define EMAC_WOL_UCAST 0x00000001
312 #define EMAC_WOL_BCAST 0x00000002
313 #define EMAC_WOL_MCAST 0x00000004
314 #define EMAC_WOL_UCAST_HASH 0x00000008
315 #define EMAC_WOL_MCAST_HASH 0x00000010
316 #define EMAC_WOL_PERFECT 0x00000020
317 #define EMAC_WOL_RX_FILTER 0x00000080
318 #define EMAC_WOL_MAG_PACKET 0x00000100
319 #define EMAC_WOL_BITMASK 0x01BF
326 #define EMAC_INT_RX_OVERRUN 0x00000001
327 #define EMAC_INT_RX_ERR 0x00000002
328 #define EMAC_INT_RX_FIN 0x00000004
329 #define EMAC_INT_RX_DONE 0x00000008
330 #define EMAC_INT_TX_UNDERRUN 0x00000010
331 #define EMAC_INT_TX_ERR 0x00000020
332 #define EMAC_INT_TX_FIN 0x00000040
333 #define EMAC_INT_TX_DONE 0x00000080
334 #define EMAC_INT_SOFT_INT 0x00001000
335 #define EMAC_INT_WAKEUP 0x00002000
340 #define EMAC_PD_POWER_DOWN 0x80000000
346 #define EMAC_RCTRL_SIZE(n) (n&0x7FF)
347 #define EMAC_RCTRL_INT 0x80000000
352 #define EMAC_RHASH_SA 0x000001FF
353 #define EMAC_RHASH_DA 0x001FF000
358 #define EMAC_RINFO_SIZE 0x000007FF
359 #define EMAC_RINFO_CTRL_FRAME 0x00040000
360 #define EMAC_RINFO_VLAN 0x00080000
361 #define EMAC_RINFO_FAIL_FILT 0x00100000
362 #define EMAC_RINFO_MCAST 0x00200000
363 #define EMAC_RINFO_BCAST 0x00400000
364 #define EMAC_RINFO_CRC_ERR 0x00800000
365 #define EMAC_RINFO_SYM_ERR 0x01000000
366 #define EMAC_RINFO_LEN_ERR 0x02000000
367 #define EMAC_RINFO_RANGE_ERR 0x04000000
368 #define EMAC_RINFO_ALIGN_ERR 0x08000000
369 #define EMAC_RINFO_OVERRUN 0x10000000
370 #define EMAC_RINFO_NO_DESCR 0x20000000
371 #define EMAC_RINFO_LAST_FLAG 0x40000000
372 #define EMAC_RINFO_ERR 0x80000000
373 #define EMAC_RINFO_ERR_MASK (EMAC_RINFO_FAIL_FILT | EMAC_RINFO_CRC_ERR | EMAC_RINFO_SYM_ERR | \
374 EMAC_RINFO_LEN_ERR | EMAC_RINFO_ALIGN_ERR | EMAC_RINFO_OVERRUN)
379 #define EMAC_TCTRL_SIZE 0x000007FF
380 #define EMAC_TCTRL_OVERRIDE 0x04000000
381 #define EMAC_TCTRL_HUGE 0x08000000
382 #define EMAC_TCTRL_PAD 0x10000000
383 #define EMAC_TCTRL_CRC 0x20000000
384 #define EMAC_TCTRL_LAST 0x40000000
385 #define EMAC_TCTRL_INT 0x80000000
390 #define EMAC_TINFO_COL_CNT 0x01E00000
391 #define EMAC_TINFO_DEFER 0x02000000
392 #define EMAC_TINFO_EXCESS_DEF 0x04000000
393 #define EMAC_TINFO_EXCESS_COL 0x08000000
394 #define EMAC_TINFO_LATE_COL 0x10000000
395 #define EMAC_TINFO_UNDERRUN 0x20000000
396 #define EMAC_TINFO_NO_DESCR 0x40000000
397 #define EMAC_TINFO_ERR 0x80000000
403 #define EMAC_PHY_RESP_TOUT 0x100000UL
406 #define EMAC_OLD_EMAC_MODULE_ID 0x39022000
411 #define EMAC_PHY_REG_BMCR 0x00
412 #define EMAC_PHY_REG_BMSR 0x01
413 #define EMAC_PHY_REG_IDR1 0x02
414 #define EMAC_PHY_REG_IDR2 0x03
415 #define EMAC_PHY_REG_ANAR 0x04
416 #define EMAC_PHY_REG_ANLPAR 0x05
417 #define EMAC_PHY_REG_ANER 0x06
418 #define EMAC_PHY_REG_ANNPTR 0x07
419 #define EMAC_PHY_REG_LPNPA 0x08
424 #define EMAC_PHY_REG_STS 0x10
425 #define EMAC_PHY_REG_MICR 0x11
426 #define EMAC_PHY_REG_MISR 0x12
427 #define EMAC_PHY_REG_FCSCR 0x14
428 #define EMAC_PHY_REG_RECR 0x15
429 #define EMAC_PHY_REG_PCSR 0x16
430 #define EMAC_PHY_REG_RBR 0x17
431 #define EMAC_PHY_REG_LEDCR 0x18
432 #define EMAC_PHY_REG_PHYCR 0x19
433 #define EMAC_PHY_REG_10BTSCR 0x1A
434 #define EMAC_PHY_REG_CDCTRL1 0x1B
435 #define EMAC_PHY_REG_EDCR 0x1D
440 #define EMAC_PHY_BMCR_RESET (1<<15)
441 #define EMAC_PHY_BMCR_LOOPBACK (1<<14)
442 #define EMAC_PHY_BMCR_SPEED_SEL (1<<13)
443 #define EMAC_PHY_BMCR_AN (1<<12)
444 #define EMAC_PHY_BMCR_POWERDOWN (1<<11)
445 #define EMAC_PHY_BMCR_ISOLATE (1<<10)
446 #define EMAC_PHY_BMCR_RE_AN (1<<9)
447 #define EMAC_PHY_BMCR_DUPLEX (1<<8)
452 #define EMAC_PHY_BMSR_100BE_T4 (1<<15)
453 #define EMAC_PHY_BMSR_100TX_FULL (1<<14)
454 #define EMAC_PHY_BMSR_100TX_HALF (1<<13)
455 #define EMAC_PHY_BMSR_10BE_FULL (1<<12)
456 #define EMAC_PHY_BMSR_10BE_HALF (1<<11)
457 #define EMAC_PHY_BMSR_NOPREAM (1<<6)
458 #define EMAC_PHY_BMSR_AUTO_DONE (1<<5)
459 #define EMAC_PHY_BMSR_REMOTE_FAULT (1<<4)
460 #define EMAC_PHY_BMSR_NO_AUTO (1<<3)
461 #define EMAC_PHY_BMSR_LINK_ESTABLISHED (1<<2)
466 #define EMAC_PHY_SR_REMOTE_FAULT (1<<6)
467 #define EMAC_PHY_SR_JABBER (1<<5)
468 #define EMAC_PHY_SR_AUTO_DONE (1<<4)
469 #define EMAC_PHY_SR_LOOPBACK (1<<3)
470 #define EMAC_PHY_SR_DUP (1<<2)
471 #define EMAC_PHY_SR_SPEED (1<<1)
472 #define EMAC_PHY_SR_LINK (1<<0)
474 #define EMAC_PHY_FULLD_100M 0x2100
475 #define EMAC_PHY_HALFD_100M 0x2000
476 #define EMAC_PHY_FULLD_10M 0x0100
477 #define EMAC_PHY_HALFD_10M 0x0000
478 #define EMAC_PHY_AUTO_NEG 0x3000
480 #define EMAC_DEF_ADR 0x0100
481 #define EMAC_DP83848C_ID 0x20005C90
483 #define EMAC_PHY_SR_100_SPEED ((1<<14)|(1<<13))
484 #define EMAC_PHY_SR_FULL_DUP ((1<<14)|(1<<12))
485 #define EMAC_PHY_BMSR_LINK_STATUS (1<<2)
487 #elif defined(IAR_LPC_1768)
490 #define EMAC_PHY_RESP_TOUT 0x100000UL
493 #define EMAC_OLD_EMAC_MODULE_ID 0x39022000
498 #define EMAC_PHY_REG_BMCR 0x00
499 #define EMAC_PHY_REG_BMSR 0x01
500 #define EMAC_PHY_REG_IDR1 0x02
501 #define EMAC_PHY_REG_IDR2 0x03
502 #define EMAC_PHY_REG_ANAR 0x04
503 #define EMAC_PHY_REG_ANLPAR 0x05
504 #define EMAC_PHY_REG_ANER 0x06
505 #define EMAC_PHY_REG_ANNPTR 0x07
506 #define EMAC_PHY_REG_LPNPA 0x08
507 #define EMAC_PHY_REG_REC 0x15
508 #define EMAC_PHY_REG_ISC 0x1b
509 #define EMAC_PHY_REG_100BASE 0x1f
514 #define EMAC_PHY_BMCR_RESET (1<<15)
515 #define EMAC_PHY_BMCR_LOOPBACK (1<<14)
516 #define EMAC_PHY_BMCR_SPEED_SEL (1<<13)
517 #define EMAC_PHY_BMCR_AN (1<<12)
518 #define EMAC_PHY_BMCR_POWERDOWN (1<<11)
519 #define EMAC_PHY_BMCR_ISOLATE (1<<10)
520 #define EMAC_PHY_BMCR_RE_AN (1<<9)
521 #define EMAC_PHY_BMCR_DUPLEX (1<<8)
522 #define EMAC_PHY_BMCR_COLLISION (1<<7)
523 #define EMAC_PHY_BMCR_TXDIS (1<<0)
528 #define EMAC_PHY_BMSR_100BE_T4 (1<<15)
529 #define EMAC_PHY_BMSR_100TX_FULL (1<<14)
530 #define EMAC_PHY_BMSR_100TX_HALF (1<<13)
531 #define EMAC_PHY_BMSR_10BE_FULL (1<<12)
532 #define EMAC_PHY_BMSR_10BE_HALF (1<<11)
533 #define EMAC_PHY_BMSR_NOPREAM (1<<6)
534 #define EMAC_PHY_BMSR_AUTO_DONE (1<<5)
535 #define EMAC_PHY_BMSR_REMOTE_FAULT (1<<4)
536 #define EMAC_PHY_BMSR_NO_AUTO (1<<3)
537 #define EMAC_PHY_BMSR_LINK_STATUS (1<<2)
538 #define EMAC_PHY_BMSR_JABBER_DETECT (1<<1)
539 #define EMAC_PHY_BMSR_EXTEND (1<<0)
545 #define EMAC_PHY_IDR1(n) (n & 0xFFFF)
548 #define EMAC_PHY_IDR2(n) (n & 0xFFFF)
553 #define EMAC_PHY_AN_NEXTPAGE (1<<15)
554 #define EMAC_PHY_AN_REMOTE_FAULT (1<<13)
555 #define EMAC_PHY_AN_PAUSE (1<<10)
556 #define EMAC_PHY_AN_100BASE_T4 (1<<9)
557 #define EMAC_PHY_AN_100BASE_TX_FD (1<<8)
558 #define EMAC_PHY_AN_100BASE_TX (1<<7)
559 #define EMAC_PHY_AN_10BASE_T_FD (1<<6)
560 #define EMAC_PHY_AN_10BASE_T (1<<5)
561 #define EMAC_PHY_AN_FIELD(n) (n & 0x1F)
563 #define EMAC_PHY_FULLD_100M 0x2100
564 #define EMAC_PHY_HALFD_100M 0x2000
565 #define EMAC_PHY_FULLD_10M 0x0100
566 #define EMAC_PHY_HALFD_10M 0x0000
567 #define EMAC_PHY_AUTO_NEG 0x3000
569 #define EMAC_PHY_SR_100_SPEED ((1<<14)|(1<<13))
570 #define EMAC_PHY_SR_FULL_DUP ((1<<14)|(1<<12))
572 #define EMAC_DEF_ADR (0x01<<8)
573 #define EMAC_KSZ8721BL_ID ((0x22 << 16) | 0x1619 )