aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x/bnx2x_link.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_link.h')
-rw-r--r--drivers/net/bnx2x/bnx2x_link.h109
1 files changed, 91 insertions, 18 deletions
diff --git a/drivers/net/bnx2x/bnx2x_link.h b/drivers/net/bnx2x/bnx2x_link.h
index 9bfe7fa452bc..9717cb1fbad0 100644
--- a/drivers/net/bnx2x/bnx2x_link.h
+++ b/drivers/net/bnx2x/bnx2x_link.h
@@ -46,6 +46,15 @@
46#define SFP_EEPROM_PART_NO_ADDR 0x28 46#define SFP_EEPROM_PART_NO_ADDR 0x28
47#define SFP_EEPROM_PART_NO_SIZE 16 47#define SFP_EEPROM_PART_NO_SIZE 16
48#define PWR_FLT_ERR_MSG_LEN 250 48#define PWR_FLT_ERR_MSG_LEN 250
49
50#define XGXS_EXT_PHY_TYPE(ext_phy_config) \
51 ((ext_phy_config) & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK)
52#define XGXS_EXT_PHY_ADDR(ext_phy_config) \
53 (((ext_phy_config) & PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> \
54 PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT)
55#define SERDES_EXT_PHY_TYPE(ext_phy_config) \
56 ((ext_phy_config) & PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK)
57
49/* Single Media Direct board is the plain 577xx board with CX4/RJ45 jacks */ 58/* Single Media Direct board is the plain 577xx board with CX4/RJ45 jacks */
50#define SINGLE_MEDIA_DIRECT(params) (params->num_phys == 1) 59#define SINGLE_MEDIA_DIRECT(params) (params->num_phys == 1)
51/* Single Media board contains single external phy */ 60/* Single Media board contains single external phy */
@@ -58,6 +67,10 @@
58 67
59#define MAX_PHYS 2 68#define MAX_PHYS 2
60 69
70/* Same configuration is shared between the XGXS and the first external phy */
71#define LINK_CONFIG_SIZE (MAX_PHYS - 1)
72#define LINK_CONFIG_IDX(_phy_idx) ((_phy_idx == INT_PHY) ? \
73 0 : (_phy_idx - 1))
61/***********************************************************/ 74/***********************************************************/
62/* bnx2x_phy struct */ 75/* bnx2x_phy struct */
63/* Defines the required arguments and function per phy */ 76/* Defines the required arguments and function per phy */
@@ -66,13 +79,88 @@ struct link_vars;
66struct link_params; 79struct link_params;
67struct bnx2x_phy; 80struct bnx2x_phy;
68 81
82typedef u8 (*config_init_t)(struct bnx2x_phy *phy, struct link_params *params,
83 struct link_vars *vars);
84typedef u8 (*read_status_t)(struct bnx2x_phy *phy, struct link_params *params,
85 struct link_vars *vars);
86typedef void (*link_reset_t)(struct bnx2x_phy *phy,
87 struct link_params *params);
88typedef void (*config_loopback_t)(struct bnx2x_phy *phy,
89 struct link_params *params);
90typedef u8 (*format_fw_ver_t)(u32 raw, u8 *str, u16 *len);
91typedef void (*hw_reset_t)(struct bnx2x_phy *phy, struct link_params *params);
92typedef void (*set_link_led_t)(struct bnx2x_phy *phy,
93 struct link_params *params, u8 mode);
94
69struct bnx2x_phy { 95struct bnx2x_phy {
70 u32 type; 96 u32 type;
71 97
72 /* Loaded during init */ 98 /* Loaded during init */
73 u8 addr; 99 u8 addr;
74 100
101 u8 flags;
102 /* Require HW lock */
103#define FLAGS_HW_LOCK_REQUIRED (1<<0)
104 /* No Over-Current detection */
105#define FLAGS_NOC (1<<1)
106 /* Fan failure detection required */
107#define FLAGS_FAN_FAILURE_DET_REQ (1<<2)
108 /* Initialize first the XGXS and only then the phy itself */
109#define FLAGS_INIT_XGXS_FIRST (1<<3)
110
111 u8 def_md_devad;
112 u8 reserved;
113 /* preemphasis values for the rx side */
114 u16 rx_preemphasis[4];
115
116 /* preemphasis values for the tx side */
117 u16 tx_preemphasis[4];
118
119 /* EMAC address for access MDIO */
75 u32 mdio_ctrl; 120 u32 mdio_ctrl;
121
122 u32 supported;
123
124 u32 media_type;
125#define ETH_PHY_UNSPECIFIED 0x0
126#define ETH_PHY_SFP_FIBER 0x1
127#define ETH_PHY_XFP_FIBER 0x2
128#define ETH_PHY_DA_TWINAX 0x3
129#define ETH_PHY_BASE_T 0x4
130#define ETH_PHY_NOT_PRESENT 0xff
131
132 /* The address in which version is located*/
133 u32 ver_addr;
134
135 u16 req_flow_ctrl;
136
137 u16 req_line_speed;
138
139 u32 speed_cap_mask;
140
141 u16 req_duplex;
142 u16 rsrv;
143 /* Called per phy/port init, and it configures LASI, speed, autoneg,
144 duplex, flow control negotiation, etc. */
145 config_init_t config_init;
146
147 /* Called due to interrupt. It determines the link, speed */
148 read_status_t read_status;
149
150 /* Called when driver is unloading. Should reset the phy */
151 link_reset_t link_reset;
152
153 /* Set the loopback configuration for the phy */
154 config_loopback_t config_loopback;
155
156 /* Format the given raw number into str up to len */
157 format_fw_ver_t format_fw_ver;
158
159 /* Reset the phy (both ports) */
160 hw_reset_t hw_reset;
161
162 /* Set link led mode (on/off/oper)*/
163 set_link_led_t set_link_led;
76}; 164};
77 165
78/* Inputs parameters to the CLC */ 166/* Inputs parameters to the CLC */
@@ -106,38 +194,23 @@ struct link_params {
106#define SWITCH_CFG_10G PORT_FEATURE_CON_SWITCH_10G_SWITCH 194#define SWITCH_CFG_10G PORT_FEATURE_CON_SWITCH_10G_SWITCH
107#define SWITCH_CFG_AUTO_DETECT PORT_FEATURE_CON_SWITCH_AUTO_DETECT 195#define SWITCH_CFG_AUTO_DETECT PORT_FEATURE_CON_SWITCH_AUTO_DETECT
108 196
109 u16 hw_led_mode; /* part of the hw_config read from the shmem */
110
111 /* phy_addr populated by the phy_init function */
112 u8 phy_addr;
113 /*u8 reserved1;*/
114
115 u32 lane_config; 197 u32 lane_config;
116 u32 ext_phy_config;
117#define XGXS_EXT_PHY_TYPE(ext_phy_config) \
118 ((ext_phy_config) & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK)
119#define XGXS_EXT_PHY_ADDR(ext_phy_config) \
120 (((ext_phy_config) & PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> \
121 PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT)
122#define SERDES_EXT_PHY_TYPE(ext_phy_config) \
123 ((ext_phy_config) & PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK)
124 198
125 /* Phy register parameter */ 199 /* Phy register parameter */
126 u32 chip_id; 200 u32 chip_id;
127 201
128 u16 xgxs_config_rx[4]; /* preemphasis values for the rx side */
129 u16 xgxs_config_tx[4]; /* preemphasis values for the tx side */
130
131 u32 feature_config_flags; 202 u32 feature_config_flags;
132#define FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED (1<<0) 203#define FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED (1<<0)
133#define FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY (1<<2) 204#define FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY (1<<2)
134#define FEATURE_CONFIG_BCM8727_NOC (1<<3)
135 /* Will be populated during common init */ 205 /* Will be populated during common init */
136 struct bnx2x_phy phy[MAX_PHYS]; 206 struct bnx2x_phy phy[MAX_PHYS];
137 207
138 /* Will be populated during common init */ 208 /* Will be populated during common init */
139 u8 num_phys; 209 u8 num_phys;
140 210
211 u8 rsrv;
212 u16 hw_led_mode; /* part of the hw_config read from the shmem */
213
141 /* Device pointer passed to all callback functions */ 214 /* Device pointer passed to all callback functions */
142 struct bnx2x *bp; 215 struct bnx2x *bp;
143}; 216};