3 * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
5 * Copyright © 2005 Agere Systems Inc.
9 *------------------------------------------------------------------------------
11 * et1310_phy.h - Defines, structs, enums, prototypes, etc. pertaining to the
14 *------------------------------------------------------------------------------
18 * This software is provided subject to the following terms and conditions,
19 * which you should read carefully before using the software. Using this
20 * software indicates your acceptance of these terms and conditions. If you do
21 * not agree with these terms and conditions, do not use the software.
23 * Copyright © 2005 Agere Systems Inc.
24 * All rights reserved.
26 * Redistribution and use in source or binary forms, with or without
27 * modifications, are permitted provided that the following conditions are met:
29 * . Redistributions of source code must retain the above copyright notice, this
30 * list of conditions and the following Disclaimer as comments in the code as
31 * well as in the documentation and/or other materials provided with the
34 * . Redistributions in binary form must reproduce the above copyright notice,
35 * this list of conditions and the following Disclaimer in the documentation
36 * and/or other materials provided with the distribution.
38 * . Neither the name of Agere Systems Inc. nor the names of the contributors
39 * may be used to endorse or promote products derived from this software
40 * without specific prior written permission.
44 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
45 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
46 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
47 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
48 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
49 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
50 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
52 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
54 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
59 #ifndef _ET1310_PHY_H_
60 #define _ET1310_PHY_H_
62 #include "et1310_address_map.h"
64 /* MI Register Addresses */
65 #define MI_CONTROL_REG 0
66 #define MI_STATUS_REG 1
67 #define MI_PHY_IDENTIFIER_1_REG 2
68 #define MI_PHY_IDENTIFIER_2_REG 3
69 #define MI_AUTONEG_ADVERTISEMENT_REG 4
70 #define MI_AUTONEG_LINK_PARTNER_ABILITY_REG 5
71 #define MI_AUTONEG_EXPANSION_REG 6
72 #define MI_AUTONEG_NEXT_PAGE_TRANSMIT_REG 7
73 #define MI_LINK_PARTNER_NEXT_PAGE_REG 8
74 #define MI_1000BASET_CONTROL_REG 9
75 #define MI_1000BASET_STATUS_REG 10
76 #define MI_RESERVED11_REG 11
77 #define MI_RESERVED12_REG 12
78 #define MI_RESERVED13_REG 13
79 #define MI_RESERVED14_REG 14
80 #define MI_EXTENDED_STATUS_REG 15
82 /* VMI Register Addresses */
83 #define VMI_RESERVED16_REG 16
84 #define VMI_RESERVED17_REG 17
85 #define VMI_RESERVED18_REG 18
86 #define VMI_LOOPBACK_CONTROL_REG 19
87 #define VMI_RESERVED20_REG 20
88 #define VMI_MI_CONTROL_REG 21
89 #define VMI_PHY_CONFIGURATION_REG 22
90 #define VMI_PHY_CONTROL_REG 23
91 #define VMI_INTERRUPT_MASK_REG 24
92 #define VMI_INTERRUPT_STATUS_REG 25
93 #define VMI_PHY_STATUS_REG 26
94 #define VMI_LED_CONTROL_1_REG 27
95 #define VMI_LED_CONTROL_2_REG 28
96 #define VMI_RESERVED29_REG 29
97 #define VMI_RESERVED30_REG 30
98 #define VMI_RESERVED31_REG 31
100 /* PHY Register Mapping(MI) Management Interface Regs */
102 u8 bmcr
; /* Basic mode control reg(Reg 0x00) */
103 u8 bmsr
; /* Basic mode status reg(Reg 0x01) */
104 u8 idr1
; /* Phy identifier reg 1(Reg 0x02) */
105 u8 idr2
; /* Phy identifier reg 2(Reg 0x03) */
106 u8 anar
; /* Auto-Negotiation advertisement(Reg 0x04) */
107 u8 anlpar
; /* Auto-Negotiation link Partner Ability(Reg 0x05) */
108 u8 aner
; /* Auto-Negotiation expansion reg(Reg 0x06) */
109 u8 annptr
; /* Auto-Negotiation next page transmit reg(Reg 0x07) */
110 u8 lpnpr
; /* link partner next page reg(Reg 0x08) */
111 u8 gcr
; /* Gigabit basic mode control reg(Reg 0x09) */
112 u8 gsr
; /* Gigabit basic mode status reg(Reg 0x0A) */
113 u8 mi_res1
[4]; /* Future use by MI working group(Reg 0x0B - 0x0E) */
114 u8 esr
; /* Extended status reg(Reg 0x0F) */
115 u8 mi_res2
[3]; /* Future use by MI working group(Reg 0x10 - 0x12) */
116 u8 loop_ctl
; /* Loopback Control Reg(Reg 0x13) */
117 u8 mi_res3
; /* Future use by MI working group(Reg 0x14) */
118 u8 mcr
; /* MI Control Reg(Reg 0x15) */
119 u8 pcr
; /* Configuration Reg(Reg 0x16) */
120 u8 phy_ctl
; /* PHY Control Reg(Reg 0x17) */
121 u8 imr
; /* Interrupt Mask Reg(Reg 0x18) */
122 u8 isr
; /* Interrupt Status Reg(Reg 0x19) */
123 u8 psr
; /* PHY Status Reg(Reg 0x1A) */
124 u8 lcr1
; /* LED Control 1 Reg(Reg 0x1B) */
125 u8 lcr2
; /* LED Control 2 Reg(Reg 0x1C) */
126 u8 mi_res4
[3]; /* Future use by MI working group(Reg 0x1D - 0x1F) */
130 * MI Register 0: Basic mode control register
145 * MI Register 1: Basic mode status register
155 * 6: preamble_supress
156 * 5: auto_neg_complete
164 #define MI_BMSR_LINK_STATUS 0x04
165 #define MI_BMSR_AUTO_NEG_COMPLETE 0x20
168 * MI Register 4: Auto-negotiation advertisement register
184 /* MI Register 5: Auto-negotiation link partner advertisement register
199 /* MI Register 6: Auto-negotiation expansion register
208 /* MI Register 7: Auto-negotiation next page transmit reg(0x07)
217 /* MI Register 8: Link Partner Next Page Reg(0x08)
226 /* MI Register 9: 1000BaseT Control Reg(0x09)
236 /* MI Register 10: 1000BaseT Status Reg(0x0A)
237 * 15: ms_config_fault
239 * 13: local_rx_status
240 * 12: remote_rx_status
247 /* MI Register 11 - 14: Reserved Regs(0x0B - 0x0E) */
249 /* MI Register 15: Extended status Reg(0x0F)
257 /* MI Register 16 - 18: Reserved Reg(0x10-0x12) */
259 /* MI Register 19: Loopback Control Reg(0x13)
269 /* MI Register 20: Reserved Reg(0x14) */
271 /* MI Register 21: Management Interface Control Reg(0x15)
273 * 10-4: mi_error_count
277 * 0: preamble_supress_en
280 /* MI Register 22: PHY Configuration Reg(0x16)
283 * 13-12: tx_fifo_depth
284 * 11-10: speed_downshift
295 /* MI Register 23: PHY CONTROL Reg(0x17)
299 * 12-11: downshift_attempts
303 * 3: tp_loopback_10baseT
309 /* MI Register 24: Interrupt Mask Reg(0x18)
315 * 5: err_counter_full
316 * 4: fifo_over_underflow
324 /* MI Register 25: Interrupt Status Reg(0x19)
330 * 5: err_counter_full
331 * 4: fifo_over_underflow
338 /* MI Register 26: PHY Status Reg(0x1A)
340 * 14-13: autoneg_fault
343 * 10: polarity_status
349 * 3: collision_status
355 /* MI Register 27: LED Control Reg 1(0x1B)
357 * 13-12: led_dup_indicate
366 /* MI Register 28: LED Control Reg 2(0x1C)
373 /* MI Register 29 - 31: Reserved Reg(0x1D - 0x1E) */
376 /* Prototypes for ET1310_phy.c */
377 /* Defines for PHY access routines */
379 /* Define bit operation flags */
380 #define TRUEPHY_BIT_CLEAR 0
381 #define TRUEPHY_BIT_SET 1
382 #define TRUEPHY_BIT_READ 2
384 /* Define read/write operation flags */
386 #define TRUEPHY_READ 0
387 #define TRUEPHY_WRITE 1
388 #define TRUEPHY_MASK 2
392 #define TRUEPHY_SPEED_10MBPS 0
393 #define TRUEPHY_SPEED_100MBPS 1
394 #define TRUEPHY_SPEED_1000MBPS 2
396 /* Define duplex modes */
397 #define TRUEPHY_DUPLEX_HALF 0
398 #define TRUEPHY_DUPLEX_FULL 1
400 /* Define master/slave configuration values */
401 #define TRUEPHY_CFG_SLAVE 0
402 #define TRUEPHY_CFG_MASTER 1
404 /* Define MDI/MDI-X settings */
405 #define TRUEPHY_MDI 0
406 #define TRUEPHY_MDIX 1
407 #define TRUEPHY_AUTO_MDI_MDIX 2
409 /* Define 10Base-T link polarities */
410 #define TRUEPHY_POLARITY_NORMAL 0
411 #define TRUEPHY_POLARITY_INVERTED 1
413 /* Define auto-negotiation results */
414 #define TRUEPHY_ANEG_NOT_COMPLETE 0
415 #define TRUEPHY_ANEG_COMPLETE 1
416 #define TRUEPHY_ANEG_DISABLED 2
418 /* Define duplex advertisement flags */
419 #define TRUEPHY_ADV_DUPLEX_NONE 0x00
420 #define TRUEPHY_ADV_DUPLEX_FULL 0x01
421 #define TRUEPHY_ADV_DUPLEX_HALF 0x02
422 #define TRUEPHY_ADV_DUPLEX_BOTH \
423 (TRUEPHY_ADV_DUPLEX_FULL | TRUEPHY_ADV_DUPLEX_HALF)
425 #define PHY_CONTROL 0x00 /* #define TRU_MI_CONTROL_REGISTER 0 */
426 #define PHY_STATUS 0x01 /* #define TRU_MI_STATUS_REGISTER 1 */
427 #define PHY_ID_1 0x02 /* #define TRU_MI_PHY_IDENTIFIER_1_REGISTER 2 */
428 #define PHY_ID_2 0x03 /* #define TRU_MI_PHY_IDENTIFIER_2_REGISTER 3 */
429 #define PHY_AUTO_ADVERTISEMENT 0x04 /* #define TRU_MI_ADVERTISEMENT_REGISTER 4 */
430 #define PHY_AUTO_LINK_PARTNER 0x05 /* #define TRU_MI_LINK_PARTNER_ABILITY_REGISTER 5 */
431 #define PHY_AUTO_EXPANSION 0x06 /* #define TRU_MI_EXPANSION_REGISTER 6 */
432 #define PHY_AUTO_NEXT_PAGE_TX 0x07 /* #define TRU_MI_NEXT_PAGE_TRANSMIT_REGISTER 7 */
433 #define PHY_LINK_PARTNER_NEXT_PAGE 0x08 /* #define TRU_MI_LINK_PARTNER_NEXT_PAGE_REGISTER 8 */
434 #define PHY_1000_CONTROL 0x09 /* #define TRU_MI_1000BASET_CONTROL_REGISTER 9 */
435 #define PHY_1000_STATUS 0x0A /* #define TRU_MI_1000BASET_STATUS_REGISTER 10 */
437 #define PHY_EXTENDED_STATUS 0x0F /* #define TRU_MI_EXTENDED_STATUS_REGISTER 15 */
439 /* some defines for modem registers that seem to be 'reserved' */
440 #define PHY_INDEX_REG 0x10
441 #define PHY_DATA_REG 0x11
443 #define PHY_MPHY_CONTROL_REG 0x12 /* #define TRU_VMI_MPHY_CONTROL_REGISTER 18 */
445 #define PHY_LOOPBACK_CONTROL 0x13 /* #define TRU_VMI_LOOPBACK_CONTROL_1_REGISTER 19 */
446 /* #define TRU_VMI_LOOPBACK_CONTROL_2_REGISTER 20 */
447 #define PHY_REGISTER_MGMT_CONTROL 0x15 /* #define TRU_VMI_MI_SEQ_CONTROL_REGISTER 21 */
448 #define PHY_CONFIG 0x16 /* #define TRU_VMI_CONFIGURATION_REGISTER 22 */
449 #define PHY_PHY_CONTROL 0x17 /* #define TRU_VMI_PHY_CONTROL_REGISTER 23 */
450 #define PHY_INTERRUPT_MASK 0x18 /* #define TRU_VMI_INTERRUPT_MASK_REGISTER 24 */
451 #define PHY_INTERRUPT_STATUS 0x19 /* #define TRU_VMI_INTERRUPT_STATUS_REGISTER 25 */
452 #define PHY_PHY_STATUS 0x1A /* #define TRU_VMI_PHY_STATUS_REGISTER 26 */
453 #define PHY_LED_1 0x1B /* #define TRU_VMI_LED_CONTROL_1_REGISTER 27 */
454 #define PHY_LED_2 0x1C /* #define TRU_VMI_LED_CONTROL_2_REGISTER 28 */
455 /* #define TRU_VMI_LINK_CONTROL_REGISTER 29 */
456 /* #define TRU_VMI_TIMING_CONTROL_REGISTER */
458 #endif /* _ET1310_PHY_H_ */