diff options
author | Yaniv Rosner <yanivr@broadcom.com> | 2011-01-30 23:21:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-31 16:22:41 -0500 |
commit | 2cf7acf98ef8327588e49bf74b7653ca4a063f09 (patch) | |
tree | bf1126b115a62b5d171ba9f5d9d3b8d5f437d038 /drivers/net/bnx2x | |
parent | cd2be89b8ed7a50b781fae43a43f20d6ef1a137b (diff) |
bnx2x: Set comments according to preferred Linux style
This patch contains cosmetic changes only of restyling comments according to Linux coding standard, and add comment for get_emac_base function.
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')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_link.c | 651 |
1 files changed, 364 insertions, 287 deletions
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c index 3be2ce03804a..9fadcdbe4115 100644 --- a/drivers/net/bnx2x/bnx2x_link.c +++ b/drivers/net/bnx2x/bnx2x_link.c | |||
@@ -217,7 +217,7 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
217 | 217 | ||
218 | DP(NETIF_MSG_LINK, "ETS disabled configuration\n"); | 218 | DP(NETIF_MSG_LINK, "ETS disabled configuration\n"); |
219 | 219 | ||
220 | /** | 220 | /* |
221 | * mapping between entry priority to client number (0,1,2 -debug and | 221 | * mapping between entry priority to client number (0,1,2 -debug and |
222 | * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) | 222 | * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) |
223 | * 3bits client num. | 223 | * 3bits client num. |
@@ -226,7 +226,7 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
226 | */ | 226 | */ |
227 | 227 | ||
228 | REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT, 0x4688); | 228 | REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT, 0x4688); |
229 | /** | 229 | /* |
230 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves | 230 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves |
231 | * as strict. Bits 0,1,2 - debug and management entries, 3 - | 231 | * as strict. Bits 0,1,2 - debug and management entries, 3 - |
232 | * COS0 entry, 4 - COS1 entry. | 232 | * COS0 entry, 4 - COS1 entry. |
@@ -238,12 +238,12 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
238 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x7); | 238 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x7); |
239 | /* defines which entries (clients) are subjected to WFQ arbitration */ | 239 | /* defines which entries (clients) are subjected to WFQ arbitration */ |
240 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0); | 240 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0); |
241 | /** | 241 | /* |
242 | * For strict priority entries defines the number of consecutive | 242 | * For strict priority entries defines the number of consecutive |
243 | * slots for the highest priority. | 243 | * slots for the highest priority. |
244 | */ | 244 | */ |
245 | REG_WR(bp, NIG_REG_P0_TX_ARB_NUM_STRICT_ARB_SLOTS, 0x100); | 245 | REG_WR(bp, NIG_REG_P0_TX_ARB_NUM_STRICT_ARB_SLOTS, 0x100); |
246 | /** | 246 | /* |
247 | * mapping between the CREDIT_WEIGHT registers and actual client | 247 | * mapping between the CREDIT_WEIGHT registers and actual client |
248 | * numbers | 248 | * numbers |
249 | */ | 249 | */ |
@@ -256,7 +256,7 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
256 | REG_WR(bp, PBF_REG_HIGH_PRIORITY_COS_NUM, 0); | 256 | REG_WR(bp, PBF_REG_HIGH_PRIORITY_COS_NUM, 0); |
257 | /* ETS mode disable */ | 257 | /* ETS mode disable */ |
258 | REG_WR(bp, PBF_REG_ETS_ENABLED, 0); | 258 | REG_WR(bp, PBF_REG_ETS_ENABLED, 0); |
259 | /** | 259 | /* |
260 | * If ETS mode is enabled (there is no strict priority) defines a WFQ | 260 | * If ETS mode is enabled (there is no strict priority) defines a WFQ |
261 | * weight for COS0/COS1. | 261 | * weight for COS0/COS1. |
262 | */ | 262 | */ |
@@ -274,19 +274,19 @@ void bnx2x_ets_bw_limit_common(const struct link_params *params) | |||
274 | /* ETS disabled configuration */ | 274 | /* ETS disabled configuration */ |
275 | struct bnx2x *bp = params->bp; | 275 | struct bnx2x *bp = params->bp; |
276 | DP(NETIF_MSG_LINK, "ETS enabled BW limit configuration\n"); | 276 | DP(NETIF_MSG_LINK, "ETS enabled BW limit configuration\n"); |
277 | /** | 277 | /* |
278 | * defines which entries (clients) are subjected to WFQ arbitration | 278 | * defines which entries (clients) are subjected to WFQ arbitration |
279 | * COS0 0x8 | 279 | * COS0 0x8 |
280 | * COS1 0x10 | 280 | * COS1 0x10 |
281 | */ | 281 | */ |
282 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0x18); | 282 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0x18); |
283 | /** | 283 | /* |
284 | * mapping between the ARB_CREDIT_WEIGHT registers and actual | 284 | * mapping between the ARB_CREDIT_WEIGHT registers and actual |
285 | * client numbers (WEIGHT_0 does not actually have to represent | 285 | * client numbers (WEIGHT_0 does not actually have to represent |
286 | * client 0) | 286 | * client 0) |
287 | * PRI4 | PRI3 | PRI2 | PRI1 | PRI0 | 287 | * PRI4 | PRI3 | PRI2 | PRI1 | PRI0 |
288 | * cos1-001 cos0-000 dbg1-100 dbg0-011 MCP-010 | 288 | * cos1-001 cos0-000 dbg1-100 dbg0-011 MCP-010 |
289 | */ | 289 | */ |
290 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP, 0x111A); | 290 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP, 0x111A); |
291 | 291 | ||
292 | REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_0, | 292 | REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_0, |
@@ -299,14 +299,14 @@ void bnx2x_ets_bw_limit_common(const struct link_params *params) | |||
299 | 299 | ||
300 | /* Defines the number of consecutive slots for the strict priority */ | 300 | /* Defines the number of consecutive slots for the strict priority */ |
301 | REG_WR(bp, PBF_REG_NUM_STRICT_ARB_SLOTS, 0); | 301 | REG_WR(bp, PBF_REG_NUM_STRICT_ARB_SLOTS, 0); |
302 | /** | 302 | /* |
303 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves | 303 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves |
304 | * as strict. Bits 0,1,2 - debug and management entries, 3 - COS0 | 304 | * as strict. Bits 0,1,2 - debug and management entries, 3 - COS0 |
305 | * entry, 4 - COS1 entry. | 305 | * entry, 4 - COS1 entry. |
306 | * COS1 | COS0 | DEBUG21 | DEBUG0 | MGMT | 306 | * COS1 | COS0 | DEBUG21 | DEBUG0 | MGMT |
307 | * bit4 bit3 bit2 bit1 bit0 | 307 | * bit4 bit3 bit2 bit1 bit0 |
308 | * MCP and debug are strict | 308 | * MCP and debug are strict |
309 | */ | 309 | */ |
310 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x7); | 310 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x7); |
311 | 311 | ||
312 | /* Upper bound that COS0_WEIGHT can reach in the WFQ arbiter.*/ | 312 | /* Upper bound that COS0_WEIGHT can reach in the WFQ arbiter.*/ |
@@ -355,7 +355,7 @@ u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) | |||
355 | u32 val = 0; | 355 | u32 val = 0; |
356 | 356 | ||
357 | DP(NETIF_MSG_LINK, "ETS enabled strict configuration\n"); | 357 | DP(NETIF_MSG_LINK, "ETS enabled strict configuration\n"); |
358 | /** | 358 | /* |
359 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves | 359 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves |
360 | * as strict. Bits 0,1,2 - debug and management entries, | 360 | * as strict. Bits 0,1,2 - debug and management entries, |
361 | * 3 - COS0 entry, 4 - COS1 entry. | 361 | * 3 - COS0 entry, 4 - COS1 entry. |
@@ -364,7 +364,7 @@ u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) | |||
364 | * MCP and debug are strict | 364 | * MCP and debug are strict |
365 | */ | 365 | */ |
366 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x1F); | 366 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x1F); |
367 | /** | 367 | /* |
368 | * For strict priority entries defines the number of consecutive slots | 368 | * For strict priority entries defines the number of consecutive slots |
369 | * for the highest priority. | 369 | * for the highest priority. |
370 | */ | 370 | */ |
@@ -377,14 +377,14 @@ u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) | |||
377 | /* Defines the number of consecutive slots for the strict priority */ | 377 | /* Defines the number of consecutive slots for the strict priority */ |
378 | REG_WR(bp, PBF_REG_HIGH_PRIORITY_COS_NUM, strict_cos); | 378 | REG_WR(bp, PBF_REG_HIGH_PRIORITY_COS_NUM, strict_cos); |
379 | 379 | ||
380 | /** | 380 | /* |
381 | * mapping between entry priority to client number (0,1,2 -debug and | 381 | * mapping between entry priority to client number (0,1,2 -debug and |
382 | * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) | 382 | * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) |
383 | * 3bits client num. | 383 | * 3bits client num. |
384 | * PRI4 | PRI3 | PRI2 | PRI1 | PRI0 | 384 | * PRI4 | PRI3 | PRI2 | PRI1 | PRI0 |
385 | * dbg0-010 dbg1-001 cos1-100 cos0-011 MCP-000 | 385 | * dbg0-010 dbg1-001 cos1-100 cos0-011 MCP-000 |
386 | * dbg0-010 dbg1-001 cos0-011 cos1-100 MCP-000 | 386 | * dbg0-010 dbg1-001 cos0-011 cos1-100 MCP-000 |
387 | */ | 387 | */ |
388 | val = (0 == strict_cos) ? 0x2318 : 0x22E0; | 388 | val = (0 == strict_cos) ? 0x2318 : 0x22E0; |
389 | REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT, val); | 389 | REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT, val); |
390 | 390 | ||
@@ -599,14 +599,14 @@ static u8 bnx2x_emac_enable(struct link_params *params, | |||
599 | val = REG_RD(bp, emac_base + EMAC_REG_EMAC_RX_MODE); | 599 | val = REG_RD(bp, emac_base + EMAC_REG_EMAC_RX_MODE); |
600 | val |= EMAC_RX_MODE_KEEP_VLAN_TAG | EMAC_RX_MODE_PROMISCUOUS; | 600 | val |= EMAC_RX_MODE_KEEP_VLAN_TAG | EMAC_RX_MODE_PROMISCUOUS; |
601 | 601 | ||
602 | /** | 602 | /* |
603 | * Setting this bit causes MAC control frames (except for pause | 603 | * Setting this bit causes MAC control frames (except for pause |
604 | * frames) to be passed on for processing. This setting has no | 604 | * frames) to be passed on for processing. This setting has no |
605 | * affect on the operation of the pause frames. This bit effects | 605 | * affect on the operation of the pause frames. This bit effects |
606 | * all packets regardless of RX Parser packet sorting logic. | 606 | * all packets regardless of RX Parser packet sorting logic. |
607 | * Turn the PFC off to make sure we are in Xon state before | 607 | * Turn the PFC off to make sure we are in Xon state before |
608 | * enabling it. | 608 | * enabling it. |
609 | */ | 609 | */ |
610 | EMAC_WR(bp, EMAC_REG_RX_PFC_MODE, 0); | 610 | EMAC_WR(bp, EMAC_REG_RX_PFC_MODE, 0); |
611 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) { | 611 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) { |
612 | DP(NETIF_MSG_LINK, "PFC is enabled\n"); | 612 | DP(NETIF_MSG_LINK, "PFC is enabled\n"); |
@@ -760,12 +760,12 @@ static void bnx2x_update_pfc_bmac2(struct link_params *params, | |||
760 | 760 | ||
761 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_PFC_CONTROL, wb_data, 2); | 761 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_PFC_CONTROL, wb_data, 2); |
762 | 762 | ||
763 | /** | 763 | /* |
764 | * Set Time (based unit is 512 bit time) between automatic | 764 | * Set Time (based unit is 512 bit time) between automatic |
765 | * re-sending of PP packets amd enable automatic re-send of | 765 | * re-sending of PP packets amd enable automatic re-send of |
766 | * Per-Priroity Packet as long as pp_gen is asserted and | 766 | * Per-Priroity Packet as long as pp_gen is asserted and |
767 | * pp_disable is low. | 767 | * pp_disable is low. |
768 | */ | 768 | */ |
769 | val = 0x8000; | 769 | val = 0x8000; |
770 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) | 770 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) |
771 | val |= (1<<16); /* enable automatic re-send */ | 771 | val |= (1<<16); /* enable automatic re-send */ |
@@ -816,17 +816,25 @@ static void bnx2x_update_pfc_brb(struct link_params *params, | |||
816 | full_xon_th = | 816 | full_xon_th = |
817 | PFC_BRB_MAC_FULL_XON_THRESHOLD_NON_PAUSEABLE; | 817 | PFC_BRB_MAC_FULL_XON_THRESHOLD_NON_PAUSEABLE; |
818 | } | 818 | } |
819 | /* The number of free blocks below which the pause signal to class 0 | 819 | /* |
820 | of MAC #n is asserted. n=0,1 */ | 820 | * The number of free blocks below which the pause signal to class 0 |
821 | * of MAC #n is asserted. n=0,1 | ||
822 | */ | ||
821 | REG_WR(bp, BRB1_REG_PAUSE_0_XOFF_THRESHOLD_0 , pause_xoff_th); | 823 | REG_WR(bp, BRB1_REG_PAUSE_0_XOFF_THRESHOLD_0 , pause_xoff_th); |
822 | /* The number of free blocks above which the pause signal to class 0 | 824 | /* |
823 | of MAC #n is de-asserted. n=0,1 */ | 825 | * The number of free blocks above which the pause signal to class 0 |
826 | * of MAC #n is de-asserted. n=0,1 | ||
827 | */ | ||
824 | REG_WR(bp, BRB1_REG_PAUSE_0_XON_THRESHOLD_0 , pause_xon_th); | 828 | REG_WR(bp, BRB1_REG_PAUSE_0_XON_THRESHOLD_0 , pause_xon_th); |
825 | /* The number of free blocks below which the full signal to class 0 | 829 | /* |
826 | of MAC #n is asserted. n=0,1 */ | 830 | * The number of free blocks below which the full signal to class 0 |
831 | * of MAC #n is asserted. n=0,1 | ||
832 | */ | ||
827 | REG_WR(bp, BRB1_REG_FULL_0_XOFF_THRESHOLD_0 , full_xoff_th); | 833 | REG_WR(bp, BRB1_REG_FULL_0_XOFF_THRESHOLD_0 , full_xoff_th); |
828 | /* The number of free blocks above which the full signal to class 0 | 834 | /* |
829 | of MAC #n is de-asserted. n=0,1 */ | 835 | * The number of free blocks above which the full signal to class 0 |
836 | * of MAC #n is de-asserted. n=0,1 | ||
837 | */ | ||
830 | REG_WR(bp, BRB1_REG_FULL_0_XON_THRESHOLD_0 , full_xon_th); | 838 | REG_WR(bp, BRB1_REG_FULL_0_XON_THRESHOLD_0 , full_xon_th); |
831 | 839 | ||
832 | if (set_pfc && pfc_params) { | 840 | if (set_pfc && pfc_params) { |
@@ -850,25 +858,25 @@ static void bnx2x_update_pfc_brb(struct link_params *params, | |||
850 | full_xon_th = | 858 | full_xon_th = |
851 | PFC_BRB_MAC_FULL_XON_THRESHOLD_NON_PAUSEABLE; | 859 | PFC_BRB_MAC_FULL_XON_THRESHOLD_NON_PAUSEABLE; |
852 | } | 860 | } |
853 | /** | 861 | /* |
854 | * The number of free blocks below which the pause signal to | 862 | * The number of free blocks below which the pause signal to |
855 | * class 1 of MAC #n is asserted. n=0,1 | 863 | * class 1 of MAC #n is asserted. n=0,1 |
856 | **/ | 864 | */ |
857 | REG_WR(bp, BRB1_REG_PAUSE_1_XOFF_THRESHOLD_0, pause_xoff_th); | 865 | REG_WR(bp, BRB1_REG_PAUSE_1_XOFF_THRESHOLD_0, pause_xoff_th); |
858 | /** | 866 | /* |
859 | * The number of free blocks above which the pause signal to | 867 | * The number of free blocks above which the pause signal to |
860 | * class 1 of MAC #n is de-asserted. n=0,1 | 868 | * class 1 of MAC #n is de-asserted. n=0,1 |
861 | **/ | 869 | */ |
862 | REG_WR(bp, BRB1_REG_PAUSE_1_XON_THRESHOLD_0, pause_xon_th); | 870 | REG_WR(bp, BRB1_REG_PAUSE_1_XON_THRESHOLD_0, pause_xon_th); |
863 | /** | 871 | /* |
864 | * The number of free blocks below which the full signal to | 872 | * The number of free blocks below which the full signal to |
865 | * class 1 of MAC #n is asserted. n=0,1 | 873 | * class 1 of MAC #n is asserted. n=0,1 |
866 | **/ | 874 | */ |
867 | REG_WR(bp, BRB1_REG_FULL_1_XOFF_THRESHOLD_0, full_xoff_th); | 875 | REG_WR(bp, BRB1_REG_FULL_1_XOFF_THRESHOLD_0, full_xoff_th); |
868 | /** | 876 | /* |
869 | * The number of free blocks above which the full signal to | 877 | * The number of free blocks above which the full signal to |
870 | * class 1 of MAC #n is de-asserted. n=0,1 | 878 | * class 1 of MAC #n is de-asserted. n=0,1 |
871 | **/ | 879 | */ |
872 | REG_WR(bp, BRB1_REG_FULL_1_XON_THRESHOLD_0, full_xon_th); | 880 | REG_WR(bp, BRB1_REG_FULL_1_XON_THRESHOLD_0, full_xon_th); |
873 | } | 881 | } |
874 | } | 882 | } |
@@ -887,7 +895,7 @@ static void bnx2x_update_pfc_nig(struct link_params *params, | |||
887 | FEATURE_CONFIG_PFC_ENABLED; | 895 | FEATURE_CONFIG_PFC_ENABLED; |
888 | DP(NETIF_MSG_LINK, "updating pfc nig parameters\n"); | 896 | DP(NETIF_MSG_LINK, "updating pfc nig parameters\n"); |
889 | 897 | ||
890 | /** | 898 | /* |
891 | * When NIG_LLH0_XCM_MASK_REG_LLHX_XCM_MASK_BCN bit is set | 899 | * When NIG_LLH0_XCM_MASK_REG_LLHX_XCM_MASK_BCN bit is set |
892 | * MAC control frames (that are not pause packets) | 900 | * MAC control frames (that are not pause packets) |
893 | * will be forwarded to the XCM. | 901 | * will be forwarded to the XCM. |
@@ -895,7 +903,7 @@ static void bnx2x_update_pfc_nig(struct link_params *params, | |||
895 | xcm_mask = REG_RD(bp, | 903 | xcm_mask = REG_RD(bp, |
896 | port ? NIG_REG_LLH1_XCM_MASK : | 904 | port ? NIG_REG_LLH1_XCM_MASK : |
897 | NIG_REG_LLH0_XCM_MASK); | 905 | NIG_REG_LLH0_XCM_MASK); |
898 | /** | 906 | /* |
899 | * nig params will override non PFC params, since it's possible to | 907 | * nig params will override non PFC params, since it's possible to |
900 | * do transition from PFC to SAFC | 908 | * do transition from PFC to SAFC |
901 | */ | 909 | */ |
@@ -985,7 +993,7 @@ void bnx2x_update_pfc(struct link_params *params, | |||
985 | struct link_vars *vars, | 993 | struct link_vars *vars, |
986 | struct bnx2x_nig_brb_pfc_port_params *pfc_params) | 994 | struct bnx2x_nig_brb_pfc_port_params *pfc_params) |
987 | { | 995 | { |
988 | /** | 996 | /* |
989 | * The PFC and pause are orthogonal to one another, meaning when | 997 | * The PFC and pause are orthogonal to one another, meaning when |
990 | * PFC is enabled, the pause are disabled, and when PFC is | 998 | * PFC is enabled, the pause are disabled, and when PFC is |
991 | * disabled, pause are set according to the pause result. | 999 | * disabled, pause are set according to the pause result. |
@@ -1331,6 +1339,23 @@ static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl, | |||
1331 | return 0; | 1339 | return 0; |
1332 | } | 1340 | } |
1333 | 1341 | ||
1342 | /* | ||
1343 | * get_emac_base | ||
1344 | * | ||
1345 | * @param cb | ||
1346 | * @param mdc_mdio_access | ||
1347 | * @param port | ||
1348 | * | ||
1349 | * @return u32 | ||
1350 | * | ||
1351 | * This function selects the MDC/MDIO access (through emac0 or | ||
1352 | * emac1) depend on the mdc_mdio_access, port, port swapped. Each | ||
1353 | * phy has a default access mode, which could also be overridden | ||
1354 | * by nvram configuration. This parameter, whether this is the | ||
1355 | * default phy configuration, or the nvram overrun | ||
1356 | * configuration, is passed here as mdc_mdio_access and selects | ||
1357 | * the emac_base for the CL45 read/writes operations | ||
1358 | */ | ||
1334 | static u32 bnx2x_get_emac_base(struct bnx2x *bp, | 1359 | static u32 bnx2x_get_emac_base(struct bnx2x *bp, |
1335 | u32 mdc_mdio_access, u8 port) | 1360 | u32 mdc_mdio_access, u8 port) |
1336 | { | 1361 | { |
@@ -1363,13 +1388,16 @@ static u32 bnx2x_get_emac_base(struct bnx2x *bp, | |||
1363 | 1388 | ||
1364 | } | 1389 | } |
1365 | 1390 | ||
1391 | /******************************************************************/ | ||
1392 | /* CL45 access functions */ | ||
1393 | /******************************************************************/ | ||
1366 | u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | 1394 | u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, |
1367 | u8 devad, u16 reg, u16 val) | 1395 | u8 devad, u16 reg, u16 val) |
1368 | { | 1396 | { |
1369 | u32 tmp, saved_mode; | 1397 | u32 tmp, saved_mode; |
1370 | u8 i, rc = 0; | 1398 | u8 i, rc = 0; |
1371 | 1399 | /* | |
1372 | /* set clause 45 mode, slow down the MDIO clock to 2.5MHz | 1400 | * Set clause 45 mode, slow down the MDIO clock to 2.5MHz |
1373 | * (a value of 49==0x31) and make sure that the AUTO poll is off | 1401 | * (a value of 49==0x31) and make sure that the AUTO poll is off |
1374 | */ | 1402 | */ |
1375 | 1403 | ||
@@ -1436,8 +1464,8 @@ u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1436 | u32 val, saved_mode; | 1464 | u32 val, saved_mode; |
1437 | u16 i; | 1465 | u16 i; |
1438 | u8 rc = 0; | 1466 | u8 rc = 0; |
1439 | 1467 | /* | |
1440 | /* set clause 45 mode, slow down the MDIO clock to 2.5MHz | 1468 | * Set clause 45 mode, slow down the MDIO clock to 2.5MHz |
1441 | * (a value of 49==0x31) and make sure that the AUTO poll is off | 1469 | * (a value of 49==0x31) and make sure that the AUTO poll is off |
1442 | */ | 1470 | */ |
1443 | 1471 | ||
@@ -1506,7 +1534,7 @@ u8 bnx2x_phy_read(struct link_params *params, u8 phy_addr, | |||
1506 | u8 devad, u16 reg, u16 *ret_val) | 1534 | u8 devad, u16 reg, u16 *ret_val) |
1507 | { | 1535 | { |
1508 | u8 phy_index; | 1536 | u8 phy_index; |
1509 | /** | 1537 | /* |
1510 | * Probe for the phy according to the given phy_addr, and execute | 1538 | * Probe for the phy according to the given phy_addr, and execute |
1511 | * the read request on it | 1539 | * the read request on it |
1512 | */ | 1540 | */ |
@@ -1524,7 +1552,7 @@ u8 bnx2x_phy_write(struct link_params *params, u8 phy_addr, | |||
1524 | u8 devad, u16 reg, u16 val) | 1552 | u8 devad, u16 reg, u16 val) |
1525 | { | 1553 | { |
1526 | u8 phy_index; | 1554 | u8 phy_index; |
1527 | /** | 1555 | /* |
1528 | * Probe for the phy according to the given phy_addr, and execute | 1556 | * Probe for the phy according to the given phy_addr, and execute |
1529 | * the write request on it | 1557 | * the write request on it |
1530 | */ | 1558 | */ |
@@ -1814,8 +1842,10 @@ static void bnx2x_set_swap_lanes(struct link_params *params, | |||
1814 | struct bnx2x_phy *phy) | 1842 | struct bnx2x_phy *phy) |
1815 | { | 1843 | { |
1816 | struct bnx2x *bp = params->bp; | 1844 | struct bnx2x *bp = params->bp; |
1817 | /* Each two bits represents a lane number: | 1845 | /* |
1818 | No swap is 0123 => 0x1b no need to enable the swap */ | 1846 | * Each two bits represents a lane number: |
1847 | * No swap is 0123 => 0x1b no need to enable the swap | ||
1848 | */ | ||
1819 | u16 ser_lane, rx_lane_swap, tx_lane_swap; | 1849 | u16 ser_lane, rx_lane_swap, tx_lane_swap; |
1820 | 1850 | ||
1821 | ser_lane = ((params->lane_config & | 1851 | ser_lane = ((params->lane_config & |
@@ -2031,8 +2061,10 @@ static void bnx2x_program_serdes(struct bnx2x_phy *phy, | |||
2031 | MDIO_REG_BANK_COMBO_IEEE0, | 2061 | MDIO_REG_BANK_COMBO_IEEE0, |
2032 | MDIO_COMBO_IEEE0_MII_CONTROL, reg_val); | 2062 | MDIO_COMBO_IEEE0_MII_CONTROL, reg_val); |
2033 | 2063 | ||
2034 | /* program speed | 2064 | /* |
2035 | - needed only if the speed is greater than 1G (2.5G or 10G) */ | 2065 | * program speed |
2066 | * - needed only if the speed is greater than 1G (2.5G or 10G) | ||
2067 | */ | ||
2036 | CL22_RD_OVER_CL45(bp, phy, | 2068 | CL22_RD_OVER_CL45(bp, phy, |
2037 | MDIO_REG_BANK_SERDES_DIGITAL, | 2069 | MDIO_REG_BANK_SERDES_DIGITAL, |
2038 | MDIO_SERDES_DIGITAL_MISC1, ®_val); | 2070 | MDIO_SERDES_DIGITAL_MISC1, ®_val); |
@@ -2089,8 +2121,10 @@ static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, | |||
2089 | { | 2121 | { |
2090 | struct bnx2x *bp = params->bp; | 2122 | struct bnx2x *bp = params->bp; |
2091 | *ieee_fc = MDIO_COMBO_IEEE0_AUTO_NEG_ADV_FULL_DUPLEX; | 2123 | *ieee_fc = MDIO_COMBO_IEEE0_AUTO_NEG_ADV_FULL_DUPLEX; |
2092 | /* resolve pause mode and advertisement | 2124 | /* |
2093 | * Please refer to Table 28B-3 of the 802.3ab-1999 spec */ | 2125 | * Resolve pause mode and advertisement. |
2126 | * Please refer to Table 28B-3 of the 802.3ab-1999 spec | ||
2127 | */ | ||
2094 | 2128 | ||
2095 | switch (phy->req_flow_ctrl) { | 2129 | switch (phy->req_flow_ctrl) { |
2096 | case BNX2X_FLOW_CTRL_AUTO: | 2130 | case BNX2X_FLOW_CTRL_AUTO: |
@@ -2415,8 +2449,10 @@ static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy, | |||
2415 | "ustat_val(0x8371) = 0x%x\n", ustat_val); | 2449 | "ustat_val(0x8371) = 0x%x\n", ustat_val); |
2416 | return; | 2450 | return; |
2417 | } | 2451 | } |
2418 | /* Step 3: Check CL37 Message Pages received to indicate LP | 2452 | /* |
2419 | supports only CL37 */ | 2453 | * Step 3: Check CL37 Message Pages received to indicate LP |
2454 | * supports only CL37 | ||
2455 | */ | ||
2420 | CL22_RD_OVER_CL45(bp, phy, | 2456 | CL22_RD_OVER_CL45(bp, phy, |
2421 | MDIO_REG_BANK_REMOTE_PHY, | 2457 | MDIO_REG_BANK_REMOTE_PHY, |
2422 | MDIO_REMOTE_PHY_MISC_RX_STATUS, | 2458 | MDIO_REMOTE_PHY_MISC_RX_STATUS, |
@@ -2431,9 +2467,13 @@ static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy, | |||
2431 | cl37_fsm_recieved); | 2467 | cl37_fsm_recieved); |
2432 | return; | 2468 | return; |
2433 | } | 2469 | } |
2434 | /* The combined cl37/cl73 fsm state information indicating that we are | 2470 | /* |
2435 | connected to a device which does not support cl73, but does support | 2471 | * The combined cl37/cl73 fsm state information indicating that |
2436 | cl37 BAM. In this case we disable cl73 and restart cl37 auto-neg */ | 2472 | * we are connected to a device which does not support cl73, but |
2473 | * does support cl37 BAM. In this case we disable cl73 and | ||
2474 | * restart cl37 auto-neg | ||
2475 | */ | ||
2476 | |||
2437 | /* Disable CL73 */ | 2477 | /* Disable CL73 */ |
2438 | CL22_WR_OVER_CL45(bp, phy, | 2478 | CL22_WR_OVER_CL45(bp, phy, |
2439 | MDIO_REG_BANK_CL73_IEEEB0, | 2479 | MDIO_REG_BANK_CL73_IEEEB0, |
@@ -2833,9 +2873,7 @@ static void bnx2x_link_int_enable(struct link_params *params) | |||
2833 | u32 mask; | 2873 | u32 mask; |
2834 | struct bnx2x *bp = params->bp; | 2874 | struct bnx2x *bp = params->bp; |
2835 | 2875 | ||
2836 | /* setting the status to report on link up | 2876 | /* Setting the status to report on link up for either XGXS or SerDes */ |
2837 | for either XGXS or SerDes */ | ||
2838 | |||
2839 | if (params->switch_cfg == SWITCH_CFG_10G) { | 2877 | if (params->switch_cfg == SWITCH_CFG_10G) { |
2840 | mask = (NIG_MASK_XGXS0_LINK10G | | 2878 | mask = (NIG_MASK_XGXS0_LINK10G | |
2841 | NIG_MASK_XGXS0_LINK_STATUS); | 2879 | NIG_MASK_XGXS0_LINK_STATUS); |
@@ -2878,7 +2916,7 @@ static void bnx2x_rearm_latch_signal(struct bnx2x *bp, u8 port, | |||
2878 | { | 2916 | { |
2879 | u32 latch_status = 0; | 2917 | u32 latch_status = 0; |
2880 | 2918 | ||
2881 | /** | 2919 | /* |
2882 | * Disable the MI INT ( external phy int ) by writing 1 to the | 2920 | * Disable the MI INT ( external phy int ) by writing 1 to the |
2883 | * status register. Link down indication is high-active-signal, | 2921 | * status register. Link down indication is high-active-signal, |
2884 | * so in this case we need to write the status to clear the XOR | 2922 | * so in this case we need to write the status to clear the XOR |
@@ -2914,16 +2952,19 @@ static void bnx2x_link_int_ack(struct link_params *params, | |||
2914 | struct bnx2x *bp = params->bp; | 2952 | struct bnx2x *bp = params->bp; |
2915 | u8 port = params->port; | 2953 | u8 port = params->port; |
2916 | 2954 | ||
2917 | /* first reset all status | 2955 | /* |
2918 | * we assume only one line will be change at a time */ | 2956 | * First reset all status we assume only one line will be |
2957 | * change at a time | ||
2958 | */ | ||
2919 | bnx2x_bits_dis(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, | 2959 | bnx2x_bits_dis(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, |
2920 | (NIG_STATUS_XGXS0_LINK10G | | 2960 | (NIG_STATUS_XGXS0_LINK10G | |
2921 | NIG_STATUS_XGXS0_LINK_STATUS | | 2961 | NIG_STATUS_XGXS0_LINK_STATUS | |
2922 | NIG_STATUS_SERDES0_LINK_STATUS)); | 2962 | NIG_STATUS_SERDES0_LINK_STATUS)); |
2923 | if (vars->phy_link_up) { | 2963 | if (vars->phy_link_up) { |
2924 | if (is_10g) { | 2964 | if (is_10g) { |
2925 | /* Disable the 10G link interrupt | 2965 | /* |
2926 | * by writing 1 to the status register | 2966 | * Disable the 10G link interrupt by writing 1 to the |
2967 | * status register | ||
2927 | */ | 2968 | */ |
2928 | DP(NETIF_MSG_LINK, "10G XGXS phy link up\n"); | 2969 | DP(NETIF_MSG_LINK, "10G XGXS phy link up\n"); |
2929 | bnx2x_bits_en(bp, | 2970 | bnx2x_bits_en(bp, |
@@ -2931,9 +2972,9 @@ static void bnx2x_link_int_ack(struct link_params *params, | |||
2931 | NIG_STATUS_XGXS0_LINK10G); | 2972 | NIG_STATUS_XGXS0_LINK10G); |
2932 | 2973 | ||
2933 | } else if (params->switch_cfg == SWITCH_CFG_10G) { | 2974 | } else if (params->switch_cfg == SWITCH_CFG_10G) { |
2934 | /* Disable the link interrupt | 2975 | /* |
2935 | * by writing 1 to the relevant lane | 2976 | * Disable the link interrupt by writing 1 to the |
2936 | * in the status register | 2977 | * relevant lane in the status register |
2937 | */ | 2978 | */ |
2938 | u32 ser_lane = ((params->lane_config & | 2979 | u32 ser_lane = ((params->lane_config & |
2939 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> | 2980 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> |
@@ -2948,8 +2989,9 @@ static void bnx2x_link_int_ack(struct link_params *params, | |||
2948 | 2989 | ||
2949 | } else { /* SerDes */ | 2990 | } else { /* SerDes */ |
2950 | DP(NETIF_MSG_LINK, "SerDes phy link up\n"); | 2991 | DP(NETIF_MSG_LINK, "SerDes phy link up\n"); |
2951 | /* Disable the link interrupt | 2992 | /* |
2952 | * by writing 1 to the status register | 2993 | * Disable the link interrupt by writing 1 to the status |
2994 | * register | ||
2953 | */ | 2995 | */ |
2954 | bnx2x_bits_en(bp, | 2996 | bnx2x_bits_en(bp, |
2955 | NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, | 2997 | NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, |
@@ -3126,19 +3168,19 @@ u8 bnx2x_set_led(struct link_params *params, | |||
3126 | break; | 3168 | break; |
3127 | 3169 | ||
3128 | case LED_MODE_OPER: | 3170 | case LED_MODE_OPER: |
3129 | /** | 3171 | /* |
3130 | * For all other phys, OPER mode is same as ON, so in case | 3172 | * For all other phys, OPER mode is same as ON, so in case |
3131 | * link is down, do nothing | 3173 | * link is down, do nothing |
3132 | **/ | 3174 | */ |
3133 | if (!vars->link_up) | 3175 | if (!vars->link_up) |
3134 | break; | 3176 | break; |
3135 | case LED_MODE_ON: | 3177 | case LED_MODE_ON: |
3136 | if (params->phy[EXT_PHY1].type == | 3178 | if (params->phy[EXT_PHY1].type == |
3137 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 && | 3179 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 && |
3138 | CHIP_IS_E2(bp) && params->num_phys == 2) { | 3180 | CHIP_IS_E2(bp) && params->num_phys == 2) { |
3139 | /** | 3181 | /* |
3140 | * This is a work-around for E2+8727 Configurations | 3182 | * This is a work-around for E2+8727 Configurations |
3141 | */ | 3183 | */ |
3142 | if (mode == LED_MODE_ON || | 3184 | if (mode == LED_MODE_ON || |
3143 | speed == SPEED_10000){ | 3185 | speed == SPEED_10000){ |
3144 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); | 3186 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); |
@@ -3150,10 +3192,10 @@ u8 bnx2x_set_led(struct link_params *params, | |||
3150 | return rc; | 3192 | return rc; |
3151 | } | 3193 | } |
3152 | } else if (SINGLE_MEDIA_DIRECT(params)) { | 3194 | } else if (SINGLE_MEDIA_DIRECT(params)) { |
3153 | /** | 3195 | /* |
3154 | * This is a work-around for HW issue found when link | 3196 | * This is a work-around for HW issue found when link |
3155 | * is up in CL73 | 3197 | * is up in CL73 |
3156 | */ | 3198 | */ |
3157 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); | 3199 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); |
3158 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1); | 3200 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1); |
3159 | } else { | 3201 | } else { |
@@ -3174,8 +3216,10 @@ u8 bnx2x_set_led(struct link_params *params, | |||
3174 | (speed == SPEED_1000) || | 3216 | (speed == SPEED_1000) || |
3175 | (speed == SPEED_100) || | 3217 | (speed == SPEED_100) || |
3176 | (speed == SPEED_10))) { | 3218 | (speed == SPEED_10))) { |
3177 | /* On Everest 1 Ax chip versions for speeds less than | 3219 | /* |
3178 | 10G LED scheme is different */ | 3220 | * On Everest 1 Ax chip versions for speeds less than |
3221 | * 10G LED scheme is different | ||
3222 | */ | ||
3179 | REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 | 3223 | REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 |
3180 | + port*4, 1); | 3224 | + port*4, 1); |
3181 | REG_WR(bp, NIG_REG_LED_CONTROL_TRAFFIC_P0 + | 3225 | REG_WR(bp, NIG_REG_LED_CONTROL_TRAFFIC_P0 + |
@@ -3195,7 +3239,7 @@ u8 bnx2x_set_led(struct link_params *params, | |||
3195 | 3239 | ||
3196 | } | 3240 | } |
3197 | 3241 | ||
3198 | /** | 3242 | /* |
3199 | * This function comes to reflect the actual link state read DIRECTLY from the | 3243 | * This function comes to reflect the actual link state read DIRECTLY from the |
3200 | * HW | 3244 | * HW |
3201 | */ | 3245 | */ |
@@ -3254,15 +3298,15 @@ static u8 bnx2x_link_initialize(struct link_params *params, | |||
3254 | u8 rc = 0; | 3298 | u8 rc = 0; |
3255 | u8 phy_index, non_ext_phy; | 3299 | u8 phy_index, non_ext_phy; |
3256 | struct bnx2x *bp = params->bp; | 3300 | struct bnx2x *bp = params->bp; |
3257 | /** | 3301 | /* |
3258 | * In case of external phy existence, the line speed would be the | 3302 | * In case of external phy existence, the line speed would be the |
3259 | * line speed linked up by the external phy. In case it is direct | 3303 | * line speed linked up by the external phy. In case it is direct |
3260 | * only, then the line_speed during initialization will be | 3304 | * only, then the line_speed during initialization will be |
3261 | * equal to the req_line_speed | 3305 | * equal to the req_line_speed |
3262 | */ | 3306 | */ |
3263 | vars->line_speed = params->phy[INT_PHY].req_line_speed; | 3307 | vars->line_speed = params->phy[INT_PHY].req_line_speed; |
3264 | 3308 | ||
3265 | /** | 3309 | /* |
3266 | * Initialize the internal phy in case this is a direct board | 3310 | * Initialize the internal phy in case this is a direct board |
3267 | * (no external phys), or this board has external phy which requires | 3311 | * (no external phys), or this board has external phy which requires |
3268 | * to first. | 3312 | * to first. |
@@ -3290,17 +3334,16 @@ static u8 bnx2x_link_initialize(struct link_params *params, | |||
3290 | if (!non_ext_phy) | 3334 | if (!non_ext_phy) |
3291 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; | 3335 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; |
3292 | phy_index++) { | 3336 | phy_index++) { |
3293 | /** | 3337 | /* |
3294 | * No need to initialize second phy in case of first | 3338 | * No need to initialize second phy in case of first |
3295 | * phy only selection. In case of second phy, we do | 3339 | * phy only selection. In case of second phy, we do |
3296 | * need to initialize the first phy, since they are | 3340 | * need to initialize the first phy, since they are |
3297 | * connected. | 3341 | * connected. |
3298 | **/ | 3342 | */ |
3299 | if (phy_index == EXT_PHY2 && | 3343 | if (phy_index == EXT_PHY2 && |
3300 | (bnx2x_phy_selection(params) == | 3344 | (bnx2x_phy_selection(params) == |
3301 | PORT_HW_CFG_PHY_SELECTION_FIRST_PHY)) { | 3345 | PORT_HW_CFG_PHY_SELECTION_FIRST_PHY)) { |
3302 | DP(NETIF_MSG_LINK, "Not initializing" | 3346 | DP(NETIF_MSG_LINK, "Ignoring second phy\n"); |
3303 | "second phy\n"); | ||
3304 | continue; | 3347 | continue; |
3305 | } | 3348 | } |
3306 | params->phy[phy_index].config_init( | 3349 | params->phy[phy_index].config_init( |
@@ -3424,7 +3467,7 @@ static u8 bnx2x_update_link_up(struct link_params *params, | |||
3424 | msleep(20); | 3467 | msleep(20); |
3425 | return rc; | 3468 | return rc; |
3426 | } | 3469 | } |
3427 | /** | 3470 | /* |
3428 | * The bnx2x_link_update function should be called upon link | 3471 | * The bnx2x_link_update function should be called upon link |
3429 | * interrupt. | 3472 | * interrupt. |
3430 | * Link is considered up as follows: | 3473 | * Link is considered up as follows: |
@@ -3476,14 +3519,14 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3476 | /* disable emac */ | 3519 | /* disable emac */ |
3477 | REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 0); | 3520 | REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 0); |
3478 | 3521 | ||
3479 | /** | 3522 | /* |
3480 | * Step 1: | 3523 | * Step 1: |
3481 | * Check external link change only for external phys, and apply | 3524 | * Check external link change only for external phys, and apply |
3482 | * priority selection between them in case the link on both phys | 3525 | * priority selection between them in case the link on both phys |
3483 | * is up. Note that the instead of the common vars, a temporary | 3526 | * is up. Note that the instead of the common vars, a temporary |
3484 | * vars argument is used since each phy may have different link/ | 3527 | * vars argument is used since each phy may have different link/ |
3485 | * speed/duplex result | 3528 | * speed/duplex result |
3486 | */ | 3529 | */ |
3487 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; | 3530 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; |
3488 | phy_index++) { | 3531 | phy_index++) { |
3489 | struct bnx2x_phy *phy = ¶ms->phy[phy_index]; | 3532 | struct bnx2x_phy *phy = ¶ms->phy[phy_index]; |
@@ -3508,22 +3551,22 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3508 | switch (bnx2x_phy_selection(params)) { | 3551 | switch (bnx2x_phy_selection(params)) { |
3509 | case PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT: | 3552 | case PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT: |
3510 | case PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY: | 3553 | case PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY: |
3511 | /** | 3554 | /* |
3512 | * In this option, the first PHY makes sure to pass the | 3555 | * In this option, the first PHY makes sure to pass the |
3513 | * traffic through itself only. | 3556 | * traffic through itself only. |
3514 | * Its not clear how to reset the link on the second phy | 3557 | * Its not clear how to reset the link on the second phy |
3515 | **/ | 3558 | */ |
3516 | active_external_phy = EXT_PHY1; | 3559 | active_external_phy = EXT_PHY1; |
3517 | break; | 3560 | break; |
3518 | case PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY: | 3561 | case PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY: |
3519 | /** | 3562 | /* |
3520 | * In this option, the first PHY makes sure to pass the | 3563 | * In this option, the first PHY makes sure to pass the |
3521 | * traffic through the second PHY. | 3564 | * traffic through the second PHY. |
3522 | **/ | 3565 | */ |
3523 | active_external_phy = EXT_PHY2; | 3566 | active_external_phy = EXT_PHY2; |
3524 | break; | 3567 | break; |
3525 | default: | 3568 | default: |
3526 | /** | 3569 | /* |
3527 | * Link indication on both PHYs with the following cases | 3570 | * Link indication on both PHYs with the following cases |
3528 | * is invalid: | 3571 | * is invalid: |
3529 | * - FIRST_PHY means that second phy wasn't initialized, | 3572 | * - FIRST_PHY means that second phy wasn't initialized, |
@@ -3531,7 +3574,7 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3531 | * - SECOND_PHY means that first phy should not be able | 3574 | * - SECOND_PHY means that first phy should not be able |
3532 | * to link up by itself (using configuration) | 3575 | * to link up by itself (using configuration) |
3533 | * - DEFAULT should be overriden during initialiazation | 3576 | * - DEFAULT should be overriden during initialiazation |
3534 | **/ | 3577 | */ |
3535 | DP(NETIF_MSG_LINK, "Invalid link indication" | 3578 | DP(NETIF_MSG_LINK, "Invalid link indication" |
3536 | "mpc=0x%x. DISABLING LINK !!!\n", | 3579 | "mpc=0x%x. DISABLING LINK !!!\n", |
3537 | params->multi_phy_config); | 3580 | params->multi_phy_config); |
@@ -3541,18 +3584,18 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3541 | } | 3584 | } |
3542 | } | 3585 | } |
3543 | prev_line_speed = vars->line_speed; | 3586 | prev_line_speed = vars->line_speed; |
3544 | /** | 3587 | /* |
3545 | * Step 2: | 3588 | * Step 2: |
3546 | * Read the status of the internal phy. In case of | 3589 | * Read the status of the internal phy. In case of |
3547 | * DIRECT_SINGLE_MEDIA board, this link is the external link, | 3590 | * DIRECT_SINGLE_MEDIA board, this link is the external link, |
3548 | * otherwise this is the link between the 577xx and the first | 3591 | * otherwise this is the link between the 577xx and the first |
3549 | * external phy | 3592 | * external phy |
3550 | */ | 3593 | */ |
3551 | if (params->phy[INT_PHY].read_status) | 3594 | if (params->phy[INT_PHY].read_status) |
3552 | params->phy[INT_PHY].read_status( | 3595 | params->phy[INT_PHY].read_status( |
3553 | ¶ms->phy[INT_PHY], | 3596 | ¶ms->phy[INT_PHY], |
3554 | params, vars); | 3597 | params, vars); |
3555 | /** | 3598 | /* |
3556 | * The INT_PHY flow control reside in the vars. This include the | 3599 | * The INT_PHY flow control reside in the vars. This include the |
3557 | * case where the speed or flow control are not set to AUTO. | 3600 | * case where the speed or flow control are not set to AUTO. |
3558 | * Otherwise, the active external phy flow control result is set | 3601 | * Otherwise, the active external phy flow control result is set |
@@ -3562,13 +3605,13 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3562 | */ | 3605 | */ |
3563 | if (active_external_phy > INT_PHY) { | 3606 | if (active_external_phy > INT_PHY) { |
3564 | vars->flow_ctrl = phy_vars[active_external_phy].flow_ctrl; | 3607 | vars->flow_ctrl = phy_vars[active_external_phy].flow_ctrl; |
3565 | /** | 3608 | /* |
3566 | * Link speed is taken from the XGXS. AN and FC result from | 3609 | * Link speed is taken from the XGXS. AN and FC result from |
3567 | * the external phy. | 3610 | * the external phy. |
3568 | */ | 3611 | */ |
3569 | vars->link_status |= phy_vars[active_external_phy].link_status; | 3612 | vars->link_status |= phy_vars[active_external_phy].link_status; |
3570 | 3613 | ||
3571 | /** | 3614 | /* |
3572 | * if active_external_phy is first PHY and link is up - disable | 3615 | * if active_external_phy is first PHY and link is up - disable |
3573 | * disable TX on second external PHY | 3616 | * disable TX on second external PHY |
3574 | */ | 3617 | */ |
@@ -3604,7 +3647,7 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3604 | DP(NETIF_MSG_LINK, "vars->flow_ctrl = 0x%x, vars->link_status = 0x%x," | 3647 | DP(NETIF_MSG_LINK, "vars->flow_ctrl = 0x%x, vars->link_status = 0x%x," |
3605 | " ext_phy_line_speed = %d\n", vars->flow_ctrl, | 3648 | " ext_phy_line_speed = %d\n", vars->flow_ctrl, |
3606 | vars->link_status, ext_phy_line_speed); | 3649 | vars->link_status, ext_phy_line_speed); |
3607 | /** | 3650 | /* |
3608 | * Upon link speed change set the NIG into drain mode. Comes to | 3651 | * Upon link speed change set the NIG into drain mode. Comes to |
3609 | * deals with possible FIFO glitch due to clk change when speed | 3652 | * deals with possible FIFO glitch due to clk change when speed |
3610 | * is decreased without link down indicator | 3653 | * is decreased without link down indicator |
@@ -3635,14 +3678,14 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3635 | 3678 | ||
3636 | bnx2x_link_int_ack(params, vars, link_10g); | 3679 | bnx2x_link_int_ack(params, vars, link_10g); |
3637 | 3680 | ||
3638 | /** | 3681 | /* |
3639 | * In case external phy link is up, and internal link is down | 3682 | * In case external phy link is up, and internal link is down |
3640 | * (not initialized yet probably after link initialization, it | 3683 | * (not initialized yet probably after link initialization, it |
3641 | * needs to be initialized. | 3684 | * needs to be initialized. |
3642 | * Note that after link down-up as result of cable plug, the xgxs | 3685 | * Note that after link down-up as result of cable plug, the xgxs |
3643 | * link would probably become up again without the need | 3686 | * link would probably become up again without the need |
3644 | * initialize it | 3687 | * initialize it |
3645 | */ | 3688 | */ |
3646 | if (!(SINGLE_MEDIA_DIRECT(params))) { | 3689 | if (!(SINGLE_MEDIA_DIRECT(params))) { |
3647 | DP(NETIF_MSG_LINK, "ext_phy_link_up = %d, int_link_up = %d," | 3690 | DP(NETIF_MSG_LINK, "ext_phy_link_up = %d, int_link_up = %d," |
3648 | " init_preceding = %d\n", ext_phy_link_up, | 3691 | " init_preceding = %d\n", ext_phy_link_up, |
@@ -3662,9 +3705,9 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3662 | vars); | 3705 | vars); |
3663 | } | 3706 | } |
3664 | } | 3707 | } |
3665 | /** | 3708 | /* |
3666 | * Link is up only if both local phy and external phy (in case of | 3709 | * Link is up only if both local phy and external phy (in case of |
3667 | * non-direct board) are up | 3710 | * non-direct board) are up |
3668 | */ | 3711 | */ |
3669 | vars->link_up = (vars->phy_link_up && | 3712 | vars->link_up = (vars->phy_link_up && |
3670 | (ext_phy_link_up || | 3713 | (ext_phy_link_up || |
@@ -3952,26 +3995,32 @@ static u8 bnx2x_8073_xaui_wa(struct bnx2x *bp, struct bnx2x_phy *phy) | |||
3952 | } | 3995 | } |
3953 | /* XAUI workaround in 8073 A0: */ | 3996 | /* XAUI workaround in 8073 A0: */ |
3954 | 3997 | ||
3955 | /* After loading the boot ROM and restarting Autoneg, | 3998 | /* |
3956 | poll Dev1, Reg $C820: */ | 3999 | * After loading the boot ROM and restarting Autoneg, poll |
4000 | * Dev1, Reg $C820: | ||
4001 | */ | ||
3957 | 4002 | ||
3958 | for (cnt = 0; cnt < 1000; cnt++) { | 4003 | for (cnt = 0; cnt < 1000; cnt++) { |
3959 | bnx2x_cl45_read(bp, phy, | 4004 | bnx2x_cl45_read(bp, phy, |
3960 | MDIO_PMA_DEVAD, | 4005 | MDIO_PMA_DEVAD, |
3961 | MDIO_PMA_REG_8073_SPEED_LINK_STATUS, | 4006 | MDIO_PMA_REG_8073_SPEED_LINK_STATUS, |
3962 | &val); | 4007 | &val); |
3963 | /* If bit [14] = 0 or bit [13] = 0, continue on with | 4008 | /* |
3964 | system initialization (XAUI work-around not required, | 4009 | * If bit [14] = 0 or bit [13] = 0, continue on with |
3965 | as these bits indicate 2.5G or 1G link up). */ | 4010 | * system initialization (XAUI work-around not required, as |
4011 | * these bits indicate 2.5G or 1G link up). | ||
4012 | */ | ||
3966 | if (!(val & (1<<14)) || !(val & (1<<13))) { | 4013 | if (!(val & (1<<14)) || !(val & (1<<13))) { |
3967 | DP(NETIF_MSG_LINK, "XAUI work-around not required\n"); | 4014 | DP(NETIF_MSG_LINK, "XAUI work-around not required\n"); |
3968 | return 0; | 4015 | return 0; |
3969 | } else if (!(val & (1<<15))) { | 4016 | } else if (!(val & (1<<15))) { |
3970 | DP(NETIF_MSG_LINK, "clc bit 15 went off\n"); | 4017 | DP(NETIF_MSG_LINK, "bit 15 went off\n"); |
3971 | /* If bit 15 is 0, then poll Dev1, Reg $C841 until | 4018 | /* |
3972 | it's MSB (bit 15) goes to 1 (indicating that the | 4019 | * If bit 15 is 0, then poll Dev1, Reg $C841 until it's |
3973 | XAUI workaround has completed), | 4020 | * MSB (bit15) goes to 1 (indicating that the XAUI |
3974 | then continue on with system initialization.*/ | 4021 | * workaround has completed), then continue on with |
4022 | * system initialization. | ||
4023 | */ | ||
3975 | for (cnt1 = 0; cnt1 < 1000; cnt1++) { | 4024 | for (cnt1 = 0; cnt1 < 1000; cnt1++) { |
3976 | bnx2x_cl45_read(bp, phy, | 4025 | bnx2x_cl45_read(bp, phy, |
3977 | MDIO_PMA_DEVAD, | 4026 | MDIO_PMA_DEVAD, |
@@ -4075,10 +4124,6 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4075 | 4124 | ||
4076 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); | 4125 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); |
4077 | 4126 | ||
4078 | /** | ||
4079 | * If this is forced speed, set to KR or KX (all other are not | ||
4080 | * supported) | ||
4081 | */ | ||
4082 | /* Swap polarity if required - Must be done only in non-1G mode */ | 4127 | /* Swap polarity if required - Must be done only in non-1G mode */ |
4083 | if (params->lane_config & PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { | 4128 | if (params->lane_config & PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { |
4084 | /* Configure the 8073 to swap _P and _N of the KR lines */ | 4129 | /* Configure the 8073 to swap _P and _N of the KR lines */ |
@@ -4121,8 +4166,10 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4121 | val = (1<<7); | 4166 | val = (1<<7); |
4122 | } else if (phy->req_line_speed == SPEED_2500) { | 4167 | } else if (phy->req_line_speed == SPEED_2500) { |
4123 | val = (1<<5); | 4168 | val = (1<<5); |
4124 | /* Note that 2.5G works only | 4169 | /* |
4125 | when used with 1G advertisment */ | 4170 | * Note that 2.5G works only when used with 1G |
4171 | * advertisment | ||
4172 | */ | ||
4126 | } else | 4173 | } else |
4127 | val = (1<<5); | 4174 | val = (1<<5); |
4128 | } else { | 4175 | } else { |
@@ -4131,8 +4178,7 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4131 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) | 4178 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) |
4132 | val |= (1<<7); | 4179 | val |= (1<<7); |
4133 | 4180 | ||
4134 | /* Note that 2.5G works only when | 4181 | /* Note that 2.5G works only when used with 1G advertisment */ |
4135 | used with 1G advertisment */ | ||
4136 | if (phy->speed_cap_mask & | 4182 | if (phy->speed_cap_mask & |
4137 | (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G | | 4183 | (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G | |
4138 | PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)) | 4184 | PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)) |
@@ -4172,9 +4218,11 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4172 | /* Add support for CL37 (passive mode) III */ | 4218 | /* Add support for CL37 (passive mode) III */ |
4173 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); | 4219 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); |
4174 | 4220 | ||
4175 | /* The SNR will improve about 2db by changing | 4221 | /* |
4176 | BW and FEE main tap. Rest commands are executed | 4222 | * The SNR will improve about 2db by changing BW and FEE main |
4177 | after link is up*/ | 4223 | * tap. Rest commands are executed after link is up |
4224 | * Change FFE main cursor to 5 in EDC register | ||
4225 | */ | ||
4178 | if (bnx2x_8073_is_snr_needed(bp, phy)) | 4226 | if (bnx2x_8073_is_snr_needed(bp, phy)) |
4179 | bnx2x_cl45_write(bp, phy, | 4227 | bnx2x_cl45_write(bp, phy, |
4180 | MDIO_PMA_DEVAD, MDIO_PMA_REG_EDC_FFE_MAIN, | 4228 | MDIO_PMA_DEVAD, MDIO_PMA_REG_EDC_FFE_MAIN, |
@@ -4258,12 +4306,11 @@ static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy, | |||
4258 | 4306 | ||
4259 | link_up = (((val1 & 4) == 4) || (an1000_status & (1<<1))); | 4307 | link_up = (((val1 & 4) == 4) || (an1000_status & (1<<1))); |
4260 | if (link_up && bnx2x_8073_is_snr_needed(bp, phy)) { | 4308 | if (link_up && bnx2x_8073_is_snr_needed(bp, phy)) { |
4261 | /* The SNR will improve about 2dbby | 4309 | /* |
4262 | changing the BW and FEE main tap.*/ | 4310 | * The SNR will improve about 2dbby changing the BW and FEE main |
4263 | /* The 1st write to change FFE main | 4311 | * tap. The 1st write to change FFE main tap is set before |
4264 | tap is set before restart AN */ | 4312 | * restart AN. Change PLL Bandwidth in EDC register |
4265 | /* Change PLL Bandwidth in EDC | 4313 | */ |
4266 | register */ | ||
4267 | bnx2x_cl45_write(bp, phy, | 4314 | bnx2x_cl45_write(bp, phy, |
4268 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PLL_BANDWIDTH, | 4315 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PLL_BANDWIDTH, |
4269 | 0x26BC); | 4316 | 0x26BC); |
@@ -4307,10 +4354,10 @@ static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy, | |||
4307 | bnx2x_cl45_read(bp, phy, | 4354 | bnx2x_cl45_read(bp, phy, |
4308 | MDIO_XS_DEVAD, | 4355 | MDIO_XS_DEVAD, |
4309 | MDIO_XS_REG_8073_RX_CTRL_PCIE, &val1); | 4356 | MDIO_XS_REG_8073_RX_CTRL_PCIE, &val1); |
4310 | /** | 4357 | /* |
4311 | * Set bit 3 to invert Rx in 1G mode and clear this bit | 4358 | * Set bit 3 to invert Rx in 1G mode and clear this bit |
4312 | * when it`s in 10G mode. | 4359 | * when it`s in 10G mode. |
4313 | */ | 4360 | */ |
4314 | if (vars->line_speed == SPEED_1000) { | 4361 | if (vars->line_speed == SPEED_1000) { |
4315 | DP(NETIF_MSG_LINK, "Swapping 1G polarity for" | 4362 | DP(NETIF_MSG_LINK, "Swapping 1G polarity for" |
4316 | "the 8073\n"); | 4363 | "the 8073\n"); |
@@ -4545,8 +4592,10 @@ static u8 bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
4545 | MDIO_PMA_DEVAD, | 4592 | MDIO_PMA_DEVAD, |
4546 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, | 4593 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, |
4547 | 0x8002); | 4594 | 0x8002); |
4548 | /* Wait appropriate time for two-wire command to finish before | 4595 | /* |
4549 | polling the status register */ | 4596 | * Wait appropriate time for two-wire command to finish before |
4597 | * polling the status register | ||
4598 | */ | ||
4550 | msleep(1); | 4599 | msleep(1); |
4551 | 4600 | ||
4552 | /* Wait up to 500us for command complete status */ | 4601 | /* Wait up to 500us for command complete status */ |
@@ -4625,8 +4674,10 @@ static u8 bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
4625 | { | 4674 | { |
4626 | u8 copper_module_type; | 4675 | u8 copper_module_type; |
4627 | 4676 | ||
4628 | /* Check if its active cable( includes SFP+ module) | 4677 | /* |
4629 | of passive cable*/ | 4678 | * Check if its active cable (includes SFP+ module) |
4679 | * of passive cable | ||
4680 | */ | ||
4630 | if (bnx2x_read_sfp_module_eeprom(phy, | 4681 | if (bnx2x_read_sfp_module_eeprom(phy, |
4631 | params, | 4682 | params, |
4632 | SFP_EEPROM_FC_TX_TECH_ADDR, | 4683 | SFP_EEPROM_FC_TX_TECH_ADDR, |
@@ -4685,8 +4736,10 @@ static u8 bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
4685 | DP(NETIF_MSG_LINK, "EDC mode is set to 0x%x\n", *edc_mode); | 4736 | DP(NETIF_MSG_LINK, "EDC mode is set to 0x%x\n", *edc_mode); |
4686 | return 0; | 4737 | return 0; |
4687 | } | 4738 | } |
4688 | /* This function read the relevant field from the module ( SFP+ ), | 4739 | /* |
4689 | and verify it is compliant with this board */ | 4740 | * This function read the relevant field from the module (SFP+), and verify it |
4741 | * is compliant with this board | ||
4742 | */ | ||
4690 | static u8 bnx2x_verify_sfp_module(struct bnx2x_phy *phy, | 4743 | static u8 bnx2x_verify_sfp_module(struct bnx2x_phy *phy, |
4691 | struct link_params *params) | 4744 | struct link_params *params) |
4692 | { | 4745 | { |
@@ -4764,8 +4817,11 @@ static u8 bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
4764 | u8 val; | 4817 | u8 val; |
4765 | struct bnx2x *bp = params->bp; | 4818 | struct bnx2x *bp = params->bp; |
4766 | u16 timeout; | 4819 | u16 timeout; |
4767 | /* Initialization time after hot-plug may take up to 300ms for some | 4820 | /* |
4768 | phys type ( e.g. JDSU ) */ | 4821 | * Initialization time after hot-plug may take up to 300ms for |
4822 | * some phys type ( e.g. JDSU ) | ||
4823 | */ | ||
4824 | |||
4769 | for (timeout = 0; timeout < 60; timeout++) { | 4825 | for (timeout = 0; timeout < 60; timeout++) { |
4770 | if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val) | 4826 | if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val) |
4771 | == 0) { | 4827 | == 0) { |
@@ -4784,16 +4840,14 @@ static void bnx2x_8727_power_module(struct bnx2x *bp, | |||
4784 | /* Make sure GPIOs are not using for LED mode */ | 4840 | /* Make sure GPIOs are not using for LED mode */ |
4785 | u16 val; | 4841 | u16 val; |
4786 | /* | 4842 | /* |
4787 | * In the GPIO register, bit 4 is use to detemine if the GPIOs are | 4843 | * In the GPIO register, bit 4 is use to determine if the GPIOs are |
4788 | * operating as INPUT or as OUTPUT. Bit 1 is for input, and 0 for | 4844 | * operating as INPUT or as OUTPUT. Bit 1 is for input, and 0 for |
4789 | * output | 4845 | * output |
4790 | * Bits 0-1 determine the gpios value for OUTPUT in case bit 4 val is 0 | 4846 | * Bits 0-1 determine the gpios value for OUTPUT in case bit 4 val is 0 |
4791 | * Bits 8-9 determine the gpios value for INPUT in case bit 4 val is 1 | 4847 | * Bits 8-9 determine the gpios value for INPUT in case bit 4 val is 1 |
4792 | * where the 1st bit is the over-current(only input), and 2nd bit is | 4848 | * where the 1st bit is the over-current(only input), and 2nd bit is |
4793 | * for power( only output ) | 4849 | * for power( only output ) |
4794 | */ | 4850 | * |
4795 | |||
4796 | /* | ||
4797 | * In case of NOC feature is disabled and power is up, set GPIO control | 4851 | * In case of NOC feature is disabled and power is up, set GPIO control |
4798 | * as input to enable listening of over-current indication | 4852 | * as input to enable listening of over-current indication |
4799 | */ | 4853 | */ |
@@ -4838,9 +4892,10 @@ static u8 bnx2x_8726_set_limiting_mode(struct bnx2x *bp, | |||
4838 | 4892 | ||
4839 | DP(NETIF_MSG_LINK, "Setting LRM MODE\n"); | 4893 | DP(NETIF_MSG_LINK, "Setting LRM MODE\n"); |
4840 | 4894 | ||
4841 | /* Changing to LRM mode takes quite few seconds. | 4895 | /* |
4842 | So do it only if current mode is limiting | 4896 | * Changing to LRM mode takes quite few seconds. So do it only |
4843 | ( default is LRM )*/ | 4897 | * if current mode is limiting (default is LRM) |
4898 | */ | ||
4844 | if (cur_limiting_mode != EDC_MODE_LIMITING) | 4899 | if (cur_limiting_mode != EDC_MODE_LIMITING) |
4845 | return 0; | 4900 | return 0; |
4846 | 4901 | ||
@@ -4964,8 +5019,10 @@ static u8 bnx2x_sfp_module_detection(struct bnx2x_phy *phy, | |||
4964 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) | 5019 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) |
4965 | bnx2x_8727_power_module(bp, phy, 1); | 5020 | bnx2x_8727_power_module(bp, phy, 1); |
4966 | 5021 | ||
4967 | /* Check and set limiting mode / LRM mode on 8726. | 5022 | /* |
4968 | On 8727 it is done automatically */ | 5023 | * Check and set limiting mode / LRM mode on 8726. On 8727 it |
5024 | * is done automatically | ||
5025 | */ | ||
4969 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) | 5026 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) |
4970 | bnx2x_8726_set_limiting_mode(bp, phy, edc_mode); | 5027 | bnx2x_8726_set_limiting_mode(bp, phy, edc_mode); |
4971 | else | 5028 | else |
@@ -4996,7 +5053,7 @@ void bnx2x_handle_module_detect_int(struct link_params *params) | |||
4996 | MISC_REGISTERS_GPIO_HIGH, | 5053 | MISC_REGISTERS_GPIO_HIGH, |
4997 | params->port); | 5054 | params->port); |
4998 | 5055 | ||
4999 | /* Get current gpio val refelecting module plugged in / out*/ | 5056 | /* Get current gpio val reflecting module plugged in / out*/ |
5000 | gpio_val = bnx2x_get_gpio(bp, MISC_REGISTERS_GPIO_3, port); | 5057 | gpio_val = bnx2x_get_gpio(bp, MISC_REGISTERS_GPIO_3, port); |
5001 | 5058 | ||
5002 | /* Call the handling function in case module is detected */ | 5059 | /* Call the handling function in case module is detected */ |
@@ -5019,8 +5076,10 @@ void bnx2x_handle_module_detect_int(struct link_params *params) | |||
5019 | bnx2x_set_gpio_int(bp, MISC_REGISTERS_GPIO_3, | 5076 | bnx2x_set_gpio_int(bp, MISC_REGISTERS_GPIO_3, |
5020 | MISC_REGISTERS_GPIO_INT_OUTPUT_SET, | 5077 | MISC_REGISTERS_GPIO_INT_OUTPUT_SET, |
5021 | port); | 5078 | port); |
5022 | /* Module was plugged out. */ | 5079 | /* |
5023 | /* Disable transmit for this module */ | 5080 | * Module was plugged out. |
5081 | * Disable transmit for this module | ||
5082 | */ | ||
5024 | if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == | 5083 | if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == |
5025 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) | 5084 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) |
5026 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 0); | 5085 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 0); |
@@ -5059,9 +5118,9 @@ static u8 bnx2x_8706_8726_read_status(struct bnx2x_phy *phy, | |||
5059 | 5118 | ||
5060 | DP(NETIF_MSG_LINK, "8706/8726 rx_sd 0x%x pcs_status 0x%x 1Gbps" | 5119 | DP(NETIF_MSG_LINK, "8706/8726 rx_sd 0x%x pcs_status 0x%x 1Gbps" |
5061 | " link_status 0x%x\n", rx_sd, pcs_status, val2); | 5120 | " link_status 0x%x\n", rx_sd, pcs_status, val2); |
5062 | /* link is up if both bit 0 of pmd_rx_sd and | 5121 | /* |
5063 | * bit 0 of pcs_status are set, or if the autoneg bit | 5122 | * link is up if both bit 0 of pmd_rx_sd and bit 0 of pcs_status |
5064 | * 1 is set | 5123 | * are set, or if the autoneg bit 1 is set |
5065 | */ | 5124 | */ |
5066 | link_up = ((rx_sd & pcs_status & 0x1) || (val2 & (1<<1))); | 5125 | link_up = ((rx_sd & pcs_status & 0x1) || (val2 & (1<<1))); |
5067 | if (link_up) { | 5126 | if (link_up) { |
@@ -5256,11 +5315,12 @@ static u8 bnx2x_8726_config_init(struct bnx2x_phy *phy, | |||
5256 | 5315 | ||
5257 | bnx2x_8726_external_rom_boot(phy, params); | 5316 | bnx2x_8726_external_rom_boot(phy, params); |
5258 | 5317 | ||
5259 | /* Need to call module detected on initialization since | 5318 | /* |
5260 | the module detection triggered by actual module | 5319 | * Need to call module detected on initialization since the module |
5261 | insertion might occur before driver is loaded, and when | 5320 | * detection triggered by actual module insertion might occur before |
5262 | driver is loaded, it reset all registers, including the | 5321 | * driver is loaded, and when driver is loaded, it reset all |
5263 | transmitter */ | 5322 | * registers, including the transmitter |
5323 | */ | ||
5264 | bnx2x_sfp_module_detection(phy, params); | 5324 | bnx2x_sfp_module_detection(phy, params); |
5265 | 5325 | ||
5266 | if (phy->req_line_speed == SPEED_1000) { | 5326 | if (phy->req_line_speed == SPEED_1000) { |
@@ -5293,8 +5353,10 @@ static u8 bnx2x_8726_config_init(struct bnx2x_phy *phy, | |||
5293 | MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); | 5353 | MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); |
5294 | bnx2x_cl45_write(bp, phy, | 5354 | bnx2x_cl45_write(bp, phy, |
5295 | MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 0x1200); | 5355 | MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 0x1200); |
5296 | /* Enable RX-ALARM control to receive | 5356 | /* |
5297 | interrupt for 1G speed change */ | 5357 | * Enable RX-ALARM control to receive interrupt for 1G speed |
5358 | * change | ||
5359 | */ | ||
5298 | bnx2x_cl45_write(bp, phy, | 5360 | bnx2x_cl45_write(bp, phy, |
5299 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, 0x4); | 5361 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, 0x4); |
5300 | bnx2x_cl45_write(bp, phy, | 5362 | bnx2x_cl45_write(bp, phy, |
@@ -5417,7 +5479,7 @@ static void bnx2x_8727_hw_reset(struct bnx2x_phy *phy, | |||
5417 | struct link_params *params) { | 5479 | struct link_params *params) { |
5418 | u32 swap_val, swap_override; | 5480 | u32 swap_val, swap_override; |
5419 | u8 port; | 5481 | u8 port; |
5420 | /** | 5482 | /* |
5421 | * The PHY reset is controlled by GPIO 1. Fake the port number | 5483 | * The PHY reset is controlled by GPIO 1. Fake the port number |
5422 | * to cancel the swap done in set_gpio() | 5484 | * to cancel the swap done in set_gpio() |
5423 | */ | 5485 | */ |
@@ -5452,14 +5514,17 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5452 | bnx2x_cl45_write(bp, phy, | 5514 | bnx2x_cl45_write(bp, phy, |
5453 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, lasi_ctrl_val); | 5515 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, lasi_ctrl_val); |
5454 | 5516 | ||
5455 | /* Initially configure MOD_ABS to interrupt when | 5517 | /* |
5456 | module is presence( bit 8) */ | 5518 | * Initially configure MOD_ABS to interrupt when module is |
5519 | * presence( bit 8) | ||
5520 | */ | ||
5457 | bnx2x_cl45_read(bp, phy, | 5521 | bnx2x_cl45_read(bp, phy, |
5458 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, &mod_abs); | 5522 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, &mod_abs); |
5459 | /* Set EDC off by setting OPTXLOS signal input to low | 5523 | /* |
5460 | (bit 9). | 5524 | * Set EDC off by setting OPTXLOS signal input to low (bit 9). |
5461 | When the EDC is off it locks onto a reference clock and | 5525 | * When the EDC is off it locks onto a reference clock and avoids |
5462 | avoids becoming 'lost'.*/ | 5526 | * becoming 'lost' |
5527 | */ | ||
5463 | mod_abs &= ~(1<<8); | 5528 | mod_abs &= ~(1<<8); |
5464 | if (!(phy->flags & FLAGS_NOC)) | 5529 | if (!(phy->flags & FLAGS_NOC)) |
5465 | mod_abs &= ~(1<<9); | 5530 | mod_abs &= ~(1<<9); |
@@ -5474,7 +5539,7 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5474 | if (phy->flags & FLAGS_NOC) | 5539 | if (phy->flags & FLAGS_NOC) |
5475 | val |= (3<<5); | 5540 | val |= (3<<5); |
5476 | 5541 | ||
5477 | /** | 5542 | /* |
5478 | * Set 8727 GPIOs to input to allow reading from the 8727 GPIO0 | 5543 | * Set 8727 GPIOs to input to allow reading from the 8727 GPIO0 |
5479 | * status which reflect SFP+ module over-current | 5544 | * status which reflect SFP+ module over-current |
5480 | */ | 5545 | */ |
@@ -5501,7 +5566,7 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5501 | bnx2x_cl45_read(bp, phy, | 5566 | bnx2x_cl45_read(bp, phy, |
5502 | MDIO_PMA_DEVAD, MDIO_PMA_REG_10G_CTRL2, &tmp1); | 5567 | MDIO_PMA_DEVAD, MDIO_PMA_REG_10G_CTRL2, &tmp1); |
5503 | DP(NETIF_MSG_LINK, "1.7 = 0x%x\n", tmp1); | 5568 | DP(NETIF_MSG_LINK, "1.7 = 0x%x\n", tmp1); |
5504 | /** | 5569 | /* |
5505 | * Power down the XAUI until link is up in case of dual-media | 5570 | * Power down the XAUI until link is up in case of dual-media |
5506 | * and 1G | 5571 | * and 1G |
5507 | */ | 5572 | */ |
@@ -5527,7 +5592,7 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5527 | bnx2x_cl45_write(bp, phy, | 5592 | bnx2x_cl45_write(bp, phy, |
5528 | MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1300); | 5593 | MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1300); |
5529 | } else { | 5594 | } else { |
5530 | /** | 5595 | /* |
5531 | * Since the 8727 has only single reset pin, need to set the 10G | 5596 | * Since the 8727 has only single reset pin, need to set the 10G |
5532 | * registers although it is default | 5597 | * registers although it is default |
5533 | */ | 5598 | */ |
@@ -5543,7 +5608,8 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5543 | 0x0008); | 5608 | 0x0008); |
5544 | } | 5609 | } |
5545 | 5610 | ||
5546 | /* Set 2-wire transfer rate of SFP+ module EEPROM | 5611 | /* |
5612 | * Set 2-wire transfer rate of SFP+ module EEPROM | ||
5547 | * to 100Khz since some DACs(direct attached cables) do | 5613 | * to 100Khz since some DACs(direct attached cables) do |
5548 | * not work at 400Khz. | 5614 | * not work at 400Khz. |
5549 | */ | 5615 | */ |
@@ -5587,12 +5653,14 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5587 | DP(NETIF_MSG_LINK, "MOD_ABS indication " | 5653 | DP(NETIF_MSG_LINK, "MOD_ABS indication " |
5588 | "show module is absent\n"); | 5654 | "show module is absent\n"); |
5589 | 5655 | ||
5590 | /* 1. Set mod_abs to detect next module | 5656 | /* |
5591 | presence event | 5657 | * 1. Set mod_abs to detect next module |
5592 | 2. Set EDC off by setting OPTXLOS signal input to low | 5658 | * presence event |
5593 | (bit 9). | 5659 | * 2. Set EDC off by setting OPTXLOS signal input to low |
5594 | When the EDC is off it locks onto a reference clock and | 5660 | * (bit 9). |
5595 | avoids becoming 'lost'.*/ | 5661 | * When the EDC is off it locks onto a reference clock and |
5662 | * avoids becoming 'lost'. | ||
5663 | */ | ||
5596 | mod_abs &= ~(1<<8); | 5664 | mod_abs &= ~(1<<8); |
5597 | if (!(phy->flags & FLAGS_NOC)) | 5665 | if (!(phy->flags & FLAGS_NOC)) |
5598 | mod_abs &= ~(1<<9); | 5666 | mod_abs &= ~(1<<9); |
@@ -5600,8 +5668,10 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5600 | MDIO_PMA_DEVAD, | 5668 | MDIO_PMA_DEVAD, |
5601 | MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs); | 5669 | MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs); |
5602 | 5670 | ||
5603 | /* Clear RX alarm since it stays up as long as | 5671 | /* |
5604 | the mod_abs wasn't changed */ | 5672 | * Clear RX alarm since it stays up as long as |
5673 | * the mod_abs wasn't changed | ||
5674 | */ | ||
5605 | bnx2x_cl45_read(bp, phy, | 5675 | bnx2x_cl45_read(bp, phy, |
5606 | MDIO_PMA_DEVAD, | 5676 | MDIO_PMA_DEVAD, |
5607 | MDIO_PMA_REG_RX_ALARM, &rx_alarm_status); | 5677 | MDIO_PMA_REG_RX_ALARM, &rx_alarm_status); |
@@ -5610,15 +5680,14 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5610 | /* Module is present */ | 5680 | /* Module is present */ |
5611 | DP(NETIF_MSG_LINK, "MOD_ABS indication " | 5681 | DP(NETIF_MSG_LINK, "MOD_ABS indication " |
5612 | "show module is present\n"); | 5682 | "show module is present\n"); |
5613 | /* First thing, disable transmitter, | 5683 | /* |
5614 | and if the module is ok, the | 5684 | * First disable transmitter, and if the module is ok, the |
5615 | module_detection will enable it*/ | 5685 | * module_detection will enable it |
5616 | 5686 | * 1. Set mod_abs to detect next module absent event ( bit 8) | |
5617 | /* 1. Set mod_abs to detect next module | 5687 | * 2. Restore the default polarity of the OPRXLOS signal and |
5618 | absent event ( bit 8) | 5688 | * this signal will then correctly indicate the presence or |
5619 | 2. Restore the default polarity of the OPRXLOS signal and | 5689 | * absence of the Rx signal. (bit 9) |
5620 | this signal will then correctly indicate the presence or | 5690 | */ |
5621 | absence of the Rx signal. (bit 9) */ | ||
5622 | mod_abs |= (1<<8); | 5691 | mod_abs |= (1<<8); |
5623 | if (!(phy->flags & FLAGS_NOC)) | 5692 | if (!(phy->flags & FLAGS_NOC)) |
5624 | mod_abs |= (1<<9); | 5693 | mod_abs |= (1<<9); |
@@ -5626,10 +5695,12 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5626 | MDIO_PMA_DEVAD, | 5695 | MDIO_PMA_DEVAD, |
5627 | MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs); | 5696 | MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs); |
5628 | 5697 | ||
5629 | /* Clear RX alarm since it stays up as long as | 5698 | /* |
5630 | the mod_abs wasn't changed. This is need to be done | 5699 | * Clear RX alarm since it stays up as long as the mod_abs |
5631 | before calling the module detection, otherwise it will clear | 5700 | * wasn't changed. This is need to be done before calling the |
5632 | the link update alarm */ | 5701 | * module detection, otherwise it will clear* the link update |
5702 | * alarm | ||
5703 | */ | ||
5633 | bnx2x_cl45_read(bp, phy, | 5704 | bnx2x_cl45_read(bp, phy, |
5634 | MDIO_PMA_DEVAD, | 5705 | MDIO_PMA_DEVAD, |
5635 | MDIO_PMA_REG_RX_ALARM, &rx_alarm_status); | 5706 | MDIO_PMA_REG_RX_ALARM, &rx_alarm_status); |
@@ -5646,9 +5717,8 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5646 | } | 5717 | } |
5647 | 5718 | ||
5648 | DP(NETIF_MSG_LINK, "8727 RX_ALARM_STATUS 0x%x\n", | 5719 | DP(NETIF_MSG_LINK, "8727 RX_ALARM_STATUS 0x%x\n", |
5649 | rx_alarm_status); | 5720 | rx_alarm_status); |
5650 | /* No need to check link status in case of | 5721 | /* No need to check link status in case of module plugged in/out */ |
5651 | module plugged in/out */ | ||
5652 | } | 5722 | } |
5653 | 5723 | ||
5654 | static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | 5724 | static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, |
@@ -5684,7 +5754,7 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5684 | bnx2x_cl45_read(bp, phy, | 5754 | bnx2x_cl45_read(bp, phy, |
5685 | MDIO_PMA_DEVAD, MDIO_PMA_REG_M8051_MSGOUT_REG, &val1); | 5755 | MDIO_PMA_DEVAD, MDIO_PMA_REG_M8051_MSGOUT_REG, &val1); |
5686 | 5756 | ||
5687 | /** | 5757 | /* |
5688 | * If a module is present and there is need to check | 5758 | * If a module is present and there is need to check |
5689 | * for over current | 5759 | * for over current |
5690 | */ | 5760 | */ |
@@ -5704,12 +5774,8 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5704 | " Please remove the SFP+ module and" | 5774 | " Please remove the SFP+ module and" |
5705 | " restart the system to clear this" | 5775 | " restart the system to clear this" |
5706 | " error.\n", | 5776 | " error.\n", |
5707 | params->port); | 5777 | params->port); |
5708 | 5778 | /* Disable all RX_ALARMs except for mod_abs */ | |
5709 | /* | ||
5710 | * Disable all RX_ALARMs except for | ||
5711 | * mod_abs | ||
5712 | */ | ||
5713 | bnx2x_cl45_write(bp, phy, | 5779 | bnx2x_cl45_write(bp, phy, |
5714 | MDIO_PMA_DEVAD, | 5780 | MDIO_PMA_DEVAD, |
5715 | MDIO_PMA_REG_RX_ALARM_CTRL, (1<<5)); | 5781 | MDIO_PMA_REG_RX_ALARM_CTRL, (1<<5)); |
@@ -5752,11 +5818,15 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5752 | MDIO_PMA_DEVAD, | 5818 | MDIO_PMA_DEVAD, |
5753 | MDIO_PMA_REG_8073_SPEED_LINK_STATUS, &link_status); | 5819 | MDIO_PMA_REG_8073_SPEED_LINK_STATUS, &link_status); |
5754 | 5820 | ||
5755 | /* Bits 0..2 --> speed detected, | 5821 | /* |
5756 | bits 13..15--> link is down */ | 5822 | * Bits 0..2 --> speed detected, |
5823 | * Bits 13..15--> link is down | ||
5824 | */ | ||
5757 | if ((link_status & (1<<2)) && (!(link_status & (1<<15)))) { | 5825 | if ((link_status & (1<<2)) && (!(link_status & (1<<15)))) { |
5758 | link_up = 1; | 5826 | link_up = 1; |
5759 | vars->line_speed = SPEED_10000; | 5827 | vars->line_speed = SPEED_10000; |
5828 | DP(NETIF_MSG_LINK, "port %x: External link up in 10G\n", | ||
5829 | params->port); | ||
5760 | } else if ((link_status & (1<<0)) && (!(link_status & (1<<13)))) { | 5830 | } else if ((link_status & (1<<0)) && (!(link_status & (1<<13)))) { |
5761 | link_up = 1; | 5831 | link_up = 1; |
5762 | vars->line_speed = SPEED_1000; | 5832 | vars->line_speed = SPEED_1000; |
@@ -5778,7 +5848,7 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5778 | bnx2x_cl45_read(bp, phy, | 5848 | bnx2x_cl45_read(bp, phy, |
5779 | MDIO_PMA_DEVAD, | 5849 | MDIO_PMA_DEVAD, |
5780 | MDIO_PMA_REG_8727_PCS_GP, &val1); | 5850 | MDIO_PMA_REG_8727_PCS_GP, &val1); |
5781 | /** | 5851 | /* |
5782 | * In case of dual-media board and 1G, power up the XAUI side, | 5852 | * In case of dual-media board and 1G, power up the XAUI side, |
5783 | * otherwise power it down. For 10G it is done automatically | 5853 | * otherwise power it down. For 10G it is done automatically |
5784 | */ | 5854 | */ |
@@ -5920,7 +5990,11 @@ static u8 bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, | |||
5920 | { | 5990 | { |
5921 | struct bnx2x *bp = params->bp; | 5991 | struct bnx2x *bp = params->bp; |
5922 | u16 autoneg_val, an_1000_val, an_10_100_val; | 5992 | u16 autoneg_val, an_1000_val, an_10_100_val; |
5923 | 5993 | /* | |
5994 | * This phy uses the NIG latch mechanism since link indication | ||
5995 | * arrives through its LED4 and not via its LASI signal, so we | ||
5996 | * get steady signal instead of clear on read | ||
5997 | */ | ||
5924 | bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, | 5998 | bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, |
5925 | 1 << NIG_LATCH_BC_ENABLE_MI_INT); | 5999 | 1 << NIG_LATCH_BC_ENABLE_MI_INT); |
5926 | 6000 | ||
@@ -6079,8 +6153,9 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
6079 | bnx2x_wait_reset_complete(bp, phy); | 6153 | bnx2x_wait_reset_complete(bp, phy); |
6080 | /* Wait for GPHY to come out of reset */ | 6154 | /* Wait for GPHY to come out of reset */ |
6081 | msleep(50); | 6155 | msleep(50); |
6082 | /* BCM84823 requires that XGXS links up first @ 10G for normal | 6156 | /* |
6083 | behavior */ | 6157 | * BCM84823 requires that XGXS links up first @ 10G for normal behavior |
6158 | */ | ||
6084 | temp = vars->line_speed; | 6159 | temp = vars->line_speed; |
6085 | vars->line_speed = SPEED_10000; | 6160 | vars->line_speed = SPEED_10000; |
6086 | bnx2x_set_autoneg(¶ms->phy[INT_PHY], params, vars, 0); | 6161 | bnx2x_set_autoneg(¶ms->phy[INT_PHY], params, vars, 0); |
@@ -6401,7 +6476,7 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
6401 | if (!((val & | 6476 | if (!((val & |
6402 | MDIO_PMA_REG_8481_LINK_SIGNAL_LED4_ENABLE_MASK) | 6477 | MDIO_PMA_REG_8481_LINK_SIGNAL_LED4_ENABLE_MASK) |
6403 | >> MDIO_PMA_REG_8481_LINK_SIGNAL_LED4_ENABLE_SHIFT)) { | 6478 | >> MDIO_PMA_REG_8481_LINK_SIGNAL_LED4_ENABLE_SHIFT)) { |
6404 | DP(NETIF_MSG_LINK, "Seting LINK_SIGNAL\n"); | 6479 | DP(NETIF_MSG_LINK, "Setting LINK_SIGNAL\n"); |
6405 | bnx2x_cl45_write(bp, phy, | 6480 | bnx2x_cl45_write(bp, phy, |
6406 | MDIO_PMA_DEVAD, | 6481 | MDIO_PMA_DEVAD, |
6407 | MDIO_PMA_REG_8481_LINK_SIGNAL, | 6482 | MDIO_PMA_REG_8481_LINK_SIGNAL, |
@@ -6522,9 +6597,7 @@ static u8 bnx2x_7101_read_status(struct bnx2x_phy *phy, | |||
6522 | DP(NETIF_MSG_LINK, "10G-base-T PMA status 0x%x->0x%x\n", | 6597 | DP(NETIF_MSG_LINK, "10G-base-T PMA status 0x%x->0x%x\n", |
6523 | val2, val1); | 6598 | val2, val1); |
6524 | link_up = ((val1 & 4) == 4); | 6599 | link_up = ((val1 & 4) == 4); |
6525 | /* if link is up | 6600 | /* if link is up print the AN outcome of the SFX7101 PHY */ |
6526 | * print the AN outcome of the SFX7101 PHY | ||
6527 | */ | ||
6528 | if (link_up) { | 6601 | if (link_up) { |
6529 | bnx2x_cl45_read(bp, phy, | 6602 | bnx2x_cl45_read(bp, phy, |
6530 | MDIO_AN_DEVAD, MDIO_AN_REG_MASTER_STATUS, | 6603 | MDIO_AN_DEVAD, MDIO_AN_REG_MASTER_STATUS, |
@@ -6987,7 +7060,7 @@ static void bnx2x_populate_preemphasis(struct bnx2x *bp, u32 shmem_base, | |||
6987 | /* Get the 4 lanes xgxs config rx and tx */ | 7060 | /* Get the 4 lanes xgxs config rx and tx */ |
6988 | u32 rx = 0, tx = 0, i; | 7061 | u32 rx = 0, tx = 0, i; |
6989 | for (i = 0; i < 2; i++) { | 7062 | for (i = 0; i < 2; i++) { |
6990 | /** | 7063 | /* |
6991 | * INT_PHY and EXT_PHY1 share the same value location in the | 7064 | * INT_PHY and EXT_PHY1 share the same value location in the |
6992 | * shmem. When num_phys is greater than 1, than this value | 7065 | * shmem. When num_phys is greater than 1, than this value |
6993 | * applies only to EXT_PHY1 | 7066 | * applies only to EXT_PHY1 |
@@ -7141,11 +7214,11 @@ static u8 bnx2x_populate_ext_phy(struct bnx2x *bp, | |||
7141 | phy->addr = XGXS_EXT_PHY_ADDR(ext_phy_config); | 7214 | phy->addr = XGXS_EXT_PHY_ADDR(ext_phy_config); |
7142 | bnx2x_populate_preemphasis(bp, shmem_base, phy, port, phy_index); | 7215 | bnx2x_populate_preemphasis(bp, shmem_base, phy, port, phy_index); |
7143 | 7216 | ||
7144 | /** | 7217 | /* |
7145 | * The shmem address of the phy version is located on different | 7218 | * The shmem address of the phy version is located on different |
7146 | * structures. In case this structure is too old, do not set | 7219 | * structures. In case this structure is too old, do not set |
7147 | * the address | 7220 | * the address |
7148 | */ | 7221 | */ |
7149 | config2 = REG_RD(bp, shmem_base + offsetof(struct shmem_region, | 7222 | config2 = REG_RD(bp, shmem_base + offsetof(struct shmem_region, |
7150 | dev_info.shared_hw_config.config2)); | 7223 | dev_info.shared_hw_config.config2)); |
7151 | if (phy_index == EXT_PHY1) { | 7224 | if (phy_index == EXT_PHY1) { |
@@ -7174,7 +7247,7 @@ static u8 bnx2x_populate_ext_phy(struct bnx2x *bp, | |||
7174 | } | 7247 | } |
7175 | phy->mdio_ctrl = bnx2x_get_emac_base(bp, mdc_mdio_access, port); | 7248 | phy->mdio_ctrl = bnx2x_get_emac_base(bp, mdc_mdio_access, port); |
7176 | 7249 | ||
7177 | /** | 7250 | /* |
7178 | * In case mdc/mdio_access of the external phy is different than the | 7251 | * In case mdc/mdio_access of the external phy is different than the |
7179 | * mdc/mdio access of the XGXS, a HW lock must be taken in each access | 7252 | * mdc/mdio access of the XGXS, a HW lock must be taken in each access |
7180 | * to prevent one port interfere with another port's CL45 operations. | 7253 | * to prevent one port interfere with another port's CL45 operations. |
@@ -7729,8 +7802,10 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
7729 | (val | 1<<10)); | 7802 | (val | 1<<10)); |
7730 | } | 7803 | } |
7731 | 7804 | ||
7732 | /* Toggle Transmitter: Power down and then up with 600ms | 7805 | /* |
7733 | delay between */ | 7806 | * Toggle Transmitter: Power down and then up with 600ms delay |
7807 | * between | ||
7808 | */ | ||
7734 | msleep(600); | 7809 | msleep(600); |
7735 | 7810 | ||
7736 | /* PART3 - complete TX_POWER_DOWN process, and set GPIO2 back to low */ | 7811 | /* PART3 - complete TX_POWER_DOWN process, and set GPIO2 back to low */ |
@@ -7913,8 +7988,10 @@ static u8 bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[], | |||
7913 | break; | 7988 | break; |
7914 | 7989 | ||
7915 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: | 7990 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: |
7916 | /* GPIO1 affects both ports, so there's need to pull | 7991 | /* |
7917 | it for single port alone */ | 7992 | * GPIO1 affects both ports, so there's need to pull |
7993 | * it for single port alone | ||
7994 | */ | ||
7918 | rc = bnx2x_8726_common_init_phy(bp, shmem_base_path, | 7995 | rc = bnx2x_8726_common_init_phy(bp, shmem_base_path, |
7919 | shmem2_base_path, | 7996 | shmem2_base_path, |
7920 | phy_index, chip_id); | 7997 | phy_index, chip_id); |
@@ -7924,8 +8001,8 @@ static u8 bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[], | |||
7924 | break; | 8001 | break; |
7925 | default: | 8002 | default: |
7926 | DP(NETIF_MSG_LINK, | 8003 | DP(NETIF_MSG_LINK, |
7927 | "bnx2x_common_init_phy: ext_phy 0x%x not required\n", | 8004 | "ext_phy 0x%x common init not required\n", |
7928 | ext_phy_type); | 8005 | ext_phy_type); |
7929 | break; | 8006 | break; |
7930 | } | 8007 | } |
7931 | 8008 | ||