ixgbe_phy.h revision 205720
1164032Srwatson/******************************************************************************
2164032Srwatson
3164032Srwatson  Copyright (c) 2001-2010, Intel Corporation
4164032Srwatson  All rights reserved.
5164032Srwatson
6164032Srwatson  Redistribution and use in source and binary forms, with or without
7164032Srwatson  modification, are permitted provided that the following conditions are met:
8164032Srwatson
9164032Srwatson   1. Redistributions of source code must retain the above copyright notice,
10164032Srwatson      this list of conditions and the following disclaimer.
11164032Srwatson
12164032Srwatson   2. Redistributions in binary form must reproduce the above copyright
13164032Srwatson      notice, this list of conditions and the following disclaimer in the
14164032Srwatson      documentation and/or other materials provided with the distribution.
15164032Srwatson
16164032Srwatson   3. Neither the name of the Intel Corporation nor the names of its
17164032Srwatson      contributors may be used to endorse or promote products derived from
18164032Srwatson      this software without specific prior written permission.
19164032Srwatson
20164032Srwatson  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21164032Srwatson  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22164032Srwatson  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23164032Srwatson  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24164032Srwatson  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25164032Srwatson  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26164032Srwatson  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27164032Srwatson  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28164032Srwatson  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29164032Srwatson  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30164032Srwatson  POSSIBILITY OF SUCH DAMAGE.
31164032Srwatson
32164037Sru******************************************************************************/
33164032Srwatson/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.h 205720 2010-03-27 00:21:40Z jfv $*/
34164032Srwatson
35164032Srwatson#ifndef _IXGBE_PHY_H_
36164032Srwatson#define _IXGBE_PHY_H_
37164032Srwatson
38164032Srwatson#include "ixgbe_type.h"
39164032Srwatson#define IXGBE_I2C_EEPROM_DEV_ADDR    0xA0
40164032Srwatson
41164032Srwatson/* EEPROM byte offsets */
42164032Srwatson#define IXGBE_SFF_IDENTIFIER         0x0
43164032Srwatson#define IXGBE_SFF_IDENTIFIER_SFP     0x3
44164032Srwatson#define IXGBE_SFF_VENDOR_OUI_BYTE0   0x25
45164037Sru#define IXGBE_SFF_VENDOR_OUI_BYTE1   0x26
46164032Srwatson#define IXGBE_SFF_VENDOR_OUI_BYTE2   0x27
47164032Srwatson#define IXGBE_SFF_1GBE_COMP_CODES    0x6
48164037Sru#define IXGBE_SFF_10GBE_COMP_CODES   0x3
49164032Srwatson#define IXGBE_SFF_CABLE_TECHNOLOGY   0x8
50164037Sru#define IXGBE_SFF_CABLE_SPEC_COMP    0x3C
51183113Sattilio
52164032Srwatson/* Bitmasks */
53164032Srwatson#define IXGBE_SFF_DA_PASSIVE_CABLE           0x4
54164032Srwatson#define IXGBE_SFF_DA_ACTIVE_CABLE            0x8
55164032Srwatson#define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING   0x4
56164032Srwatson#define IXGBE_SFF_1GBASESX_CAPABLE           0x1
57164032Srwatson#define IXGBE_SFF_1GBASELX_CAPABLE           0x2
58164032Srwatson#define IXGBE_SFF_10GBASESR_CAPABLE          0x10
59164032Srwatson#define IXGBE_SFF_10GBASELR_CAPABLE          0x20
60171058Srwatson#define IXGBE_I2C_EEPROM_READ_MASK           0x100
61171058Srwatson#define IXGBE_I2C_EEPROM_STATUS_MASK         0x3
62171058Srwatson#define IXGBE_I2C_EEPROM_STATUS_NO_OPERATION 0x0
63164032Srwatson#define IXGBE_I2C_EEPROM_STATUS_PASS         0x1
64164032Srwatson#define IXGBE_I2C_EEPROM_STATUS_FAIL         0x2
65164032Srwatson#define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS  0x3
66164037Sru
67164032Srwatson/* Bit-shift macros */
68164032Srwatson#define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT    24
69164032Srwatson#define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT    16
70164032Srwatson#define IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT    8
71164032Srwatson
72164032Srwatson/* Vendor OUIs: format of OUI is 0x[byte0][byte1][byte2][00] */
73164032Srwatson#define IXGBE_SFF_VENDOR_OUI_TYCO     0x00407600
74164032Srwatson#define IXGBE_SFF_VENDOR_OUI_FTL      0x00906500
75164032Srwatson#define IXGBE_SFF_VENDOR_OUI_AVAGO    0x00176A00
76164032Srwatson#define IXGBE_SFF_VENDOR_OUI_INTEL    0x001B2100
77164032Srwatson
78164032Srwatson/* I2C SDA and SCL timing parameters for standard mode */
79164032Srwatson#define IXGBE_I2C_T_HD_STA  4
80166867Srwatson#define IXGBE_I2C_T_LOW     5
81166867Srwatson#define IXGBE_I2C_T_HIGH    4
82166867Srwatson#define IXGBE_I2C_T_SU_STA  5
83166867Srwatson#define IXGBE_I2C_T_HD_DATA 5
84166867Srwatson#define IXGBE_I2C_T_SU_DATA 1
85166867Srwatson#define IXGBE_I2C_T_RISE    1
86166867Srwatson#define IXGBE_I2C_T_FALL    1
87167574Sbrueffer#define IXGBE_I2C_T_SU_STO  4
88164032Srwatson#define IXGBE_I2C_T_BUF     5
89164032Srwatson
90164032Srwatson#define IXGBE_TN_LASI_STATUS_REG        0x9005
91164032Srwatson#define IXGBE_TN_LASI_STATUS_TEMP_ALARM 0x0008
92164032Srwatson
93164032Srwatson
94164032Srwatsons32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw);
95164037Srubool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr);
96164032Srwatsonenum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id);
97164032Srwatsons32 ixgbe_get_phy_id(struct ixgbe_hw *hw);
98164037Srus32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw);
99164032Srwatsons32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw);
100164032Srwatsons32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
101164032Srwatson                               u32 device_type, u16 *phy_data);
102164032Srwatsons32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
103164032Srwatson                                u32 device_type, u16 phy_data);
104164032Srwatsons32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw);
105164032Srwatsons32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw,
106164032Srwatson                                       ixgbe_link_speed speed,
107164032Srwatson                                       bool autoneg,
108167574Sbrueffer                                       bool autoneg_wait_to_complete);
109167574Sbrueffers32 ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw,
110164032Srwatson                                             ixgbe_link_speed *speed,
111165213Smpp                                             bool *autoneg);
112164032Srwatson
113164032Srwatson/* PHY specific */
114164032Srwatsons32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw,
115164032Srwatson                             ixgbe_link_speed *speed,
116164032Srwatson                             bool *link_up);
117164032Srwatsons32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw);
118164037Srus32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw,
119164037Sru                                       u16 *firmware_version);
120164037Srus32 ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw,
121164037Sru                                       u16 *firmware_version);
122164032Srwatson
123s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw);
124s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw);
125s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
126                                        u16 *list_offset,
127                                        u16 *data_offset);
128s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw);
129s32 ixgbe_tn_set_low_power_state(struct ixgbe_hw *hw);
130s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
131                                u8 dev_addr, u8 *data);
132s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
133                                 u8 dev_addr, u8 data);
134s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset,
135                                  u8 *eeprom_data);
136s32 ixgbe_write_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset,
137                                   u8 eeprom_data);
138#endif /* _IXGBE_PHY_H_ */
139