3 * Copyright 2007 Free Software Foundation, Inc.
4 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 /* Much of this was extracted from the Linux e1000_hw.h file */
22 #ifndef INCLUDED_ETH_PHY_H
23 #define INCLUDED_ETH_PHY_H
25 /* PHY 1000 MII Register/Bit Definitions */
26 /* PHY Registers defined by IEEE */
28 #define PHY_CTRL 0x00 /* Control Register */
29 #define PHY_STATUS 0x01 /* Status Regiser */
30 #define PHY_ID1 0x02 /* Phy Id Reg (word 1) */
31 #define PHY_ID2 0x03 /* Phy Id Reg (word 2) */
32 #define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */
33 #define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */
34 #define PHY_AUTONEG_EXP 0x06 /* Autoneg Expansion Reg */
35 #define PHY_NEXT_PAGE_TX 0x07 /* Next Page TX */
36 #define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */
37 #define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */
38 #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */
39 #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */
41 /* PHY 1000 MII Register additions in DP83856 */
42 /* The part implements 0x00 thru 0x1f; we use these. */
44 #define PHY_LINK_AN 0x11 /* Link and Auto Negotiation Status Reg */
45 #define PHY_INT_STATUS 0x14 /* Interupt Status Reg (RO) */
46 #define PHY_INT_MASK 0x15 /* Interrupt Mask Reg (RW) */
47 #define PHY_INT_CLEAR 0x17 /* Interrupt Clear Reg (RW) */
50 /* Bit definitions for some of the registers above */
52 /* PHY Control Register (PHY_CTRL) */
53 #define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */
54 #define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */
55 #define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */
56 #define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */
57 #define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */
58 #define MII_CR_POWER_DOWN 0x0800 /* Power down */
59 #define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */
60 #define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 */
61 #define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */
62 #define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */
64 /* PHY Status Register (PHY_STATUS) */
65 #define MII_SR_EXTENDED_CAPS 0x0001 /* Extended register capabilities */
66 #define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */
67 #define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */
68 #define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */
69 #define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */
70 #define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */
71 #define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */
72 #define MII_SR_EXTENDED_STATUS 0x0100 /* Ext. status info in Reg 0x0F */
73 #define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */
74 #define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */
75 #define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */
76 #define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */
77 #define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */
78 #define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */
79 #define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */
81 /* Autoneg Advertisement Register (PHY_AUTONEG_ADV) */
82 #define NWAY_AR_SELECTOR_FIELD 0x0001 /* indicates IEEE 802.3 CSMA/CD */
83 #define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */
84 #define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */
85 #define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */
86 #define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */
87 #define NWAY_AR_100T4_CAPS 0x0200 /* 100T4 Capable */
88 #define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */
89 #define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */
90 #define NWAY_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */
91 #define NWAY_AR_NEXT_PAGE 0x8000 /* Next Page ability supported */
93 /* Link Partner Ability Register (Base Page) (PHY_LP_ABILITY) */
94 #define NWAY_LPAR_SELECTOR_FIELD 0x0000 /* LP protocol selector field */
95 #define NWAY_LPAR_10T_HD_CAPS 0x0020 /* LP is 10T Half Duplex Capable */
96 #define NWAY_LPAR_10T_FD_CAPS 0x0040 /* LP is 10T Full Duplex Capable */
97 #define NWAY_LPAR_100TX_HD_CAPS 0x0080 /* LP is 100TX Half Duplex Capable */
98 #define NWAY_LPAR_100TX_FD_CAPS 0x0100 /* LP is 100TX Full Duplex Capable */
99 #define NWAY_LPAR_100T4_CAPS 0x0200 /* LP is 100T4 Capable */
100 #define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */
101 #define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */
102 #define NWAY_LPAR_REMOTE_FAULT 0x2000 /* LP has detected Remote Fault */
103 #define NWAY_LPAR_ACKNOWLEDGE 0x4000 /* LP has rx'd link code word */
104 #define NWAY_LPAR_NEXT_PAGE 0x8000 /* Next Page ability supported */
106 /* Autoneg Expansion Register (PHY_AUTONEG_EXP) */
107 #define NWAY_ER_LP_NWAY_CAPS 0x0001 /* LP has Auto Neg Capability */
108 #define NWAY_ER_PAGE_RXD 0x0002 /* LP is 10T Half Duplex Capable */
109 #define NWAY_ER_NEXT_PAGE_CAPS 0x0004 /* LP is 10T Full Duplex Capable */
110 #define NWAY_ER_LP_NEXT_PAGE_CAPS 0x0008 /* LP is 100TX Half Duplex Capable */
111 #define NWAY_ER_PAR_DETECT_FAULT 0x0010 /* LP is 100TX Full Duplex Capable */
113 /* Next Page TX Register (PHY_NEXT_PAGE_TX) */
114 #define NPTX_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */
115 #define NPTX_TOGGLE 0x0800 /* Toggles between exchanges
118 #define NPTX_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg
119 * 0 = cannot comply with msg
121 #define NPTX_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */
122 #define NPTX_NEXT_PAGE 0x8000 /* 1 = addition NP will follow
123 * 0 = sending last NP
126 /* Link Partner Next Page Register (PHY_LP_NEXT_PAGE) */
127 #define LP_RNPR_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */
128 #define LP_RNPR_TOGGLE 0x0800 /* Toggles between exchanges
131 #define LP_RNPR_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg
132 * 0 = cannot comply with msg
134 #define LP_RNPR_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */
135 #define LP_RNPR_ACKNOWLDGE 0x4000 /* 1 = ACK / 0 = NO ACK */
136 #define LP_RNPR_NEXT_PAGE 0x8000 /* 1 = addition NP will follow
137 * 0 = sending last NP
140 /* 1000BASE-T Control Register (PHY_1000T_CTRL) */
141 #define CR_1000T_ASYM_PAUSE 0x0080 /* Advertise asymmetric pause bit */
142 #define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */
143 #define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */
144 #define CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device port */
146 #define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */
147 /* 0=Configure PHY as Slave */
148 #define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */
149 /* 0=Automatic Master/Slave config */
150 #define CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */
151 #define CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */
152 #define CR_1000T_TEST_MODE_2 0x4000 /* Master Transmit Jitter test */
153 #define CR_1000T_TEST_MODE_3 0x6000 /* Slave Transmit Jitter test */
154 #define CR_1000T_TEST_MODE_4 0x8000 /* Transmitter Distortion test */
156 /* 1000BASE-T Status Register (PHY_1000T_STATUS) */
157 #define SR_1000T_IDLE_ERROR_CNT 0x00FF /* Num idle errors since last read */
158 #define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asymmetric pause direction bit */
159 #define SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */
160 #define SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */
161 #define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */
162 #define SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */
163 #define SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local TX is Master, 0=Slave */
164 #define SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config fault */
165 #define SR_1000T_REMOTE_RX_STATUS_SHIFT 12
166 #define SR_1000T_LOCAL_RX_STATUS_SHIFT 13
167 #define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5
168 #define FFE_IDLE_ERR_COUNT_TIMEOUT_20 20
169 #define FFE_IDLE_ERR_COUNT_TIMEOUT_100 100
171 /* Extended Status Register (PHY_EXT_STATUS) */
172 #define IEEE_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */
173 #define IEEE_ESR_1000T_FD_CAPS 0x2000 /* 1000T FD capable */
174 #define IEEE_ESR_1000X_HD_CAPS 0x4000 /* 1000X HD capable */
175 #define IEEE_ESR_1000X_FD_CAPS 0x8000 /* 1000X FD capable */
177 #define PHY_TX_POLARITY_MASK 0x0100 /* register 10h bit 8 (polarity bit) */
178 #define PHY_TX_NORMAL_POLARITY 0 /* register 10h bit 8 (normal polarity) */
180 #define AUTO_POLARITY_DISABLE 0x0010 /* register 11h bit 4 */
181 /* (0=enable, 1=disable) */
183 /* Link and Auto Negotiation Status Reg (PHY_LINK_AN) [READ-ONLY] */
184 #define LANSR_MASTER 0x0001 /* 1=PHY is currently in master mode */
185 #define LANSR_FULL_DUPLEX 0x0002 /* 1=PHY is currently full duplex */
186 #define LANSR_LINK_GOOD 0x0004 /* 1=a good link is established */
187 #define LANSR_SPEED_MASK 0x0018
188 #define LANSR_SPEED_10 0x0000 /* 10Mb/s */
189 #define LANSR_SPEED_100 0x0008 /* 100Mb/s */
190 #define LANSR_SPEED_1000 0x0010 /* 1000Mb/s */
191 #define LANSR_SPEED_RSRVD 0x0018 /* reserved */
192 #define LANSR_NON_COMP_MODE 0x0020 /* 1=detects only in non-compliant mode */
193 #define LANSR_DEEP_LOOPBACK 0x0040 /* 1=the PHY operates in deep loopback mode */
194 #define LANSR_SHALLOW_LOOPBACK 0x0080 /* 1=the PHY operates in shallow loopback mode */
195 #define LANSR_RSRVD_8 0x0100 /* reserved */
196 #define LANSR_FIFO_ERR 0x0200 /* 1=FIFO error occurred */
197 #define LANSR_MDIX_XOVER 0x0400 /* 1=PHY's MDI is in cross-over mode */
198 #define LANSR_RSRVD_11 0x0800 /* resevered */
199 #define LANSR_TP_POLARITY_REV 0xf000 /* Twisted pair polarity status A:D([15:12]) 1=reversed */
201 /* Interrupt status, mask and clear regs (PHY_INT_{STATUS,MASK,CLEAR}) */
202 #define PHY_INT_RSRVD_0 0x0001 /* reserved */
203 #define PHY_INT_RSRVD_1 0x0002 /* reserved */
204 #define PHY_INT_RSRVD_2 0x0004 /* reserved */
205 #define PHY_INT_REM_FLT_CNG 0x0008 /* Remote Fault Changed */
206 #define PHY_INT_AN_CMPL 0x0010 /* Auto-negotiation completion */
207 #define PHY_INT_NXT_PG_RCVD 0x0020 /* Next Page Received */
208 #define PHY_INT_JABBER_CNG 0x0040 /* Jabber Changed */
209 #define PHY_INT_NO_LINK 0x0080 /* No link after auto-negotiation */
210 #define PHY_INT_NO_HCD 0x0100 /* AN couldn't determine highest common denominator */
211 #define PHY_INT_MAS_SLA_ERR 0x0200 /* Master / Slave Error: couldn't resolve */
212 #define PHY_INT_PRL_DET_FLT 0x0400 /* Parallel detection fault */
213 #define PHY_INT_POL_CNG 0x0800 /* Polarity of any channel changed */
214 #define PHY_INT_MDIX_CNG 0x1000 /* MDIX changed. A pair swap occurred. */
215 #define PHY_INT_DPLX_CNG 0x2000 /* Duplex changed */
216 #define PHY_INT_LNK_CNG 0x4000 /* Link changed (asserted when a link is established or broken) */
217 #define PHY_INT_SPD_CNG 0x8000 /* Speed changed */
219 #endif /* INCLUDED_ETH_PHY_H */