3 * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
5 * Copyright © 2005 Agere Systems Inc.
9 * Copyright (c) 2011 Mark Einon <mark.einon@gmail.com>
11 *------------------------------------------------------------------------------
13 * et1310_phy.h - Defines, structs, enums, prototypes, etc. pertaining to the
16 *------------------------------------------------------------------------------
20 * This software is provided subject to the following terms and conditions,
21 * which you should read carefully before using the software. Using this
22 * software indicates your acceptance of these terms and conditions. If you do
23 * not agree with these terms and conditions, do not use the software.
25 * Copyright © 2005 Agere Systems Inc.
26 * All rights reserved.
28 * Redistribution and use in source or binary forms, with or without
29 * modifications, are permitted provided that the following conditions are met:
31 * . Redistributions of source code must retain the above copyright notice, this
32 * list of conditions and the following Disclaimer as comments in the code as
33 * well as in the documentation and/or other materials provided with the
36 * . Redistributions in binary form must reproduce the above copyright notice,
37 * this list of conditions and the following Disclaimer in the documentation
38 * and/or other materials provided with the distribution.
40 * . Neither the name of Agere Systems Inc. nor the names of the contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
46 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
47 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
48 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
49 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
50 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
51 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
52 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
53 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
54 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
56 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
61 #ifndef _ET1310_PHY_H_
62 #define _ET1310_PHY_H_
64 #include "et1310_address_map.h"
67 * Defines for generic MII registers 0x00 -> 0x0F can be found in
71 /* some defines for modem registers that seem to be 'reserved' */
72 #define PHY_INDEX_REG 0x10
73 #define PHY_DATA_REG 0x11
74 #define PHY_MPHY_CONTROL_REG 0x12
76 /* defines for specified registers */
77 #define PHY_LOOPBACK_CONTROL 0x13 /* TRU_VMI_LOOPBACK_CONTROL_1_REG 19 */
78 /* TRU_VMI_LOOPBACK_CONTROL_2_REG 20 */
79 #define PHY_REGISTER_MGMT_CONTROL 0x15 /* TRU_VMI_MI_SEQ_CONTROL_REG 21 */
80 #define PHY_CONFIG 0x16 /* TRU_VMI_CONFIGURATION_REG 22 */
81 #define PHY_PHY_CONTROL 0x17 /* TRU_VMI_PHY_CONTROL_REG 23 */
82 #define PHY_INTERRUPT_MASK 0x18 /* TRU_VMI_INTERRUPT_MASK_REG 24 */
83 #define PHY_INTERRUPT_STATUS 0x19 /* TRU_VMI_INTERRUPT_STATUS_REG 25 */
84 #define PHY_PHY_STATUS 0x1A /* TRU_VMI_PHY_STATUS_REG 26 */
85 #define PHY_LED_1 0x1B /* TRU_VMI_LED_CONTROL_1_REG 27 */
86 #define PHY_LED_2 0x1C /* TRU_VMI_LED_CONTROL_2_REG 28 */
87 /* TRU_VMI_LINK_CONTROL_REG 29 */
88 /* TRU_VMI_TIMING_CONTROL_REG */
90 /* MI Register 10: Gigabit basic mode status reg(Reg 0x0A) */
91 #define ET_1000BT_MSTR_SLV 0x4000
93 /* MI Register 16 - 18: Reserved Reg(0x10-0x12) */
95 /* MI Register 19: Loopback Control Reg(0x13)
105 /* MI Register 20: Reserved Reg(0x14) */
107 /* MI Register 21: Management Interface Control Reg(0x15)
109 * 10-4: mi_error_count
113 * 0: preamble_supress_en
116 /* MI Register 22: PHY Configuration Reg(0x16)
119 * 13-12: tx_fifo_depth
120 * 11-10: speed_downshift
131 #define ET_PHY_CONFIG_TX_FIFO_DEPTH 0x3000
133 #define ET_PHY_CONFIG_FIFO_DEPTH_8 0x0000
134 #define ET_PHY_CONFIG_FIFO_DEPTH_16 0x1000
135 #define ET_PHY_CONFIG_FIFO_DEPTH_32 0x2000
136 #define ET_PHY_CONFIG_FIFO_DEPTH_64 0x3000
138 /* MI Register 23: PHY CONTROL Reg(0x17)
142 * 12-11: downshift_attempts
146 * 3: tp_loopback_10baseT
152 /* MI Register 24: Interrupt Mask Reg(0x18)
158 * 5: err_counter_full
159 * 4: fifo_over_underflow
166 #define ET_PHY_INT_MASK_AUTONEGSTAT 0x0100
167 #define ET_PHY_INT_MASK_LINKSTAT 0x0004
168 #define ET_PHY_INT_MASK_ENABLE 0x0001
170 /* MI Register 25: Interrupt Status Reg(0x19)
176 * 5: err_counter_full
177 * 4: fifo_over_underflow
184 /* MI Register 26: PHY Status Reg(0x1A)
186 * 14-13: autoneg_fault
189 * 10: polarity_status
195 * 3: collision_status
200 #define ET_PHY_AUTONEG_STATUS 0x1000
201 #define ET_PHY_POLARITY_STATUS 0x0400
202 #define ET_PHY_SPEED_STATUS 0x0300
203 #define ET_PHY_DUPLEX_STATUS 0x0080
204 #define ET_PHY_LSTATUS 0x0040
205 #define ET_PHY_AUTONEG_ENABLE 0x0020
207 /* MI Register 27: LED Control Reg 1(0x1B)
209 * 13-12: led_dup_indicate
218 /* MI Register 28: LED Control Reg 2(0x1C)
224 #define ET_LED2_LED_LINK 0xF000
225 #define ET_LED2_LED_TXRX 0x0F00
226 #define ET_LED2_LED_100TX 0x00F0
227 #define ET_LED2_LED_1000T 0x000F
229 /* defines for LED control reg 2 values */
230 #define LED_VAL_1000BT 0x0
231 #define LED_VAL_100BTX 0x1
232 #define LED_VAL_10BT 0x2
233 #define LED_VAL_1000BT_100BTX 0x3 /* 1000BT on, 100BTX blink */
234 #define LED_VAL_LINKON 0x4
235 #define LED_VAL_TX 0x5
236 #define LED_VAL_RX 0x6
237 #define LED_VAL_TXRX 0x7 /* TX or RX */
238 #define LED_VAL_DUPLEXFULL 0x8
239 #define LED_VAL_COLLISION 0x9
240 #define LED_VAL_LINKON_ACTIVE 0xA /* Link on, activity blink */
241 #define LED_VAL_LINKON_RECV 0xB /* Link on, receive blink */
242 #define LED_VAL_DUPLEXFULL_COLLISION 0xC /* Duplex on, collision blink */
243 #define LED_VAL_BLINK 0xD
244 #define LED_VAL_ON 0xE
245 #define LED_VAL_OFF 0xF
247 #define LED_LINK_SHIFT 12
248 #define LED_TXRX_SHIFT 8
249 #define LED_100TX_SHIFT 4
251 /* MI Register 29 - 31: Reserved Reg(0x1D - 0x1E) */
253 /* Defines for PHY access routines */
255 /* Define bit operation flags */
256 #define TRUEPHY_BIT_CLEAR 0
257 #define TRUEPHY_BIT_SET 1
258 #define TRUEPHY_BIT_READ 2
260 /* Define read/write operation flags */
262 #define TRUEPHY_READ 0
263 #define TRUEPHY_WRITE 1
264 #define TRUEPHY_MASK 2
267 /* Define master/slave configuration values */
268 #define TRUEPHY_CFG_SLAVE 0
269 #define TRUEPHY_CFG_MASTER 1
271 /* Define MDI/MDI-X settings */
272 #define TRUEPHY_MDI 0
273 #define TRUEPHY_MDIX 1
274 #define TRUEPHY_AUTO_MDI_MDIX 2
276 /* Define 10Base-T link polarities */
277 #define TRUEPHY_POLARITY_NORMAL 0
278 #define TRUEPHY_POLARITY_INVERTED 1
280 /* Define auto-negotiation results */
281 #define TRUEPHY_ANEG_NOT_COMPLETE 0
282 #define TRUEPHY_ANEG_COMPLETE 1
283 #define TRUEPHY_ANEG_DISABLED 2
285 /* Define duplex advertisement flags */
286 #define TRUEPHY_ADV_DUPLEX_NONE 0x00
287 #define TRUEPHY_ADV_DUPLEX_FULL 0x01
288 #define TRUEPHY_ADV_DUPLEX_HALF 0x02
289 #define TRUEPHY_ADV_DUPLEX_BOTH \
290 (TRUEPHY_ADV_DUPLEX_FULL | TRUEPHY_ADV_DUPLEX_HALF)
292 #endif /* _ET1310_PHY_H_ */