diff options
author | Yaniv Rosner <yaniv.rosner@broadcom.com> | 2010-09-07 07:41:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-07 16:15:42 -0400 |
commit | a22f078867ef362e35c54055878168e6613ff743 (patch) | |
tree | 2cf683f3057b7ed5dcaaaad16192f3a267dcf0f8 /drivers/net/bnx2x/bnx2x_link.h | |
parent | de6eae1f42eae736548f293570fd867bd37c3bdd (diff) |
bnx2x: Add dual-media changes
Add required changes in order to support dual-media boards.
Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_link.h')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_link.h | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/drivers/net/bnx2x/bnx2x_link.h b/drivers/net/bnx2x/bnx2x_link.h index 35f665f97be6..9115c125aeaf 100644 --- a/drivers/net/bnx2x/bnx2x_link.h +++ b/drivers/net/bnx2x/bnx2x_link.h | |||
@@ -59,13 +59,18 @@ | |||
59 | #define SINGLE_MEDIA_DIRECT(params) (params->num_phys == 1) | 59 | #define SINGLE_MEDIA_DIRECT(params) (params->num_phys == 1) |
60 | /* Single Media board contains single external phy */ | 60 | /* Single Media board contains single external phy */ |
61 | #define SINGLE_MEDIA(params) (params->num_phys == 2) | 61 | #define SINGLE_MEDIA(params) (params->num_phys == 2) |
62 | /* Dual Media board contains two external phy with different media */ | ||
63 | #define DUAL_MEDIA(params) (params->num_phys == 3) | ||
64 | #define FW_PARAM_MDIO_CTRL_OFFSET 16 | ||
65 | #define FW_PARAM_SET(phy_addr, phy_type, mdio_access) \ | ||
66 | (phy_addr | phy_type | mdio_access << FW_PARAM_MDIO_CTRL_OFFSET) | ||
62 | /***********************************************************/ | 67 | /***********************************************************/ |
63 | /* Structs */ | 68 | /* Structs */ |
64 | /***********************************************************/ | 69 | /***********************************************************/ |
65 | #define INT_PHY 0 | 70 | #define INT_PHY 0 |
66 | #define EXT_PHY1 1 | 71 | #define EXT_PHY1 1 |
67 | 72 | #define EXT_PHY2 2 | |
68 | #define MAX_PHYS 2 | 73 | #define MAX_PHYS 3 |
69 | 74 | ||
70 | /* Same configuration is shared between the XGXS and the first external phy */ | 75 | /* Same configuration is shared between the XGXS and the first external phy */ |
71 | #define LINK_CONFIG_SIZE (MAX_PHYS - 1) | 76 | #define LINK_CONFIG_SIZE (MAX_PHYS - 1) |
@@ -91,6 +96,8 @@ typedef u8 (*format_fw_ver_t)(u32 raw, u8 *str, u16 *len); | |||
91 | typedef void (*hw_reset_t)(struct bnx2x_phy *phy, struct link_params *params); | 96 | typedef void (*hw_reset_t)(struct bnx2x_phy *phy, struct link_params *params); |
92 | typedef void (*set_link_led_t)(struct bnx2x_phy *phy, | 97 | typedef void (*set_link_led_t)(struct bnx2x_phy *phy, |
93 | struct link_params *params, u8 mode); | 98 | struct link_params *params, u8 mode); |
99 | typedef void (*phy_specific_func_t)(struct bnx2x_phy *phy, | ||
100 | struct link_params *params, u32 action); | ||
94 | 101 | ||
95 | struct bnx2x_phy { | 102 | struct bnx2x_phy { |
96 | u32 type; | 103 | u32 type; |
@@ -106,7 +113,9 @@ struct bnx2x_phy { | |||
106 | /* Fan failure detection required */ | 113 | /* Fan failure detection required */ |
107 | #define FLAGS_FAN_FAILURE_DET_REQ (1<<2) | 114 | #define FLAGS_FAN_FAILURE_DET_REQ (1<<2) |
108 | /* Initialize first the XGXS and only then the phy itself */ | 115 | /* Initialize first the XGXS and only then the phy itself */ |
109 | #define FLAGS_INIT_XGXS_FIRST (1<<3) | 116 | #define FLAGS_INIT_XGXS_FIRST (1<<3) |
117 | #define FLAGS_REARM_LATCH_SIGNAL (1<<6) | ||
118 | #define FLAGS_SFP_NOT_APPROVED (1<<7) | ||
110 | 119 | ||
111 | u8 def_md_devad; | 120 | u8 def_md_devad; |
112 | u8 reserved; | 121 | u8 reserved; |
@@ -161,6 +170,11 @@ struct bnx2x_phy { | |||
161 | 170 | ||
162 | /* Set link led mode (on/off/oper)*/ | 171 | /* Set link led mode (on/off/oper)*/ |
163 | set_link_led_t set_link_led; | 172 | set_link_led_t set_link_led; |
173 | |||
174 | /* PHY Specific tasks */ | ||
175 | phy_specific_func_t phy_specific_func; | ||
176 | #define DISABLE_TX 1 | ||
177 | #define ENABLE_TX 2 | ||
164 | }; | 178 | }; |
165 | 179 | ||
166 | /* Inputs parameters to the CLC */ | 180 | /* Inputs parameters to the CLC */ |
@@ -177,18 +191,18 @@ struct link_params { | |||
177 | #define LOOPBACK_EXT_PHY 4 | 191 | #define LOOPBACK_EXT_PHY 4 |
178 | #define LOOPBACK_EXT 5 | 192 | #define LOOPBACK_EXT 5 |
179 | 193 | ||
180 | u16 req_duplex; | ||
181 | u16 req_flow_ctrl; | ||
182 | u16 req_fc_auto_adv; /* Should be set to TX / BOTH when | ||
183 | req_flow_ctrl is set to AUTO */ | ||
184 | u16 req_line_speed; /* Also determine AutoNeg */ | ||
185 | |||
186 | /* Device parameters */ | 194 | /* Device parameters */ |
187 | u8 mac_addr[6]; | 195 | u8 mac_addr[6]; |
188 | 196 | ||
197 | u16 req_duplex[LINK_CONFIG_SIZE]; | ||
198 | u16 req_flow_ctrl[LINK_CONFIG_SIZE]; | ||
199 | |||
200 | u16 req_line_speed[LINK_CONFIG_SIZE]; /* Also determine AutoNeg */ | ||
201 | |||
189 | /* shmem parameters */ | 202 | /* shmem parameters */ |
190 | u32 shmem_base; | 203 | u32 shmem_base; |
191 | u32 speed_cap_mask; | 204 | u32 shmem2_base; |
205 | u32 speed_cap_mask[LINK_CONFIG_SIZE]; | ||
192 | u32 switch_cfg; | 206 | u32 switch_cfg; |
193 | #define SWITCH_CFG_1G PORT_FEATURE_CON_SWITCH_1G_SWITCH | 207 | #define SWITCH_CFG_1G PORT_FEATURE_CON_SWITCH_1G_SWITCH |
194 | #define SWITCH_CFG_10G PORT_FEATURE_CON_SWITCH_10G_SWITCH | 208 | #define SWITCH_CFG_10G PORT_FEATURE_CON_SWITCH_10G_SWITCH |
@@ -202,6 +216,7 @@ struct link_params { | |||
202 | u32 feature_config_flags; | 216 | u32 feature_config_flags; |
203 | #define FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED (1<<0) | 217 | #define FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED (1<<0) |
204 | #define FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY (1<<2) | 218 | #define FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY (1<<2) |
219 | #define FEATURE_CONFIG_BC_SUPPORTS_DUAL_PHY_OPT_MDL_VRFY (1<<3) | ||
205 | /* Will be populated during common init */ | 220 | /* Will be populated during common init */ |
206 | struct bnx2x_phy phy[MAX_PHYS]; | 221 | struct bnx2x_phy phy[MAX_PHYS]; |
207 | 222 | ||
@@ -210,9 +225,12 @@ struct link_params { | |||
210 | 225 | ||
211 | u8 rsrv; | 226 | u8 rsrv; |
212 | u16 hw_led_mode; /* part of the hw_config read from the shmem */ | 227 | u16 hw_led_mode; /* part of the hw_config read from the shmem */ |
228 | u32 multi_phy_config; | ||
213 | 229 | ||
214 | /* Device pointer passed to all callback functions */ | 230 | /* Device pointer passed to all callback functions */ |
215 | struct bnx2x *bp; | 231 | struct bnx2x *bp; |
232 | u16 req_fc_auto_adv; /* Should be set to TX / BOTH when | ||
233 | req_flow_ctrl is set to AUTO */ | ||
216 | }; | 234 | }; |
217 | 235 | ||
218 | /* Output parameters */ | 236 | /* Output parameters */ |
@@ -233,12 +251,6 @@ struct link_vars { | |||
233 | u16 flow_ctrl; | 251 | u16 flow_ctrl; |
234 | u16 ieee_fc; | 252 | u16 ieee_fc; |
235 | 253 | ||
236 | u32 autoneg; | ||
237 | #define AUTO_NEG_DISABLED 0x0 | ||
238 | #define AUTO_NEG_ENABLED 0x1 | ||
239 | #define AUTO_NEG_COMPLETE 0x2 | ||
240 | #define AUTO_NEG_PARALLEL_DETECTION_USED 0x3 | ||
241 | |||
242 | /* The same definitions as the shmem parameter */ | 254 | /* The same definitions as the shmem parameter */ |
243 | u32 link_status; | 255 | u32 link_status; |
244 | }; | 256 | }; |
@@ -246,8 +258,6 @@ struct link_vars { | |||
246 | /***********************************************************/ | 258 | /***********************************************************/ |
247 | /* Functions */ | 259 | /* Functions */ |
248 | /***********************************************************/ | 260 | /***********************************************************/ |
249 | |||
250 | /* Initialize the phy */ | ||
251 | u8 bnx2x_phy_init(struct link_params *input, struct link_vars *output); | 261 | u8 bnx2x_phy_init(struct link_params *input, struct link_vars *output); |
252 | 262 | ||
253 | /* Reset the link. Should be called when driver or interface goes down | 263 | /* Reset the link. Should be called when driver or interface goes down |
@@ -298,10 +308,11 @@ void bnx2x_handle_module_detect_int(struct link_params *params); | |||
298 | 308 | ||
299 | /* Get the actual link status. In case it returns 0, link is up, | 309 | /* Get the actual link status. In case it returns 0, link is up, |
300 | otherwise link is down*/ | 310 | otherwise link is down*/ |
301 | u8 bnx2x_test_link(struct link_params *input, struct link_vars *vars); | 311 | u8 bnx2x_test_link(struct link_params *input, struct link_vars *vars, |
312 | u8 is_serdes); | ||
302 | 313 | ||
303 | /* One-time initialization for external phy after power up */ | 314 | /* One-time initialization for external phy after power up */ |
304 | u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base); | 315 | u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base, u32 shmem2_base); |
305 | 316 | ||
306 | /* Reset the external PHY using GPIO */ | 317 | /* Reset the external PHY using GPIO */ |
307 | void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port); | 318 | void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port); |
@@ -316,12 +327,19 @@ u8 bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
316 | void bnx2x_hw_reset_phy(struct link_params *params); | 327 | void bnx2x_hw_reset_phy(struct link_params *params); |
317 | 328 | ||
318 | /* Checks if HW lock is required for this phy/board type */ | 329 | /* Checks if HW lock is required for this phy/board type */ |
319 | u8 bnx2x_hw_lock_required(struct bnx2x *bp, u32 shmem_base); | 330 | u8 bnx2x_hw_lock_required(struct bnx2x *bp, u32 shmem_base, |
331 | u32 shmem2_base); | ||
332 | |||
320 | /* Returns the aggregative supported attributes of the phys on board */ | 333 | /* Returns the aggregative supported attributes of the phys on board */ |
321 | u32 bnx2x_supported_attr(struct link_params *params, u8 phy_idx); | 334 | u32 bnx2x_supported_attr(struct link_params *params, u8 phy_idx); |
335 | |||
336 | /* Check swap bit and adjust PHY order */ | ||
337 | u32 bnx2x_phy_selection(struct link_params *params); | ||
338 | |||
322 | /* Probe the phys on board, and populate them in "params" */ | 339 | /* Probe the phys on board, and populate them in "params" */ |
323 | u8 bnx2x_phy_probe(struct link_params *params); | 340 | u8 bnx2x_phy_probe(struct link_params *params); |
324 | /* Checks if fan failure detection is required on one of the phys on board */ | 341 | /* Checks if fan failure detection is required on one of the phys on board */ |
325 | u8 bnx2x_fan_failure_det_req(struct bnx2x *bp, u32 shmem_base, u8 port); | 342 | u8 bnx2x_fan_failure_det_req(struct bnx2x *bp, u32 shmem_base, |
343 | u32 shmem2_base, u8 port); | ||
326 | 344 | ||
327 | #endif /* BNX2X_LINK_H */ | 345 | #endif /* BNX2X_LINK_H */ |