aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
authorYuval Mintz <yuvalmin@broadcom.com>2012-09-10 01:51:06 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-10 16:40:29 -0400
commitec4010ecc26b78476452b499b7a476fb58032379 (patch)
tree43c03304cf17289018579e617c3905b57889ec9e /drivers/net/ethernet/broadcom
parent34dab172f08e0456f3f8a8f6497567cf6744535e (diff)
bnx2x: EEE code refactoring
In order to lay the foundation for 1G EEE support, several segments of code which are common to both 1G and 10G EEE configurations were extracted from the 10G EEE configuration flow to their own functions. E.g., bnx2x_eee_initial_config, bnx2x_eee_advertise, bnx2x_eee_disable, etc. The rest of the EEE functions were relocated and placed in a single, continuous section of the file. Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c450
1 files changed, 258 insertions, 192 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index bf60c07b1ccd..f6178a1684d1 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -1307,93 +1307,6 @@ int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos)
1307} 1307}
1308 1308
1309/******************************************************************/ 1309/******************************************************************/
1310/* EEE section */
1311/******************************************************************/
1312static u8 bnx2x_eee_has_cap(struct link_params *params)
1313{
1314 struct bnx2x *bp = params->bp;
1315
1316 if (REG_RD(bp, params->shmem2_base) <=
1317 offsetof(struct shmem2_region, eee_status[params->port]))
1318 return 0;
1319
1320 return 1;
1321}
1322
1323static int bnx2x_eee_nvram_to_time(u32 nvram_mode, u32 *idle_timer)
1324{
1325 switch (nvram_mode) {
1326 case PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED:
1327 *idle_timer = EEE_MODE_NVRAM_BALANCED_TIME;
1328 break;
1329 case PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE:
1330 *idle_timer = EEE_MODE_NVRAM_AGGRESSIVE_TIME;
1331 break;
1332 case PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY:
1333 *idle_timer = EEE_MODE_NVRAM_LATENCY_TIME;
1334 break;
1335 default:
1336 *idle_timer = 0;
1337 break;
1338 }
1339
1340 return 0;
1341}
1342
1343static int bnx2x_eee_time_to_nvram(u32 idle_timer, u32 *nvram_mode)
1344{
1345 switch (idle_timer) {
1346 case EEE_MODE_NVRAM_BALANCED_TIME:
1347 *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED;
1348 break;
1349 case EEE_MODE_NVRAM_AGGRESSIVE_TIME:
1350 *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE;
1351 break;
1352 case EEE_MODE_NVRAM_LATENCY_TIME:
1353 *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY;
1354 break;
1355 default:
1356 *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_DISABLED;
1357 break;
1358 }
1359
1360 return 0;
1361}
1362
1363static u32 bnx2x_eee_calc_timer(struct link_params *params)
1364{
1365 u32 eee_mode, eee_idle;
1366 struct bnx2x *bp = params->bp;
1367
1368 if (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) {
1369 if (params->eee_mode & EEE_MODE_OUTPUT_TIME) {
1370 /* time value in eee_mode --> used directly*/
1371 eee_idle = params->eee_mode & EEE_MODE_TIMER_MASK;
1372 } else {
1373 /* hsi value in eee_mode --> time */
1374 if (bnx2x_eee_nvram_to_time(params->eee_mode &
1375 EEE_MODE_NVRAM_MASK,
1376 &eee_idle))
1377 return 0;
1378 }
1379 } else {
1380 /* hsi values in nvram --> time*/
1381 eee_mode = ((REG_RD(bp, params->shmem_base +
1382 offsetof(struct shmem_region, dev_info.
1383 port_feature_config[params->port].
1384 eee_power_mode)) &
1385 PORT_FEAT_CFG_EEE_POWER_MODE_MASK) >>
1386 PORT_FEAT_CFG_EEE_POWER_MODE_SHIFT);
1387
1388 if (bnx2x_eee_nvram_to_time(eee_mode, &eee_idle))
1389 return 0;
1390 }
1391
1392 return eee_idle;
1393}
1394
1395
1396/******************************************************************/
1397/* PFC section */ 1310/* PFC section */
1398/******************************************************************/ 1311/******************************************************************/
1399static void bnx2x_update_pfc_xmac(struct link_params *params, 1312static void bnx2x_update_pfc_xmac(struct link_params *params,
@@ -2529,16 +2442,6 @@ static void bnx2x_update_mng(struct link_params *params, u32 link_status)
2529 port_mb[params->port].link_status), link_status); 2442 port_mb[params->port].link_status), link_status);
2530} 2443}
2531 2444
2532static void bnx2x_update_mng_eee(struct link_params *params, u32 eee_status)
2533{
2534 struct bnx2x *bp = params->bp;
2535
2536 if (bnx2x_eee_has_cap(params))
2537 REG_WR(bp, params->shmem2_base +
2538 offsetof(struct shmem2_region,
2539 eee_status[params->port]), eee_status);
2540}
2541
2542static void bnx2x_update_pfc_nig(struct link_params *params, 2445static void bnx2x_update_pfc_nig(struct link_params *params,
2543 struct link_vars *vars, 2446 struct link_vars *vars,
2544 struct bnx2x_nig_brb_pfc_port_params *nig_params) 2447 struct bnx2x_nig_brb_pfc_port_params *nig_params)
@@ -3231,6 +3134,245 @@ static int bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy,
3231 EMAC_MDIO_STATUS_10MB); 3134 EMAC_MDIO_STATUS_10MB);
3232 return rc; 3135 return rc;
3233} 3136}
3137
3138/******************************************************************/
3139/* EEE section */
3140/******************************************************************/
3141static u8 bnx2x_eee_has_cap(struct link_params *params)
3142{
3143 struct bnx2x *bp = params->bp;
3144
3145 if (REG_RD(bp, params->shmem2_base) <=
3146 offsetof(struct shmem2_region, eee_status[params->port]))
3147 return 0;
3148
3149 return 1;
3150}
3151
3152static int bnx2x_eee_nvram_to_time(u32 nvram_mode, u32 *idle_timer)
3153{
3154 switch (nvram_mode) {
3155 case PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED:
3156 *idle_timer = EEE_MODE_NVRAM_BALANCED_TIME;
3157 break;
3158 case PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE:
3159 *idle_timer = EEE_MODE_NVRAM_AGGRESSIVE_TIME;
3160 break;
3161 case PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY:
3162 *idle_timer = EEE_MODE_NVRAM_LATENCY_TIME;
3163 break;
3164 default:
3165 *idle_timer = 0;
3166 break;
3167 }
3168
3169 return 0;
3170}
3171
3172static int bnx2x_eee_time_to_nvram(u32 idle_timer, u32 *nvram_mode)
3173{
3174 switch (idle_timer) {
3175 case EEE_MODE_NVRAM_BALANCED_TIME:
3176 *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED;
3177 break;
3178 case EEE_MODE_NVRAM_AGGRESSIVE_TIME:
3179 *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE;
3180 break;
3181 case EEE_MODE_NVRAM_LATENCY_TIME:
3182 *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY;
3183 break;
3184 default:
3185 *nvram_mode = PORT_FEAT_CFG_EEE_POWER_MODE_DISABLED;
3186 break;
3187 }
3188
3189 return 0;
3190}
3191
3192static u32 bnx2x_eee_calc_timer(struct link_params *params)
3193{
3194 u32 eee_mode, eee_idle;
3195 struct bnx2x *bp = params->bp;
3196
3197 if (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) {
3198 if (params->eee_mode & EEE_MODE_OUTPUT_TIME) {
3199 /* time value in eee_mode --> used directly*/
3200 eee_idle = params->eee_mode & EEE_MODE_TIMER_MASK;
3201 } else {
3202 /* hsi value in eee_mode --> time */
3203 if (bnx2x_eee_nvram_to_time(params->eee_mode &
3204 EEE_MODE_NVRAM_MASK,
3205 &eee_idle))
3206 return 0;
3207 }
3208 } else {
3209 /* hsi values in nvram --> time*/
3210 eee_mode = ((REG_RD(bp, params->shmem_base +
3211 offsetof(struct shmem_region, dev_info.
3212 port_feature_config[params->port].
3213 eee_power_mode)) &
3214 PORT_FEAT_CFG_EEE_POWER_MODE_MASK) >>
3215 PORT_FEAT_CFG_EEE_POWER_MODE_SHIFT);
3216
3217 if (bnx2x_eee_nvram_to_time(eee_mode, &eee_idle))
3218 return 0;
3219 }
3220
3221 return eee_idle;
3222}
3223
3224static int bnx2x_eee_set_timers(struct link_params *params,
3225 struct link_vars *vars)
3226{
3227 u32 eee_idle = 0, eee_mode;
3228 struct bnx2x *bp = params->bp;
3229
3230 eee_idle = bnx2x_eee_calc_timer(params);
3231
3232 if (eee_idle) {
3233 REG_WR(bp, MISC_REG_CPMU_LP_IDLE_THR_P0 + (params->port << 2),
3234 eee_idle);
3235 } else if ((params->eee_mode & EEE_MODE_ENABLE_LPI) &&
3236 (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) &&
3237 (params->eee_mode & EEE_MODE_OUTPUT_TIME)) {
3238 DP(NETIF_MSG_LINK, "Error: Tx LPI is enabled with timer 0\n");
3239 return -EINVAL;
3240 }
3241
3242 vars->eee_status &= ~(SHMEM_EEE_TIMER_MASK | SHMEM_EEE_TIME_OUTPUT_BIT);
3243 if (params->eee_mode & EEE_MODE_OUTPUT_TIME) {
3244 /* eee_idle in 1u --> eee_status in 16u */
3245 eee_idle >>= 4;
3246 vars->eee_status |= (eee_idle & SHMEM_EEE_TIMER_MASK) |
3247 SHMEM_EEE_TIME_OUTPUT_BIT;
3248 } else {
3249 if (bnx2x_eee_time_to_nvram(eee_idle, &eee_mode))
3250 return -EINVAL;
3251 vars->eee_status |= eee_mode;
3252 }
3253
3254 return 0;
3255}
3256
3257static int bnx2x_eee_initial_config(struct link_params *params,
3258 struct link_vars *vars, u8 mode)
3259{
3260 vars->eee_status |= ((u32) mode) << SHMEM_EEE_SUPPORTED_SHIFT;
3261
3262 /* Propogate params' bits --> vars (for migration exposure) */
3263 if (params->eee_mode & EEE_MODE_ENABLE_LPI)
3264 vars->eee_status |= SHMEM_EEE_LPI_REQUESTED_BIT;
3265 else
3266 vars->eee_status &= ~SHMEM_EEE_LPI_REQUESTED_BIT;
3267
3268 if (params->eee_mode & EEE_MODE_ADV_LPI)
3269 vars->eee_status |= SHMEM_EEE_REQUESTED_BIT;
3270 else
3271 vars->eee_status &= ~SHMEM_EEE_REQUESTED_BIT;
3272
3273 return bnx2x_eee_set_timers(params, vars);
3274}
3275
3276static int bnx2x_eee_disable(struct bnx2x_phy *phy,
3277 struct link_params *params,
3278 struct link_vars *vars)
3279{
3280 struct bnx2x *bp = params->bp;
3281
3282 /* Make Certain LPI is disabled */
3283 REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2), 0);
3284
3285 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0x0);
3286
3287 vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
3288
3289 return 0;
3290}
3291
3292static int bnx2x_eee_advertise(struct bnx2x_phy *phy,
3293 struct link_params *params,
3294 struct link_vars *vars, u8 modes)
3295{
3296 struct bnx2x *bp = params->bp;
3297 u16 val = 0;
3298
3299 /* Mask events preventing LPI generation */
3300 REG_WR(bp, MISC_REG_CPMU_LP_MASK_EXT_P0 + (params->port << 2), 0xfc20);
3301
3302 if (modes & SHMEM_EEE_10G_ADV) {
3303 DP(NETIF_MSG_LINK, "Advertise 10GBase-T EEE\n");
3304 val |= 0x8;
3305 }
3306 if (modes & SHMEM_EEE_1G_ADV) {
3307 DP(NETIF_MSG_LINK, "Advertise 1GBase-T EEE\n");
3308 val |= 0x4;
3309 }
3310
3311 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, val);
3312
3313 vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
3314 vars->eee_status |= (modes << SHMEM_EEE_ADV_STATUS_SHIFT);
3315
3316 return 0;
3317}
3318
3319static void bnx2x_update_mng_eee(struct link_params *params, u32 eee_status)
3320{
3321 struct bnx2x *bp = params->bp;
3322
3323 if (bnx2x_eee_has_cap(params))
3324 REG_WR(bp, params->shmem2_base +
3325 offsetof(struct shmem2_region,
3326 eee_status[params->port]), eee_status);
3327}
3328
3329static void bnx2x_eee_an_resolve(struct bnx2x_phy *phy,
3330 struct link_params *params,
3331 struct link_vars *vars)
3332{
3333 struct bnx2x *bp = params->bp;
3334 u16 adv = 0, lp = 0;
3335 u32 lp_adv = 0;
3336 u8 neg = 0;
3337
3338 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, &adv);
3339 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_LP_EEE_ADV, &lp);
3340
3341 if (lp & 0x2) {
3342 lp_adv |= SHMEM_EEE_100M_ADV;
3343 if (adv & 0x2) {
3344 if (vars->line_speed == SPEED_100)
3345 neg = 1;
3346 DP(NETIF_MSG_LINK, "EEE negotiated - 100M\n");
3347 }
3348 }
3349 if (lp & 0x14) {
3350 lp_adv |= SHMEM_EEE_1G_ADV;
3351 if (adv & 0x14) {
3352 if (vars->line_speed == SPEED_1000)
3353 neg = 1;
3354 DP(NETIF_MSG_LINK, "EEE negotiated - 1G\n");
3355 }
3356 }
3357 if (lp & 0x68) {
3358 lp_adv |= SHMEM_EEE_10G_ADV;
3359 if (adv & 0x68) {
3360 if (vars->line_speed == SPEED_10000)
3361 neg = 1;
3362 DP(NETIF_MSG_LINK, "EEE negotiated - 10G\n");
3363 }
3364 }
3365
3366 vars->eee_status &= ~SHMEM_EEE_LP_ADV_STATUS_MASK;
3367 vars->eee_status |= (lp_adv << SHMEM_EEE_LP_ADV_STATUS_SHIFT);
3368
3369 if (neg) {
3370 DP(NETIF_MSG_LINK, "EEE is active\n");
3371 vars->eee_status |= SHMEM_EEE_ACTIVE_BIT;
3372 }
3373
3374}
3375
3234/******************************************************************/ 3376/******************************************************************/
3235/* BSC access functions from E3 */ 3377/* BSC access functions from E3 */
3236/******************************************************************/ 3378/******************************************************************/
@@ -3752,6 +3894,19 @@ static u8 bnx2x_ext_phy_resolve_fc(struct bnx2x_phy *phy,
3752 * init configuration, and set/clear SGMII flag. Internal 3894 * init configuration, and set/clear SGMII flag. Internal
3753 * phy init is done purely in phy_init stage. 3895 * phy init is done purely in phy_init stage.
3754 */ 3896 */
3897
3898static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy,
3899 struct link_params *params)
3900{
3901 struct bnx2x *bp = params->bp;
3902
3903 DP(NETIF_MSG_LINK, "Configure WC for LPI pass through\n");
3904 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3905 MDIO_WC_REG_EEE_COMBO_CONTROL0, 0x7c);
3906 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
3907 MDIO_WC_REG_DIGITAL4_MISC5, 0xc000);
3908}
3909
3755static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, 3910static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
3756 struct link_params *params, 3911 struct link_params *params,
3757 struct link_vars *vars) { 3912 struct link_vars *vars) {
@@ -4011,13 +4166,7 @@ static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy,
4011 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, 4166 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
4012 MDIO_WC_REG_DIGITAL4_MISC3, 0x8080); 4167 MDIO_WC_REG_DIGITAL4_MISC3, 0x8080);
4013 4168
4014 /* Enable LPI pass through */ 4169 bnx2x_warpcore_set_lpi_passthrough(phy, params);
4015 DP(NETIF_MSG_LINK, "Configure WC for LPI pass through\n");
4016 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
4017 MDIO_WC_REG_EEE_COMBO_CONTROL0,
4018 0x7c);
4019 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
4020 MDIO_WC_REG_DIGITAL4_MISC5, 0xc000);
4021 4170
4022 /* 10G XFI Full Duplex */ 4171 /* 10G XFI Full Duplex */
4023 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, 4172 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
@@ -9886,39 +10035,6 @@ static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy,
9886 return 0; 10035 return 0;
9887} 10036}
9888 10037
9889static int bnx2x_8483x_eee_timers(struct link_params *params,
9890 struct link_vars *vars)
9891{
9892 u32 eee_idle = 0, eee_mode;
9893 struct bnx2x *bp = params->bp;
9894
9895 eee_idle = bnx2x_eee_calc_timer(params);
9896
9897 if (eee_idle) {
9898 REG_WR(bp, MISC_REG_CPMU_LP_IDLE_THR_P0 + (params->port << 2),
9899 eee_idle);
9900 } else if ((params->eee_mode & EEE_MODE_ENABLE_LPI) &&
9901 (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) &&
9902 (params->eee_mode & EEE_MODE_OUTPUT_TIME)) {
9903 DP(NETIF_MSG_LINK, "Error: Tx LPI is enabled with timer 0\n");
9904 return -EINVAL;
9905 }
9906
9907 vars->eee_status &= ~(SHMEM_EEE_TIMER_MASK | SHMEM_EEE_TIME_OUTPUT_BIT);
9908 if (params->eee_mode & EEE_MODE_OUTPUT_TIME) {
9909 /* eee_idle in 1u --> eee_status in 16u */
9910 eee_idle >>= 4;
9911 vars->eee_status |= (eee_idle & SHMEM_EEE_TIMER_MASK) |
9912 SHMEM_EEE_TIME_OUTPUT_BIT;
9913 } else {
9914 if (bnx2x_eee_time_to_nvram(eee_idle, &eee_mode))
9915 return -EINVAL;
9916 vars->eee_status |= eee_mode;
9917 }
9918
9919 return 0;
9920}
9921
9922static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy, 10038static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy,
9923 struct link_params *params, 10039 struct link_params *params,
9924 struct link_vars *vars) 10040 struct link_vars *vars)
@@ -9929,9 +10045,6 @@ static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy,
9929 10045
9930 DP(NETIF_MSG_LINK, "Don't Advertise 10GBase-T EEE\n"); 10046 DP(NETIF_MSG_LINK, "Don't Advertise 10GBase-T EEE\n");
9931 10047
9932 /* Make Certain LPI is disabled */
9933 REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2), 0);
9934
9935 /* Prevent Phy from working in EEE and advertising it */ 10048 /* Prevent Phy from working in EEE and advertising it */
9936 rc = bnx2x_84833_cmd_hdlr(phy, params, 10049 rc = bnx2x_84833_cmd_hdlr(phy, params,
9937 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1); 10050 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1);
@@ -9940,10 +10053,7 @@ static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy,
9940 return rc; 10053 return rc;
9941 } 10054 }
9942 10055
9943 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0); 10056 return bnx2x_eee_disable(phy, params, vars);
9944 vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
9945
9946 return 0;
9947} 10057}
9948 10058
9949static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy, 10059static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy,
@@ -9954,8 +10064,6 @@ static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy,
9954 struct bnx2x *bp = params->bp; 10064 struct bnx2x *bp = params->bp;
9955 u16 cmd_args = 1; 10065 u16 cmd_args = 1;
9956 10066
9957 DP(NETIF_MSG_LINK, "Advertise 10GBase-T EEE\n");
9958
9959 rc = bnx2x_84833_cmd_hdlr(phy, params, 10067 rc = bnx2x_84833_cmd_hdlr(phy, params,
9960 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1); 10068 PHY84833_CMD_SET_EEE_MODE, &cmd_args, 1);
9961 if (rc) { 10069 if (rc) {
@@ -9963,15 +10071,7 @@ static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy,
9963 return rc; 10071 return rc;
9964 } 10072 }
9965 10073
9966 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0x8); 10074 return bnx2x_eee_advertise(phy, params, vars, SHMEM_EEE_10G_ADV);
9967
9968 /* Mask events preventing LPI generation */
9969 REG_WR(bp, MISC_REG_CPMU_LP_MASK_EXT_P0 + (params->port << 2), 0xfc20);
9970
9971 vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK;
9972 vars->eee_status |= (SHMEM_EEE_10G_ADV << SHMEM_EEE_ADV_STATUS_SHIFT);
9973
9974 return 0;
9975} 10075}
9976 10076
9977#define PHY84833_CONSTANT_LATENCY 1193 10077#define PHY84833_CONSTANT_LATENCY 1193
@@ -10105,20 +10205,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy,
10105 /* Configure EEE support */ 10205 /* Configure EEE support */
10106 if ((val >= MDIO_84833_TOP_CFG_FW_EEE) && bnx2x_eee_has_cap(params)) { 10206 if ((val >= MDIO_84833_TOP_CFG_FW_EEE) && bnx2x_eee_has_cap(params)) {
10107 phy->flags |= FLAGS_EEE_10GBT; 10207 phy->flags |= FLAGS_EEE_10GBT;
10108 vars->eee_status |= SHMEM_EEE_10G_ADV << 10208 rc = bnx2x_eee_initial_config(params, vars, SHMEM_EEE_10G_ADV);
10109 SHMEM_EEE_SUPPORTED_SHIFT;
10110 /* Propogate params' bits --> vars (for migration exposure) */
10111 if (params->eee_mode & EEE_MODE_ENABLE_LPI)
10112 vars->eee_status |= SHMEM_EEE_LPI_REQUESTED_BIT;
10113 else
10114 vars->eee_status &= ~SHMEM_EEE_LPI_REQUESTED_BIT;
10115
10116 if (params->eee_mode & EEE_MODE_ADV_LPI)
10117 vars->eee_status |= SHMEM_EEE_REQUESTED_BIT;
10118 else
10119 vars->eee_status &= ~SHMEM_EEE_REQUESTED_BIT;
10120
10121 rc = bnx2x_8483x_eee_timers(params, vars);
10122 if (rc) { 10209 if (rc) {
10123 DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n"); 10210 DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n");
10124 bnx2x_8483x_disable_eee(phy, params, vars); 10211 bnx2x_8483x_disable_eee(phy, params, vars);
@@ -10276,29 +10363,8 @@ static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy,
10276 LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE; 10363 LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE;
10277 10364
10278 /* Determine if EEE was negotiated */ 10365 /* Determine if EEE was negotiated */
10279 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { 10366 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833)
10280 u32 eee_shmem = 0; 10367 bnx2x_eee_an_resolve(phy, params, vars);
10281
10282 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD,
10283 MDIO_AN_REG_EEE_ADV, &val1);
10284 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD,
10285 MDIO_AN_REG_LP_EEE_ADV, &val2);
10286 if ((val1 & val2) & 0x8) {
10287 DP(NETIF_MSG_LINK, "EEE negotiated\n");
10288 vars->eee_status |= SHMEM_EEE_ACTIVE_BIT;
10289 }
10290
10291 if (val2 & 0x12)
10292 eee_shmem |= SHMEM_EEE_100M_ADV;
10293 if (val2 & 0x4)
10294 eee_shmem |= SHMEM_EEE_1G_ADV;
10295 if (val2 & 0x68)
10296 eee_shmem |= SHMEM_EEE_10G_ADV;
10297
10298 vars->eee_status &= ~SHMEM_EEE_LP_ADV_STATUS_MASK;
10299 vars->eee_status |= (eee_shmem <<
10300 SHMEM_EEE_LP_ADV_STATUS_SHIFT);
10301 }
10302 } 10368 }
10303 10369
10304 return link_up; 10370 return link_up;