11 /********************************************************************/
\r
13 /* Timeout for MII communications */
\r
14 #define FEC_MII_TIMEOUT 0x10000
\r
17 /********************************************************************/
\r
18 //Fucntion Protoypes
\r
20 int FEC_Mii_Write(int, int, int);
\r
21 int FEC_Mii_Read(int, int, unsigned short*);
\r
22 void FEC_Mii_Init(void);
\r
23 void fec_mii_reg_printf(void);
\r
25 /********************************************************************/
\r
26 //Register Mask and Other
\r
28 /* Definition of allowed values for MDCSEL */
\r
29 #define MII_MDCSEL(x) x/5000000
\r
31 #define MII_WRITE 0x01
\r
32 #define MII_READ 0x02
\r
34 #define TCMD_START 0x01 /* Transmit buffer frame */
\r
35 #define TCMD_PAUSE 0x02 /* Transmit PAUSE frame */
\r
36 #define TCMD_ABORT 0x03 /* Abort transmission */
\r
38 /* PHY registers symbolic names */
\r
39 /* (located in MII memory map, accessible through MDIO) */
\r
40 #define PHY_REG_CR 0x00 /* Control Register */
\r
41 #define PHY_REG_SR 0x01 /* Status Register */
\r
42 #define PHY_REG_ID1 0x02 /* PHY Identification Register 1 */
\r
43 #define PHY_REG_ID2 0x03 /* PHY Identification Register 2 */
\r
44 #define PHY_REG_ANAR 0x04 /* Auto-Negotiation Advertisement Register */
\r
45 #define PHY_REG_ANLPAR 0x05 /* Auto-Negotiation Link Partner Ability Register */
\r
46 #define PHY_REG_ER 0x06 /* Auto-Negotiation Expansion Register */
\r
47 #define PHY_REG_NPTR 0x07 /* Auto-Negotiation Next Page Transfer Register */
\r
48 #define PHY_REG_IR 0x10 /* Interrupt Register */
\r
49 #define PHY_REG_PSR 0x11 /* Proprietary Status Register */
\r
50 #define PHY_REG_PCR 0x12 /* Proprietary Control Register */
\r
51 #define PHY_REG_10BTBC 0x13 /* 10Base-T Bypass Control Register */
\r
52 #define PHY_REG_100BXBC 0x14 /* 100Base-X Bypass Control Register */
\r
53 #define PHY_REG_ADDR 0x15 /* Test & Trim Control Register */
\r
54 #define PHY_REG_DSPRC 0x17 /* DSP Reset Control */
\r
55 #define PHY_REG_DSPRR1 0x18 /* 100Base-X DSP Read Registers */
\r
56 #define PHY_REG_DSPRR2 0x19
\r
57 #define PHY_REG_DSPRR3 0x1A
\r
58 #define PHY_REG_DSPWR1 0x1B /* 100Base-X DSP Write Registers */
\r
59 #define PHY_REG_DSPWR2 0x1C
\r
60 #define PHY_REG_DSPWR3 0x1D
\r
62 /* PHY registers structure */
\r
63 /* 0 - Control Register */
\r
64 #define PHY_R0_RESET 0x8000 /* Reset */
\r
65 #define PHY_R0_LB 0x4000 /* Loop Back */
\r
66 #define PHY_R0_DR 0x2000 /* Data Rate (100Mb/s) */
\r
67 #define PHY_R0_ANE 0x1000 /* Auto-Negotiation Enable */
\r
68 #define PHY_R0_PD 0x0800 /* Power Down */
\r
69 #define PHY_R0_ISOLATE 0x0400 /* Isolate (MII is disconnected) */
\r
70 #define PHY_R0_RAN 0x0200 /* Restart Auto-Negotiation */
\r
71 #define PHY_R0_DPLX 0x0100 /* Duplex (Full duplex) */
\r
72 #define PHY_R0_CT 0x0080 /* Collision Test (Enable) */
\r
74 /* 1 - Status Register */
\r
75 #define PHY_R1_100T4 0x8000 /* 100BASET4 Supported */
\r
76 #define PHY_R1_100F 0x4000 /* 100Mb/s Full Duplex Supported */
\r
77 #define PHY_R1_100H 0x2000 /* 100Mb/s Half Duplex Supported */
\r
78 #define PHY_R1_10F 0x1000 /* 10Mb/s Full Duplex Supported */
\r
79 #define PHY_R1_10H 0x0800 /* 10Mb/s Half Duplex Supported */
\r
80 #define PHY_R1_SUP 0x0040 /* MI Preamble Supression (capable of) */
\r
81 #define PHY_R1_ANC 0x0020 /* Auto Negotiation Complete */
\r
82 #define PHY_R1_RF 0x0010 /* Remote Fault */
\r
83 #define PHY_R1_ANA 0x0008 /* Auto-Negotiation Ability (present) */
\r
84 #define PHY_R1_LS 0x0004 /* Link Status (Link is Up) */
\r
85 #define PHY_R1_JD 0x0002 /* Jabber Detect (detected) */
\r
86 #define PHY_R1_EC 0x0001 /* Extended Capability (regs 2 to 31 exists) */
\r
88 /* 2 - PHY Identifier Register 1 */
\r
89 /* 3 - PHY Identifier Register 2 */
\r
90 /* read only - contains Manufacturer's info etc.
\r
91 see documentation for the detailed description */
\r
93 /* 4 - Auto Negotiation Advertisement Register */
\r
94 #define PHY_R4_NP 0x8000 /* Next Page (capable of sending next pages) */
\r
95 #define PHY_R4_RF 0x2000 /* Remote Fault */
\r
96 #define PHY_R4_FC 0x0400 /* Flow Control */
\r
97 #define PHY_R4_100F 0x0100 /* 100Base-TX Full Duplex Capable */
\r
98 #define PHY_R4_100H 0x0080 /* 100Base-TX Half Duplex Capable */
\r
99 #define PHY_R4_10F 0x0040 /* 10Base-T Full Duplex Capable */
\r
100 #define PHY_R4_10H 0x0020 /* 10Base-T Half Duplex Capable */
\r
101 /* bits 4 to 0 are Selector Field (IEEE Std 802.3 = 00001) */
\r
103 /* 5 - Auto Negotiation Link Partner Ability Register (Base Page & Next Page) */
\r
104 /* read only - please consult PHY documentation */
\r
105 #define PHY_R5_FCTL 0x0400 /* 10Base-T Half Duplex Capable */
\r
107 /* 16 - Interrupt Control Register */
\r
108 #define PHY_R16_ACKIE 0x4000 //Acknowledge Bit Received Interrupt Enable
\r
109 #define PHY_R16_PRIE 0x2000 //Page Received INT Enable
\r
110 #define PHY_R16_LCIE 0x1000 //Link Changed Enable
\r
111 #define PHY_R16_ANIE 0x0800 //Auto-Negotiation Changed Enable
\r
112 #define PHY_R16_PDFIE 0x0400 //Parallel Detect Fault Enable
\r
113 #define PHY_R16_RFIE 0x0200 //Remote Fault Interrupt Enable
\r
114 #define PHY_R16_JABIE 0x0100 //Jabber Interrupt Enable
\r
116 #define PHY_R16_ACKR 0x0040 //Acknowledge Bit Received Interrupt
\r
117 #define PHY_R16_PGR 0x0020 //Page Received
\r
118 #define PHY_R16_LKC 0x0010 //Link Changed
\r
119 #define PHY_R16_ANC 0x0008 //Auto-Negotiation Changed
\r
120 #define PHY_R16_PDF 0x0004 //Parallel Detect Fault
\r
121 #define PHY_R16_RMTF 0x0002 //Remote Fault Interrupt
\r
122 #define PHY_R16_JABI 0x0001 //Jabber Interrupt
\r
124 ////Proprietary Status Register
\r
125 #define PHY_R17_LNK 0x4000 //
\r
126 #define PHY_R17_DPM 0x2000 //Duplex Mode
\r
127 #define PHY_R17_SPD 0x1000 //Speed
\r
128 #define PHY_R17_ANNC 0x0400 //Auto-Negotiation Complete
\r
129 #define PHY_R17_PRCVD 0x0200 //
\r
130 #define PHY_R17_ANCM 0x0100 // Auto-Negotiation (A-N) Common Operating Mode
\r
131 #define PHY_R17_PLR 0x0020 //
\r
133 /* Bit definitions and macros for MCF_FEC_MMFR */
\r
134 #define FEC_MMFR_DATA(x) (((x)&0x0000FFFF)<<0)
\r
135 #define FEC_MMFR_TA(x) (((x)&0x00000003)<<16)
\r
136 #define FEC_MMFR_RA(x) (((x)&0x0000001F)<<18)
\r
137 #define FEC_MMFR_PA(x) (((x)&0x0000001F)<<23)
\r
138 #define FEC_MMFR_OP(x) (((x)&0x00000003)<<28)
\r
139 #define FEC_MMFR_ST(x) (((x)&0x00000003)<<30)
\r
140 #define FEC_MMFR_ST_01 (0x40000000)
\r
141 #define FEC_MMFR_OP_READ (0x20000000)
\r
142 #define FEC_MMFR_OP_WRITE (0x10000000)
\r
143 #define FEC_MMFR_TA_10 (0x00020000)
\r
145 /********************************************************************/
\r
147 #endif /* _MII_H_ */
\r