aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Rosner <yanivr@broadcom.com>2011-05-31 17:26:28 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-01 16:10:55 -0400
commitfcf5b650832996bd857bb8f0b0b42097218f7fb8 (patch)
treeaa88772122baae2fa13aa72c2186ae67c30548e4
parent1ac9e4286dc9e64dd2d937df7f8660bb5f260792 (diff)
bnx2x: Change return status type
Change return status from u8 to int. 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>
-rw-r--r--drivers/net/bnx2x/bnx2x_link.c332
-rw-r--r--drivers/net/bnx2x/bnx2x_link.h44
2 files changed, 192 insertions, 184 deletions
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index 8a7d7d6b1ddf..7705e79945ec 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -342,7 +342,7 @@ void bnx2x_ets_bw_limit(const struct link_params *params, const u32 cos0_bw,
342 REG_WR(bp, PBF_REG_COS1_WEIGHT, cos1_credit_weight); 342 REG_WR(bp, PBF_REG_COS1_WEIGHT, cos1_credit_weight);
343} 343}
344 344
345u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) 345int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos)
346{ 346{
347 /* ETS disabled configuration*/ 347 /* ETS disabled configuration*/
348 struct bnx2x *bp = params->bp; 348 struct bnx2x *bp = params->bp;
@@ -508,8 +508,8 @@ static void bnx2x_emac_init(struct link_params *params,
508 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + 4, val); 508 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + 4, val);
509} 509}
510 510
511static u8 bnx2x_emac_enable(struct link_params *params, 511static int bnx2x_emac_enable(struct link_params *params,
512 struct link_vars *vars, u8 lb) 512 struct link_vars *vars, u8 lb)
513{ 513{
514 struct bnx2x *bp = params->bp; 514 struct bnx2x *bp = params->bp;
515 u8 port = params->port; 515 u8 port = params->port;
@@ -1002,9 +1002,9 @@ void bnx2x_update_pfc(struct link_params *params,
1002 REG_WR(bp, NIG_REG_BMAC0_PAUSE_OUT_EN + params->port*4, val); 1002 REG_WR(bp, NIG_REG_BMAC0_PAUSE_OUT_EN + params->port*4, val);
1003} 1003}
1004 1004
1005static u8 bnx2x_bmac1_enable(struct link_params *params, 1005static int bnx2x_bmac1_enable(struct link_params *params,
1006 struct link_vars *vars, 1006 struct link_vars *vars,
1007 u8 is_lb) 1007 u8 is_lb)
1008{ 1008{
1009 struct bnx2x *bp = params->bp; 1009 struct bnx2x *bp = params->bp;
1010 u8 port = params->port; 1010 u8 port = params->port;
@@ -1066,9 +1066,9 @@ static u8 bnx2x_bmac1_enable(struct link_params *params,
1066 return 0; 1066 return 0;
1067} 1067}
1068 1068
1069static u8 bnx2x_bmac2_enable(struct link_params *params, 1069static int bnx2x_bmac2_enable(struct link_params *params,
1070 struct link_vars *vars, 1070 struct link_vars *vars,
1071 u8 is_lb) 1071 u8 is_lb)
1072{ 1072{
1073 struct bnx2x *bp = params->bp; 1073 struct bnx2x *bp = params->bp;
1074 u8 port = params->port; 1074 u8 port = params->port;
@@ -1131,11 +1131,12 @@ static u8 bnx2x_bmac2_enable(struct link_params *params,
1131 return 0; 1131 return 0;
1132} 1132}
1133 1133
1134static u8 bnx2x_bmac_enable(struct link_params *params, 1134static int bnx2x_bmac_enable(struct link_params *params,
1135 struct link_vars *vars, 1135 struct link_vars *vars,
1136 u8 is_lb) 1136 u8 is_lb)
1137{ 1137{
1138 u8 rc, port = params->port; 1138 int rc = 0;
1139 u8 port = params->port;
1139 struct bnx2x *bp = params->bp; 1140 struct bnx2x *bp = params->bp;
1140 u32 val; 1141 u32 val;
1141 /* reset and unreset the BigMac */ 1142 /* reset and unreset the BigMac */
@@ -1218,8 +1219,8 @@ static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port)
1218 } 1219 }
1219} 1220}
1220 1221
1221static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl, 1222static int bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl,
1222 u32 line_speed) 1223 u32 line_speed)
1223{ 1224{
1224 struct bnx2x *bp = params->bp; 1225 struct bnx2x *bp = params->bp;
1225 u8 port = params->port; 1226 u8 port = params->port;
@@ -1351,11 +1352,12 @@ static u32 bnx2x_get_emac_base(struct bnx2x *bp,
1351/******************************************************************/ 1352/******************************************************************/
1352/* CL45 access functions */ 1353/* CL45 access functions */
1353/******************************************************************/ 1354/******************************************************************/
1354static u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, 1355static int bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy,
1355 u8 devad, u16 reg, u16 val) 1356 u8 devad, u16 reg, u16 val)
1356{ 1357{
1357 u32 tmp, saved_mode; 1358 u32 tmp, saved_mode;
1358 u8 i, rc = 0; 1359 u8 i;
1360 int rc = 0;
1359 /* 1361 /*
1360 * Set clause 45 mode, slow down the MDIO clock to 2.5MHz 1362 * Set clause 45 mode, slow down the MDIO clock to 2.5MHz
1361 * (a value of 49==0x31) and make sure that the AUTO poll is off 1363 * (a value of 49==0x31) and make sure that the AUTO poll is off
@@ -1420,12 +1422,12 @@ static u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy,
1420 return rc; 1422 return rc;
1421} 1423}
1422 1424
1423static u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, 1425static int bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy,
1424 u8 devad, u16 reg, u16 *ret_val) 1426 u8 devad, u16 reg, u16 *ret_val)
1425{ 1427{
1426 u32 val, saved_mode; 1428 u32 val, saved_mode;
1427 u16 i; 1429 u16 i;
1428 u8 rc = 0; 1430 int rc = 0;
1429 /* 1431 /*
1430 * Set clause 45 mode, slow down the MDIO clock to 2.5MHz 1432 * Set clause 45 mode, slow down the MDIO clock to 2.5MHz
1431 * (a value of 49==0x31) and make sure that the AUTO poll is off 1433 * (a value of 49==0x31) and make sure that the AUTO poll is off
@@ -1492,8 +1494,8 @@ static u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy,
1492 return rc; 1494 return rc;
1493} 1495}
1494 1496
1495u8 bnx2x_phy_read(struct link_params *params, u8 phy_addr, 1497int bnx2x_phy_read(struct link_params *params, u8 phy_addr,
1496 u8 devad, u16 reg, u16 *ret_val) 1498 u8 devad, u16 reg, u16 *ret_val)
1497{ 1499{
1498 u8 phy_index; 1500 u8 phy_index;
1499 /* 1501 /*
@@ -1510,8 +1512,8 @@ u8 bnx2x_phy_read(struct link_params *params, u8 phy_addr,
1510 return -EINVAL; 1512 return -EINVAL;
1511} 1513}
1512 1514
1513u8 bnx2x_phy_write(struct link_params *params, u8 phy_addr, 1515int bnx2x_phy_write(struct link_params *params, u8 phy_addr,
1514 u8 devad, u16 reg, u16 val) 1516 u8 devad, u16 reg, u16 val)
1515{ 1517{
1516 u8 phy_index; 1518 u8 phy_index;
1517 /* 1519 /*
@@ -1776,9 +1778,9 @@ static void bnx2x_set_master_ln(struct link_params *params,
1776 (new_master_ln | ser_lane)); 1778 (new_master_ln | ser_lane));
1777} 1779}
1778 1780
1779static u8 bnx2x_reset_unicore(struct link_params *params, 1781static int bnx2x_reset_unicore(struct link_params *params,
1780 struct bnx2x_phy *phy, 1782 struct bnx2x_phy *phy,
1781 u8 set_serdes) 1783 u8 set_serdes)
1782{ 1784{
1783 struct bnx2x *bp = params->bp; 1785 struct bnx2x *bp = params->bp;
1784 u16 mii_control; 1786 u16 mii_control;
@@ -2296,8 +2298,8 @@ static void bnx2x_pause_resolve(struct link_vars *vars, u32 pause_result)
2296 vars->link_status |= LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE; 2298 vars->link_status |= LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE;
2297} 2299}
2298 2300
2299static u8 bnx2x_direct_parallel_detect_used(struct bnx2x_phy *phy, 2301static int bnx2x_direct_parallel_detect_used(struct bnx2x_phy *phy,
2300 struct link_params *params) 2302 struct link_params *params)
2301{ 2303{
2302 struct bnx2x *bp = params->bp; 2304 struct bnx2x *bp = params->bp;
2303 u16 pd_10g, status2_1000x; 2305 u16 pd_10g, status2_1000x;
@@ -2480,13 +2482,13 @@ static void bnx2x_xgxs_an_resolve(struct bnx2x_phy *phy,
2480 LINK_STATUS_PARALLEL_DETECTION_USED; 2482 LINK_STATUS_PARALLEL_DETECTION_USED;
2481} 2483}
2482 2484
2483static u8 bnx2x_link_settings_status(struct bnx2x_phy *phy, 2485static int bnx2x_link_settings_status(struct bnx2x_phy *phy,
2484 struct link_params *params, 2486 struct link_params *params,
2485 struct link_vars *vars) 2487 struct link_vars *vars)
2486{ 2488{
2487 struct bnx2x *bp = params->bp; 2489 struct bnx2x *bp = params->bp;
2488 u16 new_line_speed, gp_status; 2490 u16 new_line_speed, gp_status;
2489 u8 rc = 0; 2491 int rc = 0;
2490 2492
2491 /* Read gp_status */ 2493 /* Read gp_status */
2492 CL22_RD_OVER_CL45(bp, phy, 2494 CL22_RD_OVER_CL45(bp, phy,
@@ -2659,8 +2661,8 @@ static void bnx2x_set_gmii_tx_driver(struct link_params *params)
2659 } 2661 }
2660} 2662}
2661 2663
2662static u8 bnx2x_emac_program(struct link_params *params, 2664static int bnx2x_emac_program(struct link_params *params,
2663 struct link_vars *vars) 2665 struct link_vars *vars)
2664{ 2666{
2665 struct bnx2x *bp = params->bp; 2667 struct bnx2x *bp = params->bp;
2666 u8 port = params->port; 2668 u8 port = params->port;
@@ -2779,11 +2781,11 @@ static void bnx2x_init_internal_phy(struct bnx2x_phy *phy,
2779 } 2781 }
2780} 2782}
2781 2783
2782static u8 bnx2x_init_serdes(struct bnx2x_phy *phy, 2784static int bnx2x_init_serdes(struct bnx2x_phy *phy,
2783 struct link_params *params, 2785 struct link_params *params,
2784 struct link_vars *vars) 2786 struct link_vars *vars)
2785{ 2787{
2786 u8 rc; 2788 int rc;
2787 vars->phy_flags |= PHY_SGMII_FLAG; 2789 vars->phy_flags |= PHY_SGMII_FLAG;
2788 bnx2x_calc_ieee_aneg_adv(phy, params, &vars->ieee_fc); 2790 bnx2x_calc_ieee_aneg_adv(phy, params, &vars->ieee_fc);
2789 bnx2x_set_aer_mmd_serdes(params->bp, phy); 2791 bnx2x_set_aer_mmd_serdes(params->bp, phy);
@@ -2796,11 +2798,11 @@ static u8 bnx2x_init_serdes(struct bnx2x_phy *phy,
2796 return rc; 2798 return rc;
2797} 2799}
2798 2800
2799static u8 bnx2x_init_xgxs(struct bnx2x_phy *phy, 2801static int bnx2x_init_xgxs(struct bnx2x_phy *phy,
2800 struct link_params *params, 2802 struct link_params *params,
2801 struct link_vars *vars) 2803 struct link_vars *vars)
2802{ 2804{
2803 u8 rc; 2805 int rc;
2804 vars->phy_flags = PHY_XGXS_FLAG; 2806 vars->phy_flags = PHY_XGXS_FLAG;
2805 if ((phy->req_line_speed && 2807 if ((phy->req_line_speed &&
2806 ((phy->req_line_speed == SPEED_100) || 2808 ((phy->req_line_speed == SPEED_100) ||
@@ -2989,7 +2991,7 @@ static void bnx2x_link_int_ack(struct link_params *params,
2989 } 2991 }
2990} 2992}
2991 2993
2992static u8 bnx2x_format_ver(u32 num, u8 *str, u16 *len) 2994static int bnx2x_format_ver(u32 num, u8 *str, u16 *len)
2993{ 2995{
2994 u8 *str_ptr = str; 2996 u8 *str_ptr = str;
2995 u32 mask = 0xf0000000; 2997 u32 mask = 0xf0000000;
@@ -3028,19 +3030,19 @@ static u8 bnx2x_format_ver(u32 num, u8 *str, u16 *len)
3028} 3030}
3029 3031
3030 3032
3031static u8 bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len) 3033static int bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len)
3032{ 3034{
3033 str[0] = '\0'; 3035 str[0] = '\0';
3034 (*len)--; 3036 (*len)--;
3035 return 0; 3037 return 0;
3036} 3038}
3037 3039
3038u8 bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded, 3040int bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded,
3039 u8 *version, u16 len) 3041 u8 *version, u16 len)
3040{ 3042{
3041 struct bnx2x *bp; 3043 struct bnx2x *bp;
3042 u32 spirom_ver = 0; 3044 u32 spirom_ver = 0;
3043 u8 status = 0; 3045 int status = 0;
3044 u8 *ver_p = version; 3046 u8 *ver_p = version;
3045 u16 remain_len = len; 3047 u16 remain_len = len;
3046 if (version == NULL || params == NULL) 3048 if (version == NULL || params == NULL)
@@ -3124,12 +3126,13 @@ static void bnx2x_set_xgxs_loopback(struct bnx2x_phy *phy,
3124 } 3126 }
3125} 3127}
3126 3128
3127u8 bnx2x_set_led(struct link_params *params, 3129int bnx2x_set_led(struct link_params *params,
3128 struct link_vars *vars, u8 mode, u32 speed) 3130 struct link_vars *vars, u8 mode, u32 speed)
3129{ 3131{
3130 u8 port = params->port; 3132 u8 port = params->port;
3131 u16 hw_led_mode = params->hw_led_mode; 3133 u16 hw_led_mode = params->hw_led_mode;
3132 u8 rc = 0, phy_idx; 3134 int rc = 0;
3135 u8 phy_idx;
3133 u32 tmp; 3136 u32 tmp;
3134 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 3137 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
3135 struct bnx2x *bp = params->bp; 3138 struct bnx2x *bp = params->bp;
@@ -3233,8 +3236,8 @@ u8 bnx2x_set_led(struct link_params *params,
3233 * This function comes to reflect the actual link state read DIRECTLY from the 3236 * This function comes to reflect the actual link state read DIRECTLY from the
3234 * HW 3237 * HW
3235 */ 3238 */
3236u8 bnx2x_test_link(struct link_params *params, struct link_vars *vars, 3239int bnx2x_test_link(struct link_params *params, struct link_vars *vars,
3237 u8 is_serdes) 3240 u8 is_serdes)
3238{ 3241{
3239 struct bnx2x *bp = params->bp; 3242 struct bnx2x *bp = params->bp;
3240 u16 gp_status = 0, phy_index = 0; 3243 u16 gp_status = 0, phy_index = 0;
@@ -3284,10 +3287,10 @@ u8 bnx2x_test_link(struct link_params *params, struct link_vars *vars,
3284 return -ESRCH; 3287 return -ESRCH;
3285} 3288}
3286 3289
3287static u8 bnx2x_link_initialize(struct link_params *params, 3290static int bnx2x_link_initialize(struct link_params *params,
3288 struct link_vars *vars) 3291 struct link_vars *vars)
3289{ 3292{
3290 u8 rc = 0; 3293 int rc = 0;
3291 u8 phy_index, non_ext_phy; 3294 u8 phy_index, non_ext_phy;
3292 struct bnx2x *bp = params->bp; 3295 struct bnx2x *bp = params->bp;
3293 /* 3296 /*
@@ -3380,8 +3383,8 @@ static void bnx2x_common_ext_link_reset(struct bnx2x_phy *phy,
3380 DP(NETIF_MSG_LINK, "reset external PHY\n"); 3383 DP(NETIF_MSG_LINK, "reset external PHY\n");
3381} 3384}
3382 3385
3383static u8 bnx2x_update_link_down(struct link_params *params, 3386static int bnx2x_update_link_down(struct link_params *params,
3384 struct link_vars *vars) 3387 struct link_vars *vars)
3385{ 3388{
3386 struct bnx2x *bp = params->bp; 3389 struct bnx2x *bp = params->bp;
3387 u8 port = params->port; 3390 u8 port = params->port;
@@ -3412,13 +3415,13 @@ static u8 bnx2x_update_link_down(struct link_params *params,
3412 return 0; 3415 return 0;
3413} 3416}
3414 3417
3415static u8 bnx2x_update_link_up(struct link_params *params, 3418static int bnx2x_update_link_up(struct link_params *params,
3416 struct link_vars *vars, 3419 struct link_vars *vars,
3417 u8 link_10g) 3420 u8 link_10g)
3418{ 3421{
3419 struct bnx2x *bp = params->bp; 3422 struct bnx2x *bp = params->bp;
3420 u8 port = params->port; 3423 u8 port = params->port;
3421 u8 rc = 0; 3424 int rc = 0;
3422 3425
3423 vars->link_status |= LINK_STATUS_LINK_UP; 3426 vars->link_status |= LINK_STATUS_LINK_UP;
3424 3427
@@ -3472,13 +3475,14 @@ static u8 bnx2x_update_link_up(struct link_params *params,
3472 * external phy needs to be up, and at least one of the 2 3475 * external phy needs to be up, and at least one of the 2
3473 * external phy link must be up. 3476 * external phy link must be up.
3474 */ 3477 */
3475u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) 3478int bnx2x_link_update(struct link_params *params, struct link_vars *vars)
3476{ 3479{
3477 struct bnx2x *bp = params->bp; 3480 struct bnx2x *bp = params->bp;
3478 struct link_vars phy_vars[MAX_PHYS]; 3481 struct link_vars phy_vars[MAX_PHYS];
3479 u8 port = params->port; 3482 u8 port = params->port;
3480 u8 link_10g, phy_index; 3483 u8 link_10g, phy_index;
3481 u8 ext_phy_link_up = 0, cur_link_up, rc = 0; 3484 u8 ext_phy_link_up = 0, cur_link_up;
3485 int rc = 0;
3482 u8 is_mi_int = 0; 3486 u8 is_mi_int = 0;
3483 u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed; 3487 u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed;
3484 u8 active_external_phy = INT_PHY; 3488 u8 active_external_phy = INT_PHY;
@@ -3866,13 +3870,13 @@ static void bnx2x_8073_resolve_fc(struct bnx2x_phy *phy,
3866 pause_result); 3870 pause_result);
3867 } 3871 }
3868} 3872}
3869static u8 bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp, 3873static int bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp,
3870 struct bnx2x_phy *phy, 3874 struct bnx2x_phy *phy,
3871 u8 port) 3875 u8 port)
3872{ 3876{
3873 u32 count = 0; 3877 u32 count = 0;
3874 u16 fw_ver1, fw_msgout; 3878 u16 fw_ver1, fw_msgout;
3875 u8 rc = 0; 3879 int rc = 0;
3876 3880
3877 /* Boot port from external ROM */ 3881 /* Boot port from external ROM */
3878 /* EDC grst */ 3882 /* EDC grst */
@@ -3947,7 +3951,7 @@ static u8 bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp,
3947/******************************************************************/ 3951/******************************************************************/
3948/* BCM8073 PHY SECTION */ 3952/* BCM8073 PHY SECTION */
3949/******************************************************************/ 3953/******************************************************************/
3950static u8 bnx2x_8073_is_snr_needed(struct bnx2x *bp, struct bnx2x_phy *phy) 3954static int bnx2x_8073_is_snr_needed(struct bnx2x *bp, struct bnx2x_phy *phy)
3951{ 3955{
3952 /* This is only required for 8073A1, version 102 only */ 3956 /* This is only required for 8073A1, version 102 only */
3953 u16 val; 3957 u16 val;
@@ -3973,7 +3977,7 @@ static u8 bnx2x_8073_is_snr_needed(struct bnx2x *bp, struct bnx2x_phy *phy)
3973 return 1; 3977 return 1;
3974} 3978}
3975 3979
3976static u8 bnx2x_8073_xaui_wa(struct bnx2x *bp, struct bnx2x_phy *phy) 3980static int bnx2x_8073_xaui_wa(struct bnx2x *bp, struct bnx2x_phy *phy)
3977{ 3981{
3978 u16 val, cnt, cnt1 ; 3982 u16 val, cnt, cnt1 ;
3979 3983
@@ -4080,9 +4084,9 @@ static void bnx2x_8073_set_pause_cl37(struct link_params *params,
4080 msleep(500); 4084 msleep(500);
4081} 4085}
4082 4086
4083static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, 4087static int bnx2x_8073_config_init(struct bnx2x_phy *phy,
4084 struct link_params *params, 4088 struct link_params *params,
4085 struct link_vars *vars) 4089 struct link_vars *vars)
4086{ 4090{
4087 struct bnx2x *bp = params->bp; 4091 struct bnx2x *bp = params->bp;
4088 u16 val = 0, tmp1; 4092 u16 val = 0, tmp1;
@@ -4388,9 +4392,9 @@ static void bnx2x_8073_link_reset(struct bnx2x_phy *phy,
4388/******************************************************************/ 4392/******************************************************************/
4389/* BCM8705 PHY SECTION */ 4393/* BCM8705 PHY SECTION */
4390/******************************************************************/ 4394/******************************************************************/
4391static u8 bnx2x_8705_config_init(struct bnx2x_phy *phy, 4395static int bnx2x_8705_config_init(struct bnx2x_phy *phy,
4392 struct link_params *params, 4396 struct link_params *params,
4393 struct link_vars *vars) 4397 struct link_vars *vars)
4394{ 4398{
4395 struct bnx2x *bp = params->bp; 4399 struct bnx2x *bp = params->bp;
4396 DP(NETIF_MSG_LINK, "init 8705\n"); 4400 DP(NETIF_MSG_LINK, "init 8705\n");
@@ -4521,9 +4525,9 @@ static void bnx2x_sfp_set_transmitter(struct link_params *params,
4521 } 4525 }
4522} 4526}
4523 4527
4524static u8 bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, 4528static int bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy,
4525 struct link_params *params, 4529 struct link_params *params,
4526 u16 addr, u8 byte_cnt, u8 *o_buf) 4530 u16 addr, u8 byte_cnt, u8 *o_buf)
4527{ 4531{
4528 struct bnx2x *bp = params->bp; 4532 struct bnx2x *bp = params->bp;
4529 u16 val = 0; 4533 u16 val = 0;
@@ -4587,9 +4591,9 @@ static u8 bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy,
4587 return -EINVAL; 4591 return -EINVAL;
4588} 4592}
4589 4593
4590static u8 bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, 4594static int bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy,
4591 struct link_params *params, 4595 struct link_params *params,
4592 u16 addr, u8 byte_cnt, u8 *o_buf) 4596 u16 addr, u8 byte_cnt, u8 *o_buf)
4593{ 4597{
4594 struct bnx2x *bp = params->bp; 4598 struct bnx2x *bp = params->bp;
4595 u16 val, i; 4599 u16 val, i;
@@ -4674,11 +4678,11 @@ static u8 bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy,
4674 return -EINVAL; 4678 return -EINVAL;
4675} 4679}
4676 4680
4677u8 bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, 4681int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy,
4678 struct link_params *params, u16 addr, 4682 struct link_params *params, u16 addr,
4679 u8 byte_cnt, u8 *o_buf) 4683 u8 byte_cnt, u8 *o_buf)
4680{ 4684{
4681 u8 rc = -EINVAL; 4685 int rc = -EINVAL;
4682 switch (phy->type) { 4686 switch (phy->type) {
4683 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: 4687 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
4684 rc = bnx2x_8726_read_sfp_module_eeprom(phy, params, addr, 4688 rc = bnx2x_8726_read_sfp_module_eeprom(phy, params, addr,
@@ -4693,9 +4697,9 @@ u8 bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy,
4693 return rc; 4697 return rc;
4694} 4698}
4695 4699
4696static u8 bnx2x_get_edc_mode(struct bnx2x_phy *phy, 4700static int bnx2x_get_edc_mode(struct bnx2x_phy *phy,
4697 struct link_params *params, 4701 struct link_params *params,
4698 u16 *edc_mode) 4702 u16 *edc_mode)
4699{ 4703{
4700 struct bnx2x *bp = params->bp; 4704 struct bnx2x *bp = params->bp;
4701 u32 sync_offset = 0, phy_idx, media_types; 4705 u32 sync_offset = 0, phy_idx, media_types;
@@ -4800,8 +4804,8 @@ static u8 bnx2x_get_edc_mode(struct bnx2x_phy *phy,
4800 * This function read the relevant field from the module (SFP+), and verify it 4804 * This function read the relevant field from the module (SFP+), and verify it
4801 * is compliant with this board 4805 * is compliant with this board
4802 */ 4806 */
4803static u8 bnx2x_verify_sfp_module(struct bnx2x_phy *phy, 4807static int bnx2x_verify_sfp_module(struct bnx2x_phy *phy,
4804 struct link_params *params) 4808 struct link_params *params)
4805{ 4809{
4806 struct bnx2x *bp = params->bp; 4810 struct bnx2x *bp = params->bp;
4807 u32 val, cmd; 4811 u32 val, cmd;
@@ -4870,8 +4874,8 @@ static u8 bnx2x_verify_sfp_module(struct bnx2x_phy *phy,
4870 return -EINVAL; 4874 return -EINVAL;
4871} 4875}
4872 4876
4873static u8 bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, 4877static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy,
4874 struct link_params *params) 4878 struct link_params *params)
4875 4879
4876{ 4880{
4877 u8 val; 4881 u8 val;
@@ -4929,9 +4933,9 @@ static void bnx2x_8727_power_module(struct bnx2x *bp,
4929 val); 4933 val);
4930} 4934}
4931 4935
4932static u8 bnx2x_8726_set_limiting_mode(struct bnx2x *bp, 4936static int bnx2x_8726_set_limiting_mode(struct bnx2x *bp,
4933 struct bnx2x_phy *phy, 4937 struct bnx2x_phy *phy,
4934 u16 edc_mode) 4938 u16 edc_mode)
4935{ 4939{
4936 u16 cur_limiting_mode; 4940 u16 cur_limiting_mode;
4937 4941
@@ -4979,9 +4983,9 @@ static u8 bnx2x_8726_set_limiting_mode(struct bnx2x *bp,
4979 return 0; 4983 return 0;
4980} 4984}
4981 4985
4982static u8 bnx2x_8727_set_limiting_mode(struct bnx2x *bp, 4986static int bnx2x_8727_set_limiting_mode(struct bnx2x *bp,
4983 struct bnx2x_phy *phy, 4987 struct bnx2x_phy *phy,
4984 u16 edc_mode) 4988 u16 edc_mode)
4985{ 4989{
4986 u16 phy_identifier; 4990 u16 phy_identifier;
4987 u16 rom_ver2_val; 4991 u16 rom_ver2_val;
@@ -5098,12 +5102,12 @@ static void bnx2x_set_limiting_mode(struct link_params *params,
5098 } 5102 }
5099} 5103}
5100 5104
5101static u8 bnx2x_sfp_module_detection(struct bnx2x_phy *phy, 5105int bnx2x_sfp_module_detection(struct bnx2x_phy *phy,
5102 struct link_params *params) 5106 struct link_params *params)
5103{ 5107{
5104 struct bnx2x *bp = params->bp; 5108 struct bnx2x *bp = params->bp;
5105 u16 edc_mode; 5109 u16 edc_mode;
5106 u8 rc = 0; 5110 int rc = 0;
5107 5111
5108 u32 val = REG_RD(bp, params->shmem_base + 5112 u32 val = REG_RD(bp, params->shmem_base +
5109 offsetof(struct shmem_region, dev_info. 5113 offsetof(struct shmem_region, dev_info.
@@ -5353,9 +5357,9 @@ static u8 bnx2x_8706_config_init(struct bnx2x_phy *phy,
5353 return 0; 5357 return 0;
5354} 5358}
5355 5359
5356static u8 bnx2x_8706_read_status(struct bnx2x_phy *phy, 5360static int bnx2x_8706_read_status(struct bnx2x_phy *phy,
5357 struct link_params *params, 5361 struct link_params *params,
5358 struct link_vars *vars) 5362 struct link_vars *vars)
5359{ 5363{
5360 return bnx2x_8706_8726_read_status(phy, params, vars); 5364 return bnx2x_8706_8726_read_status(phy, params, vars);
5361} 5365}
@@ -5430,9 +5434,9 @@ static u8 bnx2x_8726_read_status(struct bnx2x_phy *phy,
5430} 5434}
5431 5435
5432 5436
5433static u8 bnx2x_8726_config_init(struct bnx2x_phy *phy, 5437static int bnx2x_8726_config_init(struct bnx2x_phy *phy,
5434 struct link_params *params, 5438 struct link_params *params,
5435 struct link_vars *vars) 5439 struct link_vars *vars)
5436{ 5440{
5437 struct bnx2x *bp = params->bp; 5441 struct bnx2x *bp = params->bp;
5438 u32 val; 5442 u32 val;
@@ -5620,9 +5624,9 @@ static void bnx2x_8727_hw_reset(struct bnx2x_phy *phy,
5620 MISC_REGISTERS_GPIO_OUTPUT_LOW, port); 5624 MISC_REGISTERS_GPIO_OUTPUT_LOW, port);
5621} 5625}
5622 5626
5623static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, 5627static int bnx2x_8727_config_init(struct bnx2x_phy *phy,
5624 struct link_params *params, 5628 struct link_params *params,
5625 struct link_vars *vars) 5629 struct link_vars *vars)
5626{ 5630{
5627 u32 tx_en_mode; 5631 u32 tx_en_mode;
5628 u16 tmp1, val, mod_abs, tmp2; 5632 u16 tmp1, val, mod_abs, tmp2;
@@ -6142,9 +6146,9 @@ static void bnx2x_848xx_set_led(struct bnx2x *bp,
6142 0xFFFB, 0xFFFD); 6146 0xFFFB, 0xFFFD);
6143} 6147}
6144 6148
6145static u8 bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, 6149static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy,
6146 struct link_params *params, 6150 struct link_params *params,
6147 struct link_vars *vars) 6151 struct link_vars *vars)
6148{ 6152{
6149 struct bnx2x *bp = params->bp; 6153 struct bnx2x *bp = params->bp;
6150 u16 autoneg_val, an_1000_val, an_10_100_val; 6154 u16 autoneg_val, an_1000_val, an_10_100_val;
@@ -6270,9 +6274,9 @@ static u8 bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy,
6270 return 0; 6274 return 0;
6271} 6275}
6272 6276
6273static u8 bnx2x_8481_config_init(struct bnx2x_phy *phy, 6277static int bnx2x_8481_config_init(struct bnx2x_phy *phy,
6274 struct link_params *params, 6278 struct link_params *params,
6275 struct link_vars *vars) 6279 struct link_vars *vars)
6276{ 6280{
6277 struct bnx2x *bp = params->bp; 6281 struct bnx2x *bp = params->bp;
6278 /* Restore normal power mode*/ 6282 /* Restore normal power mode*/
@@ -6287,16 +6291,16 @@ static u8 bnx2x_8481_config_init(struct bnx2x_phy *phy,
6287 return bnx2x_848xx_cmn_config_init(phy, params, vars); 6291 return bnx2x_848xx_cmn_config_init(phy, params, vars);
6288} 6292}
6289 6293
6290static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, 6294static int bnx2x_848x3_config_init(struct bnx2x_phy *phy,
6291 struct link_params *params, 6295 struct link_params *params,
6292 struct link_vars *vars) 6296 struct link_vars *vars)
6293{ 6297{
6294 struct bnx2x *bp = params->bp; 6298 struct bnx2x *bp = params->bp;
6295 u8 port, initialize = 1; 6299 u8 port, initialize = 1;
6296 u16 val, adj; 6300 u16 val, adj;
6297 u16 temp; 6301 u16 temp;
6298 u32 actual_phy_selection, cms_enable; 6302 u32 actual_phy_selection, cms_enable;
6299 u8 rc = 0; 6303 int rc = 0;
6300 6304
6301 /* This is just for MDIO_CTL_REG_84823_MEDIA register. */ 6305 /* This is just for MDIO_CTL_REG_84823_MEDIA register. */
6302 adj = 0; 6306 adj = 0;
@@ -6475,9 +6479,10 @@ static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy,
6475 return link_up; 6479 return link_up;
6476} 6480}
6477 6481
6478static u8 bnx2x_848xx_format_ver(u32 raw_ver, u8 *str, u16 *len) 6482
6483static int bnx2x_848xx_format_ver(u32 raw_ver, u8 *str, u16 *len)
6479{ 6484{
6480 u8 status = 0; 6485 int status = 0;
6481 u32 spirom_ver; 6486 u32 spirom_ver;
6482 spirom_ver = ((raw_ver & 0xF80) >> 7) << 16 | (raw_ver & 0x7F); 6487 spirom_ver = ((raw_ver & 0xF80) >> 7) << 16 | (raw_ver & 0x7F);
6483 status = bnx2x_format_ver(spirom_ver, str, len); 6488 status = bnx2x_format_ver(spirom_ver, str, len);
@@ -6718,9 +6723,9 @@ static void bnx2x_7101_config_loopback(struct bnx2x_phy *phy,
6718 MDIO_XS_DEVAD, MDIO_XS_SFX7101_XGXS_TEST1, 0x100); 6723 MDIO_XS_DEVAD, MDIO_XS_SFX7101_XGXS_TEST1, 0x100);
6719} 6724}
6720 6725
6721static u8 bnx2x_7101_config_init(struct bnx2x_phy *phy, 6726static int bnx2x_7101_config_init(struct bnx2x_phy *phy,
6722 struct link_params *params, 6727 struct link_params *params,
6723 struct link_vars *vars) 6728 struct link_vars *vars)
6724{ 6729{
6725 u16 fw_ver1, fw_ver2, val; 6730 u16 fw_ver1, fw_ver2, val;
6726 struct bnx2x *bp = params->bp; 6731 struct bnx2x *bp = params->bp;
@@ -6793,8 +6798,7 @@ static u8 bnx2x_7101_read_status(struct bnx2x_phy *phy,
6793 return link_up; 6798 return link_up;
6794} 6799}
6795 6800
6796 6801static int bnx2x_7101_format_ver(u32 spirom_ver, u8 *str, u16 *len)
6797static u8 bnx2x_7101_format_ver(u32 spirom_ver, u8 *str, u16 *len)
6798{ 6802{
6799 if (*len < 5) 6803 if (*len < 5)
6800 return -EINVAL; 6804 return -EINVAL;
@@ -7331,8 +7335,8 @@ static u32 bnx2x_get_ext_phy_config(struct bnx2x *bp, u32 shmem_base,
7331 7335
7332 return ext_phy_config; 7336 return ext_phy_config;
7333} 7337}
7334static u8 bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port, 7338static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port,
7335 struct bnx2x_phy *phy) 7339 struct bnx2x_phy *phy)
7336{ 7340{
7337 u32 phy_addr; 7341 u32 phy_addr;
7338 u32 chip_id; 7342 u32 chip_id;
@@ -7374,12 +7378,12 @@ static u8 bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port,
7374 return 0; 7378 return 0;
7375} 7379}
7376 7380
7377static u8 bnx2x_populate_ext_phy(struct bnx2x *bp, 7381static int bnx2x_populate_ext_phy(struct bnx2x *bp,
7378 u8 phy_index, 7382 u8 phy_index,
7379 u32 shmem_base, 7383 u32 shmem_base,
7380 u32 shmem2_base, 7384 u32 shmem2_base,
7381 u8 port, 7385 u8 port,
7382 struct bnx2x_phy *phy) 7386 struct bnx2x_phy *phy)
7383{ 7387{
7384 u32 ext_phy_config, phy_type, config2; 7388 u32 ext_phy_config, phy_type, config2;
7385 u32 mdc_mdio_access = SHARED_HW_CFG_MDC_MDIO_ACCESS1_BOTH; 7389 u32 mdc_mdio_access = SHARED_HW_CFG_MDC_MDIO_ACCESS1_BOTH;
@@ -7483,10 +7487,10 @@ static u8 bnx2x_populate_ext_phy(struct bnx2x *bp,
7483 return 0; 7487 return 0;
7484} 7488}
7485 7489
7486static u8 bnx2x_populate_phy(struct bnx2x *bp, u8 phy_index, u32 shmem_base, 7490static int bnx2x_populate_phy(struct bnx2x *bp, u8 phy_index, u32 shmem_base,
7487 u32 shmem2_base, u8 port, struct bnx2x_phy *phy) 7491 u32 shmem2_base, u8 port, struct bnx2x_phy *phy)
7488{ 7492{
7489 u8 status = 0; 7493 int status = 0;
7490 phy->type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN; 7494 phy->type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN;
7491 if (phy_index == INT_PHY) 7495 if (phy_index == INT_PHY)
7492 return bnx2x_populate_int_phy(bp, shmem_base, port, phy); 7496 return bnx2x_populate_int_phy(bp, shmem_base, port, phy);
@@ -7600,7 +7604,7 @@ u32 bnx2x_phy_selection(struct link_params *params)
7600} 7604}
7601 7605
7602 7606
7603u8 bnx2x_phy_probe(struct link_params *params) 7607int bnx2x_phy_probe(struct link_params *params)
7604{ 7608{
7605 u8 phy_index, actual_phy_idx, link_cfg_idx; 7609 u8 phy_index, actual_phy_idx, link_cfg_idx;
7606 u32 phy_config_swapped, sync_offset, media_types; 7610 u32 phy_config_swapped, sync_offset, media_types;
@@ -7704,7 +7708,7 @@ static void set_phy_vars(struct link_params *params)
7704 } 7708 }
7705} 7709}
7706 7710
7707u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars) 7711int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
7708{ 7712{
7709 struct bnx2x *bp = params->bp; 7713 struct bnx2x *bp = params->bp;
7710 DP(NETIF_MSG_LINK, "Phy Initialization started\n"); 7714 DP(NETIF_MSG_LINK, "Phy Initialization started\n");
@@ -7827,8 +7831,9 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
7827 } 7831 }
7828 return 0; 7832 return 0;
7829} 7833}
7830u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, 7834
7831 u8 reset_ext_phy) 7835int bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
7836 u8 reset_ext_phy)
7832{ 7837{
7833 struct bnx2x *bp = params->bp; 7838 struct bnx2x *bp = params->bp;
7834 u8 phy_index, port = params->port, clear_latch_ind = 0; 7839 u8 phy_index, port = params->port, clear_latch_ind = 0;
@@ -7900,10 +7905,10 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
7900/****************************************************************************/ 7905/****************************************************************************/
7901/* Common function */ 7906/* Common function */
7902/****************************************************************************/ 7907/****************************************************************************/
7903static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, 7908static int bnx2x_8073_common_init_phy(struct bnx2x *bp,
7904 u32 shmem_base_path[], 7909 u32 shmem_base_path[],
7905 u32 shmem2_base_path[], u8 phy_index, 7910 u32 shmem2_base_path[], u8 phy_index,
7906 u32 chip_id) 7911 u32 chip_id)
7907{ 7912{
7908 struct bnx2x_phy phy[PORT_MAX]; 7913 struct bnx2x_phy phy[PORT_MAX];
7909 struct bnx2x_phy *phy_blk[PORT_MAX]; 7914 struct bnx2x_phy *phy_blk[PORT_MAX];
@@ -8026,10 +8031,10 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp,
8026 } 8031 }
8027 return 0; 8032 return 0;
8028} 8033}
8029static u8 bnx2x_8726_common_init_phy(struct bnx2x *bp, 8034static int bnx2x_8726_common_init_phy(struct bnx2x *bp,
8030 u32 shmem_base_path[], 8035 u32 shmem_base_path[],
8031 u32 shmem2_base_path[], u8 phy_index, 8036 u32 shmem2_base_path[], u8 phy_index,
8032 u32 chip_id) 8037 u32 chip_id)
8033{ 8038{
8034 u32 val; 8039 u32 val;
8035 s8 port; 8040 s8 port;
@@ -8120,10 +8125,11 @@ static void bnx2x_get_ext_phy_reset_gpio(struct bnx2x *bp, u32 shmem_base,
8120 break; 8125 break;
8121 } 8126 }
8122} 8127}
8123static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, 8128
8124 u32 shmem_base_path[], 8129static int bnx2x_8727_common_init_phy(struct bnx2x *bp,
8125 u32 shmem2_base_path[], u8 phy_index, 8130 u32 shmem_base_path[],
8126 u32 chip_id) 8131 u32 shmem2_base_path[], u8 phy_index,
8132 u32 chip_id)
8127{ 8133{
8128 s8 port, reset_gpio; 8134 s8 port, reset_gpio;
8129 u32 swap_val, swap_override; 8135 u32 swap_val, swap_override;
@@ -8216,11 +8222,11 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp,
8216 return 0; 8222 return 0;
8217} 8223}
8218 8224
8219static u8 bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[], 8225static int bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[],
8220 u32 shmem2_base_path[], u8 phy_index, 8226 u32 shmem2_base_path[], u8 phy_index,
8221 u32 ext_phy_type, u32 chip_id) 8227 u32 ext_phy_type, u32 chip_id)
8222{ 8228{
8223 u8 rc = 0; 8229 int rc = 0;
8224 8230
8225 switch (ext_phy_type) { 8231 switch (ext_phy_type) {
8226 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073: 8232 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
@@ -8262,10 +8268,10 @@ static u8 bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[],
8262 return rc; 8268 return rc;
8263} 8269}
8264 8270
8265u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[], 8271int bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[],
8266 u32 shmem2_base_path[], u32 chip_id) 8272 u32 shmem2_base_path[], u32 chip_id)
8267{ 8273{
8268 u8 rc = 0; 8274 int rc = 0;
8269 u32 phy_ver; 8275 u32 phy_ver;
8270 u8 phy_index; 8276 u8 phy_index;
8271 u32 ext_phy_type, ext_phy_config; 8277 u32 ext_phy_type, ext_phy_config;
diff --git a/drivers/net/bnx2x/bnx2x_link.h b/drivers/net/bnx2x/bnx2x_link.h
index ac348daae2f2..418bef472e08 100644
--- a/drivers/net/bnx2x/bnx2x_link.h
+++ b/drivers/net/bnx2x/bnx2x_link.h
@@ -281,40 +281,41 @@ struct link_vars {
281/***********************************************************/ 281/***********************************************************/
282/* Functions */ 282/* Functions */
283/***********************************************************/ 283/***********************************************************/
284u8 bnx2x_phy_init(struct link_params *input, struct link_vars *output); 284int bnx2x_phy_init(struct link_params *params, struct link_vars *vars);
285 285
286/* Reset the link. Should be called when driver or interface goes down 286/* Reset the link. Should be called when driver or interface goes down
287 Before calling phy firmware upgrade, the reset_ext_phy should be set 287 Before calling phy firmware upgrade, the reset_ext_phy should be set
288 to 0 */ 288 to 0 */
289u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, 289int bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
290 u8 reset_ext_phy); 290 u8 reset_ext_phy);
291 291
292/* bnx2x_link_update should be called upon link interrupt */ 292/* bnx2x_link_update should be called upon link interrupt */
293u8 bnx2x_link_update(struct link_params *input, struct link_vars *output); 293int bnx2x_link_update(struct link_params *params, struct link_vars *vars);
294 294
295/* use the following phy functions to read/write from external_phy 295/* use the following phy functions to read/write from external_phy
296 In order to use it to read/write internal phy registers, use 296 In order to use it to read/write internal phy registers, use
297 DEFAULT_PHY_DEV_ADDR as devad, and (_bank + (_addr & 0xf)) as 297 DEFAULT_PHY_DEV_ADDR as devad, and (_bank + (_addr & 0xf)) as
298 the register */ 298 the register */
299u8 bnx2x_phy_read(struct link_params *params, u8 phy_addr, 299int bnx2x_phy_read(struct link_params *params, u8 phy_addr,
300 u8 devad, u16 reg, u16 *ret_val); 300 u8 devad, u16 reg, u16 *ret_val);
301
302int bnx2x_phy_write(struct link_params *params, u8 phy_addr,
303 u8 devad, u16 reg, u16 val);
301 304
302u8 bnx2x_phy_write(struct link_params *params, u8 phy_addr,
303 u8 devad, u16 reg, u16 val);
304/* Reads the link_status from the shmem, 305/* Reads the link_status from the shmem,
305 and update the link vars accordingly */ 306 and update the link vars accordingly */
306void bnx2x_link_status_update(struct link_params *input, 307void bnx2x_link_status_update(struct link_params *input,
307 struct link_vars *output); 308 struct link_vars *output);
308/* returns string representing the fw_version of the external phy */ 309/* returns string representing the fw_version of the external phy */
309u8 bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded, 310int bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded,
310 u8 *version, u16 len); 311 u8 *version, u16 len);
311 312
312/* Set/Unset the led 313/* Set/Unset the led
313 Basically, the CLC takes care of the led for the link, but in case one needs 314 Basically, the CLC takes care of the led for the link, but in case one needs
314 to set/unset the led unnaturally, set the "mode" to LED_MODE_OPER to 315 to set/unset the led unnaturally, set the "mode" to LED_MODE_OPER to
315 blink the led, and LED_MODE_OFF to set the led off.*/ 316 blink the led, and LED_MODE_OFF to set the led off.*/
316u8 bnx2x_set_led(struct link_params *params, struct link_vars *vars, 317int bnx2x_set_led(struct link_params *params,
317 u8 mode, u32 speed); 318 struct link_vars *vars, u8 mode, u32 speed);
318#define LED_MODE_OFF 0 319#define LED_MODE_OFF 0
319#define LED_MODE_ON 1 320#define LED_MODE_ON 1
320#define LED_MODE_OPER 2 321#define LED_MODE_OPER 2
@@ -326,12 +327,12 @@ void bnx2x_handle_module_detect_int(struct link_params *params);
326 327
327/* Get the actual link status. In case it returns 0, link is up, 328/* Get the actual link status. In case it returns 0, link is up,
328 otherwise link is down*/ 329 otherwise link is down*/
329u8 bnx2x_test_link(struct link_params *input, struct link_vars *vars, 330int bnx2x_test_link(struct link_params *params, struct link_vars *vars,
330 u8 is_serdes); 331 u8 is_serdes);
331 332
332/* One-time initialization for external phy after power up */ 333/* One-time initialization for external phy after power up */
333u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[], 334int bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[],
334 u32 shmem2_base_path[], u32 chip_id); 335 u32 shmem2_base_path[], u32 chip_id);
335 336
336/* Reset the external PHY using GPIO */ 337/* Reset the external PHY using GPIO */
337void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port); 338void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port);
@@ -340,9 +341,9 @@ void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port);
340void bnx2x_sfx7101_sp_sw_reset(struct bnx2x *bp, struct bnx2x_phy *phy); 341void bnx2x_sfx7101_sp_sw_reset(struct bnx2x *bp, struct bnx2x_phy *phy);
341 342
342/* Read "byte_cnt" bytes from address "addr" from the SFP+ EEPROM */ 343/* Read "byte_cnt" bytes from address "addr" from the SFP+ EEPROM */
343u8 bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, 344int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy,
344 struct link_params *params, u16 addr, 345 struct link_params *params, u16 addr,
345 u8 byte_cnt, u8 *o_buf); 346 u8 byte_cnt, u8 *o_buf);
346 347
347void bnx2x_hw_reset_phy(struct link_params *params); 348void bnx2x_hw_reset_phy(struct link_params *params);
348 349
@@ -354,7 +355,8 @@ u8 bnx2x_hw_lock_required(struct bnx2x *bp, u32 shmem_base,
354u32 bnx2x_phy_selection(struct link_params *params); 355u32 bnx2x_phy_selection(struct link_params *params);
355 356
356/* Probe the phys on board, and populate them in "params" */ 357/* Probe the phys on board, and populate them in "params" */
357u8 bnx2x_phy_probe(struct link_params *params); 358int bnx2x_phy_probe(struct link_params *params);
359
358/* Checks if fan failure detection is required on one of the phys on board */ 360/* Checks if fan failure detection is required on one of the phys on board */
359u8 bnx2x_fan_failure_det_req(struct bnx2x *bp, u32 shmem_base, 361u8 bnx2x_fan_failure_det_req(struct bnx2x *bp, u32 shmem_base,
360 u32 shmem2_base, u8 port); 362 u32 shmem2_base, u8 port);
@@ -392,7 +394,7 @@ void bnx2x_ets_bw_limit(const struct link_params *params, const u32 cos0_bw,
392 const u32 cos1_bw); 394 const u32 cos1_bw);
393 395
394/* Used to configure the ETS to strict */ 396/* Used to configure the ETS to strict */
395u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos); 397int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos);
396 398
397/* Read pfc statistic*/ 399/* Read pfc statistic*/
398void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars, 400void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars,