1 |
748 |
lampret |
#define ETH_REG_BASE ETH_BASE
|
2 |
|
|
#define ETH_BD_BASE ETH_BASE + 0x400
|
3 |
|
|
#define ETH_TOTAL_BD 128
|
4 |
|
|
#define ETH_MAXBUF_LEN 0x600
|
5 |
|
|
|
6 |
|
|
/* Tx BD */
|
7 |
|
|
#define ETH_TX_BD_READY 0x8000 /* Tx BD Ready */
|
8 |
|
|
#define ETH_TX_BD_IRQ 0x4000 /* Tx BD IRQ Enable */
|
9 |
|
|
#define ETH_TX_BD_WRAP 0x2000 /* Tx BD Wrap (last BD) */
|
10 |
|
|
#define ETH_TX_BD_PAD 0x1000 /* Tx BD Pad Enable */
|
11 |
|
|
#define ETH_TX_BD_CRC 0x0800 /* Tx BD CRC Enable */
|
12 |
|
|
|
13 |
|
|
#define ETH_TX_BD_UNDERRUN 0x0100 /* Tx BD Underrun Status */
|
14 |
|
|
#define ETH_TX_BD_RETRY 0x00F0 /* Tx BD Retry Status */
|
15 |
|
|
#define ETH_TX_BD_RETLIM 0x0008 /* Tx BD Retransmission Limit Status */
|
16 |
|
|
#define ETH_TX_BD_LATECOL 0x0004 /* Tx BD Late Collision Status */
|
17 |
|
|
#define ETH_TX_BD_DEFER 0x0002 /* Tx BD Defer Status */
|
18 |
|
|
#define ETH_TX_BD_CARRIER 0x0001 /* Tx BD Carrier Sense Lost Status */
|
19 |
|
|
|
20 |
|
|
/* Rx BD */
|
21 |
|
|
#define ETH_RX_BD_EMPTY 0x8000 /* Rx BD Empty */
|
22 |
|
|
#define ETH_RX_BD_IRQ 0x4000 /* Rx BD IRQ Enable */
|
23 |
|
|
#define ETH_RX_BD_WRAP 0x2000 /* Rx BD Wrap (last BD) */
|
24 |
|
|
|
25 |
|
|
#define ETH_RX_BD_MISS 0x0080 /* Rx BD Miss Status */
|
26 |
|
|
#define ETH_RX_BD_OVERRUN 0x0040 /* Rx BD Overrun Status */
|
27 |
|
|
#define ETH_RX_BD_INVSIMB 0x0020 /* Rx BD Invalid Symbol Status */
|
28 |
|
|
#define ETH_RX_BD_DRIBBLE 0x0010 /* Rx BD Dribble Nibble Status */
|
29 |
|
|
#define ETH_RX_BD_TOOLONG 0x0008 /* Rx BD Too Long Status */
|
30 |
|
|
#define ETH_RX_BD_SHORT 0x0004 /* Rx BD Too Short Frame Status */
|
31 |
|
|
#define ETH_RX_BD_CRCERR 0x0002 /* Rx BD CRC Error Status */
|
32 |
|
|
#define ETH_RX_BD_LATECOL 0x0001 /* Rx BD Late Collision Status */
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
/* Register space */
|
37 |
|
|
#define ETH_MODER 0x00 /* Mode Register */
|
38 |
|
|
#define ETH_INT 0x04 /* Interrupt Source Register */
|
39 |
|
|
#define ETH_INT_MASK 0x08 /* Interrupt Mask Register */
|
40 |
|
|
#define ETH_IPGT 0x0C /* Back to Bak Inter Packet Gap Register */
|
41 |
|
|
#define ETH_IPGR1 0x10 /* Non Back to Back Inter Packet Gap Register 1 */
|
42 |
|
|
#define ETH_IPGR2 0x14 /* Non Back to Back Inter Packet Gap Register 2 */
|
43 |
|
|
#define ETH_PACKETLEN 0x18 /* Packet Length Register (min. and max.) */
|
44 |
|
|
#define ETH_COLLCONF 0x1C /* Collision and Retry Configuration Register */
|
45 |
|
|
#define ETH_RX_BD_NUM 0x20 /* Receive Buffer Descriptor Number Register */
|
46 |
|
|
#define ETH_CTRLMODER 0x24 /* Control Module Mode Register */
|
47 |
|
|
#define ETH_MIIMODER 0x28 /* MII Mode Register */
|
48 |
|
|
#define ETH_MIICOMMAND 0x2C /* MII Command Register */
|
49 |
|
|
#define ETH_MIIADDRESS 0x30 /* MII Address Register */
|
50 |
|
|
#define ETH_MIITX_DATA 0x34 /* MII Transmit Data Register */
|
51 |
|
|
#define ETH_MIIRX_DATA 0x38 /* MII Receive Data Register */
|
52 |
|
|
#define ETH_MIISTATUS 0x3C /* MII Status Register */
|
53 |
|
|
#define ETH_MAC_ADDR0 0x40 /* MAC Individual Address Register 0 */
|
54 |
|
|
#define ETH_MAC_ADDR1 0x44 /* MAC Individual Address Register 1 */
|
55 |
|
|
#define ETH_HASH_ADDR0 0x48 /* Hash Register 0 */
|
56 |
|
|
#define ETH_HASH_ADDR1 0x4C /* Hash Register 1 */
|
57 |
|
|
|
58 |
|
|
/* MODER Register */
|
59 |
|
|
#define ETH_MODER_RXEN 0x00000001 /* Receive Enable */
|
60 |
|
|
#define ETH_MODER_TXEN 0x00000002 /* Transmit Enable */
|
61 |
|
|
#define ETH_MODER_NOPRE 0x00000004 /* No Preamble */
|
62 |
|
|
#define ETH_MODER_BRO 0x00000008 /* Reject Broadcast */
|
63 |
|
|
#define ETH_MODER_IAM 0x00000010 /* Use Individual Hash */
|
64 |
|
|
#define ETH_MODER_PRO 0x00000020 /* Promiscuous (receive all) */
|
65 |
|
|
#define ETH_MODER_IFG 0x00000040 /* Min. IFG not required */
|
66 |
|
|
#define ETH_MODER_LOOPBCK 0x00000080 /* Loop Back */
|
67 |
|
|
#define ETH_MODER_NOBCKOF 0x00000100 /* No Backoff */
|
68 |
|
|
#define ETH_MODER_EXDFREN 0x00000200 /* Excess Defer */
|
69 |
|
|
#define ETH_MODER_FULLD 0x00000400 /* Full Duplex */
|
70 |
|
|
#define ETH_MODER_RST 0x00000800 /* Reset MAC */
|
71 |
|
|
#define ETH_MODER_DLYCRCEN 0x00001000 /* Delayed CRC Enable */
|
72 |
|
|
#define ETH_MODER_CRCEN 0x00002000 /* CRC Enable */
|
73 |
|
|
#define ETH_MODER_HUGEN 0x00004000 /* Huge Enable */
|
74 |
|
|
#define ETH_MODER_PAD 0x00008000 /* Pad Enable */
|
75 |
|
|
#define ETH_MODER_RECSMALL 0x00010000 /* Receive Small */
|
76 |
|
|
|
77 |
|
|
/* Interrupt Source Register */
|
78 |
|
|
#define ETH_INT_TXB 0x00000001 /* Transmit Buffer IRQ */
|
79 |
|
|
#define ETH_INT_TXE 0x00000002 /* Transmit Error IRQ */
|
80 |
|
|
#define ETH_INT_RXF 0x00000004 /* Receive Frame IRQ */
|
81 |
|
|
#define ETH_INT_RXE 0x00000008 /* Receive Error IRQ */
|
82 |
|
|
#define ETH_INT_BUSY 0x00000010 /* Busy IRQ */
|
83 |
|
|
#define ETH_INT_TXC 0x00000020 /* Transmit Control Frame IRQ */
|
84 |
|
|
#define ETH_INT_RXC 0x00000040 /* Received Control Frame IRQ */
|
85 |
|
|
|
86 |
|
|
/* Interrupt Mask Register */
|
87 |
|
|
#define ETH_INT_MASK_TXB 0x00000001 /* Transmit Buffer IRQ Mask */
|
88 |
|
|
#define ETH_INT_MASK_TXE 0x00000002 /* Transmit Error IRQ Mask */
|
89 |
|
|
#define ETH_INT_MASK_RXF 0x00000004 /* Receive Frame IRQ Mask */
|
90 |
|
|
#define ETH_INT_MASK_RXE 0x00000008 /* Receive Error IRQ Mask */
|
91 |
|
|
#define ETH_INT_MASK_BUSY 0x00000010 /* Busy IRQ Mask */
|
92 |
|
|
#define ETH_INT_MASK_TXC 0x00000020 /* Transmit Control Frame IRQ Mask */
|
93 |
|
|
#define ETH_INT_MASK_RXC 0x00000040 /* Received Control Frame IRQ Mask */
|
94 |
|
|
|
95 |
|
|
/* Control Module Mode Register */
|
96 |
|
|
#define ETH_CTRLMODER_PASSALL 0x00000001 /* Pass Control Frames */
|
97 |
|
|
#define ETH_CTRLMODER_RXFLOW 0x00000002 /* Receive Control Flow Enable */
|
98 |
|
|
#define ETH_CTRLMODER_TXFLOW 0x00000004 /* Transmit Control Flow Enable */
|
99 |
|
|
|
100 |
|
|
/* MII Mode Register */
|
101 |
|
|
#define ETH_MIIMODER_CLKDIV 0x000000FF /* Clock Divider */
|
102 |
|
|
#define ETH_MIIMODER_NOPRE 0x00000100 /* No Preamble */
|
103 |
|
|
#define ETH_MIIMODER_RST 0x00000200 /* MIIM Reset */
|
104 |
|
|
|
105 |
|
|
/* MII Command Register */
|
106 |
|
|
#define ETH_MIICOMMAND_SCANSTAT 0x00000001 /* Scan Status */
|
107 |
|
|
#define ETH_MIICOMMAND_RSTAT 0x00000002 /* Read Status */
|
108 |
|
|
#define ETH_MIICOMMAND_WCTRLDATA 0x00000004 /* Write Control Data */
|
109 |
|
|
|
110 |
|
|
/* MII Address Register */
|
111 |
|
|
#define ETH_MIIADDRESS_FIAD 0x0000001F /* PHY Address */
|
112 |
|
|
#define ETH_MIIADDRESS_RGAD 0x00001F00 /* RGAD Address */
|
113 |
|
|
|
114 |
|
|
/* MII Status Register */
|
115 |
|
|
#define ETH_MIISTATUS_LINKFAIL 0x00000001 /* Link Fail */
|
116 |
|
|
#define ETH_MIISTATUS_BUSY 0x00000002 /* MII Busy */
|
117 |
|
|
#define ETH_MIISTATUS_NVALID 0x00000004 /* Data in MII Status Register is invalid */
|
118 |
|
|
|