Lines Matching +full:dp +full:- +full:phy
1 /* Copyright 2008-2013 Broadcom Corporation
8 * at http://www.gnu.org/licenses/gpl-2.0.html (the "GPL").
32 typedef int (*read_sfp_module_eeprom_func_p)(struct bnx2x_phy *phy,
43 #define I2C_WA_PWR_ITER (I2C_WA_RETRY_CNT - 1)
205 (_phy)->def_md_devad, \
211 (_phy)->def_md_devad, \
217 static int bnx2x_sfp_module_detection(struct bnx2x_phy *phy,
239 * bnx2x_check_lfa - This function checks if link reinitialization is required,
251 struct bnx2x *bp = params->bp; in bnx2x_check_lfa()
254 REG_RD(bp, params->lfa_base + in bnx2x_check_lfa()
257 /* NOTE: must be first condition checked - in bnx2x_check_lfa()
261 DP(NETIF_MSG_LINK, "No LFA due to DCC flap after clp exit\n"); in bnx2x_check_lfa()
262 REG_WR(bp, params->lfa_base + in bnx2x_check_lfa()
269 link_status = REG_RD(bp, params->shmem_base + in bnx2x_check_lfa()
271 port_mb[params->port].link_status)); in bnx2x_check_lfa()
278 if (params->feature_config_flags & FEATURE_CONFIG_BOOT_FROM_SAN) in bnx2x_check_lfa()
282 if (params->loopback_mode) in bnx2x_check_lfa()
286 if (!params->lfa_base) in bnx2x_check_lfa()
289 if (params->num_phys == 3) { in bnx2x_check_lfa()
298 saved_val = REG_RD(bp, params->lfa_base + in bnx2x_check_lfa()
300 req_val = params->req_duplex[0] | (params->req_duplex[1] << 16); in bnx2x_check_lfa()
302 DP(NETIF_MSG_LINK, "Duplex mismatch %x vs. %x\n", in bnx2x_check_lfa()
307 saved_val = REG_RD(bp, params->lfa_base + in bnx2x_check_lfa()
309 req_val = params->req_flow_ctrl[0] | (params->req_flow_ctrl[1] << 16); in bnx2x_check_lfa()
311 DP(NETIF_MSG_LINK, "Flow control mismatch %x vs. %x\n", in bnx2x_check_lfa()
316 saved_val = REG_RD(bp, params->lfa_base + in bnx2x_check_lfa()
318 req_val = params->req_line_speed[0] | (params->req_line_speed[1] << 16); in bnx2x_check_lfa()
320 DP(NETIF_MSG_LINK, "Link speed mismatch %x vs. %x\n", in bnx2x_check_lfa()
326 cur_speed_cap_mask = REG_RD(bp, params->lfa_base + in bnx2x_check_lfa()
330 if (cur_speed_cap_mask != params->speed_cap_mask[cfg_idx]) { in bnx2x_check_lfa()
331 DP(NETIF_MSG_LINK, "Speed Cap mismatch %x vs. %x\n", in bnx2x_check_lfa()
333 params->speed_cap_mask[cfg_idx]); in bnx2x_check_lfa()
339 REG_RD(bp, params->lfa_base + in bnx2x_check_lfa()
343 if ((u16)cur_req_fc_auto_adv != params->req_fc_auto_adv) { in bnx2x_check_lfa()
344 DP(NETIF_MSG_LINK, "Flow Ctrl AN mismatch %x vs. %x\n", in bnx2x_check_lfa()
345 cur_req_fc_auto_adv, params->req_fc_auto_adv); in bnx2x_check_lfa()
349 eee_status = REG_RD(bp, params->shmem2_base + in bnx2x_check_lfa()
351 eee_status[params->port])); in bnx2x_check_lfa()
354 (params->eee_mode & EEE_MODE_ENABLE_LPI)) || in bnx2x_check_lfa()
356 (params->eee_mode & EEE_MODE_ADV_LPI))) { in bnx2x_check_lfa()
357 DP(NETIF_MSG_LINK, "EEE mismatch %x vs. %x\n", params->eee_mode, in bnx2x_check_lfa()
374 DP(NETIF_MSG_LINK, "Invalid EPIO pin %d to get\n", epio_pin); in bnx2x_get_epio()
391 DP(NETIF_MSG_LINK, "Invalid EPIO pin %d to set\n", epio_pin); in bnx2x_set_epio()
394 DP(NETIF_MSG_LINK, "Setting EPIO pin %d to %d\n", epio_pin, en); in bnx2x_set_epio()
415 bnx2x_set_epio(bp, pin_cfg - PIN_CFG_EPIO0, val); in bnx2x_set_cfg_pin()
417 u8 gpio_num = (pin_cfg - PIN_CFG_GPIO0_P0) & 0x3; in bnx2x_set_cfg_pin()
418 u8 gpio_port = (pin_cfg - PIN_CFG_GPIO0_P0) >> 2; in bnx2x_set_cfg_pin()
426 return -EINVAL; in bnx2x_get_cfg_pin()
428 bnx2x_get_epio(bp, pin_cfg - PIN_CFG_EPIO0, val); in bnx2x_get_cfg_pin()
430 u8 gpio_num = (pin_cfg - PIN_CFG_GPIO0_P0) & 0x3; in bnx2x_get_cfg_pin()
431 u8 gpio_port = (pin_cfg - PIN_CFG_GPIO0_P0) >> 2; in bnx2x_get_cfg_pin()
443 struct bnx2x *bp = params->bp; in bnx2x_ets_e2e3a0_disabled()
445 DP(NETIF_MSG_LINK, "ETS E2E3 disabled configuration\n"); in bnx2x_ets_e2e3a0_disabled()
447 /* mapping between entry priority to client number (0,1,2 -debug and in bnx2x_ets_e2e3a0_disabled()
448 * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) in bnx2x_ets_e2e3a0_disabled()
451 * cos1-100 cos0-011 dbg1-010 dbg0-001 MCP-000 in bnx2x_ets_e2e3a0_disabled()
456 * as strict. Bits 0,1,2 - debug and management entries, 3 - in bnx2x_ets_e2e3a0_disabled()
457 * COS0 entry, 4 - COS1 entry. in bnx2x_ets_e2e3a0_disabled()
502 if (vars->link_up) { in bnx2x_ets_get_min_w_val_nig()
503 if (vars->line_speed == SPEED_20000) in bnx2x_ets_get_min_w_val_nig()
534 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_set_credit_upper_bound_nig()
535 const u8 port = params->port; in bnx2x_ets_e3b0_set_credit_upper_bound_nig()
572 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_nig_disabled()
573 const u8 port = params->port; in bnx2x_ets_e3b0_nig_disabled()
575 /* Mapping between entry priority to client number (0,1,2 -debug and in bnx2x_ets_e3b0_nig_disabled()
576 * management clients, 3 - COS0 client, 4 - COS1, ... 8 - in bnx2x_ets_e3b0_nig_disabled()
577 * COS5)(HIGHEST) 4bits client num.TODO_ETS - Should be done by in bnx2x_ets_e3b0_nig_disabled()
607 * as strict. Bits 0,1,2 - debug and management entries, 3 - in bnx2x_ets_e3b0_nig_disabled()
608 * COS0 entry, 4 - COS1 entry. in bnx2x_ets_e3b0_nig_disabled()
622 * for here is note appropriate.In 2 port mode port0 only COS0-5 in bnx2x_ets_e3b0_nig_disabled()
624 * port mode port1 only COS0-2 can be used. DEBUG1,DEBUG1,MGMT in bnx2x_ets_e3b0_nig_disabled()
656 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_set_credit_upper_bound_pbf()
659 const u8 port = params->port; in bnx2x_ets_e3b0_set_credit_upper_bound_pbf()
663 /* In 2 port mode port0 has COS0-5 that can be used for WFQ.In 4 in bnx2x_ets_e3b0_set_credit_upper_bound_pbf()
664 * port mode port1 has COS0-2 that can be used for WFQ. in bnx2x_ets_e3b0_set_credit_upper_bound_pbf()
688 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_pbf_disabled()
689 const u8 port = params->port; in bnx2x_ets_e3b0_pbf_disabled()
695 /* Mapping between entry priority to client number 0 - COS0 in bnx2x_ets_e3b0_pbf_disabled()
696 * client, 2 - COS1, ... 5 - COS5)(HIGHEST) 4bits client num. in bnx2x_ets_e3b0_pbf_disabled()
697 * TODO_ETS - Should be done by reset value or init tool in bnx2x_ets_e3b0_pbf_disabled()
706 /* TODO_ETS - Should be done by reset value or init tool */ in bnx2x_ets_e3b0_pbf_disabled()
723 /* In 2 port mode port0 has COS0-5 that can be used for WFQ. in bnx2x_ets_e3b0_pbf_disabled()
724 * In 4 port mode port1 has COS0-2 that can be used for WFQ. in bnx2x_ets_e3b0_pbf_disabled()
747 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_disabled()
750 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_disabled()
752 return -EINVAL; in bnx2x_ets_e3b0_disabled()
770 struct bnx2x *bp = params->bp; in bnx2x_ets_disabled()
778 DP(NETIF_MSG_LINK, "bnx2x_ets_disabled - chip not supported\n"); in bnx2x_ets_disabled()
779 return -EINVAL; in bnx2x_ets_disabled()
795 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_cli_map()
796 const u8 port = params->port; in bnx2x_ets_e3b0_cli_map()
834 /* Calculate and set BW for this COS - use 1 instead of 0 for BW */ in bnx2x_ets_e3b0_set_cos_bw()
863 return -EINVAL; in bnx2x_ets_e3b0_set_cos_bw()
869 return -EINVAL; in bnx2x_ets_e3b0_set_cos_bw()
875 return -EINVAL; in bnx2x_ets_e3b0_set_cos_bw()
897 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_get_total_bw()
903 for (cos_idx = 0; cos_idx < ets_params->num_of_cos; cos_idx++) { in bnx2x_ets_e3b0_get_total_bw()
904 if (ets_params->cos[cos_idx].state == bnx2x_cos_state_bw) { in bnx2x_ets_e3b0_get_total_bw()
906 if (!ets_params->cos[cos_idx].params.bw_params.bw) { in bnx2x_ets_e3b0_get_total_bw()
907 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config BW" in bnx2x_ets_e3b0_get_total_bw()
912 ets_params->cos[cos_idx].params.bw_params.bw in bnx2x_ets_e3b0_get_total_bw()
916 ets_params->cos[cos_idx].params.bw_params.bw; in bnx2x_ets_e3b0_get_total_bw()
923 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_get_total_bw()
925 return -EINVAL; in bnx2x_ets_e3b0_get_total_bw()
927 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_get_total_bw()
957 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_sp_pri_to_cos_set()
958 const u8 port = params->port; in bnx2x_ets_e3b0_sp_pri_to_cos_set()
963 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " in bnx2x_ets_e3b0_sp_pri_to_cos_set()
965 return -EINVAL; in bnx2x_ets_e3b0_sp_pri_to_cos_set()
969 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " in bnx2x_ets_e3b0_sp_pri_to_cos_set()
972 return -EINVAL; in bnx2x_ets_e3b0_sp_pri_to_cos_set()
1038 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1040 const u8 port = params->port; in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1049 u8 cos_bit_to_set = (1 << max_num_of_cos) - 1; in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1055 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1058 return -EINVAL; in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1069 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1073 return -EINVAL; in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1098 DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_set_pri_cli_reg not all " in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1100 return -EINVAL; in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1132 struct bnx2x *bp = params->bp; in bnx2x_ets_e3b0_config()
1134 const u8 port = params->port; in bnx2x_ets_e3b0_config()
1146 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_config()
1148 return -EINVAL; in bnx2x_ets_e3b0_config()
1151 if ((ets_params->num_of_cos > max_num_of_cos)) { in bnx2x_ets_e3b0_config()
1152 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config the number of COS " in bnx2x_ets_e3b0_config()
1154 return -EINVAL; in bnx2x_ets_e3b0_config()
1164 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_config()
1166 return -EINVAL; in bnx2x_ets_e3b0_config()
1176 for (cos_entry = 0; cos_entry < ets_params->num_of_cos; cos_entry++) { in bnx2x_ets_e3b0_config()
1177 if (bnx2x_cos_state_bw == ets_params->cos[cos_entry].state) { in bnx2x_ets_e3b0_config()
1185 ets_params->cos[cos_entry].params.bw_params.bw, in bnx2x_ets_e3b0_config()
1188 ets_params->cos[cos_entry].state){ in bnx2x_ets_e3b0_config()
1194 ets_params->cos[cos_entry].params.sp_params.pri, in bnx2x_ets_e3b0_config()
1198 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_config()
1200 return -EINVAL; in bnx2x_ets_e3b0_config()
1203 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_config()
1214 DP(NETIF_MSG_LINK, in bnx2x_ets_e3b0_config()
1225 DP(NETIF_MSG_LINK, "bnx2x_ets_E3B0_config SP failed\n"); in bnx2x_ets_e3b0_config()
1233 struct bnx2x *bp = params->bp; in bnx2x_ets_bw_limit_common()
1234 DP(NETIF_MSG_LINK, "ETS enabled BW limit configuration\n"); in bnx2x_ets_bw_limit_common()
1244 * cos1-001 cos0-000 dbg1-100 dbg0-011 MCP-010 in bnx2x_ets_bw_limit_common()
1259 * as strict. Bits 0,1,2 - debug and management entries, 3 - COS0 in bnx2x_ets_bw_limit_common()
1260 * entry, 4 - COS1 entry. in bnx2x_ets_bw_limit_common()
1278 struct bnx2x *bp = params->bp; in bnx2x_ets_bw_limit()
1283 DP(NETIF_MSG_LINK, "ETS enabled BW limit configuration\n"); in bnx2x_ets_bw_limit()
1288 DP(NETIF_MSG_LINK, "Total BW can't be zero\n"); in bnx2x_ets_bw_limit()
1309 struct bnx2x *bp = params->bp; in bnx2x_ets_strict()
1312 DP(NETIF_MSG_LINK, "ETS enabled strict configuration\n"); in bnx2x_ets_strict()
1314 * as strict. Bits 0,1,2 - debug and management entries, in bnx2x_ets_strict()
1315 * 3 - COS0 entry, 4 - COS1 entry. in bnx2x_ets_strict()
1333 /* Mapping between entry priority to client number (0,1,2 -debug and in bnx2x_ets_strict()
1334 * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) in bnx2x_ets_strict()
1337 * dbg0-010 dbg1-001 cos1-100 cos0-011 MCP-000 in bnx2x_ets_strict()
1338 * dbg0-010 dbg1-001 cos0-011 cos1-100 MCP-000 in bnx2x_ets_strict()
1353 struct bnx2x *bp = params->bp; in bnx2x_update_pfc_xmac()
1358 xmac_base = (params->port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0; in bnx2x_update_pfc_xmac()
1366 if (!(params->feature_config_flags & in bnx2x_update_pfc_xmac()
1369 /* RX flow control - Process pause frame in receive direction in bnx2x_update_pfc_xmac()
1371 if (vars->flow_ctrl & BNX2X_FLOW_CTRL_RX) in bnx2x_update_pfc_xmac()
1374 /* TX flow control - Send pause packet when buffer is full */ in bnx2x_update_pfc_xmac()
1375 if (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) in bnx2x_update_pfc_xmac()
1399 ((params->mac_addr[2] << 24) | in bnx2x_update_pfc_xmac()
1400 (params->mac_addr[3] << 16) | in bnx2x_update_pfc_xmac()
1401 (params->mac_addr[4] << 8) | in bnx2x_update_pfc_xmac()
1402 (params->mac_addr[5]))); in bnx2x_update_pfc_xmac()
1404 ((params->mac_addr[0] << 8) | in bnx2x_update_pfc_xmac()
1405 (params->mac_addr[1]))); in bnx2x_update_pfc_xmac()
1437 DP(NETIF_MSG_LINK, "Changing emac_mode from 0x%x to 0x%x\n", in bnx2x_set_mdio_clk()
1447 /* Set mdio clock per phy */ in bnx2x_set_mdio_emac_per_phy()
1448 for (phy_index = INT_PHY; phy_index < params->num_phys; in bnx2x_set_mdio_emac_per_phy()
1450 bnx2x_set_mdio_clk(bp, params->chip_id, in bnx2x_set_mdio_emac_per_phy()
1451 params->phy[phy_index].mdio_ctrl); in bnx2x_set_mdio_emac_per_phy()
1457 /* Check 4-port override enabled */ in bnx2x_is_4_port_mode()
1460 /* Return 4-port mode override value */ in bnx2x_is_4_port_mode()
1463 /* Return 4-port mode from input pin */ in bnx2x_is_4_port_mode()
1471 struct bnx2x *bp = params->bp; in bnx2x_emac_init()
1472 u8 port = params->port; in bnx2x_emac_init()
1483 /* init emac - use read-modify-write */ in bnx2x_emac_init()
1491 DP(NETIF_MSG_LINK, "EMAC reset reg is %u\n", val); in bnx2x_emac_init()
1493 DP(NETIF_MSG_LINK, "EMAC timeout!\n"); in bnx2x_emac_init()
1496 timeout--; in bnx2x_emac_init()
1501 val = ((params->mac_addr[0] << 8) | in bnx2x_emac_init()
1502 params->mac_addr[1]); in bnx2x_emac_init()
1505 val = ((params->mac_addr[2] << 24) | in bnx2x_emac_init()
1506 (params->mac_addr[3] << 16) | in bnx2x_emac_init()
1507 (params->mac_addr[4] << 8) | in bnx2x_emac_init()
1508 params->mac_addr[5]); in bnx2x_emac_init()
1516 struct bnx2x *bp = params->bp; in bnx2x_set_xumac_nig()
1518 REG_WR(bp, params->port ? NIG_REG_P1_MAC_IN_EN : NIG_REG_P0_MAC_IN_EN, in bnx2x_set_xumac_nig()
1520 REG_WR(bp, params->port ? NIG_REG_P1_MAC_OUT_EN : NIG_REG_P0_MAC_OUT_EN, in bnx2x_set_xumac_nig()
1522 REG_WR(bp, params->port ? NIG_REG_P1_MAC_PAUSE_OUT_EN : in bnx2x_set_xumac_nig()
1528 u32 umac_base = params->port ? GRCBASE_UMAC1 : GRCBASE_UMAC0; in bnx2x_set_umac_rxtx()
1530 struct bnx2x *bp = params->bp; in bnx2x_set_umac_rxtx()
1532 (MISC_REGISTERS_RESET_REG_2_UMAC0 << params->port))) in bnx2x_set_umac_rxtx()
1549 u32 umac_base = params->port ? GRCBASE_UMAC1 : GRCBASE_UMAC0; in bnx2x_umac_enable()
1550 struct bnx2x *bp = params->bp; in bnx2x_umac_enable()
1553 (MISC_REGISTERS_RESET_REG_2_UMAC0 << params->port)); in bnx2x_umac_enable()
1557 (MISC_REGISTERS_RESET_REG_2_UMAC0 << params->port)); in bnx2x_umac_enable()
1559 DP(NETIF_MSG_LINK, "enabling UMAC\n"); in bnx2x_umac_enable()
1562 REG_WR(bp, NIG_REG_EGRESS_EMAC0_PORT + params->port*4, 1); in bnx2x_umac_enable()
1568 switch (vars->line_speed) { in bnx2x_umac_enable()
1582 DP(NETIF_MSG_LINK, "Invalid speed for UMAC %d\n", in bnx2x_umac_enable()
1583 vars->line_speed); in bnx2x_umac_enable()
1586 if (!(vars->flow_ctrl & BNX2X_FLOW_CTRL_TX)) in bnx2x_umac_enable()
1589 if (!(vars->flow_ctrl & BNX2X_FLOW_CTRL_RX)) in bnx2x_umac_enable()
1592 if (vars->duplex == DUPLEX_HALF) in bnx2x_umac_enable()
1599 if (vars->eee_status & SHMEM_EEE_ADV_STATUS_MASK) { in bnx2x_umac_enable()
1600 DP(NETIF_MSG_LINK, "configured UMAC for EEE\n"); in bnx2x_umac_enable()
1610 ((params->mac_addr[2] << 24) | in bnx2x_umac_enable()
1611 (params->mac_addr[3] << 16) | in bnx2x_umac_enable()
1612 (params->mac_addr[4] << 8) | in bnx2x_umac_enable()
1613 (params->mac_addr[5]))); in bnx2x_umac_enable()
1615 ((params->mac_addr[0] << 8) | in bnx2x_umac_enable()
1616 (params->mac_addr[1]))); in bnx2x_umac_enable()
1633 /* Maximum Frame Length (RW). Defines a 14-Bit maximum frame in bnx2x_umac_enable()
1638 ((vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) != 0), 1); in bnx2x_umac_enable()
1639 vars->mac_type = MAC_TYPE_UMAC; in bnx2x_umac_enable()
1646 struct bnx2x *bp = params->bp; in bnx2x_xmac_init()
1649 /* In 4-port mode, need to set the mode only once, so if XMAC is in bnx2x_xmac_init()
1661 DP(NETIF_MSG_LINK, in bnx2x_xmac_init()
1662 "XMAC already out of reset in 4-port mode\n"); in bnx2x_xmac_init()
1674 DP(NETIF_MSG_LINK, "Init XMAC to 2 ports x 10G per path\n"); in bnx2x_xmac_init()
1685 DP(NETIF_MSG_LINK, in bnx2x_xmac_init()
1690 DP(NETIF_MSG_LINK, in bnx2x_xmac_init()
1708 u8 port = params->port; in bnx2x_set_xmac_rxtx()
1709 struct bnx2x *bp = params->bp; in bnx2x_set_xmac_rxtx()
1724 DP(NETIF_MSG_LINK, "Disable XMAC on port %x\n", port); in bnx2x_set_xmac_rxtx()
1738 struct bnx2x *bp = params->bp; in bnx2x_xmac_enable()
1739 DP(NETIF_MSG_LINK, "enabling XMAC\n"); in bnx2x_xmac_enable()
1741 xmac_base = (params->port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0; in bnx2x_xmac_enable()
1743 bnx2x_xmac_init(params, vars->line_speed); in bnx2x_xmac_enable()
1752 REG_WR(bp, NIG_REG_EGRESS_EMAC0_PORT + params->port*4, 0); in bnx2x_xmac_enable()
1757 if (!(params->phy[INT_PHY].flags & FLAGS_TX_ERROR_CHECK)) { in bnx2x_xmac_enable()
1775 if (vars->eee_status & SHMEM_EEE_ADV_STATUS_MASK) { in bnx2x_xmac_enable()
1776 DP(NETIF_MSG_LINK, "Setting XMAC for EEE\n"); in bnx2x_xmac_enable()
1786 /* Set MAC in XLGMII mode for dual-mode */ in bnx2x_xmac_enable()
1787 if ((vars->line_speed == SPEED_20000) && in bnx2x_xmac_enable()
1788 (params->phy[INT_PHY].supported & in bnx2x_xmac_enable()
1797 ((vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) != 0), 1); in bnx2x_xmac_enable()
1799 vars->mac_type = MAC_TYPE_XMAC; in bnx2x_xmac_enable()
1807 struct bnx2x *bp = params->bp; in bnx2x_emac_enable()
1808 u8 port = params->port; in bnx2x_emac_enable()
1812 DP(NETIF_MSG_LINK, "enabling EMAC\n"); in bnx2x_emac_enable()
1822 if (vars->phy_flags & PHY_XGXS_FLAG) { in bnx2x_emac_enable()
1823 u32 ser_lane = ((params->lane_config & in bnx2x_emac_enable()
1827 DP(NETIF_MSG_LINK, "XGXS\n"); in bnx2x_emac_enable()
1828 /* select the master lanes (out of 0-3) */ in bnx2x_emac_enable()
1834 DP(NETIF_MSG_LINK, "SerDes\n"); in bnx2x_emac_enable()
1851 if (!(params->feature_config_flags & in bnx2x_emac_enable()
1853 if (vars->flow_ctrl & BNX2X_FLOW_CTRL_RX) in bnx2x_emac_enable()
1858 if (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) in bnx2x_emac_enable()
1879 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) { in bnx2x_emac_enable()
1880 DP(NETIF_MSG_LINK, "PFC is enabled\n"); in bnx2x_emac_enable()
1923 if ((params->feature_config_flags & in bnx2x_emac_enable()
1925 (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX)) in bnx2x_emac_enable()
1933 vars->mac_type = MAC_TYPE_EMAC; in bnx2x_emac_enable()
1941 struct bnx2x *bp = params->bp; in bnx2x_update_pfc_bmac1()
1942 u32 bmac_addr = params->port ? NIG_REG_INGRESS_BMAC1_MEM : in bnx2x_update_pfc_bmac1()
1946 if ((!(params->feature_config_flags & in bnx2x_update_pfc_bmac1()
1948 (vars->flow_ctrl & BNX2X_FLOW_CTRL_RX)) in bnx2x_update_pfc_bmac1()
1957 if (!(params->feature_config_flags & in bnx2x_update_pfc_bmac1()
1959 (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX)) in bnx2x_update_pfc_bmac1()
1974 struct bnx2x *bp = params->bp; in bnx2x_update_pfc_bmac2()
1975 u32 bmac_addr = params->port ? NIG_REG_INGRESS_BMAC1_MEM : in bnx2x_update_pfc_bmac2()
1979 if ((!(params->feature_config_flags & in bnx2x_update_pfc_bmac2()
1981 (vars->flow_ctrl & BNX2X_FLOW_CTRL_RX)) in bnx2x_update_pfc_bmac2()
1991 if (!(params->feature_config_flags & in bnx2x_update_pfc_bmac2()
1993 (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX)) in bnx2x_update_pfc_bmac2()
1999 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) { in bnx2x_update_pfc_bmac2()
2000 DP(NETIF_MSG_LINK, "PFC is enabled\n"); in bnx2x_update_pfc_bmac2()
2014 DP(NETIF_MSG_LINK, "PFC is disabled\n"); in bnx2x_update_pfc_bmac2()
2023 * re-sending of PP packets amd enable automatic re-send of in bnx2x_update_pfc_bmac2()
2024 * Per-Priroity Packet as long as pp_gen is asserted and in bnx2x_update_pfc_bmac2()
2028 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) in bnx2x_update_pfc_bmac2()
2029 val |= (1<<16); /* enable automatic re-send */ in bnx2x_update_pfc_bmac2()
2040 DP(NETIF_MSG_LINK, "enable bmac loopback\n"); in bnx2x_update_pfc_bmac2()
2043 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) in bnx2x_update_pfc_bmac2()
2080 return -EINVAL; in bnx2x_pfc_nig_rx_priority_mask()
2085 return -EINVAL; in bnx2x_pfc_nig_rx_priority_mask()
2090 return -EINVAL; in bnx2x_pfc_nig_rx_priority_mask()
2101 struct bnx2x *bp = params->bp; in bnx2x_update_mng()
2103 REG_WR(bp, params->shmem_base + in bnx2x_update_mng()
2105 port_mb[params->port].link_status), link_status); in bnx2x_update_mng()
2110 struct bnx2x *bp = params->bp; in bnx2x_update_link_attr()
2113 REG_WR(bp, params->shmem2_base + in bnx2x_update_link_attr()
2115 link_attr_sync[params->port]), link_attr); in bnx2x_update_link_attr()
2125 struct bnx2x *bp = params->bp; in bnx2x_update_pfc_nig()
2126 u8 port = params->port; in bnx2x_update_pfc_nig()
2128 int set_pfc = params->feature_config_flags & in bnx2x_update_pfc_nig()
2130 DP(NETIF_MSG_LINK, "updating pfc nig parameters\n"); in bnx2x_update_pfc_nig()
2155 llfc_out_en = nig_params->llfc_out_en; in bnx2x_update_pfc_nig()
2156 llfc_enable = nig_params->llfc_enable; in bnx2x_update_pfc_nig()
2157 pause_enable = nig_params->pause_enable; in bnx2x_update_pfc_nig()
2158 } else /* Default non PFC mode - PAUSE */ in bnx2x_update_pfc_nig()
2195 pkt_priority_to_cos = nig_params->pkt_priority_to_cos; in bnx2x_update_pfc_nig()
2197 for (i = 0; i < nig_params->num_of_rx_cos_priority_mask; i++) in bnx2x_update_pfc_nig()
2199 nig_params->rx_cos_priority_mask[i], port); in bnx2x_update_pfc_nig()
2203 nig_params->llfc_high_priority_classes); in bnx2x_update_pfc_nig()
2207 nig_params->llfc_low_priority_classes); in bnx2x_update_pfc_nig()
2223 struct bnx2x *bp = params->bp; in bnx2x_update_pfc()
2224 u8 bmac_loopback = (params->loopback_mode == LOOPBACK_BMAC); in bnx2x_update_pfc()
2226 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) in bnx2x_update_pfc()
2227 vars->link_status |= LINK_STATUS_PFC_ENABLED; in bnx2x_update_pfc()
2229 vars->link_status &= ~LINK_STATUS_PFC_ENABLED; in bnx2x_update_pfc()
2231 bnx2x_update_mng(params, vars->link_status); in bnx2x_update_pfc()
2236 if (!vars->link_up) in bnx2x_update_pfc()
2239 DP(NETIF_MSG_LINK, "About to update PFC in BMAC\n"); in bnx2x_update_pfc()
2242 if (vars->mac_type == MAC_TYPE_XMAC) in bnx2x_update_pfc()
2247 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << params->port)) in bnx2x_update_pfc()
2249 DP(NETIF_MSG_LINK, "About to update PFC in EMAC\n"); in bnx2x_update_pfc()
2259 if ((params->feature_config_flags & in bnx2x_update_pfc()
2261 (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX)) in bnx2x_update_pfc()
2263 REG_WR(bp, NIG_REG_BMAC0_PAUSE_OUT_EN + params->port*4, val); in bnx2x_update_pfc()
2272 struct bnx2x *bp = params->bp; in bnx2x_bmac1_enable()
2273 u8 port = params->port; in bnx2x_bmac1_enable()
2279 DP(NETIF_MSG_LINK, "Enabling BigMAC1\n"); in bnx2x_bmac1_enable()
2288 wb_data[0] = ((params->mac_addr[2] << 24) | in bnx2x_bmac1_enable()
2289 (params->mac_addr[3] << 16) | in bnx2x_bmac1_enable()
2290 (params->mac_addr[4] << 8) | in bnx2x_bmac1_enable()
2291 params->mac_addr[5]); in bnx2x_bmac1_enable()
2292 wb_data[1] = ((params->mac_addr[0] << 8) | in bnx2x_bmac1_enable()
2293 params->mac_addr[1]); in bnx2x_bmac1_enable()
2300 DP(NETIF_MSG_LINK, "enable bmac loopback\n"); in bnx2x_bmac1_enable()
2336 struct bnx2x *bp = params->bp; in bnx2x_bmac2_enable()
2337 u8 port = params->port; in bnx2x_bmac2_enable()
2342 DP(NETIF_MSG_LINK, "Enabling BigMAC2\n"); in bnx2x_bmac2_enable()
2349 /* XGXS control: Reset phy HW, MDIO registers, PHY PLL and BMAC */ in bnx2x_bmac2_enable()
2358 wb_data[0] = ((params->mac_addr[2] << 24) | in bnx2x_bmac2_enable()
2359 (params->mac_addr[3] << 16) | in bnx2x_bmac2_enable()
2360 (params->mac_addr[4] << 8) | in bnx2x_bmac2_enable()
2361 params->mac_addr[5]); in bnx2x_bmac2_enable()
2362 wb_data[1] = ((params->mac_addr[0] << 8) | in bnx2x_bmac2_enable()
2363 params->mac_addr[1]); in bnx2x_bmac2_enable()
2388 wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVERHEAD - 2; in bnx2x_bmac2_enable()
2402 u8 port = params->port; in bnx2x_bmac_enable()
2403 struct bnx2x *bp = params->bp; in bnx2x_bmac_enable()
2427 if ((params->feature_config_flags & in bnx2x_bmac_enable()
2429 (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX)) in bnx2x_bmac_enable()
2438 vars->mac_type = MAC_TYPE_BMAC; in bnx2x_bmac_enable()
2471 struct bnx2x *bp = params->bp; in bnx2x_pbf_update()
2472 u8 port = params->port; in bnx2x_pbf_update()
2482 DP(NETIF_MSG_LINK, "init_crd 0x%x crd 0x%x\n", init_crd, crd); in bnx2x_pbf_update()
2487 count--; in bnx2x_pbf_update()
2491 DP(NETIF_MSG_LINK, "BUG! init_crd 0x%x != crd 0x%x\n", in bnx2x_pbf_update()
2493 return -EINVAL; in bnx2x_pbf_update()
2505 init_crd = 778; /* (800-18-4) */ in bnx2x_pbf_update()
2516 init_crd = thresh + 553 - 22; in bnx2x_pbf_update()
2519 DP(NETIF_MSG_LINK, "Invalid line_speed 0x%x\n", in bnx2x_pbf_update()
2521 return -EINVAL; in bnx2x_pbf_update()
2525 DP(NETIF_MSG_LINK, "PBF updated to speed %d credit %d\n", in bnx2x_pbf_update()
2539 * bnx2x_get_emac_base - retrive emac base address
2547 * phy has a default access mode, which could also be overridden
2549 * default phy configuration, or the nvram overrun
2589 struct bnx2x_phy *phy, in bnx2x_cl22_write() argument
2596 mode = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); in bnx2x_cl22_write()
2597 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, in bnx2x_cl22_write()
2601 tmp = ((phy->addr << 21) | (reg << 16) | val | in bnx2x_cl22_write()
2604 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, tmp); in bnx2x_cl22_write()
2609 tmp = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); in bnx2x_cl22_write()
2616 DP(NETIF_MSG_LINK, "write phy register failed\n"); in bnx2x_cl22_write()
2617 rc = -EFAULT; in bnx2x_cl22_write()
2619 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, mode); in bnx2x_cl22_write()
2624 struct bnx2x_phy *phy, in bnx2x_cl22_read() argument
2632 mode = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); in bnx2x_cl22_read()
2633 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, in bnx2x_cl22_read()
2637 val = ((phy->addr << 21) | (reg << 16) | in bnx2x_cl22_read()
2640 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, val); in bnx2x_cl22_read()
2645 val = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); in bnx2x_cl22_read()
2653 DP(NETIF_MSG_LINK, "read phy register failed\n"); in bnx2x_cl22_read()
2656 rc = -EFAULT; in bnx2x_cl22_read()
2658 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, mode); in bnx2x_cl22_read()
2665 static int bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, in bnx2x_cl45_read() argument
2672 if (phy->flags & FLAGS_MDC_MDIO_WA_G) { in bnx2x_cl45_read()
2675 bnx2x_set_mdio_clk(bp, chip_id, phy->mdio_ctrl); in bnx2x_cl45_read()
2678 if (phy->flags & FLAGS_MDC_MDIO_WA_B0) in bnx2x_cl45_read()
2679 bnx2x_bits_en(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS, in bnx2x_cl45_read()
2682 val = ((phy->addr << 21) | (devad << 16) | reg | in bnx2x_cl45_read()
2685 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, val); in bnx2x_cl45_read()
2690 val = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); in bnx2x_cl45_read()
2697 DP(NETIF_MSG_LINK, "read phy register failed\n"); in bnx2x_cl45_read()
2698 netdev_err(bp->dev, "MDC/MDIO access timeout\n"); in bnx2x_cl45_read()
2700 rc = -EFAULT; in bnx2x_cl45_read()
2703 val = ((phy->addr << 21) | (devad << 16) | in bnx2x_cl45_read()
2706 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, val); in bnx2x_cl45_read()
2711 val = REG_RD(bp, phy->mdio_ctrl + in bnx2x_cl45_read()
2719 DP(NETIF_MSG_LINK, "read phy register failed\n"); in bnx2x_cl45_read()
2720 netdev_err(bp->dev, "MDC/MDIO access timeout\n"); in bnx2x_cl45_read()
2722 rc = -EFAULT; in bnx2x_cl45_read()
2726 if (phy->flags & FLAGS_MDC_MDIO_WA) { in bnx2x_cl45_read()
2727 phy->flags ^= FLAGS_DUMMY_READ; in bnx2x_cl45_read()
2728 if (phy->flags & FLAGS_DUMMY_READ) { in bnx2x_cl45_read()
2730 bnx2x_cl45_read(bp, phy, devad, 0xf, &temp_val); in bnx2x_cl45_read()
2734 if (phy->flags & FLAGS_MDC_MDIO_WA_B0) in bnx2x_cl45_read()
2735 bnx2x_bits_dis(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS, in bnx2x_cl45_read()
2740 static int bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, in bnx2x_cl45_write() argument
2747 if (phy->flags & FLAGS_MDC_MDIO_WA_G) { in bnx2x_cl45_write()
2750 bnx2x_set_mdio_clk(bp, chip_id, phy->mdio_ctrl); in bnx2x_cl45_write()
2753 if (phy->flags & FLAGS_MDC_MDIO_WA_B0) in bnx2x_cl45_write()
2754 bnx2x_bits_en(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS, in bnx2x_cl45_write()
2758 tmp = ((phy->addr << 21) | (devad << 16) | reg | in bnx2x_cl45_write()
2761 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, tmp); in bnx2x_cl45_write()
2766 tmp = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); in bnx2x_cl45_write()
2773 DP(NETIF_MSG_LINK, "write phy register failed\n"); in bnx2x_cl45_write()
2774 netdev_err(bp->dev, "MDC/MDIO access timeout\n"); in bnx2x_cl45_write()
2775 rc = -EFAULT; in bnx2x_cl45_write()
2778 tmp = ((phy->addr << 21) | (devad << 16) | val | in bnx2x_cl45_write()
2781 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, tmp); in bnx2x_cl45_write()
2786 tmp = REG_RD(bp, phy->mdio_ctrl + in bnx2x_cl45_write()
2794 DP(NETIF_MSG_LINK, "write phy register failed\n"); in bnx2x_cl45_write()
2795 netdev_err(bp->dev, "MDC/MDIO access timeout\n"); in bnx2x_cl45_write()
2796 rc = -EFAULT; in bnx2x_cl45_write()
2800 if (phy->flags & FLAGS_MDC_MDIO_WA) { in bnx2x_cl45_write()
2801 phy->flags ^= FLAGS_DUMMY_READ; in bnx2x_cl45_write()
2802 if (phy->flags & FLAGS_DUMMY_READ) { in bnx2x_cl45_write()
2804 bnx2x_cl45_read(bp, phy, devad, 0xf, &temp_val); in bnx2x_cl45_write()
2807 if (phy->flags & FLAGS_MDC_MDIO_WA_B0) in bnx2x_cl45_write()
2808 bnx2x_bits_dis(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_STATUS, in bnx2x_cl45_write()
2818 struct bnx2x *bp = params->bp; in bnx2x_eee_has_cap()
2820 if (REG_RD(bp, params->shmem2_base) <= in bnx2x_eee_has_cap()
2821 offsetof(struct shmem2_region, eee_status[params->port])) in bnx2x_eee_has_cap()
2870 struct bnx2x *bp = params->bp; in bnx2x_eee_calc_timer()
2872 if (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) { in bnx2x_eee_calc_timer()
2873 if (params->eee_mode & EEE_MODE_OUTPUT_TIME) { in bnx2x_eee_calc_timer()
2874 /* time value in eee_mode --> used directly*/ in bnx2x_eee_calc_timer()
2875 eee_idle = params->eee_mode & EEE_MODE_TIMER_MASK; in bnx2x_eee_calc_timer()
2877 /* hsi value in eee_mode --> time */ in bnx2x_eee_calc_timer()
2878 if (bnx2x_eee_nvram_to_time(params->eee_mode & in bnx2x_eee_calc_timer()
2884 /* hsi values in nvram --> time*/ in bnx2x_eee_calc_timer()
2885 eee_mode = ((REG_RD(bp, params->shmem_base + in bnx2x_eee_calc_timer()
2887 port_feature_config[params->port]. in bnx2x_eee_calc_timer()
2903 struct bnx2x *bp = params->bp; in bnx2x_eee_set_timers()
2908 REG_WR(bp, MISC_REG_CPMU_LP_IDLE_THR_P0 + (params->port << 2), in bnx2x_eee_set_timers()
2910 } else if ((params->eee_mode & EEE_MODE_ENABLE_LPI) && in bnx2x_eee_set_timers()
2911 (params->eee_mode & EEE_MODE_OVERRIDE_NVRAM) && in bnx2x_eee_set_timers()
2912 (params->eee_mode & EEE_MODE_OUTPUT_TIME)) { in bnx2x_eee_set_timers()
2913 DP(NETIF_MSG_LINK, "Error: Tx LPI is enabled with timer 0\n"); in bnx2x_eee_set_timers()
2914 return -EINVAL; in bnx2x_eee_set_timers()
2917 vars->eee_status &= ~(SHMEM_EEE_TIMER_MASK | SHMEM_EEE_TIME_OUTPUT_BIT); in bnx2x_eee_set_timers()
2918 if (params->eee_mode & EEE_MODE_OUTPUT_TIME) { in bnx2x_eee_set_timers()
2919 /* eee_idle in 1u --> eee_status in 16u */ in bnx2x_eee_set_timers()
2921 vars->eee_status |= (eee_idle & SHMEM_EEE_TIMER_MASK) | in bnx2x_eee_set_timers()
2925 return -EINVAL; in bnx2x_eee_set_timers()
2926 vars->eee_status |= eee_mode; in bnx2x_eee_set_timers()
2935 vars->eee_status |= ((u32) mode) << SHMEM_EEE_SUPPORTED_SHIFT; in bnx2x_eee_initial_config()
2937 /* Propagate params' bits --> vars (for migration exposure) */ in bnx2x_eee_initial_config()
2938 if (params->eee_mode & EEE_MODE_ENABLE_LPI) in bnx2x_eee_initial_config()
2939 vars->eee_status |= SHMEM_EEE_LPI_REQUESTED_BIT; in bnx2x_eee_initial_config()
2941 vars->eee_status &= ~SHMEM_EEE_LPI_REQUESTED_BIT; in bnx2x_eee_initial_config()
2943 if (params->eee_mode & EEE_MODE_ADV_LPI) in bnx2x_eee_initial_config()
2944 vars->eee_status |= SHMEM_EEE_REQUESTED_BIT; in bnx2x_eee_initial_config()
2946 vars->eee_status &= ~SHMEM_EEE_REQUESTED_BIT; in bnx2x_eee_initial_config()
2951 static int bnx2x_eee_disable(struct bnx2x_phy *phy, in bnx2x_eee_disable() argument
2955 struct bnx2x *bp = params->bp; in bnx2x_eee_disable()
2958 REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2), 0); in bnx2x_eee_disable()
2960 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, 0x0); in bnx2x_eee_disable()
2962 vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK; in bnx2x_eee_disable()
2967 static int bnx2x_eee_advertise(struct bnx2x_phy *phy, in bnx2x_eee_advertise() argument
2971 struct bnx2x *bp = params->bp; in bnx2x_eee_advertise()
2975 REG_WR(bp, MISC_REG_CPMU_LP_MASK_EXT_P0 + (params->port << 2), 0xfc20); in bnx2x_eee_advertise()
2978 DP(NETIF_MSG_LINK, "Advertise 10GBase-T EEE\n"); in bnx2x_eee_advertise()
2982 DP(NETIF_MSG_LINK, "Advertise 1GBase-T EEE\n"); in bnx2x_eee_advertise()
2986 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, val); in bnx2x_eee_advertise()
2988 vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK; in bnx2x_eee_advertise()
2989 vars->eee_status |= (modes << SHMEM_EEE_ADV_STATUS_SHIFT); in bnx2x_eee_advertise()
2996 struct bnx2x *bp = params->bp; in bnx2x_update_mng_eee()
2999 REG_WR(bp, params->shmem2_base + in bnx2x_update_mng_eee()
3001 eee_status[params->port]), eee_status); in bnx2x_update_mng_eee()
3004 static void bnx2x_eee_an_resolve(struct bnx2x_phy *phy, in bnx2x_eee_an_resolve() argument
3008 struct bnx2x *bp = params->bp; in bnx2x_eee_an_resolve()
3013 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_EEE_ADV, &adv); in bnx2x_eee_an_resolve()
3014 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_LP_EEE_ADV, &lp); in bnx2x_eee_an_resolve()
3019 if (vars->line_speed == SPEED_100) in bnx2x_eee_an_resolve()
3021 DP(NETIF_MSG_LINK, "EEE negotiated - 100M\n"); in bnx2x_eee_an_resolve()
3027 if (vars->line_speed == SPEED_1000) in bnx2x_eee_an_resolve()
3029 DP(NETIF_MSG_LINK, "EEE negotiated - 1G\n"); in bnx2x_eee_an_resolve()
3035 if (vars->line_speed == SPEED_10000) in bnx2x_eee_an_resolve()
3037 DP(NETIF_MSG_LINK, "EEE negotiated - 10G\n"); in bnx2x_eee_an_resolve()
3041 vars->eee_status &= ~SHMEM_EEE_LP_ADV_STATUS_MASK; in bnx2x_eee_an_resolve()
3042 vars->eee_status |= (lp_adv << SHMEM_EEE_LP_ADV_STATUS_SHIFT); in bnx2x_eee_an_resolve()
3045 DP(NETIF_MSG_LINK, "EEE is active\n"); in bnx2x_eee_an_resolve()
3046 vars->eee_status |= SHMEM_EEE_ACTIVE_BIT; in bnx2x_eee_an_resolve()
3059 struct bnx2x *bp = params->bp; in bnx2x_bsc_module_sel()
3060 u8 port = params->port; in bnx2x_bsc_module_sel()
3062 board_cfg = REG_RD(bp, params->shmem_base + in bnx2x_bsc_module_sel()
3070 sfp_ctrl = REG_RD(bp, params->shmem_base + in bnx2x_bsc_module_sel()
3075 DP(NETIF_MSG_LINK, "Setting BSC switch\n"); in bnx2x_bsc_module_sel()
3093 DP(NETIF_MSG_LINK, "invalid xfer_cnt %d. Max is 16 bytes\n", in bnx2x_bsc_read()
3095 return -EINVAL; in bnx2x_bsc_read()
3099 xfer_cnt = 16 - lc_addr; in bnx2x_bsc_read()
3121 delta = ktime_get_ns() - t0; in bnx2x_bsc_read()
3123 DP(NETIF_MSG_LINK, "wr 0 byte timed out after %Lu ns\n", in bnx2x_bsc_read()
3125 rc = -EFAULT; in bnx2x_bsc_read()
3131 if (rc == -EFAULT) in bnx2x_bsc_read()
3146 delta = ktime_get_ns() - t0; in bnx2x_bsc_read()
3148 DP(NETIF_MSG_LINK, "rd op timed out after %Lu ns\n", in bnx2x_bsc_read()
3150 rc = -EFAULT; in bnx2x_bsc_read()
3156 if (rc == -EFAULT) in bnx2x_bsc_read()
3171 static void bnx2x_cl45_read_or_write(struct bnx2x *bp, struct bnx2x_phy *phy, in bnx2x_cl45_read_or_write() argument
3175 bnx2x_cl45_read(bp, phy, devad, reg, &val); in bnx2x_cl45_read_or_write()
3176 bnx2x_cl45_write(bp, phy, devad, reg, val | or_val); in bnx2x_cl45_read_or_write()
3180 struct bnx2x_phy *phy, in bnx2x_cl45_read_and_write() argument
3184 bnx2x_cl45_read(bp, phy, devad, reg, &val); in bnx2x_cl45_read_and_write()
3185 bnx2x_cl45_write(bp, phy, devad, reg, val & and_val); in bnx2x_cl45_read_and_write()
3192 /* Probe for the phy according to the given phy_addr, and execute in bnx2x_phy_read()
3195 for (phy_index = 0; phy_index < params->num_phys; phy_index++) { in bnx2x_phy_read()
3196 if (params->phy[phy_index].addr == phy_addr) { in bnx2x_phy_read()
3197 return bnx2x_cl45_read(params->bp, in bnx2x_phy_read()
3198 ¶ms->phy[phy_index], devad, in bnx2x_phy_read()
3202 return -EINVAL; in bnx2x_phy_read()
3209 /* Probe for the phy according to the given phy_addr, and execute in bnx2x_phy_write()
3212 for (phy_index = 0; phy_index < params->num_phys; phy_index++) { in bnx2x_phy_write()
3213 if (params->phy[phy_index].addr == phy_addr) { in bnx2x_phy_write()
3214 return bnx2x_cl45_write(params->bp, in bnx2x_phy_write()
3215 ¶ms->phy[phy_index], devad, in bnx2x_phy_write()
3219 return -EINVAL; in bnx2x_phy_write()
3221 static u8 bnx2x_get_warpcore_lane(struct bnx2x_phy *phy, in bnx2x_get_warpcore_lane() argument
3225 struct bnx2x *bp = params->bp; in bnx2x_get_warpcore_lane()
3230 port = params->port; in bnx2x_get_warpcore_lane()
3256 } else { /* Two port mode - no port swap */ in bnx2x_get_warpcore_lane()
3276 struct bnx2x_phy *phy) in bnx2x_set_aer_mmd() argument
3280 struct bnx2x *bp = params->bp; in bnx2x_set_aer_mmd()
3281 ser_lane = ((params->lane_config & in bnx2x_set_aer_mmd()
3285 offset = (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) ? in bnx2x_set_aer_mmd()
3286 (phy->addr + ser_lane) : 0; in bnx2x_set_aer_mmd()
3289 aer_val = bnx2x_get_warpcore_lane(phy, params); in bnx2x_set_aer_mmd()
3290 /* In Dual-lane mode, two lanes are joined together, in bnx2x_set_aer_mmd()
3296 if (phy->flags & FLAGS_WC_DUAL_MODE) in bnx2x_set_aer_mmd()
3299 aer_val = 0x3800 + offset - 1; in bnx2x_set_aer_mmd()
3303 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_set_aer_mmd()
3309 /* Internal phy section */
3330 DP(NETIF_MSG_LINK, "bnx2x_serdes_deassert\n"); in bnx2x_serdes_deassert()
3345 static void bnx2x_xgxs_specific_func(struct bnx2x_phy *phy, in bnx2x_xgxs_specific_func() argument
3349 struct bnx2x *bp = params->bp; in bnx2x_xgxs_specific_func()
3353 REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + params->port*0x18, 0); in bnx2x_xgxs_specific_func()
3354 REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + params->port*0x18, in bnx2x_xgxs_specific_func()
3355 phy->def_md_devad); in bnx2x_xgxs_specific_func()
3362 struct bnx2x *bp = params->bp; in bnx2x_xgxs_deassert()
3365 DP(NETIF_MSG_LINK, "bnx2x_xgxs_deassert\n"); in bnx2x_xgxs_deassert()
3366 port = params->port; in bnx2x_xgxs_deassert()
3374 bnx2x_xgxs_specific_func(¶ms->phy[INT_PHY], params, in bnx2x_xgxs_deassert()
3378 static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, in bnx2x_calc_ieee_aneg_adv() argument
3381 struct bnx2x *bp = params->bp; in bnx2x_calc_ieee_aneg_adv()
3384 * 28B-3 of the 802.3ab-1999 spec in bnx2x_calc_ieee_aneg_adv()
3387 switch (phy->req_flow_ctrl) { in bnx2x_calc_ieee_aneg_adv()
3389 switch (params->req_fc_auto_adv) { in bnx2x_calc_ieee_aneg_adv()
3416 DP(NETIF_MSG_LINK, "ieee_fc = 0x%x\n", *ieee_fc); in bnx2x_calc_ieee_aneg_adv()
3422 struct bnx2x *bp = params->bp; in set_phy_vars()
3424 u8 phy_config_swapped = params->multi_phy_config & in set_phy_vars()
3426 for (phy_index = INT_PHY; phy_index < params->num_phys; in set_phy_vars()
3436 params->phy[actual_phy_idx].req_flow_ctrl = in set_phy_vars()
3437 params->req_flow_ctrl[link_cfg_idx]; in set_phy_vars()
3439 params->phy[actual_phy_idx].req_line_speed = in set_phy_vars()
3440 params->req_line_speed[link_cfg_idx]; in set_phy_vars()
3442 params->phy[actual_phy_idx].speed_cap_mask = in set_phy_vars()
3443 params->speed_cap_mask[link_cfg_idx]; in set_phy_vars()
3445 params->phy[actual_phy_idx].req_duplex = in set_phy_vars()
3446 params->req_duplex[link_cfg_idx]; in set_phy_vars()
3448 if (params->req_line_speed[link_cfg_idx] == in set_phy_vars()
3450 vars->link_status |= LINK_STATUS_AUTO_NEGOTIATE_ENABLED; in set_phy_vars()
3452 DP(NETIF_MSG_LINK, "req_flow_ctrl %x, req_line_speed %x," in set_phy_vars()
3454 params->phy[actual_phy_idx].req_flow_ctrl, in set_phy_vars()
3455 params->phy[actual_phy_idx].req_line_speed, in set_phy_vars()
3456 params->phy[actual_phy_idx].speed_cap_mask); in set_phy_vars()
3461 struct bnx2x_phy *phy, in bnx2x_ext_phy_set_pause() argument
3465 struct bnx2x *bp = params->bp; in bnx2x_ext_phy_set_pause()
3467 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_ADV_PAUSE, &val); in bnx2x_ext_phy_set_pause()
3471 /* Please refer to Table 28B-3 of 802.3ab-1999 spec. */ in bnx2x_ext_phy_set_pause()
3472 bnx2x_calc_ieee_aneg_adv(phy, params, &vars->ieee_fc); in bnx2x_ext_phy_set_pause()
3473 if ((vars->ieee_fc & in bnx2x_ext_phy_set_pause()
3478 if ((vars->ieee_fc & in bnx2x_ext_phy_set_pause()
3483 DP(NETIF_MSG_LINK, "Ext phy AN advertize 0x%x\n", val); in bnx2x_ext_phy_set_pause()
3484 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_ADV_PAUSE, val); in bnx2x_ext_phy_set_pause()
3487 static void bnx2x_pause_resolve(struct bnx2x_phy *phy, in bnx2x_pause_resolve() argument
3492 struct bnx2x *bp = params->bp; in bnx2x_pause_resolve()
3496 DP(NETIF_MSG_LINK, "Flow Control: TX only\n"); in bnx2x_pause_resolve()
3497 vars->flow_ctrl = BNX2X_FLOW_CTRL_TX; in bnx2x_pause_resolve()
3501 DP(NETIF_MSG_LINK, "Flow Control: RX only\n"); in bnx2x_pause_resolve()
3502 vars->flow_ctrl = BNX2X_FLOW_CTRL_RX; in bnx2x_pause_resolve()
3513 if (params->req_fc_auto_adv == BNX2X_FLOW_CTRL_BOTH) { in bnx2x_pause_resolve()
3514 DP(NETIF_MSG_LINK, "Flow Control: RX & TX\n"); in bnx2x_pause_resolve()
3515 vars->flow_ctrl = BNX2X_FLOW_CTRL_BOTH; in bnx2x_pause_resolve()
3517 DP(NETIF_MSG_LINK, "Flow Control: RX only\n"); in bnx2x_pause_resolve()
3518 vars->flow_ctrl = BNX2X_FLOW_CTRL_RX; in bnx2x_pause_resolve()
3523 DP(NETIF_MSG_LINK, "Flow Control: None\n"); in bnx2x_pause_resolve()
3524 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_pause_resolve()
3528 vars->link_status |= LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE; in bnx2x_pause_resolve()
3530 vars->link_status |= LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE; in bnx2x_pause_resolve()
3534 static void bnx2x_ext_phy_update_adv_fc(struct bnx2x_phy *phy, in bnx2x_ext_phy_update_adv_fc() argument
3541 struct bnx2x *bp = params->bp; in bnx2x_ext_phy_update_adv_fc()
3542 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) { in bnx2x_ext_phy_update_adv_fc()
3543 bnx2x_cl22_read(bp, phy, 0x4, &ld_pause); in bnx2x_ext_phy_update_adv_fc()
3544 bnx2x_cl22_read(bp, phy, 0x5, &lp_pause); in bnx2x_ext_phy_update_adv_fc()
3547 u8 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_ext_phy_update_adv_fc()
3549 bnx2x_cl45_read(bp, phy, in bnx2x_ext_phy_update_adv_fc()
3556 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_ext_phy_update_adv_fc()
3558 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_ext_phy_update_adv_fc()
3561 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_ext_phy_update_adv_fc()
3563 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_ext_phy_update_adv_fc()
3573 bnx2x_cl45_read(bp, phy, in bnx2x_ext_phy_update_adv_fc()
3576 bnx2x_cl45_read(bp, phy, in bnx2x_ext_phy_update_adv_fc()
3584 DP(NETIF_MSG_LINK, "Ext PHY pause result 0x%x\n", pause_result); in bnx2x_ext_phy_update_adv_fc()
3585 bnx2x_pause_resolve(phy, params, vars, pause_result); in bnx2x_ext_phy_update_adv_fc()
3589 static u8 bnx2x_ext_phy_resolve_fc(struct bnx2x_phy *phy, in bnx2x_ext_phy_resolve_fc() argument
3594 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_ext_phy_resolve_fc()
3595 if (phy->req_flow_ctrl != BNX2X_FLOW_CTRL_AUTO) { in bnx2x_ext_phy_resolve_fc()
3596 /* Update the advertised flow-controled of LD/LP in AN */ in bnx2x_ext_phy_resolve_fc()
3597 if (phy->req_line_speed == SPEED_AUTO_NEG) in bnx2x_ext_phy_resolve_fc()
3598 bnx2x_ext_phy_update_adv_fc(phy, params, vars); in bnx2x_ext_phy_resolve_fc()
3599 /* But set the flow-control result as the requested one */ in bnx2x_ext_phy_resolve_fc()
3600 vars->flow_ctrl = phy->req_flow_ctrl; in bnx2x_ext_phy_resolve_fc()
3601 } else if (phy->req_line_speed != SPEED_AUTO_NEG) in bnx2x_ext_phy_resolve_fc()
3602 vars->flow_ctrl = params->req_fc_auto_adv; in bnx2x_ext_phy_resolve_fc()
3603 else if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) { in bnx2x_ext_phy_resolve_fc()
3605 bnx2x_ext_phy_update_adv_fc(phy, params, vars); in bnx2x_ext_phy_resolve_fc()
3615 * phy init is done purely in phy_init stage.
3628 static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy, in bnx2x_warpcore_enable_AN_KR2() argument
3632 struct bnx2x *bp = params->bp; in bnx2x_warpcore_enable_AN_KR2()
3635 /* Step 1 - Program the TX/RX alignment markers */ in bnx2x_warpcore_enable_AN_KR2()
3642 /* Step 2 - Configure the NP registers */ in bnx2x_warpcore_enable_AN_KR2()
3653 DP(NETIF_MSG_LINK, "Enabling 20G-KR2\n"); in bnx2x_warpcore_enable_AN_KR2()
3655 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR2()
3659 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, in bnx2x_warpcore_enable_AN_KR2()
3662 /* Start KR2 work-around timer which handles BCM8073 link-parner */ in bnx2x_warpcore_enable_AN_KR2()
3663 params->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; in bnx2x_warpcore_enable_AN_KR2()
3664 bnx2x_update_link_attr(params, params->link_attr_sync); in bnx2x_warpcore_enable_AN_KR2()
3669 struct bnx2x_phy *phy) in bnx2x_disable_kr2() argument
3671 struct bnx2x *bp = params->bp; in bnx2x_disable_kr2()
3674 /* Step 1 - Program the TX/RX alignment markers */ in bnx2x_disable_kr2()
3691 DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n"); in bnx2x_disable_kr2()
3694 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, in bnx2x_disable_kr2()
3696 params->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; in bnx2x_disable_kr2()
3697 bnx2x_update_link_attr(params, params->link_attr_sync); in bnx2x_disable_kr2()
3699 vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; in bnx2x_disable_kr2()
3702 static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, in bnx2x_warpcore_set_lpi_passthrough() argument
3705 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_lpi_passthrough()
3707 DP(NETIF_MSG_LINK, "Configure WC for LPI pass through\n"); in bnx2x_warpcore_set_lpi_passthrough()
3708 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_lpi_passthrough()
3710 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_lpi_passthrough()
3714 static void bnx2x_warpcore_restart_AN_KR(struct bnx2x_phy *phy, in bnx2x_warpcore_restart_AN_KR() argument
3718 struct bnx2x *bp = params->bp; in bnx2x_warpcore_restart_AN_KR()
3719 u16 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_restart_AN_KR()
3720 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_warpcore_restart_AN_KR()
3722 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_restart_AN_KR()
3726 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_restart_AN_KR()
3729 static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, in bnx2x_warpcore_enable_AN_KR() argument
3734 struct bnx2x *bp = params->bp; in bnx2x_warpcore_enable_AN_KR()
3740 /* Disable Autoneg: re-enable it after adv is done. */ in bnx2x_warpcore_enable_AN_KR()
3745 DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n"); in bnx2x_warpcore_enable_AN_KR()
3748 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, in bnx2x_warpcore_enable_AN_KR()
3751 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3755 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3759 if (((vars->line_speed == SPEED_AUTO_NEG) && in bnx2x_warpcore_enable_AN_KR()
3760 (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) || in bnx2x_warpcore_enable_AN_KR()
3761 (vars->line_speed == SPEED_1000)) { in bnx2x_warpcore_enable_AN_KR()
3766 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1); in bnx2x_warpcore_enable_AN_KR()
3767 DP(NETIF_MSG_LINK, "Advertize 1G\n"); in bnx2x_warpcore_enable_AN_KR()
3769 if (((vars->line_speed == SPEED_AUTO_NEG) && in bnx2x_warpcore_enable_AN_KR()
3770 (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) || in bnx2x_warpcore_enable_AN_KR()
3771 (vars->line_speed == SPEED_10000)) { in bnx2x_warpcore_enable_AN_KR()
3775 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_warpcore_enable_AN_KR()
3778 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3780 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_enable_AN_KR()
3781 DP(NETIF_MSG_LINK, "Advertize 10G\n"); in bnx2x_warpcore_enable_AN_KR()
3785 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_enable_AN_KR()
3786 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3790 if (phy->flags & FLAGS_WC_DUAL_MODE) in bnx2x_warpcore_enable_AN_KR()
3791 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3794 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3797 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3802 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3806 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3812 if (REG_RD(bp, params->shmem_base + in bnx2x_warpcore_enable_AN_KR()
3814 port_hw_config[params->port].default_cfg)) & in bnx2x_warpcore_enable_AN_KR()
3816 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3819 DP(NETIF_MSG_LINK, "Enable CL37 BAM on KR\n"); in bnx2x_warpcore_enable_AN_KR()
3823 bnx2x_ext_phy_set_pause(params, phy, vars); in bnx2x_warpcore_enable_AN_KR()
3824 vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; in bnx2x_warpcore_enable_AN_KR()
3825 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3828 /* Over 1G - AN local device user page 1 */ in bnx2x_warpcore_enable_AN_KR()
3829 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3832 if (((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_warpcore_enable_AN_KR()
3833 (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_20G)) || in bnx2x_warpcore_enable_AN_KR()
3834 (phy->req_line_speed == SPEED_20000)) { in bnx2x_warpcore_enable_AN_KR()
3836 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_warpcore_enable_AN_KR()
3839 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3843 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3845 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_enable_AN_KR()
3847 bnx2x_warpcore_enable_AN_KR2(phy, params, vars); in bnx2x_warpcore_enable_AN_KR()
3849 /* Enable Auto-Detect to support 1G over CL37 as well */ in bnx2x_warpcore_enable_AN_KR()
3850 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3852 wc_lane_config = REG_RD(bp, params->shmem_base + in bnx2x_warpcore_enable_AN_KR()
3855 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3858 * parallel-detect loop when CL73 and CL37 are enabled. in bnx2x_warpcore_enable_AN_KR()
3870 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_enable_AN_KR()
3874 bnx2x_disable_kr2(params, vars, phy); in bnx2x_warpcore_enable_AN_KR()
3878 bnx2x_warpcore_restart_AN_KR(phy, params); in bnx2x_warpcore_enable_AN_KR()
3881 static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, in bnx2x_warpcore_set_10G_KR() argument
3885 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_10G_KR()
3901 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, in bnx2x_warpcore_set_10G_KR()
3904 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_set_10G_KR()
3906 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_warpcore_set_10G_KR()
3909 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3912 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3915 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3918 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3921 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_set_10G_KR()
3923 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, in bnx2x_warpcore_set_10G_KR()
3926 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, in bnx2x_warpcore_set_10G_KR()
3930 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3934 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3938 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3942 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3944 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_KR()
3949 static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy, in bnx2x_warpcore_set_10G_XFI() argument
3953 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_10G_XFI()
3959 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
3963 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
3967 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 0); in bnx2x_warpcore_set_10G_XFI()
3969 /* Disable 100FX Enable and Auto-Detect */ in bnx2x_warpcore_set_10G_XFI()
3970 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
3974 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
3977 /* Set Block address to Remote PHY & Clear forced_speed[5] */ in bnx2x_warpcore_set_10G_XFI()
3978 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
3981 /* Turn off auto-detect & fiber mode */ in bnx2x_warpcore_set_10G_XFI()
3982 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
3987 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
3989 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
3994 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4004 cfg_tap_val = REG_RD(bp, params->shmem_base + in bnx2x_warpcore_set_10G_XFI()
4006 port_hw_config[params->port]. in bnx2x_warpcore_set_10G_XFI()
4050 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4054 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_set_10G_XFI()
4055 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4058 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4063 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4066 /* Set Block address to Remote PHY & Set forced_speed[5], 40bit mode */ in bnx2x_warpcore_set_10G_XFI()
4067 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4070 bnx2x_warpcore_set_lpi_passthrough(phy, params); in bnx2x_warpcore_set_10G_XFI()
4073 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4077 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4081 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_10G_XFI()
4085 static void bnx2x_warpcore_set_20G_force_KR2(struct bnx2x_phy *phy, in bnx2x_warpcore_set_20G_force_KR2() argument
4089 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_20G_force_KR2()
4091 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_warpcore_set_20G_force_KR2()
4095 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4098 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_set_20G_force_KR2()
4100 bnx2x_cl45_read_and_write(bp, phy, MDIO_PMA_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4102 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4105 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4109 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4113 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4116 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4119 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4123 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4125 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4129 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_warpcore_set_20G_force_KR2()
4132 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_force_KR2()
4135 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_set_20G_force_KR2()
4139 struct bnx2x_phy *phy, in bnx2x_warpcore_set_20G_DXGXS() argument
4143 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4147 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4150 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4153 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4156 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4159 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4162 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4165 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4168 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4171 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4175 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4179 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4183 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4187 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_20G_DXGXS()
4192 static void bnx2x_warpcore_set_sgmii_speed(struct bnx2x_phy *phy, in bnx2x_warpcore_set_sgmii_speed() argument
4197 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_sgmii_speed()
4200 /* Clear XFI clock comp in non-10G single lane mode. */ in bnx2x_warpcore_set_sgmii_speed()
4201 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4204 bnx2x_warpcore_set_lpi_passthrough(phy, params); in bnx2x_warpcore_set_sgmii_speed()
4206 if (always_autoneg || phy->req_line_speed == SPEED_AUTO_NEG) { in bnx2x_warpcore_set_sgmii_speed()
4208 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4211 DP(NETIF_MSG_LINK, "set SGMII AUTONEG\n"); in bnx2x_warpcore_set_sgmii_speed()
4213 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4216 switch (phy->req_line_speed) { in bnx2x_warpcore_set_sgmii_speed()
4226 DP(NETIF_MSG_LINK, in bnx2x_warpcore_set_sgmii_speed()
4227 "Speed not supported: 0x%x\n", phy->req_line_speed); in bnx2x_warpcore_set_sgmii_speed()
4231 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_warpcore_set_sgmii_speed()
4234 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4237 DP(NETIF_MSG_LINK, "set SGMII force speed %d\n", in bnx2x_warpcore_set_sgmii_speed()
4238 phy->req_line_speed); in bnx2x_warpcore_set_sgmii_speed()
4239 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4241 DP(NETIF_MSG_LINK, " (readback) %x\n", val16); in bnx2x_warpcore_set_sgmii_speed()
4245 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4252 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4257 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4259 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4263 /* Re-enable parallel detect */ in bnx2x_warpcore_set_sgmii_speed()
4264 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4269 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_sgmii_speed()
4275 struct bnx2x_phy *phy, in bnx2x_warpcore_reset_lane() argument
4280 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_reset_lane()
4286 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_reset_lane()
4288 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_reset_lane()
4292 static void bnx2x_warpcore_clear_regs(struct bnx2x_phy *phy, in bnx2x_warpcore_clear_regs() argument
4296 struct bnx2x *bp = params->bp; in bnx2x_warpcore_clear_regs()
4315 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_clear_regs()
4319 bnx2x_cl45_write(bp, phy, wc_regs[i].devad, wc_regs[i].reg, in bnx2x_warpcore_clear_regs()
4322 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_clear_regs()
4323 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_clear_regs()
4351 DP(NETIF_MSG_LINK, in bnx2x_get_mod_abs_int_cfg()
4354 return -EINVAL; in bnx2x_get_mod_abs_int_cfg()
4357 *gpio_num = (cfg_pin - PIN_CFG_GPIO0_P0) & 0x3; in bnx2x_get_mod_abs_int_cfg()
4358 *gpio_port = (cfg_pin - PIN_CFG_GPIO0_P0) >> 2; in bnx2x_get_mod_abs_int_cfg()
4367 static int bnx2x_is_sfp_module_plugged(struct bnx2x_phy *phy, in bnx2x_is_sfp_module_plugged() argument
4370 struct bnx2x *bp = params->bp; in bnx2x_is_sfp_module_plugged()
4373 if (bnx2x_get_mod_abs_int_cfg(bp, params->chip_id, in bnx2x_is_sfp_module_plugged()
4374 params->shmem_base, params->port, in bnx2x_is_sfp_module_plugged()
4385 static int bnx2x_warpcore_get_sigdet(struct bnx2x_phy *phy, in bnx2x_warpcore_get_sigdet() argument
4389 struct bnx2x *bp = params->bp; in bnx2x_warpcore_get_sigdet()
4391 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_get_sigdet()
4393 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, MDIO_WC_REG_GP2_STATUS_GP_2_0, in bnx2x_warpcore_get_sigdet()
4399 static void bnx2x_warpcore_config_runtime(struct bnx2x_phy *phy, in bnx2x_warpcore_config_runtime() argument
4403 struct bnx2x *bp = params->bp; in bnx2x_warpcore_config_runtime()
4407 vars->turn_to_run_wc_rt = vars->turn_to_run_wc_rt ? 0 : 1; in bnx2x_warpcore_config_runtime()
4409 if (!vars->turn_to_run_wc_rt) in bnx2x_warpcore_config_runtime()
4412 if (vars->rx_tx_asic_rst) { in bnx2x_warpcore_config_runtime()
4413 u16 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_config_runtime()
4414 serdes_net_if = (REG_RD(bp, params->shmem_base + in bnx2x_warpcore_config_runtime()
4416 port_hw_config[params->port].default_cfg)) & in bnx2x_warpcore_config_runtime()
4422 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, 0x81d1, in bnx2x_warpcore_config_runtime()
4429 vars->rx_tx_asic_rst = 0; in bnx2x_warpcore_config_runtime()
4432 bnx2x_warpcore_reset_lane(bp, phy, 1); in bnx2x_warpcore_config_runtime()
4433 bnx2x_warpcore_reset_lane(bp, phy, 0); in bnx2x_warpcore_config_runtime()
4436 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_config_runtime()
4439 vars->rx_tx_asic_rst--; in bnx2x_warpcore_config_runtime()
4440 DP(NETIF_MSG_LINK, "0x%x retry left\n", in bnx2x_warpcore_config_runtime()
4441 vars->rx_tx_asic_rst); in bnx2x_warpcore_config_runtime()
4449 } /*params->rx_tx_asic_rst*/ in bnx2x_warpcore_config_runtime()
4452 static void bnx2x_warpcore_config_sfi(struct bnx2x_phy *phy, in bnx2x_warpcore_config_sfi() argument
4455 u16 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_config_sfi()
4456 struct bnx2x *bp = params->bp; in bnx2x_warpcore_config_sfi()
4457 bnx2x_warpcore_clear_regs(phy, params, lane); in bnx2x_warpcore_config_sfi()
4458 if ((params->req_line_speed[LINK_CONFIG_IDX(INT_PHY)] == in bnx2x_warpcore_config_sfi()
4460 (phy->media_type != ETH_PHY_SFP_1G_FIBER)) { in bnx2x_warpcore_config_sfi()
4461 DP(NETIF_MSG_LINK, "Setting 10G SFI\n"); in bnx2x_warpcore_config_sfi()
4462 bnx2x_warpcore_set_10G_XFI(phy, params, 0); in bnx2x_warpcore_config_sfi()
4464 DP(NETIF_MSG_LINK, "Setting 1G Fiber\n"); in bnx2x_warpcore_config_sfi()
4465 bnx2x_warpcore_set_sgmii_speed(phy, params, 1, 0); in bnx2x_warpcore_config_sfi()
4470 struct bnx2x_phy *phy, in bnx2x_sfp_e3_set_transmitter() argument
4473 struct bnx2x *bp = params->bp; in bnx2x_sfp_e3_set_transmitter()
4475 u8 port = params->port; in bnx2x_sfp_e3_set_transmitter()
4477 cfg_pin = REG_RD(bp, params->shmem_base + in bnx2x_sfp_e3_set_transmitter()
4482 DP(NETIF_MSG_LINK, "Setting WC TX to %d\n", tx_en); in bnx2x_sfp_e3_set_transmitter()
4486 if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_20G) in bnx2x_sfp_e3_set_transmitter()
4490 static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, in bnx2x_warpcore_config_init() argument
4494 struct bnx2x *bp = params->bp; in bnx2x_warpcore_config_init()
4497 u16 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_config_init()
4498 serdes_net_if = (REG_RD(bp, params->shmem_base + in bnx2x_warpcore_config_init()
4500 port_hw_config[params->port].default_cfg)) & in bnx2x_warpcore_config_init()
4502 DP(NETIF_MSG_LINK, "Begin Warpcore init, link_speed %d, " in bnx2x_warpcore_config_init()
4504 vars->line_speed, serdes_net_if); in bnx2x_warpcore_config_init()
4505 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_config_init()
4506 bnx2x_warpcore_reset_lane(bp, phy, 1); in bnx2x_warpcore_config_init()
4507 vars->phy_flags |= PHY_XGXS_FLAG; in bnx2x_warpcore_config_init()
4509 (phy->req_line_speed && in bnx2x_warpcore_config_init()
4510 ((phy->req_line_speed == SPEED_100) || in bnx2x_warpcore_config_init()
4511 (phy->req_line_speed == SPEED_10)))) { in bnx2x_warpcore_config_init()
4512 vars->phy_flags |= PHY_SGMII_FLAG; in bnx2x_warpcore_config_init()
4513 DP(NETIF_MSG_LINK, "Setting SGMII mode\n"); in bnx2x_warpcore_config_init()
4514 bnx2x_warpcore_clear_regs(phy, params, lane); in bnx2x_warpcore_config_init()
4515 bnx2x_warpcore_set_sgmii_speed(phy, params, 0, 1); in bnx2x_warpcore_config_init()
4520 if (params->loopback_mode != LOOPBACK_EXT) in bnx2x_warpcore_config_init()
4521 bnx2x_warpcore_enable_AN_KR(phy, params, vars); in bnx2x_warpcore_config_init()
4523 DP(NETIF_MSG_LINK, "Setting KR 10G-Force\n"); in bnx2x_warpcore_config_init()
4524 bnx2x_warpcore_set_10G_KR(phy, params, vars); in bnx2x_warpcore_config_init()
4529 bnx2x_warpcore_clear_regs(phy, params, lane); in bnx2x_warpcore_config_init()
4530 if (vars->line_speed == SPEED_10000) { in bnx2x_warpcore_config_init()
4531 DP(NETIF_MSG_LINK, "Setting 10G XFI\n"); in bnx2x_warpcore_config_init()
4532 bnx2x_warpcore_set_10G_XFI(phy, params, 1); in bnx2x_warpcore_config_init()
4535 DP(NETIF_MSG_LINK, "1G Fiber\n"); in bnx2x_warpcore_config_init()
4538 DP(NETIF_MSG_LINK, "10/100/1G SGMII\n"); in bnx2x_warpcore_config_init()
4541 bnx2x_warpcore_set_sgmii_speed(phy, in bnx2x_warpcore_config_init()
4554 if ((params->loopback_mode == LOOPBACK_NONE) || in bnx2x_warpcore_config_init()
4555 (params->loopback_mode == LOOPBACK_EXT)) { in bnx2x_warpcore_config_init()
4556 if (bnx2x_is_sfp_module_plugged(phy, params)) in bnx2x_warpcore_config_init()
4557 bnx2x_sfp_module_detection(phy, params); in bnx2x_warpcore_config_init()
4560 phy, 1); in bnx2x_warpcore_config_init()
4563 bnx2x_warpcore_config_sfi(phy, params); in bnx2x_warpcore_config_init()
4567 if (vars->line_speed != SPEED_20000) { in bnx2x_warpcore_config_init()
4568 DP(NETIF_MSG_LINK, "Speed not supported yet\n"); in bnx2x_warpcore_config_init()
4571 DP(NETIF_MSG_LINK, "Setting 20G DXGXS\n"); in bnx2x_warpcore_config_init()
4572 bnx2x_warpcore_set_20G_DXGXS(bp, phy, lane); in bnx2x_warpcore_config_init()
4575 bnx2x_sfp_module_detection(phy, params); in bnx2x_warpcore_config_init()
4578 if (!params->loopback_mode) { in bnx2x_warpcore_config_init()
4579 bnx2x_warpcore_enable_AN_KR(phy, params, vars); in bnx2x_warpcore_config_init()
4581 DP(NETIF_MSG_LINK, "Setting KR 20G-Force\n"); in bnx2x_warpcore_config_init()
4582 bnx2x_warpcore_set_20G_force_KR2(phy, params); in bnx2x_warpcore_config_init()
4586 DP(NETIF_MSG_LINK, in bnx2x_warpcore_config_init()
4594 bnx2x_warpcore_reset_lane(bp, phy, 0); in bnx2x_warpcore_config_init()
4595 DP(NETIF_MSG_LINK, "Exit config init\n"); in bnx2x_warpcore_config_init()
4598 static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, in bnx2x_warpcore_link_reset() argument
4601 struct bnx2x *bp = params->bp; in bnx2x_warpcore_link_reset()
4603 bnx2x_sfp_e3_set_transmitter(params, phy, 0); in bnx2x_warpcore_link_reset()
4605 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_link_reset()
4607 bnx2x_warpcore_reset_lane(bp, phy, 1); in bnx2x_warpcore_link_reset()
4611 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_link_reset()
4614 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_link_reset()
4617 /* Update those 1-copy registers */ in bnx2x_warpcore_link_reset()
4618 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_warpcore_link_reset()
4620 /* Enable 1G MDIO (1-copy) */ in bnx2x_warpcore_link_reset()
4621 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_link_reset()
4625 bnx2x_cl45_read_and_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_link_reset()
4627 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_link_reset()
4629 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_link_reset()
4632 if (phy->flags & FLAGS_WC_DUAL_MODE) in bnx2x_warpcore_link_reset()
4634 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_link_reset()
4637 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_link_reset()
4641 if (phy->flags & FLAGS_WC_DUAL_MODE) { in bnx2x_warpcore_link_reset()
4646 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_link_reset()
4649 bnx2x_set_aer_mmd(params, phy); in bnx2x_warpcore_link_reset()
4653 static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, in bnx2x_set_warpcore_loopback() argument
4656 struct bnx2x *bp = params->bp; in bnx2x_set_warpcore_loopback()
4659 DP(NETIF_MSG_LINK, "Setting Warpcore loopback type %x, speed %d\n", in bnx2x_set_warpcore_loopback()
4660 params->loopback_mode, phy->req_line_speed); in bnx2x_set_warpcore_loopback()
4662 if (phy->req_line_speed < SPEED_10000 || in bnx2x_set_warpcore_loopback()
4663 phy->supported & SUPPORTED_20000baseKR2_Full) { in bnx2x_set_warpcore_loopback()
4664 /* 10/100/1000/20G-KR2 */ in bnx2x_set_warpcore_loopback()
4666 /* Update those 1-copy registers */ in bnx2x_set_warpcore_loopback()
4667 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_set_warpcore_loopback()
4669 /* Enable 1G MDIO (1-copy) */ in bnx2x_set_warpcore_loopback()
4670 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_set_warpcore_loopback()
4673 /* Set 1G loopback based on lane (1-copy) */ in bnx2x_set_warpcore_loopback()
4674 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_set_warpcore_loopback()
4675 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_set_warpcore_loopback()
4678 if (phy->flags & FLAGS_WC_DUAL_MODE) in bnx2x_set_warpcore_loopback()
4680 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_set_warpcore_loopback()
4684 /* Switch back to 4-copy registers */ in bnx2x_set_warpcore_loopback()
4685 bnx2x_set_aer_mmd(params, phy); in bnx2x_set_warpcore_loopback()
4687 /* 10G / 20G-DXGXS */ in bnx2x_set_warpcore_loopback()
4688 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_set_warpcore_loopback()
4691 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_set_warpcore_loopback()
4701 struct bnx2x *bp = params->bp; in bnx2x_sync_link()
4703 if (vars->link_status & LINK_STATUS_PHYSICAL_LINK_FLAG) in bnx2x_sync_link()
4704 vars->phy_flags |= PHY_PHYSICAL_LINK_FLAG; in bnx2x_sync_link()
4705 vars->link_up = (vars->link_status & LINK_STATUS_LINK_UP); in bnx2x_sync_link()
4706 if (vars->link_up) { in bnx2x_sync_link()
4707 DP(NETIF_MSG_LINK, "phy link up\n"); in bnx2x_sync_link()
4709 vars->phy_link_up = 1; in bnx2x_sync_link()
4710 vars->duplex = DUPLEX_FULL; in bnx2x_sync_link()
4711 switch (vars->link_status & in bnx2x_sync_link()
4714 vars->duplex = DUPLEX_HALF; in bnx2x_sync_link()
4717 vars->line_speed = SPEED_10; in bnx2x_sync_link()
4721 vars->duplex = DUPLEX_HALF; in bnx2x_sync_link()
4725 vars->line_speed = SPEED_100; in bnx2x_sync_link()
4729 vars->duplex = DUPLEX_HALF; in bnx2x_sync_link()
4732 vars->line_speed = SPEED_1000; in bnx2x_sync_link()
4736 vars->duplex = DUPLEX_HALF; in bnx2x_sync_link()
4739 vars->line_speed = SPEED_2500; in bnx2x_sync_link()
4743 vars->line_speed = SPEED_10000; in bnx2x_sync_link()
4746 vars->line_speed = SPEED_20000; in bnx2x_sync_link()
4751 vars->flow_ctrl = 0; in bnx2x_sync_link()
4752 if (vars->link_status & LINK_STATUS_TX_FLOW_CONTROL_ENABLED) in bnx2x_sync_link()
4753 vars->flow_ctrl |= BNX2X_FLOW_CTRL_TX; in bnx2x_sync_link()
4755 if (vars->link_status & LINK_STATUS_RX_FLOW_CONTROL_ENABLED) in bnx2x_sync_link()
4756 vars->flow_ctrl |= BNX2X_FLOW_CTRL_RX; in bnx2x_sync_link()
4758 if (!vars->flow_ctrl) in bnx2x_sync_link()
4759 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_sync_link()
4761 if (vars->line_speed && in bnx2x_sync_link()
4762 ((vars->line_speed == SPEED_10) || in bnx2x_sync_link()
4763 (vars->line_speed == SPEED_100))) { in bnx2x_sync_link()
4764 vars->phy_flags |= PHY_SGMII_FLAG; in bnx2x_sync_link()
4766 vars->phy_flags &= ~PHY_SGMII_FLAG; in bnx2x_sync_link()
4768 if (vars->line_speed && in bnx2x_sync_link()
4770 (vars->line_speed == SPEED_1000)) in bnx2x_sync_link()
4771 vars->phy_flags |= PHY_SGMII_FLAG; in bnx2x_sync_link()
4773 link_10g_plus = (vars->line_speed >= SPEED_10000); in bnx2x_sync_link()
4777 vars->mac_type = MAC_TYPE_XMAC; in bnx2x_sync_link()
4779 vars->mac_type = MAC_TYPE_BMAC; in bnx2x_sync_link()
4782 vars->mac_type = MAC_TYPE_UMAC; in bnx2x_sync_link()
4784 vars->mac_type = MAC_TYPE_EMAC; in bnx2x_sync_link()
4787 DP(NETIF_MSG_LINK, "phy link down\n"); in bnx2x_sync_link()
4789 vars->phy_link_up = 0; in bnx2x_sync_link()
4791 vars->line_speed = 0; in bnx2x_sync_link()
4792 vars->duplex = DUPLEX_FULL; in bnx2x_sync_link()
4793 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_sync_link()
4796 vars->mac_type = MAC_TYPE_NONE; in bnx2x_sync_link()
4797 if (vars->link_status & LINK_STATUS_PHYSICAL_LINK_FLAG) in bnx2x_sync_link()
4798 vars->phy_flags |= PHY_HALF_OPEN_CONN_FLAG; in bnx2x_sync_link()
4799 if (vars->link_status & LINK_STATUS_SFP_TX_FAULT) in bnx2x_sync_link()
4800 vars->phy_flags |= PHY_SFP_TX_FAULT_FLAG; in bnx2x_sync_link()
4807 struct bnx2x *bp = params->bp; in bnx2x_link_status_update()
4808 u8 port = params->port; in bnx2x_link_status_update()
4810 /* Update PHY configuration */ in bnx2x_link_status_update()
4813 vars->link_status = REG_RD(bp, params->shmem_base + in bnx2x_link_status_update()
4818 if (params->loopback_mode != LOOPBACK_NONE && in bnx2x_link_status_update()
4819 params->loopback_mode != LOOPBACK_EXT) in bnx2x_link_status_update()
4820 vars->link_status |= LINK_STATUS_LINK_UP; in bnx2x_link_status_update()
4823 vars->eee_status = REG_RD(bp, params->shmem2_base + in bnx2x_link_status_update()
4825 eee_status[params->port])); in bnx2x_link_status_update()
4827 vars->phy_flags = PHY_XGXS_FLAG; in bnx2x_link_status_update()
4830 sync_offset = params->shmem_base + in bnx2x_link_status_update()
4835 params->phy[INT_PHY].media_type = in bnx2x_link_status_update()
4838 params->phy[EXT_PHY1].media_type = in bnx2x_link_status_update()
4841 params->phy[EXT_PHY2].media_type = in bnx2x_link_status_update()
4844 DP(NETIF_MSG_LINK, "media_types = 0x%x\n", media_types); in bnx2x_link_status_update()
4847 sync_offset = params->shmem_base + in bnx2x_link_status_update()
4851 vars->aeu_int_mask = REG_RD(bp, sync_offset); in bnx2x_link_status_update()
4854 if (vars->link_status & LINK_STATUS_PFC_ENABLED) in bnx2x_link_status_update()
4855 params->feature_config_flags |= in bnx2x_link_status_update()
4858 params->feature_config_flags &= in bnx2x_link_status_update()
4862 params->link_attr_sync = SHMEM2_RD(bp, in bnx2x_link_status_update()
4863 link_attr_sync[params->port]); in bnx2x_link_status_update()
4865 DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", in bnx2x_link_status_update()
4866 vars->link_status, vars->phy_link_up, vars->aeu_int_mask); in bnx2x_link_status_update()
4867 DP(NETIF_MSG_LINK, "line_speed %x duplex %x flow_ctrl 0x%x\n", in bnx2x_link_status_update()
4868 vars->line_speed, vars->duplex, vars->flow_ctrl); in bnx2x_link_status_update()
4872 struct bnx2x_phy *phy) in bnx2x_set_master_ln() argument
4874 struct bnx2x *bp = params->bp; in bnx2x_set_master_ln()
4876 ser_lane = ((params->lane_config & in bnx2x_set_master_ln()
4881 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_master_ln()
4886 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_master_ln()
4893 struct bnx2x_phy *phy, in bnx2x_reset_unicore() argument
4896 struct bnx2x *bp = params->bp; in bnx2x_reset_unicore()
4899 CL22_RD_OVER_CL45(bp, phy, in bnx2x_reset_unicore()
4904 CL22_WR_OVER_CL45(bp, phy, in bnx2x_reset_unicore()
4910 bnx2x_set_serdes_access(bp, params->port); in bnx2x_reset_unicore()
4917 CL22_RD_OVER_CL45(bp, phy, in bnx2x_reset_unicore()
4928 netdev_err(bp->dev, "Warning: PHY was not initialized," in bnx2x_reset_unicore()
4930 params->port); in bnx2x_reset_unicore()
4931 DP(NETIF_MSG_LINK, "BUG! XGXS is still in reset!\n"); in bnx2x_reset_unicore()
4932 return -EINVAL; in bnx2x_reset_unicore()
4937 struct bnx2x_phy *phy) in bnx2x_set_swap_lanes() argument
4939 struct bnx2x *bp = params->bp; in bnx2x_set_swap_lanes()
4945 rx_lane_swap = ((params->lane_config & in bnx2x_set_swap_lanes()
4948 tx_lane_swap = ((params->lane_config & in bnx2x_set_swap_lanes()
4953 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_swap_lanes()
4960 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_swap_lanes()
4966 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_swap_lanes()
4972 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_swap_lanes()
4978 static void bnx2x_set_parallel_detection(struct bnx2x_phy *phy, in bnx2x_set_parallel_detection() argument
4981 struct bnx2x *bp = params->bp; in bnx2x_set_parallel_detection()
4983 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_parallel_detection()
4987 if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G) in bnx2x_set_parallel_detection()
4991 DP(NETIF_MSG_LINK, "phy->speed_cap_mask = 0x%x, control2 = 0x%x\n", in bnx2x_set_parallel_detection()
4992 phy->speed_cap_mask, control2); in bnx2x_set_parallel_detection()
4993 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_parallel_detection()
4998 if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) && in bnx2x_set_parallel_detection()
4999 (phy->speed_cap_mask & in bnx2x_set_parallel_detection()
5001 DP(NETIF_MSG_LINK, "XGXS\n"); in bnx2x_set_parallel_detection()
5003 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_parallel_detection()
5008 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_parallel_detection()
5017 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_parallel_detection()
5023 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_parallel_detection()
5031 static void bnx2x_set_autoneg(struct bnx2x_phy *phy, in bnx2x_set_autoneg() argument
5036 struct bnx2x *bp = params->bp; in bnx2x_set_autoneg()
5040 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5045 if (vars->line_speed == SPEED_AUTO_NEG) in bnx2x_set_autoneg()
5051 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5057 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5063 if (vars->line_speed == SPEED_AUTO_NEG) in bnx2x_set_autoneg()
5068 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5073 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5077 if (vars->line_speed == SPEED_AUTO_NEG) { in bnx2x_set_autoneg()
5086 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5093 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5099 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5107 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5111 if (phy->speed_cap_mask & in bnx2x_set_autoneg()
5114 if (phy->speed_cap_mask & in bnx2x_set_autoneg()
5118 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5129 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_autoneg()
5135 static void bnx2x_program_serdes(struct bnx2x_phy *phy, in bnx2x_program_serdes() argument
5139 struct bnx2x *bp = params->bp; in bnx2x_program_serdes()
5143 CL22_RD_OVER_CL45(bp, phy, in bnx2x_program_serdes()
5149 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_program_serdes()
5151 CL22_WR_OVER_CL45(bp, phy, in bnx2x_program_serdes()
5156 * - needed only if the speed is greater than 1G (2.5G or 10G) in bnx2x_program_serdes()
5158 CL22_RD_OVER_CL45(bp, phy, in bnx2x_program_serdes()
5162 DP(NETIF_MSG_LINK, "MDIO_REG_BANK_SERDES_DIGITAL = 0x%x\n", reg_val); in bnx2x_program_serdes()
5167 if (!((vars->line_speed == SPEED_1000) || in bnx2x_program_serdes()
5168 (vars->line_speed == SPEED_100) || in bnx2x_program_serdes()
5169 (vars->line_speed == SPEED_10))) { in bnx2x_program_serdes()
5173 if (vars->line_speed == SPEED_10000) in bnx2x_program_serdes()
5178 CL22_WR_OVER_CL45(bp, phy, in bnx2x_program_serdes()
5184 static void bnx2x_set_brcm_cl37_advertisement(struct bnx2x_phy *phy, in bnx2x_set_brcm_cl37_advertisement() argument
5187 struct bnx2x *bp = params->bp; in bnx2x_set_brcm_cl37_advertisement()
5191 if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G) in bnx2x_set_brcm_cl37_advertisement()
5193 if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) in bnx2x_set_brcm_cl37_advertisement()
5195 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_brcm_cl37_advertisement()
5199 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_brcm_cl37_advertisement()
5204 static void bnx2x_set_ieee_aneg_advertisement(struct bnx2x_phy *phy, in bnx2x_set_ieee_aneg_advertisement() argument
5208 struct bnx2x *bp = params->bp; in bnx2x_set_ieee_aneg_advertisement()
5212 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_ieee_aneg_advertisement()
5215 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_ieee_aneg_advertisement()
5220 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_ieee_aneg_advertisement()
5225 static void bnx2x_restart_autoneg(struct bnx2x_phy *phy, in bnx2x_restart_autoneg() argument
5229 struct bnx2x *bp = params->bp; in bnx2x_restart_autoneg()
5232 DP(NETIF_MSG_LINK, "bnx2x_restart_autoneg\n"); in bnx2x_restart_autoneg()
5236 CL22_RD_OVER_CL45(bp, phy, in bnx2x_restart_autoneg()
5241 CL22_WR_OVER_CL45(bp, phy, in bnx2x_restart_autoneg()
5249 CL22_RD_OVER_CL45(bp, phy, in bnx2x_restart_autoneg()
5253 DP(NETIF_MSG_LINK, in bnx2x_restart_autoneg()
5256 CL22_WR_OVER_CL45(bp, phy, in bnx2x_restart_autoneg()
5265 static void bnx2x_initialize_sgmii_process(struct bnx2x_phy *phy, in bnx2x_initialize_sgmii_process() argument
5269 struct bnx2x *bp = params->bp; in bnx2x_initialize_sgmii_process()
5274 CL22_RD_OVER_CL45(bp, phy, in bnx2x_initialize_sgmii_process()
5283 CL22_WR_OVER_CL45(bp, phy, in bnx2x_initialize_sgmii_process()
5289 if (!(vars->line_speed == SPEED_AUTO_NEG)) { in bnx2x_initialize_sgmii_process()
5293 CL22_RD_OVER_CL45(bp, phy, in bnx2x_initialize_sgmii_process()
5301 switch (vars->line_speed) { in bnx2x_initialize_sgmii_process()
5315 DP(NETIF_MSG_LINK, "Invalid line_speed 0x%x\n", in bnx2x_initialize_sgmii_process()
5316 vars->line_speed); in bnx2x_initialize_sgmii_process()
5321 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_initialize_sgmii_process()
5324 CL22_WR_OVER_CL45(bp, phy, in bnx2x_initialize_sgmii_process()
5331 bnx2x_restart_autoneg(phy, params, 0); in bnx2x_initialize_sgmii_process()
5337 static int bnx2x_direct_parallel_detect_used(struct bnx2x_phy *phy, in bnx2x_direct_parallel_detect_used() argument
5340 struct bnx2x *bp = params->bp; in bnx2x_direct_parallel_detect_used()
5342 if (phy->req_line_speed != SPEED_AUTO_NEG) in bnx2x_direct_parallel_detect_used()
5344 CL22_RD_OVER_CL45(bp, phy, in bnx2x_direct_parallel_detect_used()
5348 CL22_RD_OVER_CL45(bp, phy, in bnx2x_direct_parallel_detect_used()
5353 DP(NETIF_MSG_LINK, "1G parallel detect link on port %d\n", in bnx2x_direct_parallel_detect_used()
5354 params->port); in bnx2x_direct_parallel_detect_used()
5358 CL22_RD_OVER_CL45(bp, phy, in bnx2x_direct_parallel_detect_used()
5364 DP(NETIF_MSG_LINK, "10G parallel detect link on port %d\n", in bnx2x_direct_parallel_detect_used()
5365 params->port); in bnx2x_direct_parallel_detect_used()
5371 static void bnx2x_update_adv_fc(struct bnx2x_phy *phy, in bnx2x_update_adv_fc() argument
5379 struct bnx2x *bp = params->bp; in bnx2x_update_adv_fc()
5386 CL22_RD_OVER_CL45(bp, phy, in bnx2x_update_adv_fc()
5390 CL22_RD_OVER_CL45(bp, phy, in bnx2x_update_adv_fc()
5398 DP(NETIF_MSG_LINK, "pause_result CL73 0x%x\n", pause_result); in bnx2x_update_adv_fc()
5400 CL22_RD_OVER_CL45(bp, phy, in bnx2x_update_adv_fc()
5404 CL22_RD_OVER_CL45(bp, phy, in bnx2x_update_adv_fc()
5412 DP(NETIF_MSG_LINK, "pause_result CL37 0x%x\n", pause_result); in bnx2x_update_adv_fc()
5414 bnx2x_pause_resolve(phy, params, vars, pause_result); in bnx2x_update_adv_fc()
5418 static void bnx2x_flow_ctrl_resolve(struct bnx2x_phy *phy, in bnx2x_flow_ctrl_resolve() argument
5423 struct bnx2x *bp = params->bp; in bnx2x_flow_ctrl_resolve()
5424 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_flow_ctrl_resolve()
5427 if (phy->req_flow_ctrl != BNX2X_FLOW_CTRL_AUTO) { in bnx2x_flow_ctrl_resolve()
5428 /* Update the advertised flow-controled of LD/LP in AN */ in bnx2x_flow_ctrl_resolve()
5429 if (phy->req_line_speed == SPEED_AUTO_NEG) in bnx2x_flow_ctrl_resolve()
5430 bnx2x_update_adv_fc(phy, params, vars, gp_status); in bnx2x_flow_ctrl_resolve()
5431 /* But set the flow-control result as the requested one */ in bnx2x_flow_ctrl_resolve()
5432 vars->flow_ctrl = phy->req_flow_ctrl; in bnx2x_flow_ctrl_resolve()
5433 } else if (phy->req_line_speed != SPEED_AUTO_NEG) in bnx2x_flow_ctrl_resolve()
5434 vars->flow_ctrl = params->req_fc_auto_adv; in bnx2x_flow_ctrl_resolve()
5436 (!(vars->phy_flags & PHY_SGMII_FLAG))) { in bnx2x_flow_ctrl_resolve()
5437 if (bnx2x_direct_parallel_detect_used(phy, params)) { in bnx2x_flow_ctrl_resolve()
5438 vars->flow_ctrl = params->req_fc_auto_adv; in bnx2x_flow_ctrl_resolve()
5441 bnx2x_update_adv_fc(phy, params, vars, gp_status); in bnx2x_flow_ctrl_resolve()
5443 DP(NETIF_MSG_LINK, "flow_ctrl 0x%x\n", vars->flow_ctrl); in bnx2x_flow_ctrl_resolve()
5446 static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy, in bnx2x_check_fallback_to_cl37() argument
5449 struct bnx2x *bp = params->bp; in bnx2x_check_fallback_to_cl37()
5451 DP(NETIF_MSG_LINK, "bnx2x_check_fallback_to_cl37\n"); in bnx2x_check_fallback_to_cl37()
5453 CL22_RD_OVER_CL45(bp, phy, in bnx2x_check_fallback_to_cl37()
5459 DP(NETIF_MSG_LINK, "Signal is not detected. Restoring CL73." in bnx2x_check_fallback_to_cl37()
5461 CL22_WR_OVER_CL45(bp, phy, in bnx2x_check_fallback_to_cl37()
5468 CL22_RD_OVER_CL45(bp, phy, in bnx2x_check_fallback_to_cl37()
5477 DP(NETIF_MSG_LINK, "CL73 state-machine is not stable. " in bnx2x_check_fallback_to_cl37()
5484 CL22_RD_OVER_CL45(bp, phy, in bnx2x_check_fallback_to_cl37()
5493 DP(NETIF_MSG_LINK, "No CL37 FSM were received. " in bnx2x_check_fallback_to_cl37()
5501 * restart cl37 auto-neg in bnx2x_check_fallback_to_cl37()
5505 CL22_WR_OVER_CL45(bp, phy, in bnx2x_check_fallback_to_cl37()
5510 bnx2x_restart_autoneg(phy, params, 0); in bnx2x_check_fallback_to_cl37()
5511 DP(NETIF_MSG_LINK, "Disabling CL73, and restarting CL37 autoneg\n"); in bnx2x_check_fallback_to_cl37()
5514 static void bnx2x_xgxs_an_resolve(struct bnx2x_phy *phy, in bnx2x_xgxs_an_resolve() argument
5520 vars->link_status |= in bnx2x_xgxs_an_resolve()
5523 if (bnx2x_direct_parallel_detect_used(phy, params)) in bnx2x_xgxs_an_resolve()
5524 vars->link_status |= in bnx2x_xgxs_an_resolve()
5527 static int bnx2x_get_link_speed_duplex(struct bnx2x_phy *phy, in bnx2x_get_link_speed_duplex() argument
5534 struct bnx2x *bp = params->bp; in bnx2x_get_link_speed_duplex()
5535 if (phy->req_line_speed == SPEED_AUTO_NEG) in bnx2x_get_link_speed_duplex()
5536 vars->link_status |= LINK_STATUS_AUTO_NEGOTIATE_ENABLED; in bnx2x_get_link_speed_duplex()
5538 DP(NETIF_MSG_LINK, "phy link up\n"); in bnx2x_get_link_speed_duplex()
5540 vars->phy_link_up = 1; in bnx2x_get_link_speed_duplex()
5541 vars->link_status |= LINK_STATUS_LINK_UP; in bnx2x_get_link_speed_duplex()
5545 vars->line_speed = SPEED_10; in bnx2x_get_link_speed_duplex()
5547 vars->link_status |= LINK_10TFD; in bnx2x_get_link_speed_duplex()
5549 vars->link_status |= LINK_10THD; in bnx2x_get_link_speed_duplex()
5553 vars->line_speed = SPEED_100; in bnx2x_get_link_speed_duplex()
5555 vars->link_status |= LINK_100TXFD; in bnx2x_get_link_speed_duplex()
5557 vars->link_status |= LINK_100TXHD; in bnx2x_get_link_speed_duplex()
5562 vars->line_speed = SPEED_1000; in bnx2x_get_link_speed_duplex()
5564 vars->link_status |= LINK_1000TFD; in bnx2x_get_link_speed_duplex()
5566 vars->link_status |= LINK_1000THD; in bnx2x_get_link_speed_duplex()
5570 vars->line_speed = SPEED_2500; in bnx2x_get_link_speed_duplex()
5572 vars->link_status |= LINK_2500TFD; in bnx2x_get_link_speed_duplex()
5574 vars->link_status |= LINK_2500THD; in bnx2x_get_link_speed_duplex()
5579 DP(NETIF_MSG_LINK, in bnx2x_get_link_speed_duplex()
5582 return -EINVAL; in bnx2x_get_link_speed_duplex()
5590 vars->line_speed = SPEED_10000; in bnx2x_get_link_speed_duplex()
5591 vars->link_status |= LINK_10GTFD; in bnx2x_get_link_speed_duplex()
5595 vars->line_speed = SPEED_20000; in bnx2x_get_link_speed_duplex()
5596 vars->link_status |= LINK_20GTFD; in bnx2x_get_link_speed_duplex()
5599 DP(NETIF_MSG_LINK, in bnx2x_get_link_speed_duplex()
5602 return -EINVAL; in bnx2x_get_link_speed_duplex()
5605 DP(NETIF_MSG_LINK, "phy link down\n"); in bnx2x_get_link_speed_duplex()
5607 vars->phy_link_up = 0; in bnx2x_get_link_speed_duplex()
5609 vars->duplex = DUPLEX_FULL; in bnx2x_get_link_speed_duplex()
5610 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_get_link_speed_duplex()
5611 vars->mac_type = MAC_TYPE_NONE; in bnx2x_get_link_speed_duplex()
5613 DP(NETIF_MSG_LINK, " phy_link_up %x line_speed %d\n", in bnx2x_get_link_speed_duplex()
5614 vars->phy_link_up, vars->line_speed); in bnx2x_get_link_speed_duplex()
5618 static u8 bnx2x_link_settings_status(struct bnx2x_phy *phy, in bnx2x_link_settings_status() argument
5622 struct bnx2x *bp = params->bp; in bnx2x_link_settings_status()
5628 CL22_RD_OVER_CL45(bp, phy, in bnx2x_link_settings_status()
5637 DP(NETIF_MSG_LINK, "gp_status 0x%x, is_link_up %d, speed_mask 0x%x\n", in bnx2x_link_settings_status()
5639 rc = bnx2x_get_link_speed_duplex(phy, params, vars, link_up, speed_mask, in bnx2x_link_settings_status()
5641 if (rc == -EINVAL) in bnx2x_link_settings_status()
5646 vars->duplex = duplex; in bnx2x_link_settings_status()
5647 bnx2x_flow_ctrl_resolve(phy, params, vars, gp_status); in bnx2x_link_settings_status()
5648 if (phy->req_line_speed == SPEED_AUTO_NEG) in bnx2x_link_settings_status()
5649 bnx2x_xgxs_an_resolve(phy, params, vars, in bnx2x_link_settings_status()
5653 if ((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_link_settings_status()
5656 bnx2x_check_fallback_to_cl37(phy, params); in bnx2x_link_settings_status()
5662 (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE)) { in bnx2x_link_settings_status()
5665 CL22_RD_OVER_CL45(bp, phy, MDIO_REG_BANK_CL73_IEEEB1, in bnx2x_link_settings_status()
5669 vars->link_status |= in bnx2x_link_settings_status()
5673 vars->link_status |= in bnx2x_link_settings_status()
5676 CL22_RD_OVER_CL45(bp, phy, MDIO_REG_BANK_OVER_1G, in bnx2x_link_settings_status()
5680 vars->link_status |= in bnx2x_link_settings_status()
5683 vars->link_status |= in bnx2x_link_settings_status()
5687 DP(NETIF_MSG_LINK, "duplex %x flow_ctrl 0x%x link_status 0x%x\n", in bnx2x_link_settings_status()
5688 vars->duplex, vars->flow_ctrl, vars->link_status); in bnx2x_link_settings_status()
5692 static u8 bnx2x_warpcore_read_status(struct bnx2x_phy *phy, in bnx2x_warpcore_read_status() argument
5696 struct bnx2x *bp = params->bp; in bnx2x_warpcore_read_status()
5700 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_read_status()
5702 if ((params->loopback_mode) && in bnx2x_warpcore_read_status()
5703 (phy->flags & FLAGS_WC_DUAL_MODE)) { in bnx2x_warpcore_read_status()
5704 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5706 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5709 } else if ((phy->req_line_speed > SPEED_10000) && in bnx2x_warpcore_read_status()
5710 (phy->supported & SUPPORTED_20000baseMLD2_Full)) { in bnx2x_warpcore_read_status()
5712 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5714 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5716 DP(NETIF_MSG_LINK, "PCS RX link status = 0x%x-->0x%x\n", in bnx2x_warpcore_read_status()
5720 bnx2x_ext_phy_resolve_fc(phy, params, vars); in bnx2x_warpcore_read_status()
5722 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5725 DP(NETIF_MSG_LINK, "0x81d1 = 0x%x\n", gp_status1); in bnx2x_warpcore_read_status()
5731 if (phy->supported & SUPPORTED_20000baseKR2_Full) { in bnx2x_warpcore_read_status()
5733 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_read_status()
5735 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_read_status()
5741 if (phy->req_line_speed == SPEED_AUTO_NEG) { in bnx2x_warpcore_read_status()
5743 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5747 vars->link_status |= in bnx2x_warpcore_read_status()
5751 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5755 vars->link_status |= in bnx2x_warpcore_read_status()
5758 bnx2x_ext_phy_resolve_fc(phy, params, vars); in bnx2x_warpcore_read_status()
5759 vars->duplex = duplex; in bnx2x_warpcore_read_status()
5763 if ((vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) && in bnx2x_warpcore_read_status()
5767 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_warpcore_read_status()
5771 vars->link_status |= in bnx2x_warpcore_read_status()
5775 vars->link_status |= in bnx2x_warpcore_read_status()
5778 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5782 vars->link_status |= in bnx2x_warpcore_read_status()
5785 vars->link_status |= in bnx2x_warpcore_read_status()
5792 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5795 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_read_status()
5798 DP(NETIF_MSG_LINK, "lane %d gp_speed 0x%x\n", lane, gp_speed); in bnx2x_warpcore_read_status()
5805 rc = bnx2x_get_link_speed_duplex(phy, params, vars, link_up, gp_speed, in bnx2x_warpcore_read_status()
5809 if ((!link_up) && (phy->media_type == ETH_PHY_KR) && in bnx2x_warpcore_read_status()
5810 (!(phy->flags & FLAGS_WC_DUAL_MODE))) in bnx2x_warpcore_read_status()
5811 vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; in bnx2x_warpcore_read_status()
5813 DP(NETIF_MSG_LINK, "duplex %x flow_ctrl 0x%x link_status 0x%x\n", in bnx2x_warpcore_read_status()
5814 vars->duplex, vars->flow_ctrl, vars->link_status); in bnx2x_warpcore_read_status()
5819 struct bnx2x *bp = params->bp; in bnx2x_set_gmii_tx_driver()
5820 struct bnx2x_phy *phy = ¶ms->phy[INT_PHY]; in bnx2x_set_gmii_tx_driver() local
5826 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_gmii_tx_driver()
5839 bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0)) { in bnx2x_set_gmii_tx_driver()
5840 CL22_RD_OVER_CL45(bp, phy, in bnx2x_set_gmii_tx_driver()
5849 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_gmii_tx_driver()
5859 struct bnx2x *bp = params->bp; in bnx2x_emac_program()
5860 u8 port = params->port; in bnx2x_emac_program()
5863 DP(NETIF_MSG_LINK, "setting link speed & duplex\n"); in bnx2x_emac_program()
5869 switch (vars->line_speed) { in bnx2x_emac_program()
5888 DP(NETIF_MSG_LINK, "Invalid line_speed 0x%x\n", in bnx2x_emac_program()
5889 vars->line_speed); in bnx2x_emac_program()
5890 return -EINVAL; in bnx2x_emac_program()
5893 if (vars->duplex == DUPLEX_HALF) in bnx2x_emac_program()
5899 bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed); in bnx2x_emac_program()
5903 static void bnx2x_set_preemphasis(struct bnx2x_phy *phy, in bnx2x_set_preemphasis() argument
5908 struct bnx2x *bp = params->bp; in bnx2x_set_preemphasis()
5911 bank += (MDIO_REG_BANK_RX1-MDIO_REG_BANK_RX0), i++) { in bnx2x_set_preemphasis()
5912 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_preemphasis()
5915 phy->rx_preemphasis[i]); in bnx2x_set_preemphasis()
5919 bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0), i++) { in bnx2x_set_preemphasis()
5920 CL22_WR_OVER_CL45(bp, phy, in bnx2x_set_preemphasis()
5923 phy->tx_preemphasis[i]); in bnx2x_set_preemphasis()
5927 static void bnx2x_xgxs_config_init(struct bnx2x_phy *phy, in bnx2x_xgxs_config_init() argument
5931 struct bnx2x *bp = params->bp; in bnx2x_xgxs_config_init()
5933 (params->loopback_mode == LOOPBACK_XGXS)); in bnx2x_xgxs_config_init()
5934 if (!(vars->phy_flags & PHY_SGMII_FLAG)) { in bnx2x_xgxs_config_init()
5936 (params->feature_config_flags & in bnx2x_xgxs_config_init()
5938 bnx2x_set_preemphasis(phy, params); in bnx2x_xgxs_config_init()
5941 if (vars->line_speed != SPEED_AUTO_NEG || in bnx2x_xgxs_config_init()
5943 params->loopback_mode == LOOPBACK_EXT)) { in bnx2x_xgxs_config_init()
5944 DP(NETIF_MSG_LINK, "not SGMII, no AN\n"); in bnx2x_xgxs_config_init()
5947 bnx2x_set_autoneg(phy, params, vars, 0); in bnx2x_xgxs_config_init()
5950 bnx2x_program_serdes(phy, params, vars); in bnx2x_xgxs_config_init()
5953 DP(NETIF_MSG_LINK, "not SGMII, AN\n"); in bnx2x_xgxs_config_init()
5956 bnx2x_set_brcm_cl37_advertisement(phy, params); in bnx2x_xgxs_config_init()
5959 bnx2x_set_ieee_aneg_advertisement(phy, params, in bnx2x_xgxs_config_init()
5960 vars->ieee_fc); in bnx2x_xgxs_config_init()
5963 bnx2x_set_autoneg(phy, params, vars, enable_cl73); in bnx2x_xgxs_config_init()
5966 bnx2x_restart_autoneg(phy, params, enable_cl73); in bnx2x_xgxs_config_init()
5970 DP(NETIF_MSG_LINK, "SGMII\n"); in bnx2x_xgxs_config_init()
5972 bnx2x_initialize_sgmii_process(phy, params, vars); in bnx2x_xgxs_config_init()
5976 static int bnx2x_prepare_xgxs(struct bnx2x_phy *phy, in bnx2x_prepare_xgxs() argument
5981 vars->phy_flags |= PHY_XGXS_FLAG; in bnx2x_prepare_xgxs()
5982 if ((phy->req_line_speed && in bnx2x_prepare_xgxs()
5983 ((phy->req_line_speed == SPEED_100) || in bnx2x_prepare_xgxs()
5984 (phy->req_line_speed == SPEED_10))) || in bnx2x_prepare_xgxs()
5985 (!phy->req_line_speed && in bnx2x_prepare_xgxs()
5986 (phy->speed_cap_mask >= in bnx2x_prepare_xgxs()
5988 (phy->speed_cap_mask < in bnx2x_prepare_xgxs()
5990 (phy->type == PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT_SD)) in bnx2x_prepare_xgxs()
5991 vars->phy_flags |= PHY_SGMII_FLAG; in bnx2x_prepare_xgxs()
5993 vars->phy_flags &= ~PHY_SGMII_FLAG; in bnx2x_prepare_xgxs()
5995 bnx2x_calc_ieee_aneg_adv(phy, params, &vars->ieee_fc); in bnx2x_prepare_xgxs()
5996 bnx2x_set_aer_mmd(params, phy); in bnx2x_prepare_xgxs()
5997 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) in bnx2x_prepare_xgxs()
5998 bnx2x_set_master_ln(params, phy); in bnx2x_prepare_xgxs()
6000 rc = bnx2x_reset_unicore(params, phy, 0); in bnx2x_prepare_xgxs()
6005 bnx2x_set_aer_mmd(params, phy); in bnx2x_prepare_xgxs()
6007 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) { in bnx2x_prepare_xgxs()
6008 bnx2x_set_master_ln(params, phy); in bnx2x_prepare_xgxs()
6009 bnx2x_set_swap_lanes(params, phy); in bnx2x_prepare_xgxs()
6016 struct bnx2x_phy *phy, in bnx2x_wait_reset_complete() argument
6022 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) in bnx2x_wait_reset_complete()
6023 bnx2x_cl22_read(bp, phy, in bnx2x_wait_reset_complete()
6026 bnx2x_cl45_read(bp, phy, in bnx2x_wait_reset_complete()
6035 netdev_err(bp->dev, "Warning: PHY was not initialized," in bnx2x_wait_reset_complete()
6037 params->port); in bnx2x_wait_reset_complete()
6038 DP(NETIF_MSG_LINK, "control reg 0x%x (after %d ms)\n", ctrl, cnt); in bnx2x_wait_reset_complete()
6044 u8 port = params->port; in bnx2x_link_int_enable()
6046 struct bnx2x *bp = params->bp; in bnx2x_link_int_enable()
6053 } else if (params->switch_cfg == SWITCH_CFG_10G) { in bnx2x_link_int_enable()
6056 DP(NETIF_MSG_LINK, "enabled XGXS interrupt\n"); in bnx2x_link_int_enable()
6058 params->phy[INT_PHY].type != in bnx2x_link_int_enable()
6061 DP(NETIF_MSG_LINK, "enabled external phy int\n"); in bnx2x_link_int_enable()
6066 DP(NETIF_MSG_LINK, "enabled SerDes interrupt\n"); in bnx2x_link_int_enable()
6068 params->phy[INT_PHY].type != in bnx2x_link_int_enable()
6071 DP(NETIF_MSG_LINK, "enabled external phy int\n"); in bnx2x_link_int_enable()
6078 DP(NETIF_MSG_LINK, "port %x, is_xgxs %x, int_status 0x%x\n", port, in bnx2x_link_int_enable()
6079 (params->switch_cfg == SWITCH_CFG_10G), in bnx2x_link_int_enable()
6081 DP(NETIF_MSG_LINK, " int_mask 0x%x, MI_INT %x, SERDES_LINK %x\n", in bnx2x_link_int_enable()
6085 DP(NETIF_MSG_LINK, " 10G %x, XGXS_LINK %x\n", in bnx2x_link_int_enable()
6095 /* Disable the MI INT ( external phy int ) by writing 1 to the in bnx2x_rearm_latch_signal()
6096 * status register. Link down indication is high-active-signal, in bnx2x_rearm_latch_signal()
6102 DP(NETIF_MSG_LINK, "latch_status = 0x%x\n", latch_status); in bnx2x_rearm_latch_signal()
6103 /* Handle only those with latched-signal=up.*/ in bnx2x_rearm_latch_signal()
6117 /* For all latched-signal=up : Re-Arm Latch signals */ in bnx2x_rearm_latch_signal()
6121 /* For all latched-signal=up,Write original_signal to status */ in bnx2x_rearm_latch_signal()
6127 struct bnx2x *bp = params->bp; in bnx2x_link_int_ack()
6128 u8 port = params->port; in bnx2x_link_int_ack()
6137 if (vars->phy_link_up) { in bnx2x_link_int_ack()
6143 else if (params->switch_cfg == SWITCH_CFG_10G) { in bnx2x_link_int_ack()
6148 ((params->lane_config & in bnx2x_link_int_ack()
6156 DP(NETIF_MSG_LINK, "Ack link up interrupt with mask 0x%x\n", in bnx2x_link_int_ack()
6167 (*len)--; in bnx2x_null_format_ver()
6178 return -EINVAL; in bnx2x_format_ver()
6182 *len -= ret; in bnx2x_format_ver()
6193 return -EINVAL; in bnx2x_3_seq_format_ver()
6197 *len -= ret; in bnx2x_3_seq_format_ver()
6210 return -EINVAL; in bnx2x_get_ext_phy_fw_version()
6211 bp = params->bp; in bnx2x_get_ext_phy_fw_version()
6213 /* Extract first external phy*/ in bnx2x_get_ext_phy_fw_version()
6215 spirom_ver = REG_RD(bp, params->phy[EXT_PHY1].ver_addr); in bnx2x_get_ext_phy_fw_version()
6217 if (params->phy[EXT_PHY1].format_fw_ver) { in bnx2x_get_ext_phy_fw_version()
6218 status |= params->phy[EXT_PHY1].format_fw_ver(spirom_ver, in bnx2x_get_ext_phy_fw_version()
6221 ver_p += (len - remain_len); in bnx2x_get_ext_phy_fw_version()
6223 if ((params->num_phys == MAX_PHYS) && in bnx2x_get_ext_phy_fw_version()
6224 (params->phy[EXT_PHY2].ver_addr != 0)) { in bnx2x_get_ext_phy_fw_version()
6225 spirom_ver = REG_RD(bp, params->phy[EXT_PHY2].ver_addr); in bnx2x_get_ext_phy_fw_version()
6226 if (params->phy[EXT_PHY2].format_fw_ver) { in bnx2x_get_ext_phy_fw_version()
6229 remain_len--; in bnx2x_get_ext_phy_fw_version()
6230 status |= params->phy[EXT_PHY2].format_fw_ver( in bnx2x_get_ext_phy_fw_version()
6234 ver_p = version + (len - remain_len); in bnx2x_get_ext_phy_fw_version()
6241 static void bnx2x_set_xgxs_loopback(struct bnx2x_phy *phy, in bnx2x_set_xgxs_loopback() argument
6244 u8 port = params->port; in bnx2x_set_xgxs_loopback()
6245 struct bnx2x *bp = params->bp; in bnx2x_set_xgxs_loopback()
6247 if (phy->req_line_speed != SPEED_1000) { in bnx2x_set_xgxs_loopback()
6250 DP(NETIF_MSG_LINK, "XGXS 10G loopback enable\n"); in bnx2x_set_xgxs_loopback()
6261 bnx2x_cl45_write(bp, phy, in bnx2x_set_xgxs_loopback()
6267 bnx2x_cl45_write(bp, phy, in bnx2x_set_xgxs_loopback()
6274 bnx2x_set_aer_mmd(params, phy); in bnx2x_set_xgxs_loopback()
6283 DP(NETIF_MSG_LINK, "XGXS 1G loopback enable\n"); in bnx2x_set_xgxs_loopback()
6284 bnx2x_cl45_read(bp, phy, 5, in bnx2x_set_xgxs_loopback()
6288 bnx2x_cl45_write(bp, phy, 5, in bnx2x_set_xgxs_loopback()
6299 u8 port = params->port; in bnx2x_set_led()
6300 u16 hw_led_mode = params->hw_led_mode; in bnx2x_set_led()
6305 struct bnx2x *bp = params->bp; in bnx2x_set_led()
6306 DP(NETIF_MSG_LINK, "bnx2x_set_led: port %x, mode %d\n", port, mode); in bnx2x_set_led()
6307 DP(NETIF_MSG_LINK, "speed 0x%x, hw_led_mode 0x%x\n", in bnx2x_set_led()
6311 if (params->phy[phy_idx].set_link_led) { in bnx2x_set_led()
6312 params->phy[phy_idx].set_link_led( in bnx2x_set_led()
6313 ¶ms->phy[phy_idx], params, mode); in bnx2x_set_led()
6325 if (params->phy[EXT_PHY1].type == in bnx2x_set_led()
6340 if (!vars->link_up) in bnx2x_set_led()
6344 if (((params->phy[EXT_PHY1].type == in bnx2x_set_led()
6346 (params->phy[EXT_PHY1].type == in bnx2x_set_led()
6348 CHIP_IS_E2(bp) && params->num_phys == 2) { in bnx2x_set_led()
6349 /* This is a work-around for E2+8727 Configurations */ in bnx2x_set_led()
6367 /* This is a work-around for HW issue found when link in bnx2x_set_led()
6382 } else if ((params->phy[EXT_PHY1].type == in bnx2x_set_led()
6394 u32 nig_led_mode = ((params->hw_led_mode << in bnx2x_set_led()
6433 rc = -EINVAL; in bnx2x_set_led()
6434 DP(NETIF_MSG_LINK, "bnx2x_set_led: Invalid led mode %d\n", in bnx2x_set_led()
6448 struct bnx2x *bp = params->bp; in bnx2x_test_link()
6452 struct bnx2x_phy *int_phy = ¶ms->phy[INT_PHY]; in bnx2x_test_link()
6456 if (params->req_line_speed[LINK_CONFIG_IDX(INT_PHY)] in bnx2x_test_link()
6475 return -ESRCH; in bnx2x_test_link()
6481 /* Link is up only if both local phy and external phy are up */ in bnx2x_test_link()
6483 return -ESRCH; in bnx2x_test_link()
6485 /* In XGXS loopback mode, do not check external PHY */ in bnx2x_test_link()
6486 if (params->loopback_mode == LOOPBACK_XGXS) in bnx2x_test_link()
6489 switch (params->num_phys) { in bnx2x_test_link()
6491 /* No external PHY */ in bnx2x_test_link()
6494 ext_phy_link_up = params->phy[EXT_PHY1].read_status( in bnx2x_test_link()
6495 ¶ms->phy[EXT_PHY1], in bnx2x_test_link()
6499 for (phy_index = EXT_PHY1; phy_index < params->num_phys; in bnx2x_test_link()
6501 serdes_phy_type = ((params->phy[phy_index].media_type == in bnx2x_test_link()
6503 (params->phy[phy_index].media_type == in bnx2x_test_link()
6505 (params->phy[phy_index].media_type == in bnx2x_test_link()
6507 (params->phy[phy_index].media_type == in bnx2x_test_link()
6512 if (params->phy[phy_index].read_status) { in bnx2x_test_link()
6514 params->phy[phy_index].read_status( in bnx2x_test_link()
6515 ¶ms->phy[phy_index], in bnx2x_test_link()
6523 return -ESRCH; in bnx2x_test_link()
6530 struct bnx2x *bp = params->bp; in bnx2x_link_initialize()
6531 /* In case of external phy existence, the line speed would be the in bnx2x_link_initialize()
6532 * line speed linked up by the external phy. In case it is direct in bnx2x_link_initialize()
6536 vars->line_speed = params->phy[INT_PHY].req_line_speed; in bnx2x_link_initialize()
6538 /* Initialize the internal phy in case this is a direct board in bnx2x_link_initialize()
6539 * (no external phys), or this board has external phy which requires in bnx2x_link_initialize()
6543 bnx2x_prepare_xgxs(¶ms->phy[INT_PHY], params, vars); in bnx2x_link_initialize()
6544 /* init ext phy and enable link state int */ in bnx2x_link_initialize()
6546 (params->loopback_mode == LOOPBACK_XGXS)); in bnx2x_link_initialize()
6549 (params->phy[EXT_PHY1].flags & FLAGS_INIT_XGXS_FIRST) || in bnx2x_link_initialize()
6550 (params->loopback_mode == LOOPBACK_EXT_PHY)) { in bnx2x_link_initialize()
6551 struct bnx2x_phy *phy = ¶ms->phy[INT_PHY]; in bnx2x_link_initialize() local
6552 if (vars->line_speed == SPEED_AUTO_NEG && in bnx2x_link_initialize()
6555 bnx2x_set_parallel_detection(phy, params); in bnx2x_link_initialize()
6556 if (params->phy[INT_PHY].config_init) in bnx2x_link_initialize()
6557 params->phy[INT_PHY].config_init(phy, params, vars); in bnx2x_link_initialize()
6560 /* Re-read this value in case it was changed inside config_init due to in bnx2x_link_initialize()
6563 vars->line_speed = params->phy[INT_PHY].req_line_speed; in bnx2x_link_initialize()
6565 /* Init external phy*/ in bnx2x_link_initialize()
6567 if (params->phy[INT_PHY].supported & in bnx2x_link_initialize()
6569 vars->link_status |= LINK_STATUS_SERDES_LINK; in bnx2x_link_initialize()
6571 for (phy_index = EXT_PHY1; phy_index < params->num_phys; in bnx2x_link_initialize()
6573 /* No need to initialize second phy in case of first in bnx2x_link_initialize()
6574 * phy only selection. In case of second phy, we do in bnx2x_link_initialize()
6575 * need to initialize the first phy, since they are in bnx2x_link_initialize()
6578 if (params->phy[phy_index].supported & in bnx2x_link_initialize()
6580 vars->link_status |= LINK_STATUS_SERDES_LINK; in bnx2x_link_initialize()
6585 DP(NETIF_MSG_LINK, in bnx2x_link_initialize()
6586 "Not initializing second phy\n"); in bnx2x_link_initialize()
6589 params->phy[phy_index].config_init( in bnx2x_link_initialize()
6590 ¶ms->phy[phy_index], in bnx2x_link_initialize()
6594 /* Reset the interrupt indication after phy was initialized */ in bnx2x_link_initialize()
6596 params->port*4, in bnx2x_link_initialize()
6604 static void bnx2x_int_link_reset(struct bnx2x_phy *phy, in bnx2x_int_link_reset() argument
6608 REG_WR(params->bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, in bnx2x_int_link_reset()
6609 (0x1ff << (params->port*16))); in bnx2x_int_link_reset()
6612 static void bnx2x_common_ext_link_reset(struct bnx2x_phy *phy, in bnx2x_common_ext_link_reset() argument
6615 struct bnx2x *bp = params->bp; in bnx2x_common_ext_link_reset()
6621 gpio_port = params->port; in bnx2x_common_ext_link_reset()
6628 DP(NETIF_MSG_LINK, "reset external PHY\n"); in bnx2x_common_ext_link_reset()
6634 struct bnx2x *bp = params->bp; in bnx2x_update_link_down()
6635 u8 port = params->port; in bnx2x_update_link_down()
6637 DP(NETIF_MSG_LINK, "Port %x: Link is down\n", port); in bnx2x_update_link_down()
6639 vars->phy_flags &= ~PHY_PHYSICAL_LINK_FLAG; in bnx2x_update_link_down()
6641 vars->mac_type = MAC_TYPE_NONE; in bnx2x_update_link_down()
6644 vars->link_status &= ~LINK_UPDATE_MASK; in bnx2x_update_link_down()
6645 vars->line_speed = 0; in bnx2x_update_link_down()
6646 bnx2x_update_mng(params, vars->link_status); in bnx2x_update_link_down()
6659 bnx2x_set_bmac_rx(bp, params->chip_id, params->port, 0); in bnx2x_update_link_down()
6663 REG_WR(bp, MISC_REG_CPMU_LP_FW_ENABLE_P0 + (params->port << 2), in bnx2x_update_link_down()
6665 REG_WR(bp, MISC_REG_CPMU_LP_MASK_ENT_P0 + (params->port << 2), in bnx2x_update_link_down()
6667 vars->eee_status &= ~(SHMEM_EEE_LP_ADV_STATUS_MASK | in bnx2x_update_link_down()
6670 bnx2x_update_mng_eee(params, vars->eee_status); in bnx2x_update_link_down()
6682 struct bnx2x *bp = params->bp; in bnx2x_update_link_up()
6683 u8 phy_idx, port = params->port; in bnx2x_update_link_up()
6686 vars->link_status |= (LINK_STATUS_LINK_UP | in bnx2x_update_link_up()
6688 vars->phy_flags |= PHY_PHYSICAL_LINK_FLAG; in bnx2x_update_link_up()
6690 if (vars->flow_ctrl & BNX2X_FLOW_CTRL_TX) in bnx2x_update_link_up()
6691 vars->link_status |= in bnx2x_update_link_up()
6694 if (vars->flow_ctrl & BNX2X_FLOW_CTRL_RX) in bnx2x_update_link_up()
6695 vars->link_status |= in bnx2x_update_link_up()
6700 -ESRCH) { in bnx2x_update_link_up()
6701 DP(NETIF_MSG_LINK, "Found errors on XMAC\n"); in bnx2x_update_link_up()
6702 vars->link_up = 0; in bnx2x_update_link_up()
6703 vars->phy_flags |= PHY_HALF_OPEN_CONN_FLAG; in bnx2x_update_link_up()
6704 vars->link_status &= ~LINK_STATUS_LINK_UP; in bnx2x_update_link_up()
6709 LED_MODE_OPER, vars->line_speed); in bnx2x_update_link_up()
6711 if ((vars->eee_status & SHMEM_EEE_ACTIVE_BIT) && in bnx2x_update_link_up()
6712 (vars->eee_status & SHMEM_EEE_LPI_REQUESTED_BIT)) { in bnx2x_update_link_up()
6713 DP(NETIF_MSG_LINK, "Enabling LPI assertion\n"); in bnx2x_update_link_up()
6715 (params->port << 2), 1); in bnx2x_update_link_up()
6718 (params->port << 2), 0xfc20); in bnx2x_update_link_up()
6725 -ESRCH) { in bnx2x_update_link_up()
6726 DP(NETIF_MSG_LINK, "Found errors on BMAC\n"); in bnx2x_update_link_up()
6727 vars->link_up = 0; in bnx2x_update_link_up()
6728 vars->phy_flags |= PHY_HALF_OPEN_CONN_FLAG; in bnx2x_update_link_up()
6729 vars->link_status &= ~LINK_STATUS_LINK_UP; in bnx2x_update_link_up()
6739 if ((vars->link_status & in bnx2x_update_link_up()
6741 && (!(vars->phy_flags & PHY_SGMII_FLAG)) && in bnx2x_update_link_up()
6747 /* PBF - link up */ in bnx2x_update_link_up()
6749 rc |= bnx2x_pbf_update(params, vars->flow_ctrl, in bnx2x_update_link_up()
6750 vars->line_speed); in bnx2x_update_link_up()
6756 bnx2x_update_mng(params, vars->link_status); in bnx2x_update_link_up()
6757 bnx2x_update_mng_eee(params, vars->eee_status); in bnx2x_update_link_up()
6760 if (params->phy[phy_idx].flags & FLAGS_TX_ERROR_CHECK) { in bnx2x_update_link_up()
6771 struct bnx2x *bp = params->bp; in bnx2x_chng_link_count()
6778 addr = params->shmem2_base + in bnx2x_chng_link_count()
6779 offsetof(struct shmem2_region, link_change_count[params->port]); in bnx2x_chng_link_count()
6790 * - DIRECT_SINGLE_MEDIA - Only XGXS link (internal link) needs
6792 * - SINGLE_MEDIA - The link between the 577xx and the external
6793 * phy (XGXS) need to up as well as the external link of the
6794 * phy (PHY_EXT1)
6795 * - DUAL_MEDIA - The link between the 577xx and the first
6796 * external phy needs to be up, and at least one of the 2
6797 * external phy link must be up.
6801 struct bnx2x *bp = params->bp; in bnx2x_link_update()
6803 u8 port = params->port; in bnx2x_link_update()
6805 u32 prev_link_status = vars->link_status; in bnx2x_link_update()
6809 u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed; in bnx2x_link_update()
6811 vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG; in bnx2x_link_update()
6812 vars->link_status &= ~LINK_UPDATE_MASK; in bnx2x_link_update()
6813 for (phy_index = INT_PHY; phy_index < params->num_phys; in bnx2x_link_update()
6823 phy_vars[phy_index].eee_status = vars->eee_status; in bnx2x_link_update()
6827 bnx2x_set_aer_mmd(params, ¶ms->phy[INT_PHY]); in bnx2x_link_update()
6829 DP(NETIF_MSG_LINK, "port %x, XGXS?%x, int_status 0x%x\n", in bnx2x_link_update()
6830 port, (vars->phy_flags & PHY_XGXS_FLAG), in bnx2x_link_update()
6835 DP(NETIF_MSG_LINK, "int_mask 0x%x MI_INT %x, SERDES_LINK %x\n", in bnx2x_link_update()
6840 DP(NETIF_MSG_LINK, " 10G %x, XGXS_LINK %x\n", in bnx2x_link_update()
6852 * vars argument is used since each phy may have different link/ in bnx2x_link_update()
6855 for (phy_index = EXT_PHY1; phy_index < params->num_phys; in bnx2x_link_update()
6857 struct bnx2x_phy *phy = ¶ms->phy[phy_index]; in bnx2x_link_update() local
6858 if (!phy->read_status) in bnx2x_link_update()
6860 /* Read link status and params of this ext phy */ in bnx2x_link_update()
6861 cur_link_up = phy->read_status(phy, params, in bnx2x_link_update()
6864 DP(NETIF_MSG_LINK, "phy in index %d link is up\n", in bnx2x_link_update()
6867 DP(NETIF_MSG_LINK, "phy in index %d link is down\n", in bnx2x_link_update()
6879 /* In this option, the first PHY makes sure to pass the in bnx2x_link_update()
6882 * phy. in bnx2x_link_update()
6887 /* In this option, the first PHY makes sure to pass the in bnx2x_link_update()
6888 * traffic through the second PHY. in bnx2x_link_update()
6895 * - FIRST_PHY means that second phy wasn't initialized, in bnx2x_link_update()
6897 * - SECOND_PHY means that first phy should not be able in bnx2x_link_update()
6899 * - DEFAULT should be overridden during initialization in bnx2x_link_update()
6901 DP(NETIF_MSG_LINK, "Invalid link indication" in bnx2x_link_update()
6903 params->multi_phy_config); in bnx2x_link_update()
6909 prev_line_speed = vars->line_speed; in bnx2x_link_update()
6911 * Read the status of the internal phy. In case of in bnx2x_link_update()
6914 * external phy in bnx2x_link_update()
6916 if (params->phy[INT_PHY].read_status) in bnx2x_link_update()
6917 params->phy[INT_PHY].read_status( in bnx2x_link_update()
6918 ¶ms->phy[INT_PHY], in bnx2x_link_update()
6922 * Otherwise, the active external phy flow control result is set in bnx2x_link_update()
6924 * speed is different between the internal phy and external phy. in bnx2x_link_update()
6928 vars->flow_ctrl = phy_vars[active_external_phy].flow_ctrl; in bnx2x_link_update()
6930 * the external phy. in bnx2x_link_update()
6932 vars->link_status |= phy_vars[active_external_phy].link_status; in bnx2x_link_update()
6934 /* if active_external_phy is first PHY and link is up - disable in bnx2x_link_update()
6935 * disable TX on second external PHY in bnx2x_link_update()
6938 if (params->phy[EXT_PHY2].phy_specific_func) { in bnx2x_link_update()
6939 DP(NETIF_MSG_LINK, in bnx2x_link_update()
6941 params->phy[EXT_PHY2].phy_specific_func( in bnx2x_link_update()
6942 ¶ms->phy[EXT_PHY2], in bnx2x_link_update()
6948 vars->duplex = phy_vars[active_external_phy].duplex; in bnx2x_link_update()
6949 if (params->phy[active_external_phy].supported & in bnx2x_link_update()
6951 vars->link_status |= LINK_STATUS_SERDES_LINK; in bnx2x_link_update()
6953 vars->link_status &= ~LINK_STATUS_SERDES_LINK; in bnx2x_link_update()
6955 vars->eee_status = phy_vars[active_external_phy].eee_status; in bnx2x_link_update()
6957 DP(NETIF_MSG_LINK, "Active external phy selected: %x\n", in bnx2x_link_update()
6961 for (phy_index = EXT_PHY1; phy_index < params->num_phys; in bnx2x_link_update()
6963 if (params->phy[phy_index].flags & in bnx2x_link_update()
6971 DP(NETIF_MSG_LINK, "vars->flow_ctrl = 0x%x, vars->link_status = 0x%x," in bnx2x_link_update()
6972 " ext_phy_line_speed = %d\n", vars->flow_ctrl, in bnx2x_link_update()
6973 vars->link_status, ext_phy_line_speed); in bnx2x_link_update()
6979 if (vars->phy_link_up) { in bnx2x_link_update()
6981 (ext_phy_line_speed != vars->line_speed)) { in bnx2x_link_update()
6982 DP(NETIF_MSG_LINK, "Internal link speed %d is" in bnx2x_link_update()
6984 " link speed %d\n", vars->line_speed, in bnx2x_link_update()
6986 vars->phy_link_up = 0; in bnx2x_link_update()
6987 } else if (prev_line_speed != vars->line_speed) { in bnx2x_link_update()
6988 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, in bnx2x_link_update()
6995 link_10g_plus = (vars->line_speed >= SPEED_10000); in bnx2x_link_update()
6999 /* In case external phy link is up, and internal link is down in bnx2x_link_update()
7002 * Note that after link down-up as result of cable plug, the xgxs in bnx2x_link_update()
7007 DP(NETIF_MSG_LINK, "ext_phy_link_up = %d, int_link_up = %d," in bnx2x_link_update()
7009 vars->phy_link_up, in bnx2x_link_update()
7010 params->phy[EXT_PHY1].flags & in bnx2x_link_update()
7012 if (!(params->phy[EXT_PHY1].flags & in bnx2x_link_update()
7014 && ext_phy_link_up && !vars->phy_link_up) { in bnx2x_link_update()
7015 vars->line_speed = ext_phy_line_speed; in bnx2x_link_update()
7016 if (vars->line_speed < SPEED_1000) in bnx2x_link_update()
7017 vars->phy_flags |= PHY_SGMII_FLAG; in bnx2x_link_update()
7019 vars->phy_flags &= ~PHY_SGMII_FLAG; in bnx2x_link_update()
7021 if (params->phy[INT_PHY].config_init) in bnx2x_link_update()
7022 params->phy[INT_PHY].config_init( in bnx2x_link_update()
7023 ¶ms->phy[INT_PHY], params, in bnx2x_link_update()
7027 /* Link is up only if both local phy and external phy (in case of in bnx2x_link_update()
7028 * non-direct board) are up and no fault detected on active PHY. in bnx2x_link_update()
7030 vars->link_up = (vars->phy_link_up && in bnx2x_link_update()
7036 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) in bnx2x_link_update()
7037 vars->link_status |= LINK_STATUS_PFC_ENABLED; in bnx2x_link_update()
7039 vars->link_status &= ~LINK_STATUS_PFC_ENABLED; in bnx2x_link_update()
7041 if (vars->link_up) in bnx2x_link_update()
7046 if ((prev_link_status ^ vars->link_status) & LINK_STATUS_LINK_UP) in bnx2x_link_update()
7050 if (params->feature_config_flags & FEATURE_CONFIG_BC_SUPPORTS_AFEX) in bnx2x_link_update()
7057 /* External Phy section */
7071 DP(NETIF_MSG_LINK, "FW version 0x%x:0x%x for port %d\n", in bnx2x_save_spirom_version()
7079 struct bnx2x_phy *phy, in bnx2x_save_bcm_spirom_ver() argument
7084 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, in bnx2x_save_bcm_spirom_ver()
7086 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, in bnx2x_save_bcm_spirom_ver()
7089 phy->ver_addr); in bnx2x_save_bcm_spirom_ver()
7093 struct bnx2x_phy *phy, in bnx2x_ext_phy_10G_an_resolve() argument
7097 bnx2x_cl45_read(bp, phy, in bnx2x_ext_phy_10G_an_resolve()
7100 bnx2x_cl45_read(bp, phy, in bnx2x_ext_phy_10G_an_resolve()
7104 vars->link_status |= LINK_STATUS_AUTO_NEGOTIATE_COMPLETE; in bnx2x_ext_phy_10G_an_resolve()
7106 vars->link_status |= LINK_STATUS_PARALLEL_DETECTION_USED; in bnx2x_ext_phy_10G_an_resolve()
7110 /* common BCM8073/BCM8727 PHY SECTION */
7112 static void bnx2x_8073_resolve_fc(struct bnx2x_phy *phy, in bnx2x_8073_resolve_fc() argument
7116 struct bnx2x *bp = params->bp; in bnx2x_8073_resolve_fc()
7117 if (phy->req_line_speed == SPEED_10 || in bnx2x_8073_resolve_fc()
7118 phy->req_line_speed == SPEED_100) { in bnx2x_8073_resolve_fc()
7119 vars->flow_ctrl = phy->req_flow_ctrl; in bnx2x_8073_resolve_fc()
7123 if (bnx2x_ext_phy_resolve_fc(phy, params, vars) && in bnx2x_8073_resolve_fc()
7124 (vars->flow_ctrl == BNX2X_FLOW_CTRL_NONE)) { in bnx2x_8073_resolve_fc()
7128 bnx2x_cl45_read(bp, phy, in bnx2x_8073_resolve_fc()
7132 bnx2x_cl45_read(bp, phy, in bnx2x_8073_resolve_fc()
7140 bnx2x_pause_resolve(phy, params, vars, pause_result); in bnx2x_8073_resolve_fc()
7141 DP(NETIF_MSG_LINK, "Ext PHY CL37 pause result 0x%x\n", in bnx2x_8073_resolve_fc()
7146 struct bnx2x_phy *phy, in bnx2x_8073_8727_external_rom_boot() argument
7155 bnx2x_cl45_write(bp, phy, in bnx2x_8073_8727_external_rom_boot()
7161 bnx2x_cl45_write(bp, phy, in bnx2x_8073_8727_external_rom_boot()
7166 bnx2x_cl45_write(bp, phy, in bnx2x_8073_8727_external_rom_boot()
7171 bnx2x_cl45_write(bp, phy, in bnx2x_8073_8727_external_rom_boot()
7177 bnx2x_cl45_write(bp, phy, in bnx2x_8073_8727_external_rom_boot()
7182 /* Delay 100ms per the PHY specifications */ in bnx2x_8073_8727_external_rom_boot()
7189 DP(NETIF_MSG_LINK, in bnx2x_8073_8727_external_rom_boot()
7193 rc = -EINVAL; in bnx2x_8073_8727_external_rom_boot()
7197 bnx2x_cl45_read(bp, phy, in bnx2x_8073_8727_external_rom_boot()
7200 bnx2x_cl45_read(bp, phy, in bnx2x_8073_8727_external_rom_boot()
7206 ((fw_msgout & 0xff) != 0x03 && (phy->type == in bnx2x_8073_8727_external_rom_boot()
7210 bnx2x_cl45_write(bp, phy, in bnx2x_8073_8727_external_rom_boot()
7213 bnx2x_save_bcm_spirom_ver(bp, phy, port); in bnx2x_8073_8727_external_rom_boot()
7215 DP(NETIF_MSG_LINK, in bnx2x_8073_8727_external_rom_boot()
7224 /* BCM8073 PHY SECTION */
7226 static int bnx2x_8073_is_snr_needed(struct bnx2x *bp, struct bnx2x_phy *phy) in bnx2x_8073_is_snr_needed() argument
7232 bnx2x_cl45_read(bp, phy, in bnx2x_8073_is_snr_needed()
7241 bnx2x_cl45_read(bp, phy, in bnx2x_8073_is_snr_needed()
7252 static int bnx2x_8073_xaui_wa(struct bnx2x *bp, struct bnx2x_phy *phy) in bnx2x_8073_xaui_wa() argument
7256 bnx2x_cl45_read(bp, phy, in bnx2x_8073_xaui_wa()
7271 bnx2x_cl45_read(bp, phy, in bnx2x_8073_xaui_wa()
7276 * system initialization (XAUI work-around not required, as in bnx2x_8073_xaui_wa()
7280 DP(NETIF_MSG_LINK, "XAUI work-around not required\n"); in bnx2x_8073_xaui_wa()
7283 DP(NETIF_MSG_LINK, "bit 15 went off\n"); in bnx2x_8073_xaui_wa()
7290 bnx2x_cl45_read(bp, phy, in bnx2x_8073_xaui_wa()
7294 DP(NETIF_MSG_LINK, in bnx2x_8073_xaui_wa()
7304 DP(NETIF_MSG_LINK, "Warning: XAUI work-around timeout !!!\n"); in bnx2x_8073_xaui_wa()
7305 return -EINVAL; in bnx2x_8073_xaui_wa()
7308 static void bnx2x_807x_force_10G(struct bnx2x *bp, struct bnx2x_phy *phy) in bnx2x_807x_force_10G() argument
7311 bnx2x_cl45_write(bp, phy, in bnx2x_807x_force_10G()
7313 bnx2x_cl45_write(bp, phy, in bnx2x_807x_force_10G()
7315 bnx2x_cl45_write(bp, phy, in bnx2x_807x_force_10G()
7317 bnx2x_cl45_write(bp, phy, in bnx2x_807x_force_10G()
7322 struct bnx2x_phy *phy, in bnx2x_8073_set_pause_cl37() argument
7326 struct bnx2x *bp = params->bp; in bnx2x_8073_set_pause_cl37()
7327 bnx2x_cl45_read(bp, phy, in bnx2x_8073_set_pause_cl37()
7331 /* Please refer to Table 28B-3 of 802.3ab-1999 spec. */ in bnx2x_8073_set_pause_cl37()
7332 bnx2x_calc_ieee_aneg_adv(phy, params, &vars->ieee_fc); in bnx2x_8073_set_pause_cl37()
7333 if ((vars->ieee_fc & in bnx2x_8073_set_pause_cl37()
7338 if ((vars->ieee_fc & in bnx2x_8073_set_pause_cl37()
7343 if ((vars->ieee_fc & in bnx2x_8073_set_pause_cl37()
7348 DP(NETIF_MSG_LINK, in bnx2x_8073_set_pause_cl37()
7349 "Ext phy AN advertize cl37 0x%x\n", cl37_val); in bnx2x_8073_set_pause_cl37()
7351 bnx2x_cl45_write(bp, phy, in bnx2x_8073_set_pause_cl37()
7356 static void bnx2x_8073_specific_func(struct bnx2x_phy *phy, in bnx2x_8073_specific_func() argument
7360 struct bnx2x *bp = params->bp; in bnx2x_8073_specific_func()
7364 bnx2x_cl45_write(bp, phy, in bnx2x_8073_specific_func()
7366 bnx2x_cl45_write(bp, phy, in bnx2x_8073_specific_func()
7372 static void bnx2x_8073_config_init(struct bnx2x_phy *phy, in bnx2x_8073_config_init() argument
7376 struct bnx2x *bp = params->bp; in bnx2x_8073_config_init()
7379 DP(NETIF_MSG_LINK, "Init 8073\n"); in bnx2x_8073_config_init()
7384 gpio_port = params->port; in bnx2x_8073_config_init()
7392 bnx2x_8073_specific_func(phy, params, PHY_INIT); in bnx2x_8073_config_init()
7393 bnx2x_8073_set_pause_cl37(params, phy, vars); in bnx2x_8073_config_init()
7395 bnx2x_cl45_read(bp, phy, in bnx2x_8073_config_init()
7398 bnx2x_cl45_read(bp, phy, in bnx2x_8073_config_init()
7401 DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); in bnx2x_8073_config_init()
7403 /* Swap polarity if required - Must be done only in non-1G mode */ in bnx2x_8073_config_init()
7404 if (params->lane_config & PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { in bnx2x_8073_config_init()
7406 DP(NETIF_MSG_LINK, "Swapping polarity for the 8073\n"); in bnx2x_8073_config_init()
7408 bnx2x_cl45_read(bp, phy, in bnx2x_8073_config_init()
7411 bnx2x_cl45_write(bp, phy, in bnx2x_8073_config_init()
7419 if (REG_RD(bp, params->shmem_base + in bnx2x_8073_config_init()
7421 port_hw_config[params->port].default_cfg)) & in bnx2x_8073_config_init()
7424 bnx2x_cl45_read(bp, phy, in bnx2x_8073_config_init()
7427 bnx2x_cl45_write(bp, phy, in bnx2x_8073_config_init()
7430 DP(NETIF_MSG_LINK, "Enable CL37 BAM on KR\n"); in bnx2x_8073_config_init()
7432 if (params->loopback_mode == LOOPBACK_EXT) { in bnx2x_8073_config_init()
7433 bnx2x_807x_force_10G(bp, phy); in bnx2x_8073_config_init()
7434 DP(NETIF_MSG_LINK, "Forced speed 10G on 807X\n"); in bnx2x_8073_config_init()
7437 bnx2x_cl45_write(bp, phy, in bnx2x_8073_config_init()
7440 if (phy->req_line_speed != SPEED_AUTO_NEG) { in bnx2x_8073_config_init()
7441 if (phy->req_line_speed == SPEED_10000) { in bnx2x_8073_config_init()
7443 } else if (phy->req_line_speed == SPEED_2500) { in bnx2x_8073_config_init()
7452 if (phy->speed_cap_mask & in bnx2x_8073_config_init()
7457 if (phy->speed_cap_mask & in bnx2x_8073_config_init()
7461 DP(NETIF_MSG_LINK, "807x autoneg val = 0x%x\n", val); in bnx2x_8073_config_init()
7464 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_ADV, val); in bnx2x_8073_config_init()
7465 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_8073_2_5G, &tmp1); in bnx2x_8073_config_init()
7467 if (((phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G) && in bnx2x_8073_config_init()
7468 (phy->req_line_speed == SPEED_AUTO_NEG)) || in bnx2x_8073_config_init()
7469 (phy->req_line_speed == SPEED_2500)) { in bnx2x_8073_config_init()
7472 bnx2x_cl45_read(bp, phy, in bnx2x_8073_config_init()
7475 DP(NETIF_MSG_LINK, "Add 2.5G\n"); in bnx2x_8073_config_init()
7481 DP(NETIF_MSG_LINK, "Disable 2.5G\n"); in bnx2x_8073_config_init()
7485 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_8073_2_5G, tmp1); in bnx2x_8073_config_init()
7488 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CL37_FC_LD, &tmp1); in bnx2x_8073_config_init()
7489 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CL37_FC_LD, in bnx2x_8073_config_init()
7490 (tmp1 | ((phy->req_duplex == DUPLEX_FULL) ? in bnx2x_8073_config_init()
7494 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); in bnx2x_8073_config_init()
7500 if (bnx2x_8073_is_snr_needed(bp, phy)) in bnx2x_8073_config_init()
7501 bnx2x_cl45_write(bp, phy, in bnx2x_8073_config_init()
7506 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_ADV2, &tmp1); in bnx2x_8073_config_init()
7508 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_ADV2, tmp1); in bnx2x_8073_config_init()
7510 bnx2x_ext_phy_set_pause(params, phy, vars); in bnx2x_8073_config_init()
7514 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 0x1200); in bnx2x_8073_config_init()
7515 DP(NETIF_MSG_LINK, "807x Autoneg Restart: Advertise 1G=%x, 10G=%x\n", in bnx2x_8073_config_init()
7519 static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy, in bnx2x_8073_read_status() argument
7523 struct bnx2x *bp = params->bp; in bnx2x_8073_read_status()
7529 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7532 DP(NETIF_MSG_LINK, "8703 LASI status 0x%x\n", val1); in bnx2x_8073_read_status()
7535 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7537 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7539 DP(NETIF_MSG_LINK, "807x PCS status 0x%x->0x%x\n", val2, val1); in bnx2x_8073_read_status()
7540 /* Clear MSG-OUT */ in bnx2x_8073_read_status()
7541 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7545 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7548 DP(NETIF_MSG_LINK, "KR 0x9003 0x%x\n", val2); in bnx2x_8073_read_status()
7551 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7553 DP(NETIF_MSG_LINK, "KR PCS status 0x%x\n", val2); in bnx2x_8073_read_status()
7555 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7557 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7560 DP(NETIF_MSG_LINK, "PMA_REG_STATUS=0x%x\n", val1); in bnx2x_8073_read_status()
7563 ((phy->req_line_speed != SPEED_10000))) { in bnx2x_8073_read_status()
7564 if (bnx2x_8073_xaui_wa(bp, phy) != 0) in bnx2x_8073_read_status()
7567 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7569 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7573 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7575 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7577 DP(NETIF_MSG_LINK, "KR PMA status 0x%x->0x%x," in bnx2x_8073_read_status()
7581 if (link_up && bnx2x_8073_is_snr_needed(bp, phy)) { in bnx2x_8073_read_status()
7586 bnx2x_cl45_write(bp, phy, in bnx2x_8073_read_status()
7591 bnx2x_cl45_write(bp, phy, in bnx2x_8073_read_status()
7595 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7599 /* Bits 0..2 --> speed detected, bits 13..15--> link is down */ in bnx2x_8073_read_status()
7602 vars->line_speed = SPEED_10000; in bnx2x_8073_read_status()
7603 DP(NETIF_MSG_LINK, "port %x: External link up in 10G\n", in bnx2x_8073_read_status()
7604 params->port); in bnx2x_8073_read_status()
7607 vars->line_speed = SPEED_2500; in bnx2x_8073_read_status()
7608 DP(NETIF_MSG_LINK, "port %x: External link up in 2.5G\n", in bnx2x_8073_read_status()
7609 params->port); in bnx2x_8073_read_status()
7612 vars->line_speed = SPEED_1000; in bnx2x_8073_read_status()
7613 DP(NETIF_MSG_LINK, "port %x: External link up in 1G\n", in bnx2x_8073_read_status()
7614 params->port); in bnx2x_8073_read_status()
7617 DP(NETIF_MSG_LINK, "port %x: External link is down\n", in bnx2x_8073_read_status()
7618 params->port); in bnx2x_8073_read_status()
7623 if (params->lane_config & in bnx2x_8073_read_status()
7626 bnx2x_cl45_read(bp, phy, in bnx2x_8073_read_status()
7632 if (vars->line_speed == SPEED_1000) { in bnx2x_8073_read_status()
7633 DP(NETIF_MSG_LINK, "Swapping 1G polarity for" in bnx2x_8073_read_status()
7639 bnx2x_cl45_write(bp, phy, in bnx2x_8073_read_status()
7644 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); in bnx2x_8073_read_status()
7645 bnx2x_8073_resolve_fc(phy, params, vars); in bnx2x_8073_read_status()
7646 vars->duplex = DUPLEX_FULL; in bnx2x_8073_read_status()
7649 if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) { in bnx2x_8073_read_status()
7650 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_8073_read_status()
7654 vars->link_status |= in bnx2x_8073_read_status()
7657 vars->link_status |= in bnx2x_8073_read_status()
7664 static void bnx2x_8073_link_reset(struct bnx2x_phy *phy, in bnx2x_8073_link_reset() argument
7667 struct bnx2x *bp = params->bp; in bnx2x_8073_link_reset()
7672 gpio_port = params->port; in bnx2x_8073_link_reset()
7673 DP(NETIF_MSG_LINK, "Setting 8073 port %d into low power mode\n", in bnx2x_8073_link_reset()
7681 /* BCM8705 PHY SECTION */
7683 static void bnx2x_8705_config_init(struct bnx2x_phy *phy, in bnx2x_8705_config_init() argument
7687 struct bnx2x *bp = params->bp; in bnx2x_8705_config_init()
7688 DP(NETIF_MSG_LINK, "init 8705\n"); in bnx2x_8705_config_init()
7691 MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); in bnx2x_8705_config_init()
7693 bnx2x_ext_phy_hw_reset(bp, params->port); in bnx2x_8705_config_init()
7694 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0xa040); in bnx2x_8705_config_init()
7695 bnx2x_wait_reset_complete(bp, phy, params); in bnx2x_8705_config_init()
7697 bnx2x_cl45_write(bp, phy, in bnx2x_8705_config_init()
7699 bnx2x_cl45_write(bp, phy, in bnx2x_8705_config_init()
7701 bnx2x_cl45_write(bp, phy, in bnx2x_8705_config_init()
7703 bnx2x_cl45_write(bp, phy, in bnx2x_8705_config_init()
7706 bnx2x_save_spirom_version(bp, params->port, params->shmem_base, 0); in bnx2x_8705_config_init()
7709 static u8 bnx2x_8705_read_status(struct bnx2x_phy *phy, in bnx2x_8705_read_status() argument
7715 struct bnx2x *bp = params->bp; in bnx2x_8705_read_status()
7716 DP(NETIF_MSG_LINK, "read status 8705\n"); in bnx2x_8705_read_status()
7717 bnx2x_cl45_read(bp, phy, in bnx2x_8705_read_status()
7719 DP(NETIF_MSG_LINK, "8705 LASI status 0x%x\n", val1); in bnx2x_8705_read_status()
7721 bnx2x_cl45_read(bp, phy, in bnx2x_8705_read_status()
7723 DP(NETIF_MSG_LINK, "8705 LASI status 0x%x\n", val1); in bnx2x_8705_read_status()
7725 bnx2x_cl45_read(bp, phy, in bnx2x_8705_read_status()
7728 bnx2x_cl45_read(bp, phy, in bnx2x_8705_read_status()
7730 bnx2x_cl45_read(bp, phy, in bnx2x_8705_read_status()
7733 DP(NETIF_MSG_LINK, "8705 1.c809 val=0x%x\n", val1); in bnx2x_8705_read_status()
7736 vars->line_speed = SPEED_10000; in bnx2x_8705_read_status()
7737 bnx2x_ext_phy_resolve_fc(phy, params, vars); in bnx2x_8705_read_status()
7746 struct bnx2x_phy *phy, in bnx2x_set_disable_pmd_transmit() argument
7749 struct bnx2x *bp = params->bp; in bnx2x_set_disable_pmd_transmit()
7754 if (params->feature_config_flags & in bnx2x_set_disable_pmd_transmit()
7756 DP(NETIF_MSG_LINK, "Disabling PMD transmitter\n"); in bnx2x_set_disable_pmd_transmit()
7758 DP(NETIF_MSG_LINK, "NOT disabling PMD transmitter\n"); in bnx2x_set_disable_pmd_transmit()
7762 DP(NETIF_MSG_LINK, "Enabling PMD transmitter\n"); in bnx2x_set_disable_pmd_transmit()
7763 bnx2x_cl45_write(bp, phy, in bnx2x_set_disable_pmd_transmit()
7772 struct bnx2x *bp = params->bp; in bnx2x_get_gpio_port()
7776 gpio_port = params->port; in bnx2x_get_gpio_port()
7783 struct bnx2x_phy *phy, in bnx2x_sfp_e1e2_set_transmitter() argument
7787 u8 port = params->port; in bnx2x_sfp_e1e2_set_transmitter()
7788 struct bnx2x *bp = params->bp; in bnx2x_sfp_e1e2_set_transmitter()
7792 tx_en_mode = REG_RD(bp, params->shmem_base + in bnx2x_sfp_e1e2_set_transmitter()
7796 DP(NETIF_MSG_LINK, "Setting transmitter tx_en=%x for port %x " in bnx2x_sfp_e1e2_set_transmitter()
7801 bnx2x_cl45_read(bp, phy, in bnx2x_sfp_e1e2_set_transmitter()
7811 bnx2x_cl45_write(bp, phy, in bnx2x_sfp_e1e2_set_transmitter()
7828 gpio_pin = tx_en_mode - PORT_HW_CFG_TX_LASER_GPIO0; in bnx2x_sfp_e1e2_set_transmitter()
7834 DP(NETIF_MSG_LINK, "Invalid TX_LASER_MDIO 0x%x\n", tx_en_mode); in bnx2x_sfp_e1e2_set_transmitter()
7840 struct bnx2x_phy *phy, in bnx2x_sfp_set_transmitter() argument
7843 struct bnx2x *bp = params->bp; in bnx2x_sfp_set_transmitter()
7844 DP(NETIF_MSG_LINK, "Setting SFP+ transmitter to %d\n", tx_en); in bnx2x_sfp_set_transmitter()
7846 bnx2x_sfp_e3_set_transmitter(params, phy, tx_en); in bnx2x_sfp_set_transmitter()
7848 bnx2x_sfp_e1e2_set_transmitter(params, phy, tx_en); in bnx2x_sfp_set_transmitter()
7851 static int bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, in bnx2x_8726_read_sfp_module_eeprom() argument
7856 struct bnx2x *bp = params->bp; in bnx2x_8726_read_sfp_module_eeprom()
7860 DP(NETIF_MSG_LINK, in bnx2x_8726_read_sfp_module_eeprom()
7862 return -EINVAL; in bnx2x_8726_read_sfp_module_eeprom()
7865 bnx2x_cl45_write(bp, phy, in bnx2x_8726_read_sfp_module_eeprom()
7870 bnx2x_cl45_write(bp, phy, in bnx2x_8726_read_sfp_module_eeprom()
7875 bnx2x_cl45_write(bp, phy, in bnx2x_8726_read_sfp_module_eeprom()
7881 bnx2x_cl45_read(bp, phy, in bnx2x_8726_read_sfp_module_eeprom()
7892 DP(NETIF_MSG_LINK, in bnx2x_8726_read_sfp_module_eeprom()
7895 return -EINVAL; in bnx2x_8726_read_sfp_module_eeprom()
7900 bnx2x_cl45_read(bp, phy, in bnx2x_8726_read_sfp_module_eeprom()
7907 bnx2x_cl45_read(bp, phy, in bnx2x_8726_read_sfp_module_eeprom()
7915 return -EINVAL; in bnx2x_8726_read_sfp_module_eeprom()
7922 struct bnx2x *bp = params->bp; in bnx2x_warpcore_power_module()
7924 pin_cfg = (REG_RD(bp, params->shmem_base + in bnx2x_warpcore_power_module()
7926 dev_info.port_hw_config[params->port].e3_sfp_ctrl)) & in bnx2x_warpcore_power_module()
7932 DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n", in bnx2x_warpcore_power_module()
7939 static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, in bnx2x_warpcore_read_sfp_module_eeprom() argument
7949 struct bnx2x *bp = params->bp; in bnx2x_warpcore_read_sfp_module_eeprom()
7952 DP(NETIF_MSG_LINK, in bnx2x_warpcore_read_sfp_module_eeprom()
7954 return -EINVAL; in bnx2x_warpcore_read_sfp_module_eeprom()
7971 for (i = (addr - addr32); i < byte_cnt + (addr - addr32); i++) { in bnx2x_warpcore_read_sfp_module_eeprom()
7980 static int bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, in bnx2x_8727_read_sfp_module_eeprom() argument
7985 struct bnx2x *bp = params->bp; in bnx2x_8727_read_sfp_module_eeprom()
7989 DP(NETIF_MSG_LINK, in bnx2x_8727_read_sfp_module_eeprom()
7991 return -EINVAL; in bnx2x_8727_read_sfp_module_eeprom()
7994 /* Set 2-wire transfer rate of SFP+ module EEPROM in bnx2x_8727_read_sfp_module_eeprom()
7998 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8004 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8010 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8016 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8021 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8027 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8031 /* Wait appropriate time for two-wire command to finish before in bnx2x_8727_read_sfp_module_eeprom()
8038 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8049 DP(NETIF_MSG_LINK, in bnx2x_8727_read_sfp_module_eeprom()
8052 return -EFAULT; in bnx2x_8727_read_sfp_module_eeprom()
8057 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8064 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_sfp_module_eeprom()
8073 return -EINVAL; in bnx2x_8727_read_sfp_module_eeprom()
8075 int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, in bnx2x_read_sfp_module_eeprom() argument
8080 struct bnx2x *bp = params->bp; in bnx2x_read_sfp_module_eeprom()
8086 DP(NETIF_MSG_LINK, "invalid dev_addr 0x%x\n", dev_addr); in bnx2x_read_sfp_module_eeprom()
8087 return -EINVAL; in bnx2x_read_sfp_module_eeprom()
8090 switch (phy->type) { in bnx2x_read_sfp_module_eeprom()
8102 return -EOPNOTSUPP; in bnx2x_read_sfp_module_eeprom()
8108 rc = read_func(phy, params, dev_addr, addr, xfer_size, in bnx2x_read_sfp_module_eeprom()
8110 byte_cnt -= xfer_size; in bnx2x_read_sfp_module_eeprom()
8117 static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, in bnx2x_get_edc_mode() argument
8121 struct bnx2x *bp = params->bp; in bnx2x_get_edc_mode()
8125 phy->media_type = ETH_PHY_UNSPECIFIED; in bnx2x_get_edc_mode()
8127 if (bnx2x_read_sfp_module_eeprom(phy, in bnx2x_get_edc_mode()
8133 DP(NETIF_MSG_LINK, "Failed to read from SFP+ module EEPROM\n"); in bnx2x_get_edc_mode()
8134 return -EINVAL; in bnx2x_get_edc_mode()
8136 params->link_attr_sync &= ~LINK_SFP_EEPROM_COMP_CODE_MASK; in bnx2x_get_edc_mode()
8137 params->link_attr_sync |= val[SFP_EEPROM_10G_COMP_CODE_ADDR] << in bnx2x_get_edc_mode()
8139 bnx2x_update_link_attr(params, params->link_attr_sync); in bnx2x_get_edc_mode()
8144 phy->media_type = ETH_PHY_DA_TWINAX; in bnx2x_get_edc_mode()
8152 DP(NETIF_MSG_LINK, "Active Copper cable detected\n"); in bnx2x_get_edc_mode()
8153 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) in bnx2x_get_edc_mode()
8165 DP(NETIF_MSG_LINK, in bnx2x_get_edc_mode()
8168 DP(NETIF_MSG_LINK, in bnx2x_get_edc_mode()
8169 "Unknown copper-cable-type\n"); in bnx2x_get_edc_mode()
8183 DP(NETIF_MSG_LINK, "1G SFP module detected\n"); in bnx2x_get_edc_mode()
8184 phy->media_type = ETH_PHY_SFP_1G_FIBER; in bnx2x_get_edc_mode()
8185 if (phy->req_line_speed != SPEED_1000) { in bnx2x_get_edc_mode()
8186 u8 gport = params->port; in bnx2x_get_edc_mode()
8187 phy->req_line_speed = SPEED_1000; in bnx2x_get_edc_mode()
8190 (params->port << 1); in bnx2x_get_edc_mode()
8192 netdev_err(bp->dev, in bnx2x_get_edc_mode()
8198 bnx2x_sfp_set_transmitter(params, phy, 0); in bnx2x_get_edc_mode()
8200 bnx2x_sfp_set_transmitter(params, phy, 1); in bnx2x_get_edc_mode()
8204 DP(NETIF_MSG_LINK, "10G Optic module detected\n"); in bnx2x_get_edc_mode()
8206 if (params->phy[idx].type == phy->type) { in bnx2x_get_edc_mode()
8211 phy->media_type = ETH_PHY_SFPP_10G_FIBER; in bnx2x_get_edc_mode()
8212 phy->req_line_speed = params->req_line_speed[cfg_idx]; in bnx2x_get_edc_mode()
8216 DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n", in bnx2x_get_edc_mode()
8218 return -EINVAL; in bnx2x_get_edc_mode()
8220 sync_offset = params->shmem_base + in bnx2x_get_edc_mode()
8222 dev_info.port_hw_config[params->port].media_type); in bnx2x_get_edc_mode()
8224 /* Update media type for non-PMF sync */ in bnx2x_get_edc_mode()
8226 if (&(params->phy[phy_idx]) == phy) { in bnx2x_get_edc_mode()
8229 media_types |= ((phy->media_type & in bnx2x_get_edc_mode()
8238 if (bnx2x_read_sfp_module_eeprom(phy, in bnx2x_get_edc_mode()
8244 DP(NETIF_MSG_LINK, in bnx2x_get_edc_mode()
8246 return -EINVAL; in bnx2x_get_edc_mode()
8253 DP(NETIF_MSG_LINK, "EDC mode is set to 0x%x\n", *edc_mode); in bnx2x_get_edc_mode()
8259 static int bnx2x_verify_sfp_module(struct bnx2x_phy *phy, in bnx2x_verify_sfp_module() argument
8262 struct bnx2x *bp = params->bp; in bnx2x_verify_sfp_module()
8267 phy->flags &= ~FLAGS_SFP_NOT_APPROVED; in bnx2x_verify_sfp_module()
8268 val = REG_RD(bp, params->shmem_base + in bnx2x_verify_sfp_module()
8270 port_feature_config[params->port].config)); in bnx2x_verify_sfp_module()
8273 DP(NETIF_MSG_LINK, "NOT enforcing module verification\n"); in bnx2x_verify_sfp_module()
8277 if (params->feature_config_flags & in bnx2x_verify_sfp_module()
8279 /* Use specific phy request */ in bnx2x_verify_sfp_module()
8281 } else if (params->feature_config_flags & in bnx2x_verify_sfp_module()
8283 /* Use first phy request only in case of non-dual media*/ in bnx2x_verify_sfp_module()
8285 DP(NETIF_MSG_LINK, in bnx2x_verify_sfp_module()
8287 return -EINVAL; in bnx2x_verify_sfp_module()
8292 DP(NETIF_MSG_LINK, in bnx2x_verify_sfp_module()
8294 return -EINVAL; in bnx2x_verify_sfp_module()
8297 fw_cmd_param = FW_PARAM_SET(phy->addr, phy->type, phy->mdio_ctrl); in bnx2x_verify_sfp_module()
8300 DP(NETIF_MSG_LINK, "Approved module\n"); in bnx2x_verify_sfp_module()
8305 if (bnx2x_read_sfp_module_eeprom(phy, in bnx2x_verify_sfp_module()
8314 if (bnx2x_read_sfp_module_eeprom(phy, in bnx2x_verify_sfp_module()
8324 netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected," in bnx2x_verify_sfp_module()
8326 params->port, vendor_name, vendor_pn); in bnx2x_verify_sfp_module()
8329 phy->flags |= FLAGS_SFP_NOT_APPROVED; in bnx2x_verify_sfp_module()
8330 return -EINVAL; in bnx2x_verify_sfp_module()
8333 static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, in bnx2x_wait_for_sfp_module_initialized() argument
8339 struct bnx2x *bp = params->bp; in bnx2x_wait_for_sfp_module_initialized()
8341 /* Initialization time after hot-plug may take up to 300ms for in bnx2x_wait_for_sfp_module_initialized()
8346 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) in bnx2x_wait_for_sfp_module_initialized()
8348 phy, params, I2C_DEV_ADDR_A0, 1, 1, &val, in bnx2x_wait_for_sfp_module_initialized()
8351 rc = bnx2x_read_sfp_module_eeprom(phy, params, in bnx2x_wait_for_sfp_module_initialized()
8355 DP(NETIF_MSG_LINK, in bnx2x_wait_for_sfp_module_initialized()
8362 rc = bnx2x_read_sfp_module_eeprom(phy, params, I2C_DEV_ADDR_A0, in bnx2x_wait_for_sfp_module_initialized()
8368 struct bnx2x_phy *phy, in bnx2x_8727_power_module() argument
8375 * Bits 0-1 determine the GPIOs value for OUTPUT in case bit 4 val is 0 in bnx2x_8727_power_module()
8376 * Bits 8-9 determine the GPIOs value for INPUT in case bit 4 val is 1 in bnx2x_8727_power_module()
8377 * where the 1st bit is the over-current(only input), and 2nd bit is in bnx2x_8727_power_module()
8381 * as input to enable listening of over-current indication in bnx2x_8727_power_module()
8383 if (phy->flags & FLAGS_NOC) in bnx2x_8727_power_module()
8393 bnx2x_cl45_write(bp, phy, in bnx2x_8727_power_module()
8400 struct bnx2x_phy *phy, in bnx2x_8726_set_limiting_mode() argument
8405 bnx2x_cl45_read(bp, phy, in bnx2x_8726_set_limiting_mode()
8409 DP(NETIF_MSG_LINK, "Current Limiting mode is 0x%x\n", in bnx2x_8726_set_limiting_mode()
8413 DP(NETIF_MSG_LINK, "Setting LIMITING MODE\n"); in bnx2x_8726_set_limiting_mode()
8414 bnx2x_cl45_write(bp, phy, in bnx2x_8726_set_limiting_mode()
8420 DP(NETIF_MSG_LINK, "Setting LRM MODE\n"); in bnx2x_8726_set_limiting_mode()
8428 bnx2x_cl45_write(bp, phy, in bnx2x_8726_set_limiting_mode()
8432 bnx2x_cl45_write(bp, phy, in bnx2x_8726_set_limiting_mode()
8436 bnx2x_cl45_write(bp, phy, in bnx2x_8726_set_limiting_mode()
8440 bnx2x_cl45_write(bp, phy, in bnx2x_8726_set_limiting_mode()
8449 struct bnx2x_phy *phy, in bnx2x_8727_set_limiting_mode() argument
8454 bnx2x_cl45_read(bp, phy, in bnx2x_8727_set_limiting_mode()
8459 bnx2x_cl45_write(bp, phy, in bnx2x_8727_set_limiting_mode()
8464 bnx2x_cl45_read(bp, phy, in bnx2x_8727_set_limiting_mode()
8468 /* Keep the MSB 8-bits, and set the LSB 8-bits with the edc_mode */ in bnx2x_8727_set_limiting_mode()
8469 bnx2x_cl45_write(bp, phy, in bnx2x_8727_set_limiting_mode()
8474 bnx2x_cl45_write(bp, phy, in bnx2x_8727_set_limiting_mode()
8482 static void bnx2x_8727_specific_func(struct bnx2x_phy *phy, in bnx2x_8727_specific_func() argument
8486 struct bnx2x *bp = params->bp; in bnx2x_8727_specific_func()
8490 bnx2x_sfp_set_transmitter(params, phy, 0); in bnx2x_8727_specific_func()
8493 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) in bnx2x_8727_specific_func()
8494 bnx2x_sfp_set_transmitter(params, phy, 1); in bnx2x_8727_specific_func()
8497 bnx2x_cl45_write(bp, phy, in bnx2x_8727_specific_func()
8500 bnx2x_cl45_write(bp, phy, in bnx2x_8727_specific_func()
8503 bnx2x_cl45_write(bp, phy, in bnx2x_8727_specific_func()
8506 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, in bnx2x_8727_specific_func()
8510 if (phy->flags & FLAGS_NOC) in bnx2x_8727_specific_func()
8513 * status which reflect SFP+ module over-current in bnx2x_8727_specific_func()
8515 if (!(phy->flags & FLAGS_NOC)) in bnx2x_8727_specific_func()
8516 val &= 0xff8f; /* Reset bits 4-6 */ in bnx2x_8727_specific_func()
8517 bnx2x_cl45_write(bp, phy, in bnx2x_8727_specific_func()
8522 DP(NETIF_MSG_LINK, "Function 0x%x not supported by 8727\n", in bnx2x_8727_specific_func()
8531 struct bnx2x *bp = params->bp; in bnx2x_set_e1e2_module_fault_led()
8533 u32 fault_led_gpio = REG_RD(bp, params->shmem_base + in bnx2x_set_e1e2_module_fault_led()
8535 dev_info.port_hw_config[params->port].sfp_ctrl)) & in bnx2x_set_e1e2_module_fault_led()
8546 u16 gpio_pin = fault_led_gpio - in bnx2x_set_e1e2_module_fault_led()
8548 DP(NETIF_MSG_LINK, "Set fault module-detected led " in bnx2x_set_e1e2_module_fault_led()
8555 DP(NETIF_MSG_LINK, "Error: Invalid fault led mode 0x%x\n", in bnx2x_set_e1e2_module_fault_led()
8564 u8 port = params->port; in bnx2x_set_e3_module_fault_led()
8565 struct bnx2x *bp = params->bp; in bnx2x_set_e3_module_fault_led()
8566 pin_cfg = (REG_RD(bp, params->shmem_base + in bnx2x_set_e3_module_fault_led()
8571 DP(NETIF_MSG_LINK, "Setting Fault LED to %d using pin cfg %d\n", in bnx2x_set_e3_module_fault_led()
8579 struct bnx2x *bp = params->bp; in bnx2x_set_sfp_module_fault_led()
8580 DP(NETIF_MSG_LINK, "Setting SFP+ module fault LED to %d\n", gpio_mode); in bnx2x_set_sfp_module_fault_led()
8590 static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy, in bnx2x_warpcore_hw_reset() argument
8593 struct bnx2x *bp = params->bp; in bnx2x_warpcore_hw_reset()
8605 struct bnx2x_phy *phy, in bnx2x_power_sfp_module() argument
8608 struct bnx2x *bp = params->bp; in bnx2x_power_sfp_module()
8609 DP(NETIF_MSG_LINK, "Setting SFP+ power to %x\n", power); in bnx2x_power_sfp_module()
8611 switch (phy->type) { in bnx2x_power_sfp_module()
8614 bnx2x_8727_power_module(params->bp, phy, power); in bnx2x_power_sfp_module()
8624 struct bnx2x_phy *phy, in bnx2x_warpcore_set_limiting_mode() argument
8629 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_limiting_mode()
8631 u8 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_warpcore_set_limiting_mode()
8633 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_limiting_mode()
8651 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_limiting_mode()
8654 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_warpcore_set_limiting_mode()
8657 /* Restart microcode to re-read the new mode */ in bnx2x_warpcore_set_limiting_mode()
8658 bnx2x_warpcore_reset_lane(bp, phy, 1); in bnx2x_warpcore_set_limiting_mode()
8659 bnx2x_warpcore_reset_lane(bp, phy, 0); in bnx2x_warpcore_set_limiting_mode()
8664 struct bnx2x_phy *phy, in bnx2x_set_limiting_mode() argument
8667 switch (phy->type) { in bnx2x_set_limiting_mode()
8669 bnx2x_8726_set_limiting_mode(params->bp, phy, edc_mode); in bnx2x_set_limiting_mode()
8673 bnx2x_8727_set_limiting_mode(params->bp, phy, edc_mode); in bnx2x_set_limiting_mode()
8676 bnx2x_warpcore_set_limiting_mode(params, phy, edc_mode); in bnx2x_set_limiting_mode()
8681 static int bnx2x_sfp_module_detection(struct bnx2x_phy *phy, in bnx2x_sfp_module_detection() argument
8684 struct bnx2x *bp = params->bp; in bnx2x_sfp_module_detection()
8688 u32 val = REG_RD(bp, params->shmem_base + in bnx2x_sfp_module_detection()
8690 port_feature_config[params->port].config)); in bnx2x_sfp_module_detection()
8692 bnx2x_sfp_set_transmitter(params, phy, 1); in bnx2x_sfp_module_detection()
8693 DP(NETIF_MSG_LINK, "SFP+ module plugged in/out detected on port %d\n", in bnx2x_sfp_module_detection()
8694 params->port); in bnx2x_sfp_module_detection()
8696 bnx2x_power_sfp_module(params, phy, 1); in bnx2x_sfp_module_detection()
8697 if (bnx2x_get_edc_mode(phy, params, &edc_mode) != 0) { in bnx2x_sfp_module_detection()
8698 DP(NETIF_MSG_LINK, "Failed to get valid module type\n"); in bnx2x_sfp_module_detection()
8699 return -EINVAL; in bnx2x_sfp_module_detection()
8700 } else if (bnx2x_verify_sfp_module(phy, params) != 0) { in bnx2x_sfp_module_detection()
8702 DP(NETIF_MSG_LINK, "Module verification failed!!\n"); in bnx2x_sfp_module_detection()
8703 rc = -EINVAL; in bnx2x_sfp_module_detection()
8704 /* Turn on fault module-detected led */ in bnx2x_sfp_module_detection()
8711 DP(NETIF_MSG_LINK, "Shutdown SFP+ module!!\n"); in bnx2x_sfp_module_detection()
8712 bnx2x_power_sfp_module(params, phy, 0); in bnx2x_sfp_module_detection()
8716 /* Turn off fault module-detected led */ in bnx2x_sfp_module_detection()
8723 bnx2x_set_limiting_mode(params, phy, edc_mode); in bnx2x_sfp_module_detection()
8731 bnx2x_sfp_set_transmitter(params, phy, 0); in bnx2x_sfp_module_detection()
8738 struct bnx2x *bp = params->bp; in bnx2x_handle_module_detect_int()
8739 struct bnx2x_phy *phy; in bnx2x_handle_module_detect_int() local
8743 phy = ¶ms->phy[INT_PHY]; in bnx2x_handle_module_detect_int()
8745 bnx2x_sfp_set_transmitter(params, phy, 1); in bnx2x_handle_module_detect_int()
8747 phy = ¶ms->phy[EXT_PHY1]; in bnx2x_handle_module_detect_int()
8749 if (bnx2x_get_mod_abs_int_cfg(bp, params->chip_id, params->shmem_base, in bnx2x_handle_module_detect_int()
8750 params->port, &gpio_num, &gpio_port) == in bnx2x_handle_module_detect_int()
8751 -EINVAL) { in bnx2x_handle_module_detect_int()
8752 DP(NETIF_MSG_LINK, "Failed to get MOD_ABS interrupt config\n"); in bnx2x_handle_module_detect_int()
8765 bnx2x_set_aer_mmd(params, phy); in bnx2x_handle_module_detect_int()
8767 bnx2x_power_sfp_module(params, phy, 1); in bnx2x_handle_module_detect_int()
8771 if (bnx2x_wait_for_sfp_module_initialized(phy, params) == 0) { in bnx2x_handle_module_detect_int()
8772 bnx2x_sfp_module_detection(phy, params); in bnx2x_handle_module_detect_int()
8779 bnx2x_cl45_read(bp, phy, in bnx2x_handle_module_detect_int()
8784 (params->link_flags & in bnx2x_handle_module_detect_int()
8786 bnx2x_warpcore_reset_lane(bp, phy, 1); in bnx2x_handle_module_detect_int()
8787 bnx2x_warpcore_config_sfi(phy, params); in bnx2x_handle_module_detect_int()
8788 bnx2x_warpcore_reset_lane(bp, phy, 0); in bnx2x_handle_module_detect_int()
8792 DP(NETIF_MSG_LINK, "SFP+ module is not initialized\n"); in bnx2x_handle_module_detect_int()
8801 phy->media_type = ETH_PHY_NOT_PRESENT; in bnx2x_handle_module_detect_int()
8809 struct bnx2x_phy *phy, in bnx2x_sfp_mask_fault() argument
8814 bnx2x_cl45_read(bp, phy, in bnx2x_sfp_mask_fault()
8817 bnx2x_cl45_read(bp, phy, in bnx2x_sfp_mask_fault()
8821 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, alarm_ctrl_offset, &val); in bnx2x_sfp_mask_fault()
8826 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, alarm_ctrl_offset, val); in bnx2x_sfp_mask_fault()
8829 /* common BCM8706/BCM8726 PHY SECTION */
8831 static u8 bnx2x_8706_8726_read_status(struct bnx2x_phy *phy, in bnx2x_8706_8726_read_status() argument
8837 struct bnx2x *bp = params->bp; in bnx2x_8706_8726_read_status()
8838 DP(NETIF_MSG_LINK, "XGXS 8706/8726\n"); in bnx2x_8706_8726_read_status()
8840 bnx2x_cl45_read(bp, phy, in bnx2x_8706_8726_read_status()
8843 bnx2x_sfp_mask_fault(bp, phy, MDIO_PMA_LASI_TXSTAT, in bnx2x_8706_8726_read_status()
8847 bnx2x_cl45_read(bp, phy, in bnx2x_8706_8726_read_status()
8849 bnx2x_cl45_read(bp, phy, in bnx2x_8706_8726_read_status()
8851 DP(NETIF_MSG_LINK, "8706/8726 LASI status 0x%x--> 0x%x\n", val1, val2); in bnx2x_8706_8726_read_status()
8853 bnx2x_cl45_read(bp, phy, in bnx2x_8706_8726_read_status()
8855 bnx2x_cl45_read(bp, phy, in bnx2x_8706_8726_read_status()
8857 bnx2x_cl45_read(bp, phy, in bnx2x_8706_8726_read_status()
8859 bnx2x_cl45_read(bp, phy, in bnx2x_8706_8726_read_status()
8862 DP(NETIF_MSG_LINK, "8706/8726 rx_sd 0x%x pcs_status 0x%x 1Gbps" in bnx2x_8706_8726_read_status()
8870 vars->line_speed = SPEED_1000; in bnx2x_8706_8726_read_status()
8872 vars->line_speed = SPEED_10000; in bnx2x_8706_8726_read_status()
8873 bnx2x_ext_phy_resolve_fc(phy, params, vars); in bnx2x_8706_8726_read_status()
8874 vars->duplex = DUPLEX_FULL; in bnx2x_8706_8726_read_status()
8878 if (vars->line_speed == SPEED_10000) { in bnx2x_8706_8726_read_status()
8879 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, in bnx2x_8706_8726_read_status()
8881 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, in bnx2x_8706_8726_read_status()
8884 vars->fault_detected = 1; in bnx2x_8706_8726_read_status()
8891 /* BCM8706 PHY SECTION */
8893 static void bnx2x_8706_config_init(struct bnx2x_phy *phy, in bnx2x_8706_config_init() argument
8899 struct bnx2x *bp = params->bp; in bnx2x_8706_config_init()
8902 MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); in bnx2x_8706_config_init()
8904 bnx2x_ext_phy_hw_reset(bp, params->port); in bnx2x_8706_config_init()
8905 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0xa040); in bnx2x_8706_config_init()
8906 bnx2x_wait_reset_complete(bp, phy, params); in bnx2x_8706_config_init()
8910 bnx2x_cl45_read(bp, phy, in bnx2x_8706_config_init()
8916 DP(NETIF_MSG_LINK, "XGXS 8706 is initialized after %d ms\n", cnt); in bnx2x_8706_config_init()
8917 if ((params->feature_config_flags & in bnx2x_8706_config_init()
8923 i*(MDIO_XS_8706_REG_BANK_RX1 - in bnx2x_8706_config_init()
8925 bnx2x_cl45_read(bp, phy, MDIO_XS_DEVAD, reg, &val); in bnx2x_8706_config_init()
8929 val |= (phy->rx_preemphasis[i] & 0x7); in bnx2x_8706_config_init()
8930 DP(NETIF_MSG_LINK, "Setting RX Equalizer to BCM8706" in bnx2x_8706_config_init()
8931 " reg 0x%x <-- val 0x%x\n", reg, val); in bnx2x_8706_config_init()
8932 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, reg, val); in bnx2x_8706_config_init()
8936 if (phy->req_line_speed == SPEED_10000) { in bnx2x_8706_config_init()
8937 DP(NETIF_MSG_LINK, "XGXS 8706 force 10Gbps\n"); in bnx2x_8706_config_init()
8939 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8942 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8946 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8952 DP(NETIF_MSG_LINK, "XGXS 8706 AutoNeg\n"); in bnx2x_8706_config_init()
8953 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8956 /* Enable Full-Duplex advertisement on CL37 */ in bnx2x_8706_config_init()
8957 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8960 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8963 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8967 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8969 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8972 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8976 bnx2x_save_bcm_spirom_ver(bp, phy, params->port); in bnx2x_8706_config_init()
8978 /* If TX Laser is controlled by GPIO_0, do not let PHY go into low in bnx2x_8706_config_init()
8982 tx_en_mode = REG_RD(bp, params->shmem_base + in bnx2x_8706_config_init()
8984 dev_info.port_hw_config[params->port].sfp_ctrl)) in bnx2x_8706_config_init()
8988 DP(NETIF_MSG_LINK, "Enabling TXONOFF_PWRDN_DIS\n"); in bnx2x_8706_config_init()
8989 bnx2x_cl45_read(bp, phy, in bnx2x_8706_config_init()
8992 bnx2x_cl45_write(bp, phy, in bnx2x_8706_config_init()
8997 static u8 bnx2x_8706_read_status(struct bnx2x_phy *phy, in bnx2x_8706_read_status() argument
9001 return bnx2x_8706_8726_read_status(phy, params, vars); in bnx2x_8706_read_status()
9005 /* BCM8726 PHY SECTION */
9007 static void bnx2x_8726_config_loopback(struct bnx2x_phy *phy, in bnx2x_8726_config_loopback() argument
9010 struct bnx2x *bp = params->bp; in bnx2x_8726_config_loopback()
9011 DP(NETIF_MSG_LINK, "PMA/PMD ext_phy_loopback: 8726\n"); in bnx2x_8726_config_loopback()
9012 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0x0001); in bnx2x_8726_config_loopback()
9015 static void bnx2x_8726_external_rom_boot(struct bnx2x_phy *phy, in bnx2x_8726_external_rom_boot() argument
9018 struct bnx2x *bp = params->bp; in bnx2x_8726_external_rom_boot()
9022 /* Micro controller re-boot */ in bnx2x_8726_external_rom_boot()
9023 bnx2x_cl45_write(bp, phy, in bnx2x_8726_external_rom_boot()
9027 bnx2x_cl45_write(bp, phy, in bnx2x_8726_external_rom_boot()
9032 bnx2x_cl45_write(bp, phy, in bnx2x_8726_external_rom_boot()
9036 bnx2x_cl45_write(bp, phy, in bnx2x_8726_external_rom_boot()
9045 bnx2x_cl45_write(bp, phy, in bnx2x_8726_external_rom_boot()
9050 bnx2x_save_bcm_spirom_ver(bp, phy, params->port); in bnx2x_8726_external_rom_boot()
9053 static u8 bnx2x_8726_read_status(struct bnx2x_phy *phy, in bnx2x_8726_read_status() argument
9057 struct bnx2x *bp = params->bp; in bnx2x_8726_read_status()
9059 u8 link_up = bnx2x_8706_8726_read_status(phy, params, vars); in bnx2x_8726_read_status()
9061 bnx2x_cl45_read(bp, phy, in bnx2x_8726_read_status()
9065 DP(NETIF_MSG_LINK, "Tx is disabled\n"); in bnx2x_8726_read_status()
9067 vars->line_speed = 0; in bnx2x_8726_read_status()
9074 static void bnx2x_8726_config_init(struct bnx2x_phy *phy, in bnx2x_8726_config_init() argument
9078 struct bnx2x *bp = params->bp; in bnx2x_8726_config_init()
9079 DP(NETIF_MSG_LINK, "Initializing BCM8726\n"); in bnx2x_8726_config_init()
9081 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); in bnx2x_8726_config_init()
9082 bnx2x_wait_reset_complete(bp, phy, params); in bnx2x_8726_config_init()
9084 bnx2x_8726_external_rom_boot(phy, params); in bnx2x_8726_config_init()
9091 bnx2x_sfp_module_detection(phy, params); in bnx2x_8726_config_init()
9093 if (phy->req_line_speed == SPEED_1000) { in bnx2x_8726_config_init()
9094 DP(NETIF_MSG_LINK, "Setting 1G force\n"); in bnx2x_8726_config_init()
9095 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9097 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9099 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9101 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9104 } else if ((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_8726_config_init()
9105 (phy->speed_cap_mask & in bnx2x_8726_config_init()
9107 ((phy->speed_cap_mask & in bnx2x_8726_config_init()
9110 DP(NETIF_MSG_LINK, "Setting 1G clause37\n"); in bnx2x_8726_config_init()
9112 bnx2x_ext_phy_set_pause(params, phy, vars); in bnx2x_8726_config_init()
9113 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9115 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9117 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9119 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9121 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9123 /* Enable RX-ALARM control to receive interrupt for 1G speed in bnx2x_8726_config_init()
9126 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9128 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9133 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9138 if ((params->feature_config_flags & in bnx2x_8726_config_init()
9140 DP(NETIF_MSG_LINK, in bnx2x_8726_config_init()
9142 phy->tx_preemphasis[0], in bnx2x_8726_config_init()
9143 phy->tx_preemphasis[1]); in bnx2x_8726_config_init()
9144 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9147 phy->tx_preemphasis[0]); in bnx2x_8726_config_init()
9149 bnx2x_cl45_write(bp, phy, in bnx2x_8726_config_init()
9152 phy->tx_preemphasis[1]); in bnx2x_8726_config_init()
9156 static void bnx2x_8726_link_reset(struct bnx2x_phy *phy, in bnx2x_8726_link_reset() argument
9159 struct bnx2x *bp = params->bp; in bnx2x_8726_link_reset()
9160 DP(NETIF_MSG_LINK, "bnx2x_8726_link_reset port %d\n", params->port); in bnx2x_8726_link_reset()
9162 bnx2x_cl45_write(bp, phy, in bnx2x_8726_link_reset()
9168 /* BCM8727 PHY SECTION */
9171 static void bnx2x_8727_set_link_led(struct bnx2x_phy *phy, in bnx2x_8727_set_link_led() argument
9174 struct bnx2x *bp = params->bp; in bnx2x_8727_set_link_led()
9179 if (!(phy->flags & FLAGS_NOC)) in bnx2x_8727_set_link_led()
9196 bnx2x_cl45_read(bp, phy, in bnx2x_8727_set_link_led()
9202 bnx2x_cl45_write(bp, phy, in bnx2x_8727_set_link_led()
9206 bnx2x_cl45_read(bp, phy, in bnx2x_8727_set_link_led()
9212 bnx2x_cl45_write(bp, phy, in bnx2x_8727_set_link_led()
9217 static void bnx2x_8727_hw_reset(struct bnx2x_phy *phy, in bnx2x_8727_hw_reset() argument
9221 /* The PHY reset is controlled by GPIO 1. Fake the port number in bnx2x_8727_hw_reset()
9224 struct bnx2x *bp = params->bp; in bnx2x_8727_hw_reset()
9232 static void bnx2x_8727_config_speed(struct bnx2x_phy *phy, in bnx2x_8727_config_speed() argument
9235 struct bnx2x *bp = params->bp; in bnx2x_8727_config_speed()
9238 if ((phy->req_line_speed == SPEED_1000) || in bnx2x_8727_config_speed()
9239 (phy->media_type == ETH_PHY_SFP_1G_FIBER)) { in bnx2x_8727_config_speed()
9240 DP(NETIF_MSG_LINK, "Setting 1G force\n"); in bnx2x_8727_config_speed()
9241 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9243 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9245 bnx2x_cl45_read(bp, phy, in bnx2x_8727_config_speed()
9247 DP(NETIF_MSG_LINK, "1.7 = 0x%x\n", tmp1); in bnx2x_8727_config_speed()
9248 /* Power down the XAUI until link is up in case of dual-media in bnx2x_8727_config_speed()
9252 bnx2x_cl45_read(bp, phy, in bnx2x_8727_config_speed()
9256 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9260 } else if ((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_8727_config_speed()
9261 ((phy->speed_cap_mask & in bnx2x_8727_config_speed()
9263 ((phy->speed_cap_mask & in bnx2x_8727_config_speed()
9267 DP(NETIF_MSG_LINK, "Setting 1G clause37\n"); in bnx2x_8727_config_speed()
9268 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9270 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9276 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9279 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9281 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9283 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_speed()
9289 static void bnx2x_8727_config_init(struct bnx2x_phy *phy, in bnx2x_8727_config_init() argument
9295 struct bnx2x *bp = params->bp; in bnx2x_8727_config_init()
9298 bnx2x_wait_reset_complete(bp, phy, params); in bnx2x_8727_config_init()
9300 DP(NETIF_MSG_LINK, "Initializing BCM8727\n"); in bnx2x_8727_config_init()
9302 bnx2x_8727_specific_func(phy, params, PHY_INIT); in bnx2x_8727_config_init()
9306 bnx2x_cl45_read(bp, phy, in bnx2x_8727_config_init()
9313 if (!(phy->flags & FLAGS_NOC)) in bnx2x_8727_config_init()
9315 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_init()
9318 /* Enable/Disable PHY transmitter output */ in bnx2x_8727_config_init()
9319 bnx2x_set_disable_pmd_transmit(params, phy, 0); in bnx2x_8727_config_init()
9321 bnx2x_8727_power_module(bp, phy, 1); in bnx2x_8727_config_init()
9323 bnx2x_cl45_read(bp, phy, in bnx2x_8727_config_init()
9326 bnx2x_cl45_read(bp, phy, in bnx2x_8727_config_init()
9329 bnx2x_8727_config_speed(phy, params); in bnx2x_8727_config_init()
9333 if ((params->feature_config_flags & in bnx2x_8727_config_init()
9335 DP(NETIF_MSG_LINK, "Setting TX_CTRL1 0x%x, TX_CTRL2 0x%x\n", in bnx2x_8727_config_init()
9336 phy->tx_preemphasis[0], in bnx2x_8727_config_init()
9337 phy->tx_preemphasis[1]); in bnx2x_8727_config_init()
9338 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_init()
9340 phy->tx_preemphasis[0]); in bnx2x_8727_config_init()
9342 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_init()
9344 phy->tx_preemphasis[1]); in bnx2x_8727_config_init()
9347 /* If TX Laser is controlled by GPIO_0, do not let PHY go into low in bnx2x_8727_config_init()
9350 tx_en_mode = REG_RD(bp, params->shmem_base + in bnx2x_8727_config_init()
9352 dev_info.port_hw_config[params->port].sfp_ctrl)) in bnx2x_8727_config_init()
9357 DP(NETIF_MSG_LINK, "Enabling TXONOFF_PWRDN_DIS\n"); in bnx2x_8727_config_init()
9358 bnx2x_cl45_read(bp, phy, in bnx2x_8727_config_init()
9362 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_init()
9364 bnx2x_cl45_read(bp, phy, in bnx2x_8727_config_init()
9367 bnx2x_cl45_write(bp, phy, in bnx2x_8727_config_init()
9373 static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, in bnx2x_8727_handle_mod_abs() argument
9376 struct bnx2x *bp = params->bp; in bnx2x_8727_handle_mod_abs()
9378 u32 val = REG_RD(bp, params->shmem_base + in bnx2x_8727_handle_mod_abs()
9380 port_feature_config[params->port]. in bnx2x_8727_handle_mod_abs()
9382 bnx2x_cl45_read(bp, phy, in bnx2x_8727_handle_mod_abs()
9388 DP(NETIF_MSG_LINK, in bnx2x_8727_handle_mod_abs()
9390 phy->media_type = ETH_PHY_NOT_PRESENT; in bnx2x_8727_handle_mod_abs()
9399 if (!(phy->flags & FLAGS_NOC)) in bnx2x_8727_handle_mod_abs()
9401 bnx2x_cl45_write(bp, phy, in bnx2x_8727_handle_mod_abs()
9408 bnx2x_cl45_read(bp, phy, in bnx2x_8727_handle_mod_abs()
9414 DP(NETIF_MSG_LINK, in bnx2x_8727_handle_mod_abs()
9424 if (!(phy->flags & FLAGS_NOC)) in bnx2x_8727_handle_mod_abs()
9426 bnx2x_cl45_write(bp, phy, in bnx2x_8727_handle_mod_abs()
9435 bnx2x_cl45_read(bp, phy, in bnx2x_8727_handle_mod_abs()
9442 bnx2x_sfp_set_transmitter(params, phy, 0); in bnx2x_8727_handle_mod_abs()
9444 if (bnx2x_wait_for_sfp_module_initialized(phy, params) == 0) in bnx2x_8727_handle_mod_abs()
9445 bnx2x_sfp_module_detection(phy, params); in bnx2x_8727_handle_mod_abs()
9447 DP(NETIF_MSG_LINK, "SFP+ module is not initialized\n"); in bnx2x_8727_handle_mod_abs()
9450 bnx2x_8727_config_speed(phy, params); in bnx2x_8727_handle_mod_abs()
9453 DP(NETIF_MSG_LINK, "8727 RX_ALARM_STATUS 0x%x\n", in bnx2x_8727_handle_mod_abs()
9458 static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, in bnx2x_8727_read_status() argument
9463 struct bnx2x *bp = params->bp; in bnx2x_8727_read_status()
9464 u8 link_up = 0, oc_port = params->port; in bnx2x_8727_read_status()
9468 /* If PHY is not initialized, do not check link status */ in bnx2x_8727_read_status()
9469 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9476 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9479 vars->line_speed = 0; in bnx2x_8727_read_status()
9480 DP(NETIF_MSG_LINK, "8727 RX_ALARM_STATUS 0x%x\n", rx_alarm_status); in bnx2x_8727_read_status()
9482 bnx2x_sfp_mask_fault(bp, phy, MDIO_PMA_LASI_TXSTAT, in bnx2x_8727_read_status()
9485 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9488 DP(NETIF_MSG_LINK, "8727 LASI status 0x%x\n", val1); in bnx2x_8727_read_status()
9490 /* Clear MSG-OUT */ in bnx2x_8727_read_status()
9491 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9497 if (!(phy->flags & FLAGS_NOC) && !(rx_alarm_status & (1<<5))) { in bnx2x_8727_read_status()
9498 /* Check over-current using 8727 GPIO0 input*/ in bnx2x_8727_read_status()
9499 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9505 oc_port = BP_PATH(bp) + (params->port << 1); in bnx2x_8727_read_status()
9506 DP(NETIF_MSG_LINK, in bnx2x_8727_read_status()
9509 netdev_err(bp->dev, "Error: Power fault on Port %d has " in bnx2x_8727_read_status()
9518 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_status()
9522 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9527 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_status()
9531 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9534 bnx2x_8727_power_module(params->bp, phy, 0); in bnx2x_8727_read_status()
9541 bnx2x_8727_handle_mod_abs(phy, params); in bnx2x_8727_read_status()
9543 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_status()
9548 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) { in bnx2x_8727_read_status()
9549 DP(NETIF_MSG_LINK, "Enabling 8727 TX laser\n"); in bnx2x_8727_read_status()
9550 bnx2x_sfp_set_transmitter(params, phy, 1); in bnx2x_8727_read_status()
9552 DP(NETIF_MSG_LINK, "Tx is disabled\n"); in bnx2x_8727_read_status()
9556 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9560 /* Bits 0..2 --> speed detected, in bnx2x_8727_read_status()
9561 * Bits 13..15--> link is down in bnx2x_8727_read_status()
9565 vars->line_speed = SPEED_10000; in bnx2x_8727_read_status()
9566 DP(NETIF_MSG_LINK, "port %x: External link up in 10G\n", in bnx2x_8727_read_status()
9567 params->port); in bnx2x_8727_read_status()
9570 vars->line_speed = SPEED_1000; in bnx2x_8727_read_status()
9571 DP(NETIF_MSG_LINK, "port %x: External link up in 1G\n", in bnx2x_8727_read_status()
9572 params->port); in bnx2x_8727_read_status()
9575 DP(NETIF_MSG_LINK, "port %x: External link is down\n", in bnx2x_8727_read_status()
9576 params->port); in bnx2x_8727_read_status()
9580 if (vars->line_speed == SPEED_10000) { in bnx2x_8727_read_status()
9581 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, in bnx2x_8727_read_status()
9584 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, in bnx2x_8727_read_status()
9588 vars->fault_detected = 1; in bnx2x_8727_read_status()
9593 bnx2x_ext_phy_resolve_fc(phy, params, vars); in bnx2x_8727_read_status()
9594 vars->duplex = DUPLEX_FULL; in bnx2x_8727_read_status()
9595 DP(NETIF_MSG_LINK, "duplex = 0x%x\n", vars->duplex); in bnx2x_8727_read_status()
9599 (phy->req_line_speed == SPEED_1000)) { in bnx2x_8727_read_status()
9600 bnx2x_cl45_read(bp, phy, in bnx2x_8727_read_status()
9603 /* In case of dual-media board and 1G, power up the XAUI side, in bnx2x_8727_read_status()
9610 bnx2x_cl45_write(bp, phy, in bnx2x_8727_read_status()
9617 static void bnx2x_8727_link_reset(struct bnx2x_phy *phy, in bnx2x_8727_link_reset() argument
9620 struct bnx2x *bp = params->bp; in bnx2x_8727_link_reset()
9622 /* Enable/Disable PHY transmitter output */ in bnx2x_8727_link_reset()
9623 bnx2x_set_disable_pmd_transmit(params, phy, 1); in bnx2x_8727_link_reset()
9626 bnx2x_sfp_set_transmitter(params, phy, 0); in bnx2x_8727_link_reset()
9628 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_LASI_CTRL, 0); in bnx2x_8727_link_reset()
9633 /* BCM8481/BCM84823/BCM84833 PHY SECTION */
9635 static int bnx2x_is_8483x_8485x(struct bnx2x_phy *phy) in bnx2x_is_8483x_8485x() argument
9637 return ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) || in bnx2x_is_8483x_8485x()
9638 (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834) || in bnx2x_is_8483x_8485x()
9639 (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858)); in bnx2x_is_8483x_8485x()
9642 static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, in bnx2x_save_848xx_spirom_version() argument
9656 if (bnx2x_is_8483x_8485x(phy)) { in bnx2x_save_848xx_spirom_version()
9657 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); in bnx2x_save_848xx_spirom_version()
9658 if (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) in bnx2x_save_848xx_spirom_version()
9660 bnx2x_save_spirom_version(bp, port, fw_ver1, phy->ver_addr); in bnx2x_save_848xx_spirom_version()
9662 /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ in bnx2x_save_848xx_spirom_version()
9665 bnx2x_cl45_write(bp, phy, reg_set[i].devad, in bnx2x_save_848xx_spirom_version()
9669 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA818, &val); in bnx2x_save_848xx_spirom_version()
9675 DP(NETIF_MSG_LINK, "Unable to read 848xx " in bnx2x_save_848xx_spirom_version()
9676 "phy fw version(1)\n"); in bnx2x_save_848xx_spirom_version()
9678 phy->ver_addr); in bnx2x_save_848xx_spirom_version()
9684 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA819, 0x0000); in bnx2x_save_848xx_spirom_version()
9685 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81A, 0xc200); in bnx2x_save_848xx_spirom_version()
9686 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA817, 0x000A); in bnx2x_save_848xx_spirom_version()
9688 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA818, &val); in bnx2x_save_848xx_spirom_version()
9694 DP(NETIF_MSG_LINK, "Unable to read 848xx phy fw " in bnx2x_save_848xx_spirom_version()
9697 phy->ver_addr); in bnx2x_save_848xx_spirom_version()
9702 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA81B, &fw_ver1); in bnx2x_save_848xx_spirom_version()
9704 bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA81C, &fw_ver2); in bnx2x_save_848xx_spirom_version()
9707 phy->ver_addr); in bnx2x_save_848xx_spirom_version()
9712 struct bnx2x_phy *phy) in bnx2x_848xx_set_led() argument
9724 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) { in bnx2x_848xx_set_led()
9726 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_led()
9735 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_led()
9741 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_set_led()
9747 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) in bnx2x_848xx_set_led()
9750 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_led()
9755 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, in bnx2x_848xx_set_led()
9758 if (bnx2x_is_8483x_8485x(phy)) in bnx2x_848xx_set_led()
9763 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) in bnx2x_848xx_set_led()
9770 bnx2x_cl45_read_or_write(bp, phy, in bnx2x_848xx_set_led()
9776 static void bnx2x_848xx_specific_func(struct bnx2x_phy *phy, in bnx2x_848xx_specific_func() argument
9780 struct bnx2x *bp = params->bp; in bnx2x_848xx_specific_func()
9783 if (bnx2x_is_8483x_8485x(phy)) { in bnx2x_848xx_specific_func()
9785 bnx2x_save_848xx_spirom_version(phy, bp, params->port); in bnx2x_848xx_specific_func()
9787 /* This phy uses the NIG latch mechanism since link indication in bnx2x_848xx_specific_func()
9791 bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, in bnx2x_848xx_specific_func()
9794 bnx2x_848xx_set_led(bp, phy); in bnx2x_848xx_specific_func()
9799 static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, in bnx2x_848xx_cmn_config_init() argument
9803 struct bnx2x *bp = params->bp; in bnx2x_848xx_cmn_config_init()
9806 bnx2x_848xx_specific_func(phy, params, PHY_INIT); in bnx2x_848xx_cmn_config_init()
9807 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_cmn_config_init()
9811 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_cmn_config_init()
9815 bnx2x_ext_phy_set_pause(params, phy, vars); in bnx2x_848xx_cmn_config_init()
9816 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_cmn_config_init()
9820 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_cmn_config_init()
9827 if (((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_848xx_cmn_config_init()
9828 (phy->speed_cap_mask & in bnx2x_848xx_cmn_config_init()
9830 (phy->req_line_speed == SPEED_1000)) { in bnx2x_848xx_cmn_config_init()
9833 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_848xx_cmn_config_init()
9835 DP(NETIF_MSG_LINK, "Advertising 1G\n"); in bnx2x_848xx_cmn_config_init()
9839 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_cmn_config_init()
9844 if (phy->req_line_speed == SPEED_AUTO_NEG) { in bnx2x_848xx_cmn_config_init()
9845 if (phy->speed_cap_mask & in bnx2x_848xx_cmn_config_init()
9851 DP(NETIF_MSG_LINK, "Advertising 100M-FD\n"); in bnx2x_848xx_cmn_config_init()
9854 if (phy->speed_cap_mask & in bnx2x_848xx_cmn_config_init()
9860 DP(NETIF_MSG_LINK, "Advertising 100M-HD\n"); in bnx2x_848xx_cmn_config_init()
9863 if ((phy->speed_cap_mask & in bnx2x_848xx_cmn_config_init()
9865 (phy->supported & SUPPORTED_10baseT_Full)) { in bnx2x_848xx_cmn_config_init()
9868 DP(NETIF_MSG_LINK, "Advertising 10M-FD\n"); in bnx2x_848xx_cmn_config_init()
9871 if ((phy->speed_cap_mask & in bnx2x_848xx_cmn_config_init()
9873 (phy->supported & SUPPORTED_10baseT_Half)) { in bnx2x_848xx_cmn_config_init()
9876 DP(NETIF_MSG_LINK, "Advertising 10M-HD\n"); in bnx2x_848xx_cmn_config_init()
9881 if ((phy->req_line_speed == SPEED_100) && in bnx2x_848xx_cmn_config_init()
9882 (phy->supported & in bnx2x_848xx_cmn_config_init()
9886 /* Enabled AUTO-MDIX when autoneg is disabled */ in bnx2x_848xx_cmn_config_init()
9887 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_cmn_config_init()
9890 /* The PHY needs this set even for forced link. */ in bnx2x_848xx_cmn_config_init()
9892 DP(NETIF_MSG_LINK, "Setting 100M force\n"); in bnx2x_848xx_cmn_config_init()
9894 if ((phy->req_line_speed == SPEED_10) && in bnx2x_848xx_cmn_config_init()
9895 (phy->supported & in bnx2x_848xx_cmn_config_init()
9898 /* Enabled AUTO-MDIX when autoneg is disabled */ in bnx2x_848xx_cmn_config_init()
9899 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_cmn_config_init()
9902 DP(NETIF_MSG_LINK, "Setting 10M force\n"); in bnx2x_848xx_cmn_config_init()
9905 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_cmn_config_init()
9909 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_848xx_cmn_config_init()
9915 if (!bnx2x_is_8483x_8485x(phy) || in bnx2x_848xx_cmn_config_init()
9917 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_cmn_config_init()
9921 if (((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_848xx_cmn_config_init()
9922 (phy->speed_cap_mask & in bnx2x_848xx_cmn_config_init()
9924 (phy->req_line_speed == SPEED_10000)) { in bnx2x_848xx_cmn_config_init()
9925 DP(NETIF_MSG_LINK, "Advertising 10G\n"); in bnx2x_848xx_cmn_config_init()
9929 bp, phy, in bnx2x_848xx_cmn_config_init()
9933 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_cmn_config_init()
9937 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_cmn_config_init()
9945 static void bnx2x_8481_config_init(struct bnx2x_phy *phy, in bnx2x_8481_config_init() argument
9949 struct bnx2x *bp = params->bp; in bnx2x_8481_config_init()
9952 MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); in bnx2x_8481_config_init()
9955 bnx2x_ext_phy_hw_reset(bp, params->port); in bnx2x_8481_config_init()
9956 bnx2x_wait_reset_complete(bp, phy, params); in bnx2x_8481_config_init()
9958 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); in bnx2x_8481_config_init()
9959 bnx2x_848xx_cmn_config_init(phy, params, vars); in bnx2x_8481_config_init()
9965 static int bnx2x_84858_cmd_hdlr(struct bnx2x_phy *phy, in bnx2x_84858_cmd_hdlr() argument
9972 struct bnx2x *bp = params->bp; in bnx2x_84858_cmd_hdlr()
9982 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84858_cmd_hdlr()
9990 DP(NETIF_MSG_LINK, "FW cmd: FW not ready.\n"); in bnx2x_84858_cmd_hdlr()
9991 return -EINVAL; in bnx2x_84858_cmd_hdlr()
9999 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84858_cmd_hdlr()
10007 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84858_cmd_hdlr()
10016 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84858_cmd_hdlr()
10025 DP(NETIF_MSG_LINK, "FW cmd failed.\n"); in bnx2x_84858_cmd_hdlr()
10026 return -EINVAL; in bnx2x_84858_cmd_hdlr()
10034 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84858_cmd_hdlr()
10042 static int bnx2x_84833_cmd_hdlr(struct bnx2x_phy *phy, in bnx2x_84833_cmd_hdlr() argument
10048 struct bnx2x *bp = params->bp; in bnx2x_84833_cmd_hdlr()
10053 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84833_cmd_hdlr()
10059 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84833_cmd_hdlr()
10066 DP(NETIF_MSG_LINK, "FW cmd: FW not ready.\n"); in bnx2x_84833_cmd_hdlr()
10072 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84833_cmd_hdlr()
10076 return -EINVAL; in bnx2x_84833_cmd_hdlr()
10082 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84833_cmd_hdlr()
10088 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84833_cmd_hdlr()
10091 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84833_cmd_hdlr()
10100 DP(NETIF_MSG_LINK, "FW cmd failed.\n"); in bnx2x_84833_cmd_hdlr()
10101 rc = -EINVAL; in bnx2x_84833_cmd_hdlr()
10106 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84833_cmd_hdlr()
10113 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_84833_cmd_hdlr()
10120 static int bnx2x_848xx_cmd_hdlr(struct bnx2x_phy *phy, in bnx2x_848xx_cmd_hdlr() argument
10126 struct bnx2x *bp = params->bp; in bnx2x_848xx_cmd_hdlr()
10128 if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) || in bnx2x_848xx_cmd_hdlr()
10129 (REG_RD(bp, params->shmem2_base + in bnx2x_848xx_cmd_hdlr()
10131 link_attr_sync[params->port])) & in bnx2x_848xx_cmd_hdlr()
10133 return bnx2x_84858_cmd_hdlr(phy, params, fw_cmd, cmd_args, in bnx2x_848xx_cmd_hdlr()
10136 return bnx2x_84833_cmd_hdlr(phy, params, fw_cmd, cmd_args, in bnx2x_848xx_cmd_hdlr()
10141 static int bnx2x_848xx_pair_swap_cfg(struct bnx2x_phy *phy, in bnx2x_848xx_pair_swap_cfg() argument
10148 struct bnx2x *bp = params->bp; in bnx2x_848xx_pair_swap_cfg()
10151 pair_swap = REG_RD(bp, params->shmem_base + in bnx2x_848xx_pair_swap_cfg()
10153 dev_info.port_hw_config[params->port].xgbt_phy_cfg)) & in bnx2x_848xx_pair_swap_cfg()
10162 status = bnx2x_848xx_cmd_hdlr(phy, params, in bnx2x_848xx_pair_swap_cfg()
10166 DP(NETIF_MSG_LINK, "Pairswap OK, val=0x%x\n", data[1]); in bnx2x_848xx_pair_swap_cfg()
10188 reset_pin[idx] -= PIN_CFG_GPIO0_P0; in bnx2x_84833_get_reset_gpios()
10199 reset_pin[idx] -= PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P0; in bnx2x_84833_get_reset_gpios()
10209 static void bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, in bnx2x_84833_hw_reset_phy() argument
10212 struct bnx2x *bp = params->bp; in bnx2x_84833_hw_reset_phy()
10214 u32 other_shmem_base_addr = REG_RD(bp, params->shmem2_base + in bnx2x_84833_hw_reset_phy()
10221 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_84833_hw_reset_phy()
10224 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_84833_hw_reset_phy()
10228 shmem_base_path[0] = params->shmem_base; in bnx2x_84833_hw_reset_phy()
10232 params->chip_id); in bnx2x_84833_hw_reset_phy()
10236 DP(NETIF_MSG_LINK, "84833 hw reset on pin values 0x%x\n", in bnx2x_84833_hw_reset_phy()
10240 static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy, in bnx2x_8483x_disable_eee() argument
10245 struct bnx2x *bp = params->bp; in bnx2x_8483x_disable_eee()
10248 DP(NETIF_MSG_LINK, "Don't Advertise 10GBase-T EEE\n"); in bnx2x_8483x_disable_eee()
10250 /* Prevent Phy from working in EEE and advertising it */ in bnx2x_8483x_disable_eee()
10251 rc = bnx2x_848xx_cmd_hdlr(phy, params, PHY848xx_CMD_SET_EEE_MODE, in bnx2x_8483x_disable_eee()
10254 DP(NETIF_MSG_LINK, "EEE disable failed.\n"); in bnx2x_8483x_disable_eee()
10258 return bnx2x_eee_disable(phy, params, vars); in bnx2x_8483x_disable_eee()
10261 static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy, in bnx2x_8483x_enable_eee() argument
10266 struct bnx2x *bp = params->bp; in bnx2x_8483x_enable_eee()
10269 rc = bnx2x_848xx_cmd_hdlr(phy, params, PHY848xx_CMD_SET_EEE_MODE, in bnx2x_8483x_enable_eee()
10272 DP(NETIF_MSG_LINK, "EEE enable failed.\n"); in bnx2x_8483x_enable_eee()
10276 return bnx2x_eee_advertise(phy, params, vars, SHMEM_EEE_10G_ADV); in bnx2x_8483x_enable_eee()
10280 static void bnx2x_848x3_config_init(struct bnx2x_phy *phy, in bnx2x_848x3_config_init() argument
10284 struct bnx2x *bp = params->bp; in bnx2x_848x3_config_init()
10296 port = params->port; in bnx2x_848x3_config_init()
10298 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823) { in bnx2x_848x3_config_init()
10304 bnx2x_cl45_write(bp, phy, in bnx2x_848x3_config_init()
10309 bnx2x_wait_reset_complete(bp, phy, params); in bnx2x_848x3_config_init()
10313 if (!bnx2x_is_8483x_8485x(phy)) { in bnx2x_848x3_config_init()
10318 temp = vars->line_speed; in bnx2x_848x3_config_init()
10319 vars->line_speed = SPEED_10000; in bnx2x_848x3_config_init()
10320 bnx2x_set_autoneg(¶ms->phy[INT_PHY], params, vars, 0); in bnx2x_848x3_config_init()
10321 bnx2x_program_serdes(¶ms->phy[INT_PHY], params, vars); in bnx2x_848x3_config_init()
10322 vars->line_speed = temp; in bnx2x_848x3_config_init()
10325 if (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) { in bnx2x_848x3_config_init()
10328 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_848x3_config_init()
10331 params->link_attr_sync |= LINK_ATTR_84858; in bnx2x_848x3_config_init()
10332 bnx2x_update_link_attr(params, params->link_attr_sync); in bnx2x_848x3_config_init()
10336 /* Set dual-media configuration according to configuration */ in bnx2x_848x3_config_init()
10337 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_848x3_config_init()
10366 /* Do nothing here. The first PHY won't be initialized at all */ in bnx2x_848x3_config_init()
10373 if (params->phy[EXT_PHY2].req_line_speed == SPEED_1000) in bnx2x_848x3_config_init()
10376 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_848x3_config_init()
10378 DP(NETIF_MSG_LINK, "Multi_phy config = 0x%x, Media control = 0x%x\n", in bnx2x_848x3_config_init()
10379 params->multi_phy_config, val); in bnx2x_848x3_config_init()
10381 if (bnx2x_is_8483x_8485x(phy)) { in bnx2x_848x3_config_init()
10382 bnx2x_848xx_pair_swap_cfg(phy, params, vars); in bnx2x_848x3_config_init()
10389 rc = bnx2x_848xx_cmd_hdlr(phy, params, in bnx2x_848x3_config_init()
10393 DP(NETIF_MSG_LINK, "Cfg AutogrEEEn failed.\n"); in bnx2x_848x3_config_init()
10396 rc = bnx2x_848xx_cmn_config_init(phy, params, vars); in bnx2x_848x3_config_init()
10398 bnx2x_save_848xx_spirom_version(phy, bp, params->port); in bnx2x_848x3_config_init()
10399 /* 84833 PHY has a better feature and doesn't need to support this. */ in bnx2x_848x3_config_init()
10400 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823) { in bnx2x_848x3_config_init()
10401 u32 cms_enable = REG_RD(bp, params->shmem_base + in bnx2x_848x3_config_init()
10403 dev_info.port_hw_config[params->port].default_cfg)) & in bnx2x_848x3_config_init()
10406 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_848x3_config_init()
10412 bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, in bnx2x_848x3_config_init()
10416 bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, in bnx2x_848x3_config_init()
10425 DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n"); in bnx2x_848x3_config_init()
10426 bnx2x_8483x_disable_eee(phy, params, vars); in bnx2x_848x3_config_init()
10430 if ((phy->req_duplex == DUPLEX_FULL) && in bnx2x_848x3_config_init()
10431 (params->eee_mode & EEE_MODE_ADV_LPI) && in bnx2x_848x3_config_init()
10433 !(params->eee_mode & EEE_MODE_ENABLE_LPI))) in bnx2x_848x3_config_init()
10434 rc = bnx2x_8483x_enable_eee(phy, params, vars); in bnx2x_848x3_config_init()
10436 rc = bnx2x_8483x_disable_eee(phy, params, vars); in bnx2x_848x3_config_init()
10438 DP(NETIF_MSG_LINK, "Failed to set EEE advertisement\n"); in bnx2x_848x3_config_init()
10442 vars->eee_status &= ~SHMEM_EEE_SUPPORTED_MASK; in bnx2x_848x3_config_init()
10445 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { in bnx2x_848x3_config_init()
10446 /* Additional settings for jumbo packets in 1000BASE-T mode */ in bnx2x_848x3_config_init()
10448 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_848x3_config_init()
10451 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_848x3_config_init()
10454 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_848x3_config_init()
10457 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_848x3_config_init()
10461 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_848x3_config_init()
10464 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_848x3_config_init()
10467 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_848x3_config_init()
10471 if (bnx2x_is_8483x_8485x(phy)) { in bnx2x_848x3_config_init()
10472 /* Bring PHY out of super isolate mode as the final step. */ in bnx2x_848x3_config_init()
10473 bnx2x_cl45_read_and_write(bp, phy, in bnx2x_848x3_config_init()
10480 static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, in bnx2x_848xx_read_status() argument
10484 struct bnx2x *bp = params->bp; in bnx2x_848xx_read_status()
10489 /* Check 10G-BaseT link status */ in bnx2x_848xx_read_status()
10491 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_read_status()
10493 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_read_status()
10496 DP(NETIF_MSG_LINK, "BCM848xx: PMD_SIGNAL 1.a811 = 0x%x\n", val2); in bnx2x_848xx_read_status()
10500 vars->line_speed = SPEED_10000; in bnx2x_848xx_read_status()
10501 vars->duplex = DUPLEX_FULL; in bnx2x_848xx_read_status()
10503 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); in bnx2x_848xx_read_status()
10508 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_read_status()
10513 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_read_status()
10518 DP(NETIF_MSG_LINK, "Legacy speed status = 0x%x\n", in bnx2x_848xx_read_status()
10523 vars->line_speed = SPEED_10; in bnx2x_848xx_read_status()
10525 vars->line_speed = SPEED_100; in bnx2x_848xx_read_status()
10527 vars->line_speed = SPEED_1000; in bnx2x_848xx_read_status()
10529 vars->line_speed = 0; in bnx2x_848xx_read_status()
10535 vars->duplex = DUPLEX_FULL; in bnx2x_848xx_read_status()
10537 vars->duplex = DUPLEX_HALF; in bnx2x_848xx_read_status()
10539 DP(NETIF_MSG_LINK, in bnx2x_848xx_read_status()
10541 vars->line_speed, in bnx2x_848xx_read_status()
10542 (vars->duplex == DUPLEX_FULL)); in bnx2x_848xx_read_status()
10544 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_read_status()
10549 vars->link_status |= in bnx2x_848xx_read_status()
10551 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_read_status()
10556 vars->link_status |= in bnx2x_848xx_read_status()
10561 DP(NETIF_MSG_LINK, "BCM848x3: link speed is %d\n", in bnx2x_848xx_read_status()
10562 vars->line_speed); in bnx2x_848xx_read_status()
10563 bnx2x_ext_phy_resolve_fc(phy, params, vars); in bnx2x_848xx_read_status()
10566 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_848xx_read_status()
10569 vars->link_status |= in bnx2x_848xx_read_status()
10572 vars->link_status |= in bnx2x_848xx_read_status()
10575 vars->link_status |= in bnx2x_848xx_read_status()
10578 vars->link_status |= in bnx2x_848xx_read_status()
10581 vars->link_status |= in bnx2x_848xx_read_status()
10584 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_848xx_read_status()
10588 vars->link_status |= in bnx2x_848xx_read_status()
10591 vars->link_status |= in bnx2x_848xx_read_status()
10594 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_848xx_read_status()
10598 vars->link_status |= in bnx2x_848xx_read_status()
10602 if (bnx2x_is_8483x_8485x(phy)) in bnx2x_848xx_read_status()
10603 bnx2x_eee_an_resolve(phy, params, vars); in bnx2x_848xx_read_status()
10626 static void bnx2x_8481_hw_reset(struct bnx2x_phy *phy, in bnx2x_8481_hw_reset() argument
10629 bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, in bnx2x_8481_hw_reset()
10631 bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, in bnx2x_8481_hw_reset()
10635 static void bnx2x_8481_link_reset(struct bnx2x_phy *phy, in bnx2x_8481_link_reset() argument
10638 bnx2x_cl45_write(params->bp, phy, in bnx2x_8481_link_reset()
10640 bnx2x_cl45_write(params->bp, phy, in bnx2x_8481_link_reset()
10644 static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy, in bnx2x_848x3_link_reset() argument
10647 struct bnx2x *bp = params->bp; in bnx2x_848x3_link_reset()
10654 port = params->port; in bnx2x_848x3_link_reset()
10656 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823) { in bnx2x_848x3_link_reset()
10661 bnx2x_cl45_read(bp, phy, in bnx2x_848x3_link_reset()
10665 bnx2x_cl45_write(bp, phy, in bnx2x_848x3_link_reset()
10671 static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, in bnx2x_848xx_set_link_led() argument
10674 struct bnx2x *bp = params->bp; in bnx2x_848xx_set_link_led()
10681 port = params->port; in bnx2x_848xx_set_link_led()
10686 DP(NETIF_MSG_LINK, "Port 0x%x: LED MODE OFF\n", port); in bnx2x_848xx_set_link_led()
10688 if ((params->hw_led_mode << SHARED_HW_CFG_LED_MODE_SHIFT) == in bnx2x_848xx_set_link_led()
10692 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10697 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10702 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10707 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10714 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10719 if (phy->type == in bnx2x_848xx_set_link_led()
10722 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10727 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10736 DP(NETIF_MSG_LINK, "Port 0x%x: LED MODE FRONT PANEL OFF\n", in bnx2x_848xx_set_link_led()
10739 if ((params->hw_led_mode << SHARED_HW_CFG_LED_MODE_SHIFT) == in bnx2x_848xx_set_link_led()
10743 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10748 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10753 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10758 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10764 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10768 if (phy->type == in bnx2x_848xx_set_link_led()
10774 params->port*4) & in bnx2x_848xx_set_link_led()
10776 params->link_flags |= in bnx2x_848xx_set_link_led()
10782 params->port*4, in bnx2x_848xx_set_link_led()
10785 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10790 if (phy->type == in bnx2x_848xx_set_link_led()
10793 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10798 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10807 DP(NETIF_MSG_LINK, "Port 0x%x: LED MODE ON\n", port); in bnx2x_848xx_set_link_led()
10809 if ((params->hw_led_mode << SHARED_HW_CFG_LED_MODE_SHIFT) == in bnx2x_848xx_set_link_led()
10812 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_set_link_led()
10819 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10825 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10830 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10835 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10840 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10845 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10849 if (phy->type == in bnx2x_848xx_set_link_led()
10855 params->port*4) & in bnx2x_848xx_set_link_led()
10857 params->link_flags |= in bnx2x_848xx_set_link_led()
10863 params->port*4, in bnx2x_848xx_set_link_led()
10867 if (phy->type == in bnx2x_848xx_set_link_led()
10870 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_set_link_led()
10876 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10880 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10885 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10895 DP(NETIF_MSG_LINK, "Port 0x%x: LED MODE OPER\n", port); in bnx2x_848xx_set_link_led()
10897 if ((params->hw_led_mode << SHARED_HW_CFG_LED_MODE_SHIFT) == in bnx2x_848xx_set_link_led()
10901 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_set_link_led()
10909 DP(NETIF_MSG_LINK, "Setting LINK_SIGNAL\n"); in bnx2x_848xx_set_link_led()
10910 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10917 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10922 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10927 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10932 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10942 val = ((params->hw_led_mode << in bnx2x_848xx_set_link_led()
10946 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10952 bnx2x_cl45_read(bp, phy, in bnx2x_848xx_set_link_led()
10958 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10962 if (phy->type == in bnx2x_848xx_set_link_led()
10964 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10968 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10973 if (phy->type == in bnx2x_848xx_set_link_led()
10976 * and re-enable interrupts. in bnx2x_848xx_set_link_led()
10978 bnx2x_cl45_write(bp, phy, in bnx2x_848xx_set_link_led()
10982 if (params->link_flags & in bnx2x_848xx_set_link_led()
10985 params->link_flags &= in bnx2x_848xx_set_link_led()
10997 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, in bnx2x_848xx_set_link_led()
11003 /* 54618SE PHY SECTION */
11005 static void bnx2x_54618se_specific_func(struct bnx2x_phy *phy, in bnx2x_54618se_specific_func() argument
11009 struct bnx2x *bp = params->bp; in bnx2x_54618se_specific_func()
11015 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_specific_func()
11018 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_specific_func()
11023 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_specific_func()
11027 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_specific_func()
11034 static void bnx2x_54618se_config_init(struct bnx2x_phy *phy, in bnx2x_54618se_config_init() argument
11038 struct bnx2x *bp = params->bp; in bnx2x_54618se_config_init()
11043 DP(NETIF_MSG_LINK, "54618SE cfg init\n"); in bnx2x_54618se_config_init()
11049 port = params->port; in bnx2x_54618se_config_init()
11051 cfg_pin = (REG_RD(bp, params->shmem_base + in bnx2x_54618se_config_init()
11063 /* reset phy */ in bnx2x_54618se_config_init()
11064 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_config_init()
11066 bnx2x_wait_reset_complete(bp, phy, params); in bnx2x_54618se_config_init()
11072 bnx2x_54618se_specific_func(phy, params, PHY_INIT); in bnx2x_54618se_config_init()
11074 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_config_init()
11077 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_config_init()
11081 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_config_init()
11086 /* Please refer to Table 28B-3 of 802.3ab-1999 spec. */ in bnx2x_54618se_config_init()
11087 bnx2x_calc_ieee_aneg_adv(phy, params, &vars->ieee_fc); in bnx2x_54618se_config_init()
11089 if ((vars->ieee_fc & MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC) == in bnx2x_54618se_config_init()
11093 if ((vars->ieee_fc & MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH) == in bnx2x_54618se_config_init()
11098 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_config_init()
11102 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_config_init()
11106 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_config_init()
11115 if (((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_54618se_config_init()
11116 (phy->speed_cap_mask & in bnx2x_54618se_config_init()
11118 (phy->req_line_speed == SPEED_1000)) { in bnx2x_54618se_config_init()
11121 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_54618se_config_init()
11123 DP(NETIF_MSG_LINK, "Advertising 1G\n"); in bnx2x_54618se_config_init()
11127 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_config_init()
11130 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_config_init()
11135 if (phy->req_line_speed == SPEED_AUTO_NEG) { in bnx2x_54618se_config_init()
11136 if (phy->speed_cap_mask & in bnx2x_54618se_config_init()
11140 DP(NETIF_MSG_LINK, "Advertising 10M-HD\n"); in bnx2x_54618se_config_init()
11142 if (phy->speed_cap_mask & in bnx2x_54618se_config_init()
11146 DP(NETIF_MSG_LINK, "Advertising 10M-FD\n"); in bnx2x_54618se_config_init()
11148 if (phy->speed_cap_mask & in bnx2x_54618se_config_init()
11152 DP(NETIF_MSG_LINK, "Advertising 100M-HD\n"); in bnx2x_54618se_config_init()
11154 if (phy->speed_cap_mask & in bnx2x_54618se_config_init()
11158 DP(NETIF_MSG_LINK, "Advertising 100M-FD\n"); in bnx2x_54618se_config_init()
11163 if (phy->req_line_speed == SPEED_100) { in bnx2x_54618se_config_init()
11165 /* Enabled AUTO-MDIX when autoneg is disabled */ in bnx2x_54618se_config_init()
11166 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_config_init()
11169 DP(NETIF_MSG_LINK, "Setting 100M force\n"); in bnx2x_54618se_config_init()
11171 if (phy->req_line_speed == SPEED_10) { in bnx2x_54618se_config_init()
11172 /* Enabled AUTO-MDIX when autoneg is disabled */ in bnx2x_54618se_config_init()
11173 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_config_init()
11176 DP(NETIF_MSG_LINK, "Setting 10M force\n"); in bnx2x_54618se_config_init()
11179 if ((phy->flags & FLAGS_EEE) && bnx2x_eee_has_cap(params)) { in bnx2x_54618se_config_init()
11182 bnx2x_cl22_write(bp, phy, MDIO_REG_GPHY_EXP_ACCESS, in bnx2x_54618se_config_init()
11185 bnx2x_cl22_read(bp, phy, MDIO_REG_GPHY_EXP_ACCESS_GATE, &temp); in bnx2x_54618se_config_init()
11187 bnx2x_cl22_write(bp, phy, MDIO_REG_GPHY_EXP_ACCESS_GATE, temp); in bnx2x_54618se_config_init()
11191 DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n"); in bnx2x_54618se_config_init()
11192 bnx2x_eee_disable(phy, params, vars); in bnx2x_54618se_config_init()
11193 } else if ((params->eee_mode & EEE_MODE_ADV_LPI) && in bnx2x_54618se_config_init()
11194 (phy->req_duplex == DUPLEX_FULL) && in bnx2x_54618se_config_init()
11196 !(params->eee_mode & EEE_MODE_ENABLE_LPI))) { in bnx2x_54618se_config_init()
11202 bnx2x_eee_advertise(phy, params, vars, in bnx2x_54618se_config_init()
11205 DP(NETIF_MSG_LINK, "Don't Advertise 1GBase-T EEE\n"); in bnx2x_54618se_config_init()
11206 bnx2x_eee_disable(phy, params, vars); in bnx2x_54618se_config_init()
11209 vars->eee_status &= ~SHMEM_EEE_1G_ADV << in bnx2x_54618se_config_init()
11212 if (phy->flags & FLAGS_EEE) { in bnx2x_54618se_config_init()
11213 /* Handle legacy auto-grEEEn */ in bnx2x_54618se_config_init()
11214 if (params->feature_config_flags & in bnx2x_54618se_config_init()
11217 DP(NETIF_MSG_LINK, "Enabling Auto-GrEEEn\n"); in bnx2x_54618se_config_init()
11220 DP(NETIF_MSG_LINK, "Don't Adv. EEE\n"); in bnx2x_54618se_config_init()
11222 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, in bnx2x_54618se_config_init()
11227 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_config_init()
11231 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_54618se_config_init()
11234 bnx2x_cl22_write(bp, phy, in bnx2x_54618se_config_init()
11239 static void bnx2x_5461x_set_link_led(struct bnx2x_phy *phy, in bnx2x_5461x_set_link_led() argument
11242 struct bnx2x *bp = params->bp; in bnx2x_5461x_set_link_led()
11245 bnx2x_cl22_write(bp, phy, in bnx2x_5461x_set_link_led()
11248 bnx2x_cl22_read(bp, phy, in bnx2x_5461x_set_link_led()
11253 DP(NETIF_MSG_LINK, "54618x set link led (mode=%x)\n", mode); in bnx2x_5461x_set_link_led()
11268 bnx2x_cl22_write(bp, phy, in bnx2x_5461x_set_link_led()
11275 static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy, in bnx2x_54618se_link_reset() argument
11278 struct bnx2x *bp = params->bp; in bnx2x_54618se_link_reset()
11285 bnx2x_cl22_write(bp, phy, MDIO_PMA_REG_CTRL, 0x800); in bnx2x_54618se_link_reset()
11289 port = params->port; in bnx2x_54618se_link_reset()
11290 cfg_pin = (REG_RD(bp, params->shmem_base + in bnx2x_54618se_link_reset()
11300 static u8 bnx2x_54618se_read_status(struct bnx2x_phy *phy, in bnx2x_54618se_read_status() argument
11304 struct bnx2x *bp = params->bp; in bnx2x_54618se_read_status()
11310 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_read_status()
11313 DP(NETIF_MSG_LINK, "54618SE read_status: 0x%x\n", legacy_status); in bnx2x_54618se_read_status()
11315 /* Read status to clear the PHY interrupt. */ in bnx2x_54618se_read_status()
11316 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_read_status()
11325 vars->line_speed = SPEED_1000; in bnx2x_54618se_read_status()
11326 vars->duplex = DUPLEX_FULL; in bnx2x_54618se_read_status()
11328 vars->line_speed = SPEED_1000; in bnx2x_54618se_read_status()
11329 vars->duplex = DUPLEX_HALF; in bnx2x_54618se_read_status()
11331 vars->line_speed = SPEED_100; in bnx2x_54618se_read_status()
11332 vars->duplex = DUPLEX_FULL; in bnx2x_54618se_read_status()
11334 /* Omitting 100Base-T4 for now */ in bnx2x_54618se_read_status()
11336 vars->line_speed = SPEED_100; in bnx2x_54618se_read_status()
11337 vars->duplex = DUPLEX_HALF; in bnx2x_54618se_read_status()
11339 vars->line_speed = SPEED_10; in bnx2x_54618se_read_status()
11340 vars->duplex = DUPLEX_FULL; in bnx2x_54618se_read_status()
11342 vars->line_speed = SPEED_10; in bnx2x_54618se_read_status()
11343 vars->duplex = DUPLEX_HALF; in bnx2x_54618se_read_status()
11345 vars->line_speed = 0; in bnx2x_54618se_read_status()
11347 DP(NETIF_MSG_LINK, in bnx2x_54618se_read_status()
11349 vars->line_speed, in bnx2x_54618se_read_status()
11350 (vars->duplex == DUPLEX_FULL)); in bnx2x_54618se_read_status()
11353 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_read_status()
11357 vars->link_status |= in bnx2x_54618se_read_status()
11359 bnx2x_cl22_read(bp, phy, in bnx2x_54618se_read_status()
11363 vars->link_status |= in bnx2x_54618se_read_status()
11366 DP(NETIF_MSG_LINK, "BCM54618SE: link speed is %d\n", in bnx2x_54618se_read_status()
11367 vars->line_speed); in bnx2x_54618se_read_status()
11369 bnx2x_ext_phy_resolve_fc(phy, params, vars); in bnx2x_54618se_read_status()
11371 if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) { in bnx2x_54618se_read_status()
11373 bnx2x_cl22_read(bp, phy, 0x5, &val); in bnx2x_54618se_read_status()
11376 vars->link_status |= in bnx2x_54618se_read_status()
11379 vars->link_status |= in bnx2x_54618se_read_status()
11382 vars->link_status |= in bnx2x_54618se_read_status()
11385 vars->link_status |= in bnx2x_54618se_read_status()
11388 vars->link_status |= in bnx2x_54618se_read_status()
11391 bnx2x_cl22_read(bp, phy, 0xa, &val); in bnx2x_54618se_read_status()
11393 vars->link_status |= in bnx2x_54618se_read_status()
11396 vars->link_status |= in bnx2x_54618se_read_status()
11399 if ((phy->flags & FLAGS_EEE) && in bnx2x_54618se_read_status()
11401 bnx2x_eee_an_resolve(phy, params, vars); in bnx2x_54618se_read_status()
11407 static void bnx2x_54618se_config_loopback(struct bnx2x_phy *phy, in bnx2x_54618se_config_loopback() argument
11410 struct bnx2x *bp = params->bp; in bnx2x_54618se_config_loopback()
11412 u32 umac_base = params->port ? GRCBASE_UMAC1 : GRCBASE_UMAC0; in bnx2x_54618se_config_loopback()
11414 DP(NETIF_MSG_LINK, "2PMA/PMD ext_phy_loopback: 54618se\n"); in bnx2x_54618se_config_loopback()
11418 bnx2x_cl22_write(bp, phy, 0x09, 3<<11); in bnx2x_54618se_config_loopback()
11425 bnx2x_cl22_read(bp, phy, 0x00, &val); in bnx2x_54618se_config_loopback()
11428 bnx2x_cl22_write(bp, phy, 0x00, val); in bnx2x_54618se_config_loopback()
11434 bnx2x_cl22_write(bp, phy, 0x18, 7); in bnx2x_54618se_config_loopback()
11435 bnx2x_cl22_read(bp, phy, 0x18, &val); in bnx2x_54618se_config_loopback()
11436 bnx2x_cl22_write(bp, phy, 0x18, val | (1<<10) | (1<<15)); in bnx2x_54618se_config_loopback()
11439 REG_WR(bp, NIG_REG_EGRESS_EMAC0_PORT + params->port*4, 1); in bnx2x_54618se_config_loopback()
11441 /* Maximum Frame Length (RW). Defines a 14-Bit maximum frame in bnx2x_54618se_config_loopback()
11448 /* SFX7101 PHY SECTION */
11450 static void bnx2x_7101_config_loopback(struct bnx2x_phy *phy, in bnx2x_7101_config_loopback() argument
11453 struct bnx2x *bp = params->bp; in bnx2x_7101_config_loopback()
11455 bnx2x_cl45_write(bp, phy, in bnx2x_7101_config_loopback()
11459 static void bnx2x_7101_config_init(struct bnx2x_phy *phy, in bnx2x_7101_config_init() argument
11464 struct bnx2x *bp = params->bp; in bnx2x_7101_config_init()
11465 DP(NETIF_MSG_LINK, "Setting the SFX7101 LASI indication\n"); in bnx2x_7101_config_init()
11469 MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); in bnx2x_7101_config_init()
11471 bnx2x_ext_phy_hw_reset(bp, params->port); in bnx2x_7101_config_init()
11472 bnx2x_wait_reset_complete(bp, phy, params); in bnx2x_7101_config_init()
11474 bnx2x_cl45_write(bp, phy, in bnx2x_7101_config_init()
11476 DP(NETIF_MSG_LINK, "Setting the SFX7101 LED to blink on traffic\n"); in bnx2x_7101_config_init()
11477 bnx2x_cl45_write(bp, phy, in bnx2x_7101_config_init()
11480 bnx2x_ext_phy_set_pause(params, phy, vars); in bnx2x_7101_config_init()
11482 bnx2x_cl45_read(bp, phy, in bnx2x_7101_config_init()
11485 bnx2x_cl45_write(bp, phy, in bnx2x_7101_config_init()
11489 bnx2x_cl45_read(bp, phy, in bnx2x_7101_config_init()
11492 bnx2x_cl45_read(bp, phy, in bnx2x_7101_config_init()
11494 bnx2x_save_spirom_version(bp, params->port, in bnx2x_7101_config_init()
11495 (u32)(fw_ver1<<16 | fw_ver2), phy->ver_addr); in bnx2x_7101_config_init()
11498 static u8 bnx2x_7101_read_status(struct bnx2x_phy *phy, in bnx2x_7101_read_status() argument
11502 struct bnx2x *bp = params->bp; in bnx2x_7101_read_status()
11505 bnx2x_cl45_read(bp, phy, in bnx2x_7101_read_status()
11507 bnx2x_cl45_read(bp, phy, in bnx2x_7101_read_status()
11509 DP(NETIF_MSG_LINK, "10G-base-T LASI status 0x%x->0x%x\n", in bnx2x_7101_read_status()
11511 bnx2x_cl45_read(bp, phy, in bnx2x_7101_read_status()
11513 bnx2x_cl45_read(bp, phy, in bnx2x_7101_read_status()
11515 DP(NETIF_MSG_LINK, "10G-base-T PMA status 0x%x->0x%x\n", in bnx2x_7101_read_status()
11518 /* If link is up print the AN outcome of the SFX7101 PHY */ in bnx2x_7101_read_status()
11520 bnx2x_cl45_read(bp, phy, in bnx2x_7101_read_status()
11523 vars->line_speed = SPEED_10000; in bnx2x_7101_read_status()
11524 vars->duplex = DUPLEX_FULL; in bnx2x_7101_read_status()
11525 DP(NETIF_MSG_LINK, "SFX7101 AN status 0x%x->Master=%x\n", in bnx2x_7101_read_status()
11527 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); in bnx2x_7101_read_status()
11528 bnx2x_ext_phy_resolve_fc(phy, params, vars); in bnx2x_7101_read_status()
11532 vars->link_status |= in bnx2x_7101_read_status()
11541 return -EINVAL; in bnx2x_7101_format_ver()
11547 *len -= 5; in bnx2x_7101_format_ver()
11551 void bnx2x_sfx7101_sp_sw_reset(struct bnx2x *bp, struct bnx2x_phy *phy) in bnx2x_sfx7101_sp_sw_reset() argument
11555 bnx2x_cl45_read(bp, phy, in bnx2x_sfx7101_sp_sw_reset()
11561 /* Writes a self-clearing reset */ in bnx2x_sfx7101_sp_sw_reset()
11562 bnx2x_cl45_write(bp, phy, in bnx2x_sfx7101_sp_sw_reset()
11567 bnx2x_cl45_read(bp, phy, in bnx2x_sfx7101_sp_sw_reset()
11576 static void bnx2x_7101_hw_reset(struct bnx2x_phy *phy, in bnx2x_7101_hw_reset() argument
11579 bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_2, in bnx2x_7101_hw_reset()
11580 MISC_REGISTERS_GPIO_OUTPUT_LOW, params->port); in bnx2x_7101_hw_reset()
11581 /* The PHY reset is controlled by GPIO 1 */ in bnx2x_7101_hw_reset()
11582 bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, in bnx2x_7101_hw_reset()
11583 MISC_REGISTERS_GPIO_OUTPUT_LOW, params->port); in bnx2x_7101_hw_reset()
11586 static void bnx2x_7101_set_link_led(struct bnx2x_phy *phy, in bnx2x_7101_set_link_led() argument
11590 struct bnx2x *bp = params->bp; in bnx2x_7101_set_link_led()
11603 bnx2x_cl45_write(bp, phy, in bnx2x_7101_set_link_led()
11610 /* STATIC PHY DECLARATION */
12140 /* Populate the phy according. Main function: bnx2x_populate_phy */
12145 struct bnx2x_phy *phy, u8 port, in bnx2x_populate_preemphasis() argument
12173 phy->rx_preemphasis[i << 1] = ((rx>>16) & 0xffff); in bnx2x_populate_preemphasis()
12174 phy->rx_preemphasis[(i << 1) + 1] = (rx & 0xffff); in bnx2x_populate_preemphasis()
12176 phy->tx_preemphasis[i << 1] = ((tx>>16) & 0xffff); in bnx2x_populate_preemphasis()
12177 phy->tx_preemphasis[(i << 1) + 1] = (tx & 0xffff); in bnx2x_populate_preemphasis()
12197 DP(NETIF_MSG_LINK, "Invalid phy_index %d\n", phy_index); in bnx2x_get_ext_phy_config()
12198 return -EINVAL; in bnx2x_get_ext_phy_config()
12204 struct bnx2x_phy *phy) in bnx2x_populate_int_phy() argument
12215 DP(NETIF_MSG_LINK, ":chip_id = 0x%x\n", chip_id); in bnx2x_populate_int_phy()
12220 *phy = phy_warpcore; in bnx2x_populate_int_phy()
12222 phy->flags |= FLAGS_4_PORT_MODE; in bnx2x_populate_int_phy()
12224 phy->flags &= ~FLAGS_4_PORT_MODE; in bnx2x_populate_int_phy()
12235 phy->supported &= (SUPPORTED_10baseT_Half | in bnx2x_populate_int_phy()
12244 phy->media_type = ETH_PHY_BASE_T; in bnx2x_populate_int_phy()
12247 phy->supported &= (SUPPORTED_1000baseT_Full | in bnx2x_populate_int_phy()
12252 phy->media_type = ETH_PHY_XFP_FIBER; in bnx2x_populate_int_phy()
12255 phy->supported &= (SUPPORTED_1000baseT_Full | in bnx2x_populate_int_phy()
12260 phy->media_type = ETH_PHY_SFPP_10G_FIBER; in bnx2x_populate_int_phy()
12263 phy->media_type = ETH_PHY_KR; in bnx2x_populate_int_phy()
12264 phy->supported &= (SUPPORTED_1000baseKX_Full | in bnx2x_populate_int_phy()
12272 phy->media_type = ETH_PHY_KR; in bnx2x_populate_int_phy()
12273 phy->flags |= FLAGS_WC_DUAL_MODE; in bnx2x_populate_int_phy()
12274 phy->supported &= (SUPPORTED_20000baseMLD2_Full | in bnx2x_populate_int_phy()
12280 phy->media_type = ETH_PHY_KR; in bnx2x_populate_int_phy()
12281 phy->flags |= FLAGS_WC_DUAL_MODE; in bnx2x_populate_int_phy()
12282 phy->supported &= (SUPPORTED_20000baseKR2_Full | in bnx2x_populate_int_phy()
12289 phy->flags &= ~FLAGS_TX_ERROR_CHECK; in bnx2x_populate_int_phy()
12292 DP(NETIF_MSG_LINK, "Unknown WC interface type 0x%x\n", in bnx2x_populate_int_phy()
12297 /* Enable MDC/MDIO work-around for E3 A0 since free running MDC in bnx2x_populate_int_phy()
12302 phy->flags |= FLAGS_MDC_MDIO_WA; in bnx2x_populate_int_phy()
12304 phy->flags |= FLAGS_MDC_MDIO_WA_B0; in bnx2x_populate_int_phy()
12311 *phy = phy_serdes; in bnx2x_populate_int_phy()
12317 *phy = phy_xgxs; in bnx2x_populate_int_phy()
12320 DP(NETIF_MSG_LINK, "Invalid switch_cfg\n"); in bnx2x_populate_int_phy()
12321 return -EINVAL; in bnx2x_populate_int_phy()
12324 phy->addr = (u8)phy_addr; in bnx2x_populate_int_phy()
12325 phy->mdio_ctrl = bnx2x_get_emac_base(bp, in bnx2x_populate_int_phy()
12329 phy->def_md_devad = E2_DEFAULT_PHY_DEV_ADDR; in bnx2x_populate_int_phy()
12331 phy->def_md_devad = DEFAULT_PHY_DEV_ADDR; in bnx2x_populate_int_phy()
12333 DP(NETIF_MSG_LINK, "Internal phy port=%d, addr=0x%x, mdio_ctl=0x%x\n", in bnx2x_populate_int_phy()
12334 port, phy->addr, phy->mdio_ctrl); in bnx2x_populate_int_phy()
12336 bnx2x_populate_preemphasis(bp, shmem_base, phy, port, INT_PHY); in bnx2x_populate_int_phy()
12345 struct bnx2x_phy *phy) in bnx2x_populate_ext_phy() argument
12352 /* Select the phy type */ in bnx2x_populate_ext_phy()
12356 *phy = phy_8073; in bnx2x_populate_ext_phy()
12359 *phy = phy_8705; in bnx2x_populate_ext_phy()
12362 *phy = phy_8706; in bnx2x_populate_ext_phy()
12366 *phy = phy_8726; in bnx2x_populate_ext_phy()
12371 *phy = phy_8727; in bnx2x_populate_ext_phy()
12372 phy->flags |= FLAGS_NOC; in bnx2x_populate_ext_phy()
12377 *phy = phy_8727; in bnx2x_populate_ext_phy()
12380 *phy = phy_8481; in bnx2x_populate_ext_phy()
12383 *phy = phy_84823; in bnx2x_populate_ext_phy()
12386 *phy = phy_84833; in bnx2x_populate_ext_phy()
12389 *phy = phy_84834; in bnx2x_populate_ext_phy()
12392 *phy = phy_84858; in bnx2x_populate_ext_phy()
12396 *phy = phy_54618se; in bnx2x_populate_ext_phy()
12398 phy->flags |= FLAGS_EEE; in bnx2x_populate_ext_phy()
12401 *phy = phy_7101; in bnx2x_populate_ext_phy()
12404 *phy = phy_null; in bnx2x_populate_ext_phy()
12405 return -EINVAL; in bnx2x_populate_ext_phy()
12407 *phy = phy_null; in bnx2x_populate_ext_phy()
12408 /* In case external PHY wasn't found */ in bnx2x_populate_ext_phy()
12411 return -EINVAL; in bnx2x_populate_ext_phy()
12415 phy->addr = XGXS_EXT_PHY_ADDR(ext_phy_config); in bnx2x_populate_ext_phy()
12416 bnx2x_populate_preemphasis(bp, shmem_base, phy, port, phy_index); in bnx2x_populate_ext_phy()
12418 /* The shmem address of the phy version is located on different in bnx2x_populate_ext_phy()
12425 phy->ver_addr = shmem_base + offsetof(struct shmem_region, in bnx2x_populate_ext_phy()
12437 phy->ver_addr = shmem2_base + in bnx2x_populate_ext_phy()
12445 (SHARED_HW_CFG_MDC_MDIO_ACCESS2_SHIFT - in bnx2x_populate_ext_phy()
12448 phy->mdio_ctrl = bnx2x_get_emac_base(bp, mdc_mdio_access, port); in bnx2x_populate_ext_phy()
12450 if (bnx2x_is_8483x_8485x(phy) && (phy->ver_addr)) { in bnx2x_populate_ext_phy()
12451 /* Remove 100Mb link supported for BCM84833/4 when phy fw in bnx2x_populate_ext_phy()
12454 u32 raw_ver = REG_RD(bp, phy->ver_addr); in bnx2x_populate_ext_phy()
12457 phy->supported &= ~(SUPPORTED_100baseT_Half | in bnx2x_populate_ext_phy()
12461 DP(NETIF_MSG_LINK, "phy_type 0x%x port %d found in index %d\n", in bnx2x_populate_ext_phy()
12463 DP(NETIF_MSG_LINK, " addr=0x%x, mdio_ctl=0x%x\n", in bnx2x_populate_ext_phy()
12464 phy->addr, phy->mdio_ctrl); in bnx2x_populate_ext_phy()
12469 u32 shmem2_base, u8 port, struct bnx2x_phy *phy) in bnx2x_populate_phy() argument
12471 phy->type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN; in bnx2x_populate_phy()
12473 return bnx2x_populate_int_phy(bp, shmem_base, port, phy); in bnx2x_populate_phy()
12476 port, phy); in bnx2x_populate_phy()
12480 struct bnx2x_phy *phy, in bnx2x_phy_def_cfg() argument
12483 struct bnx2x *bp = params->bp; in bnx2x_phy_def_cfg()
12485 /* Populate the default phy configuration for MF mode */ in bnx2x_phy_def_cfg()
12487 link_config = REG_RD(bp, params->shmem_base + in bnx2x_phy_def_cfg()
12489 port_feature_config[params->port].link_config2)); in bnx2x_phy_def_cfg()
12490 phy->speed_cap_mask = REG_RD(bp, params->shmem_base + in bnx2x_phy_def_cfg()
12493 port_hw_config[params->port].speed_capability_mask2)); in bnx2x_phy_def_cfg()
12495 link_config = REG_RD(bp, params->shmem_base + in bnx2x_phy_def_cfg()
12497 port_feature_config[params->port].link_config)); in bnx2x_phy_def_cfg()
12498 phy->speed_cap_mask = REG_RD(bp, params->shmem_base + in bnx2x_phy_def_cfg()
12501 port_hw_config[params->port].speed_capability_mask)); in bnx2x_phy_def_cfg()
12503 DP(NETIF_MSG_LINK, in bnx2x_phy_def_cfg()
12504 "Default config phy idx %x cfg 0x%x speed_cap_mask 0x%x\n", in bnx2x_phy_def_cfg()
12505 phy_index, link_config, phy->speed_cap_mask); in bnx2x_phy_def_cfg()
12507 phy->req_duplex = DUPLEX_FULL; in bnx2x_phy_def_cfg()
12510 phy->req_duplex = DUPLEX_HALF; in bnx2x_phy_def_cfg()
12513 phy->req_line_speed = SPEED_10; in bnx2x_phy_def_cfg()
12516 phy->req_duplex = DUPLEX_HALF; in bnx2x_phy_def_cfg()
12519 phy->req_line_speed = SPEED_100; in bnx2x_phy_def_cfg()
12522 phy->req_line_speed = SPEED_1000; in bnx2x_phy_def_cfg()
12525 phy->req_line_speed = SPEED_2500; in bnx2x_phy_def_cfg()
12528 phy->req_line_speed = SPEED_10000; in bnx2x_phy_def_cfg()
12531 phy->req_line_speed = SPEED_AUTO_NEG; in bnx2x_phy_def_cfg()
12537 phy->req_flow_ctrl = BNX2X_FLOW_CTRL_AUTO; in bnx2x_phy_def_cfg()
12540 phy->req_flow_ctrl = BNX2X_FLOW_CTRL_TX; in bnx2x_phy_def_cfg()
12543 phy->req_flow_ctrl = BNX2X_FLOW_CTRL_RX; in bnx2x_phy_def_cfg()
12546 phy->req_flow_ctrl = BNX2X_FLOW_CTRL_BOTH; in bnx2x_phy_def_cfg()
12549 phy->req_flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_phy_def_cfg()
12559 phy_config_swapped = params->multi_phy_config & in bnx2x_phy_selection()
12562 prio_cfg = params->multi_phy_config & in bnx2x_phy_selection()
12590 struct bnx2x *bp = params->bp; in bnx2x_phy_probe()
12591 struct bnx2x_phy *phy; in bnx2x_phy_probe() local
12592 params->num_phys = 0; in bnx2x_phy_probe()
12593 DP(NETIF_MSG_LINK, "Begin phy probe\n"); in bnx2x_phy_probe()
12594 phy_config_swapped = params->multi_phy_config & in bnx2x_phy_probe()
12606 DP(NETIF_MSG_LINK, "phy_config_swapped %x, phy_index %x," in bnx2x_phy_probe()
12609 phy = ¶ms->phy[actual_phy_idx]; in bnx2x_phy_probe()
12610 if (bnx2x_populate_phy(bp, phy_index, params->shmem_base, in bnx2x_phy_probe()
12611 params->shmem2_base, params->port, in bnx2x_phy_probe()
12612 phy) != 0) { in bnx2x_phy_probe()
12613 params->num_phys = 0; in bnx2x_phy_probe()
12614 DP(NETIF_MSG_LINK, "phy probe failed in phy index %d\n", in bnx2x_phy_probe()
12619 *phy = phy_null; in bnx2x_phy_probe()
12620 return -EINVAL; in bnx2x_phy_probe()
12622 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN) in bnx2x_phy_probe()
12625 if (params->feature_config_flags & in bnx2x_phy_probe()
12627 phy->flags &= ~FLAGS_TX_ERROR_CHECK; in bnx2x_phy_probe()
12629 if (!(params->feature_config_flags & in bnx2x_phy_probe()
12631 phy->flags |= FLAGS_MDC_MDIO_WA_G; in bnx2x_phy_probe()
12633 sync_offset = params->shmem_base + in bnx2x_phy_probe()
12635 dev_info.port_hw_config[params->port].media_type); in bnx2x_phy_probe()
12638 /* Update media type for non-PMF sync only for the first time in bnx2x_phy_probe()
12645 media_types |= ((phy->media_type & in bnx2x_phy_probe()
12652 bnx2x_phy_def_cfg(params, phy, phy_index); in bnx2x_phy_probe()
12653 params->num_phys++; in bnx2x_phy_probe()
12656 DP(NETIF_MSG_LINK, "End phy probe. #phys found %x\n", params->num_phys); in bnx2x_phy_probe()
12663 struct bnx2x *bp = params->bp; in bnx2x_init_bmac_loopback()
12664 vars->link_up = 1; in bnx2x_init_bmac_loopback()
12665 vars->line_speed = SPEED_10000; in bnx2x_init_bmac_loopback()
12666 vars->duplex = DUPLEX_FULL; in bnx2x_init_bmac_loopback()
12667 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_init_bmac_loopback()
12668 vars->mac_type = MAC_TYPE_BMAC; in bnx2x_init_bmac_loopback()
12670 vars->phy_flags = PHY_XGXS_FLAG; in bnx2x_init_bmac_loopback()
12677 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port * 4, 0); in bnx2x_init_bmac_loopback()
12683 struct bnx2x *bp = params->bp; in bnx2x_init_emac_loopback()
12684 vars->link_up = 1; in bnx2x_init_emac_loopback()
12685 vars->line_speed = SPEED_1000; in bnx2x_init_emac_loopback()
12686 vars->duplex = DUPLEX_FULL; in bnx2x_init_emac_loopback()
12687 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_init_emac_loopback()
12688 vars->mac_type = MAC_TYPE_EMAC; in bnx2x_init_emac_loopback()
12690 vars->phy_flags = PHY_XGXS_FLAG; in bnx2x_init_emac_loopback()
12696 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port * 4, 0); in bnx2x_init_emac_loopback()
12702 struct bnx2x *bp = params->bp; in bnx2x_init_xmac_loopback()
12703 vars->link_up = 1; in bnx2x_init_xmac_loopback()
12704 if (!params->req_line_speed[0]) in bnx2x_init_xmac_loopback()
12705 vars->line_speed = SPEED_10000; in bnx2x_init_xmac_loopback()
12707 vars->line_speed = params->req_line_speed[0]; in bnx2x_init_xmac_loopback()
12708 vars->duplex = DUPLEX_FULL; in bnx2x_init_xmac_loopback()
12709 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_init_xmac_loopback()
12710 vars->mac_type = MAC_TYPE_XMAC; in bnx2x_init_xmac_loopback()
12711 vars->phy_flags = PHY_XGXS_FLAG; in bnx2x_init_xmac_loopback()
12715 bnx2x_set_aer_mmd(params, ¶ms->phy[0]); in bnx2x_init_xmac_loopback()
12716 bnx2x_warpcore_reset_lane(bp, ¶ms->phy[0], 0); in bnx2x_init_xmac_loopback()
12717 params->phy[INT_PHY].config_loopback( in bnx2x_init_xmac_loopback()
12718 ¶ms->phy[INT_PHY], in bnx2x_init_xmac_loopback()
12722 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); in bnx2x_init_xmac_loopback()
12728 struct bnx2x *bp = params->bp; in bnx2x_init_umac_loopback()
12729 vars->link_up = 1; in bnx2x_init_umac_loopback()
12730 vars->line_speed = SPEED_1000; in bnx2x_init_umac_loopback()
12731 vars->duplex = DUPLEX_FULL; in bnx2x_init_umac_loopback()
12732 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_init_umac_loopback()
12733 vars->mac_type = MAC_TYPE_UMAC; in bnx2x_init_umac_loopback()
12734 vars->phy_flags = PHY_XGXS_FLAG; in bnx2x_init_umac_loopback()
12737 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); in bnx2x_init_umac_loopback()
12743 struct bnx2x *bp = params->bp; in bnx2x_init_xgxs_loopback()
12744 struct bnx2x_phy *int_phy = ¶ms->phy[INT_PHY]; in bnx2x_init_xgxs_loopback()
12745 vars->link_up = 1; in bnx2x_init_xgxs_loopback()
12746 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_init_xgxs_loopback()
12747 vars->duplex = DUPLEX_FULL; in bnx2x_init_xgxs_loopback()
12748 if (params->req_line_speed[0] == SPEED_1000) in bnx2x_init_xgxs_loopback()
12749 vars->line_speed = SPEED_1000; in bnx2x_init_xgxs_loopback()
12750 else if ((params->req_line_speed[0] == SPEED_20000) || in bnx2x_init_xgxs_loopback()
12751 (int_phy->flags & FLAGS_WC_DUAL_MODE)) in bnx2x_init_xgxs_loopback()
12752 vars->line_speed = SPEED_20000; in bnx2x_init_xgxs_loopback()
12754 vars->line_speed = SPEED_10000; in bnx2x_init_xgxs_loopback()
12760 if (params->req_line_speed[0] == SPEED_1000) { in bnx2x_init_xgxs_loopback()
12774 if (params->loopback_mode == LOOPBACK_XGXS) { in bnx2x_init_xgxs_loopback()
12776 int_phy->config_loopback(int_phy, params); in bnx2x_init_xgxs_loopback()
12778 /* Set external phy loopback */ in bnx2x_init_xgxs_loopback()
12781 phy_index < params->num_phys; phy_index++) in bnx2x_init_xgxs_loopback()
12782 if (params->phy[phy_index].config_loopback) in bnx2x_init_xgxs_loopback()
12783 params->phy[phy_index].config_loopback( in bnx2x_init_xgxs_loopback()
12784 ¶ms->phy[phy_index], in bnx2x_init_xgxs_loopback()
12787 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); in bnx2x_init_xgxs_loopback()
12789 bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed); in bnx2x_init_xgxs_loopback()
12794 struct bnx2x *bp = params->bp; in bnx2x_set_rx_filter()
12800 REG_WR(bp, NIG_REG_LLH0_BRB1_DRV_MASK + params->port*4, val); in bnx2x_set_rx_filter()
12803 REG_WR(bp, NIG_REG_LLH0_BRB1_DRV_MASK_MF + params->port*4, in bnx2x_set_rx_filter()
12807 REG_WR(bp, (params->port ? NIG_REG_LLH1_BRB1_NOT_MCP : in bnx2x_set_rx_filter()
12815 struct bnx2x *bp = params->bp; in bnx2x_avoid_link_flap()
12826 for (phy_idx = INT_PHY; phy_idx < params->num_phys; phy_idx++) { in bnx2x_avoid_link_flap()
12827 struct bnx2x_phy *phy = ¶ms->phy[phy_idx]; in bnx2x_avoid_link_flap() local
12828 if (phy->phy_specific_func) { in bnx2x_avoid_link_flap()
12829 DP(NETIF_MSG_LINK, "Calling PHY specific func\n"); in bnx2x_avoid_link_flap()
12830 phy->phy_specific_func(phy, params, PHY_INIT); in bnx2x_avoid_link_flap()
12832 if ((phy->media_type == ETH_PHY_SFPP_10G_FIBER) || in bnx2x_avoid_link_flap()
12833 (phy->media_type == ETH_PHY_SFP_1G_FIBER) || in bnx2x_avoid_link_flap()
12834 (phy->media_type == ETH_PHY_DA_TWINAX)) in bnx2x_avoid_link_flap()
12835 bnx2x_verify_sfp_module(phy, params); in bnx2x_avoid_link_flap()
12837 lfa_sts = REG_RD(bp, params->lfa_base + in bnx2x_avoid_link_flap()
12843 /* Re-enable the NIG/MAC */ in bnx2x_avoid_link_flap()
12849 params->port)); in bnx2x_avoid_link_flap()
12853 params->port)); in bnx2x_avoid_link_flap()
12855 if (vars->line_speed < SPEED_10000) in bnx2x_avoid_link_flap()
12860 if (vars->line_speed < SPEED_10000) in bnx2x_avoid_link_flap()
12874 REG_WR(bp, params->lfa_base + in bnx2x_avoid_link_flap()
12878 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); in bnx2x_avoid_link_flap()
12890 struct bnx2x *bp = params->bp; in bnx2x_cannot_avoid_link_flap()
12894 if (!params->lfa_base) in bnx2x_cannot_avoid_link_flap()
12897 REG_WR(bp, params->lfa_base + in bnx2x_cannot_avoid_link_flap()
12899 params->req_duplex[0] | (params->req_duplex[1] << 16)); in bnx2x_cannot_avoid_link_flap()
12901 REG_WR(bp, params->lfa_base + in bnx2x_cannot_avoid_link_flap()
12903 params->req_flow_ctrl[0] | (params->req_flow_ctrl[1] << 16)); in bnx2x_cannot_avoid_link_flap()
12905 REG_WR(bp, params->lfa_base + in bnx2x_cannot_avoid_link_flap()
12907 params->req_line_speed[0] | (params->req_line_speed[1] << 16)); in bnx2x_cannot_avoid_link_flap()
12910 REG_WR(bp, params->lfa_base + in bnx2x_cannot_avoid_link_flap()
12913 params->speed_cap_mask[cfg_idx]); in bnx2x_cannot_avoid_link_flap()
12916 tmp_val = REG_RD(bp, params->lfa_base + in bnx2x_cannot_avoid_link_flap()
12919 tmp_val |= params->req_fc_auto_adv; in bnx2x_cannot_avoid_link_flap()
12921 REG_WR(bp, params->lfa_base + in bnx2x_cannot_avoid_link_flap()
12924 lfa_sts = REG_RD(bp, params->lfa_base + in bnx2x_cannot_avoid_link_flap()
12940 REG_WR(bp, params->lfa_base + in bnx2x_cannot_avoid_link_flap()
12948 struct bnx2x *bp = params->bp; in bnx2x_phy_init()
12949 DP(NETIF_MSG_LINK, "Phy Initialization started\n"); in bnx2x_phy_init()
12950 DP(NETIF_MSG_LINK, "(1) req_speed %d, req_flowctrl %d\n", in bnx2x_phy_init()
12951 params->req_line_speed[0], params->req_flow_ctrl[0]); in bnx2x_phy_init()
12952 DP(NETIF_MSG_LINK, "(2) req_speed %d, req_flowctrl %d\n", in bnx2x_phy_init()
12953 params->req_line_speed[1], params->req_flow_ctrl[1]); in bnx2x_phy_init()
12954 DP(NETIF_MSG_LINK, "req_adv_flow_ctrl 0x%x\n", params->req_fc_auto_adv); in bnx2x_phy_init()
12955 vars->link_status = 0; in bnx2x_phy_init()
12956 vars->phy_link_up = 0; in bnx2x_phy_init()
12957 vars->link_up = 0; in bnx2x_phy_init()
12958 vars->line_speed = 0; in bnx2x_phy_init()
12959 vars->duplex = DUPLEX_FULL; in bnx2x_phy_init()
12960 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; in bnx2x_phy_init()
12961 vars->mac_type = MAC_TYPE_NONE; in bnx2x_phy_init()
12962 vars->phy_flags = 0; in bnx2x_phy_init()
12963 vars->check_kr2_recovery_cnt = 0; in bnx2x_phy_init()
12964 params->link_flags = PHY_INITIALIZED; in bnx2x_phy_init()
12965 /* Driver opens NIG-BRB filters */ in bnx2x_phy_init()
12972 DP(NETIF_MSG_LINK, "Link Flap Avoidance in progress\n"); in bnx2x_phy_init()
12976 DP(NETIF_MSG_LINK, "Cannot avoid link flap lfa_sta=0x%x\n", in bnx2x_phy_init()
12981 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + params->port*4, in bnx2x_phy_init()
12989 if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) in bnx2x_phy_init()
12990 vars->link_status |= LINK_STATUS_PFC_ENABLED; in bnx2x_phy_init()
12992 if (params->num_phys == 0) { in bnx2x_phy_init()
12993 DP(NETIF_MSG_LINK, "No phy found for initialization !!\n"); in bnx2x_phy_init()
12994 return -EINVAL; in bnx2x_phy_init()
12998 DP(NETIF_MSG_LINK, "Num of phys on board: %d\n", params->num_phys); in bnx2x_phy_init()
12999 switch (params->loopback_mode) { in bnx2x_phy_init()
13018 if (params->switch_cfg == SWITCH_CFG_10G) in bnx2x_phy_init()
13021 bnx2x_serdes_deassert(bp, params->port); in bnx2x_phy_init()
13028 bnx2x_update_mng(params, vars->link_status); in bnx2x_phy_init()
13030 bnx2x_update_mng_eee(params, vars->eee_status); in bnx2x_phy_init()
13037 struct bnx2x *bp = params->bp; in bnx2x_link_reset()
13038 u8 phy_index, port = params->port, clear_latch_ind = 0; in bnx2x_link_reset()
13039 DP(NETIF_MSG_LINK, "Resetting the link of port %d\n", port); in bnx2x_link_reset()
13041 vars->link_status = 0; in bnx2x_link_reset()
13043 bnx2x_update_mng(params, vars->link_status); in bnx2x_link_reset()
13044 vars->eee_status &= ~(SHMEM_EEE_LP_ADV_STATUS_MASK | in bnx2x_link_reset()
13046 bnx2x_update_mng_eee(params, vars->eee_status); in bnx2x_link_reset()
13063 bnx2x_set_bmac_rx(bp, params->chip_id, port, 0); in bnx2x_link_reset()
13073 /* The PHY reset is controlled by GPIO 1 in bnx2x_link_reset()
13081 for (phy_index = EXT_PHY1; phy_index < params->num_phys; in bnx2x_link_reset()
13083 if (params->phy[phy_index].link_reset) { in bnx2x_link_reset()
13085 ¶ms->phy[phy_index]); in bnx2x_link_reset()
13086 params->phy[phy_index].link_reset( in bnx2x_link_reset()
13087 ¶ms->phy[phy_index], in bnx2x_link_reset()
13090 if (params->phy[phy_index].flags & in bnx2x_link_reset()
13102 if (params->phy[INT_PHY].link_reset) in bnx2x_link_reset()
13103 params->phy[INT_PHY].link_reset( in bnx2x_link_reset()
13104 ¶ms->phy[INT_PHY], params); in bnx2x_link_reset()
13114 u32 xmac_base = (params->port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0; in bnx2x_link_reset()
13121 vars->link_up = 0; in bnx2x_link_reset()
13122 vars->phy_flags = 0; in bnx2x_link_reset()
13128 struct bnx2x *bp = params->bp; in bnx2x_lfa_reset()
13129 vars->link_up = 0; in bnx2x_lfa_reset()
13130 vars->phy_flags = 0; in bnx2x_lfa_reset()
13131 params->link_flags &= ~PHY_INITIALIZED; in bnx2x_lfa_reset()
13132 if (!params->lfa_base) in bnx2x_lfa_reset()
13138 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 1); in bnx2x_lfa_reset()
13145 bnx2x_set_bmac_rx(bp, params->chip_id, params->port, 0); in bnx2x_lfa_reset()
13154 /* Clean the NIG-BRB using the network filters in a way that will in bnx2x_lfa_reset()
13160 * Re-open the gate between the BMAC and the NIG, after verifying the in bnx2x_lfa_reset()
13166 bnx2x_set_bmac_rx(bp, params->chip_id, params->port, 1); in bnx2x_lfa_reset()
13173 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); in bnx2x_lfa_reset()
13185 struct bnx2x_phy phy[PORT_MAX]; in bnx2x_8073_common_init_phy() local
13195 /* PART1 - Reset both phys */ in bnx2x_8073_common_init_phy()
13196 for (port = PORT_MAX - 1; port >= PORT_0; port--) { in bnx2x_8073_common_init_phy()
13198 /* In E2, same phy is using for port0 of the two paths */ in bnx2x_8073_common_init_phy()
13209 /* Extract the ext phy address for the port */ in bnx2x_8073_common_init_phy()
13211 port_of_path, &phy[port]) != in bnx2x_8073_common_init_phy()
13213 DP(NETIF_MSG_LINK, "populate_phy failed\n"); in bnx2x_8073_common_init_phy()
13214 return -EINVAL; in bnx2x_8073_common_init_phy()
13224 /* Need to take the phy out of low power mode in order in bnx2x_8073_common_init_phy()
13231 /* Reset the phy */ in bnx2x_8073_common_init_phy()
13232 bnx2x_cl45_write(bp, &phy[port], in bnx2x_8073_common_init_phy()
13241 if (phy[PORT_0].addr & 0x1) { in bnx2x_8073_common_init_phy()
13242 phy_blk[PORT_0] = &(phy[PORT_1]); in bnx2x_8073_common_init_phy()
13243 phy_blk[PORT_1] = &(phy[PORT_0]); in bnx2x_8073_common_init_phy()
13245 phy_blk[PORT_0] = &(phy[PORT_0]); in bnx2x_8073_common_init_phy()
13246 phy_blk[PORT_1] = &(phy[PORT_1]); in bnx2x_8073_common_init_phy()
13249 /* PART2 - Download firmware to both phys */ in bnx2x_8073_common_init_phy()
13250 for (port = PORT_MAX - 1; port >= PORT_0; port--) { in bnx2x_8073_common_init_phy()
13256 DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n", in bnx2x_8073_common_init_phy()
13257 phy_blk[port]->addr); in bnx2x_8073_common_init_phy()
13260 return -EINVAL; in bnx2x_8073_common_init_phy()
13279 /* PART3 - complete TX_POWER_DOWN process, and set GPIO2 back to low */ in bnx2x_8073_common_init_phy()
13280 for (port = PORT_MAX - 1; port >= PORT_0; port--) { in bnx2x_8073_common_init_phy()
13292 /* Read modify write the SPI-ROM version select register */ in bnx2x_8073_common_init_phy()
13313 struct bnx2x_phy phy; in bnx2x_8726_common_init_phy() local
13314 /* Use port1 because of the static port-swap */ in bnx2x_8726_common_init_phy()
13326 /* In E2, same phy is using for port0 of the two paths */ in bnx2x_8726_common_init_phy()
13334 /* Extract the ext phy address for the port */ in bnx2x_8726_common_init_phy()
13336 port, &phy) != in bnx2x_8726_common_init_phy()
13338 DP(NETIF_MSG_LINK, "populate phy failed\n"); in bnx2x_8726_common_init_phy()
13339 return -EINVAL; in bnx2x_8726_common_init_phy()
13342 /* Reset phy*/ in bnx2x_8726_common_init_phy()
13343 bnx2x_cl45_write(bp, &phy, in bnx2x_8726_common_init_phy()
13408 struct bnx2x_phy phy[PORT_MAX]; in bnx2x_8727_common_init_phy() local
13426 /* Initiate PHY reset*/ in bnx2x_8727_common_init_phy()
13435 /* PART1 - Reset both phys */ in bnx2x_8727_common_init_phy()
13436 for (port = PORT_MAX - 1; port >= PORT_0; port--) { in bnx2x_8727_common_init_phy()
13439 /* In E2, same phy is using for port0 of the two paths */ in bnx2x_8727_common_init_phy()
13450 /* Extract the ext phy address for the port */ in bnx2x_8727_common_init_phy()
13452 port_of_path, &phy[port]) != in bnx2x_8727_common_init_phy()
13454 DP(NETIF_MSG_LINK, "populate phy failed\n"); in bnx2x_8727_common_init_phy()
13455 return -EINVAL; in bnx2x_8727_common_init_phy()
13466 /* Reset the phy */ in bnx2x_8727_common_init_phy()
13467 bnx2x_cl45_write(bp, &phy[port], in bnx2x_8727_common_init_phy()
13473 if (phy[PORT_0].addr & 0x1) { in bnx2x_8727_common_init_phy()
13474 phy_blk[PORT_0] = &(phy[PORT_1]); in bnx2x_8727_common_init_phy()
13475 phy_blk[PORT_1] = &(phy[PORT_0]); in bnx2x_8727_common_init_phy()
13477 phy_blk[PORT_0] = &(phy[PORT_0]); in bnx2x_8727_common_init_phy()
13478 phy_blk[PORT_1] = &(phy[PORT_1]); in bnx2x_8727_common_init_phy()
13480 /* PART2 - Download firmware to both phys */ in bnx2x_8727_common_init_phy()
13481 for (port = PORT_MAX - 1; port >= PORT_0; port--) { in bnx2x_8727_common_init_phy()
13486 DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n", in bnx2x_8727_common_init_phy()
13487 phy_blk[port]->addr); in bnx2x_8727_common_init_phy()
13490 return -EINVAL; in bnx2x_8727_common_init_phy()
13491 /* Disable PHY transmitter output */ in bnx2x_8727_common_init_phy()
13511 DP(NETIF_MSG_LINK, "84833 reset pulse on pin values 0x%x\n", in bnx2x_84833_common_init_phy()
13555 rc = -EINVAL; in bnx2x_ext_phy_common_init()
13558 DP(NETIF_MSG_LINK, in bnx2x_ext_phy_common_init()
13565 netdev_err(bp->dev, "Warning: PHY was not initialized," in bnx2x_ext_phy_common_init()
13581 DP(NETIF_MSG_LINK, "Begin common phy init\n"); in bnx2x_common_init_phy()
13592 DP(NETIF_MSG_LINK, "Not doing common init; phy ver is 0x%x\n", in bnx2x_common_init_phy()
13615 struct bnx2x *bp = params->bp; in bnx2x_check_over_curr()
13617 u8 port = params->port; in bnx2x_check_over_curr()
13620 cfg_pin = (REG_RD(bp, params->shmem_base + in bnx2x_check_over_curr()
13631 if ((vars->phy_flags & PHY_OVER_CURRENT_FLAG) == 0) { in bnx2x_check_over_curr()
13632 netdev_err(bp->dev, "Error: Power fault on Port %d has" in bnx2x_check_over_curr()
13639 params->port); in bnx2x_check_over_curr()
13640 vars->phy_flags |= PHY_OVER_CURRENT_FLAG; in bnx2x_check_over_curr()
13644 vars->phy_flags &= ~PHY_OVER_CURRENT_FLAG; in bnx2x_check_over_curr()
13652 struct bnx2x *bp = params->bp; in bnx2x_analyze_link_error()
13655 u32 old_status = (vars->phy_flags & phy_flag) ? 1 : 0; in bnx2x_analyze_link_error()
13663 DP(NETIF_MSG_LINK, "Analyze Remote Fault\n"); in bnx2x_analyze_link_error()
13666 DP(NETIF_MSG_LINK, "Analyze TX Fault\n"); in bnx2x_analyze_link_error()
13669 DP(NETIF_MSG_LINK, "Analyze UNKNOWN\n"); in bnx2x_analyze_link_error()
13671 DP(NETIF_MSG_LINK, "Link changed:[%x %x]->%x\n", vars->link_up, in bnx2x_analyze_link_error()
13675 if ((vars->phy_flags & PHY_PHYSICAL_LINK_FLAG) == 0) in bnx2x_analyze_link_error()
13678 /* a. Update shmem->link_status accordingly in bnx2x_analyze_link_error()
13679 * b. Update link_vars->link_up in bnx2x_analyze_link_error()
13682 vars->link_status &= ~LINK_STATUS_LINK_UP; in bnx2x_analyze_link_error()
13683 vars->link_status |= link_flag; in bnx2x_analyze_link_error()
13684 vars->link_up = 0; in bnx2x_analyze_link_error()
13685 vars->phy_flags |= phy_flag; in bnx2x_analyze_link_error()
13688 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 1); in bnx2x_analyze_link_error()
13689 /* Set LED mode to off since the PHY doesn't know about these in bnx2x_analyze_link_error()
13694 vars->link_status |= LINK_STATUS_LINK_UP; in bnx2x_analyze_link_error()
13695 vars->link_status &= ~link_flag; in bnx2x_analyze_link_error()
13696 vars->link_up = 1; in bnx2x_analyze_link_error()
13697 vars->phy_flags &= ~phy_flag; in bnx2x_analyze_link_error()
13701 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); in bnx2x_analyze_link_error()
13708 bnx2x_update_mng(params, vars->link_status); in bnx2x_analyze_link_error()
13711 vars->periodic_flags |= PERIODIC_FLAGS_LINK_EVENT; in bnx2x_analyze_link_error()
13731 struct bnx2x *bp = params->bp; in bnx2x_check_half_open_conn()
13735 if (((vars->phy_flags & PHY_PHYSICAL_LINK_FLAG) == 0) || in bnx2x_check_half_open_conn()
13736 (REG_RD(bp, NIG_REG_EGRESS_EMAC0_PORT + params->port*4))) in bnx2x_check_half_open_conn()
13747 mac_base = (params->port) ? GRCBASE_XMAC1 : GRCBASE_XMAC0; in bnx2x_check_half_open_conn()
13761 (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << params->port)) { in bnx2x_check_half_open_conn()
13765 mac_base = params->port ? NIG_REG_INGRESS_BMAC1_MEM : in bnx2x_check_half_open_conn()
13782 static void bnx2x_sfp_tx_fault_detection(struct bnx2x_phy *phy, in bnx2x_sfp_tx_fault_detection() argument
13786 struct bnx2x *bp = params->bp; in bnx2x_sfp_tx_fault_detection()
13788 u8 led_change, port = params->port; in bnx2x_sfp_tx_fault_detection()
13791 cfg_pin = (REG_RD(bp, params->shmem_base + offsetof(struct shmem_region, in bnx2x_sfp_tx_fault_detection()
13797 DP(NETIF_MSG_LINK, "Failed to read pin 0x%02x\n", cfg_pin); in bnx2x_sfp_tx_fault_detection()
13809 if (vars->phy_flags & PHY_SFP_TX_FAULT_FLAG) { in bnx2x_sfp_tx_fault_detection()
13811 vars->link_status |= LINK_STATUS_SFP_TX_FAULT; in bnx2x_sfp_tx_fault_detection()
13814 vars->link_status &= ~LINK_STATUS_SFP_TX_FAULT; in bnx2x_sfp_tx_fault_detection()
13818 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) { in bnx2x_sfp_tx_fault_detection()
13819 DP(NETIF_MSG_LINK, "Change TX_Fault LED: ->%x\n", in bnx2x_sfp_tx_fault_detection()
13827 struct bnx2x_phy *phy) in bnx2x_kr2_recovery() argument
13829 struct bnx2x *bp = params->bp; in bnx2x_kr2_recovery()
13830 DP(NETIF_MSG_LINK, "KR2 recovery\n"); in bnx2x_kr2_recovery()
13831 bnx2x_warpcore_enable_AN_KR2(phy, params, vars); in bnx2x_kr2_recovery()
13832 bnx2x_warpcore_restart_AN_KR(phy, params); in bnx2x_kr2_recovery()
13837 struct bnx2x_phy *phy) in bnx2x_check_kr2_wa() argument
13839 struct bnx2x *bp = params->bp; in bnx2x_check_kr2_wa()
13848 if (vars->check_kr2_recovery_cnt > 0) { in bnx2x_check_kr2_wa()
13849 vars->check_kr2_recovery_cnt--; in bnx2x_check_kr2_wa()
13853 sigdet = bnx2x_warpcore_get_sigdet(phy, params); in bnx2x_check_kr2_wa()
13855 if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { in bnx2x_check_kr2_wa()
13856 bnx2x_kr2_recovery(params, vars, phy); in bnx2x_check_kr2_wa()
13857 DP(NETIF_MSG_LINK, "No sigdet\n"); in bnx2x_check_kr2_wa()
13862 lane = bnx2x_get_warpcore_lane(phy, params); in bnx2x_check_kr2_wa()
13863 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, in bnx2x_check_kr2_wa()
13865 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_check_kr2_wa()
13867 bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, in bnx2x_check_kr2_wa()
13869 bnx2x_set_aer_mmd(params, phy); in bnx2x_check_kr2_wa()
13873 if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { in bnx2x_check_kr2_wa()
13874 bnx2x_kr2_recovery(params, vars, phy); in bnx2x_check_kr2_wa()
13875 DP(NETIF_MSG_LINK, "No BP\n"); in bnx2x_check_kr2_wa()
13881 * but only KX is advertised, declare this link partner as non-KR2 in bnx2x_check_kr2_wa()
13888 /* In case KR2 is already disabled, check if we need to re-enable it */ in bnx2x_check_kr2_wa()
13889 if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { in bnx2x_check_kr2_wa()
13891 DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, in bnx2x_check_kr2_wa()
13893 bnx2x_kr2_recovery(params, vars, phy); in bnx2x_check_kr2_wa()
13900 DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, next_page); in bnx2x_check_kr2_wa()
13901 bnx2x_disable_kr2(params, vars, phy); in bnx2x_check_kr2_wa()
13903 bnx2x_warpcore_restart_AN_KR(phy, params); in bnx2x_check_kr2_wa()
13911 struct bnx2x *bp = params->bp; in bnx2x_period_func()
13913 if (params->phy[phy_idx].flags & FLAGS_TX_ERROR_CHECK) { in bnx2x_period_func()
13914 bnx2x_set_aer_mmd(params, ¶ms->phy[phy_idx]); in bnx2x_period_func()
13917 DP(NETIF_MSG_LINK, "Fault detection failed\n"); in bnx2x_period_func()
13923 struct bnx2x_phy *phy = ¶ms->phy[INT_PHY]; in bnx2x_period_func() local
13924 bnx2x_set_aer_mmd(params, phy); in bnx2x_period_func()
13925 if (((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_period_func()
13926 (phy->speed_cap_mask & in bnx2x_period_func()
13928 (phy->req_line_speed == SPEED_20000)) in bnx2x_period_func()
13929 bnx2x_check_kr2_wa(params, vars, phy); in bnx2x_period_func()
13931 if (vars->rx_tx_asic_rst) in bnx2x_period_func()
13932 bnx2x_warpcore_config_runtime(phy, params, vars); in bnx2x_period_func()
13934 if ((REG_RD(bp, params->shmem_base + in bnx2x_period_func()
13936 port_hw_config[params->port].default_cfg)) in bnx2x_period_func()
13939 if (bnx2x_is_sfp_module_plugged(phy, params)) { in bnx2x_period_func()
13940 bnx2x_sfp_tx_fault_detection(phy, params, vars); in bnx2x_period_func()
13941 } else if (vars->link_status & in bnx2x_period_func()
13944 vars->link_status &= ~LINK_STATUS_SFP_TX_FAULT; in bnx2x_period_func()
13945 vars->phy_flags &= ~PHY_SFP_TX_FAULT_FLAG; in bnx2x_period_func()
13947 bnx2x_update_mng(params, vars->link_status); in bnx2x_period_func()
13959 struct bnx2x_phy phy; in bnx2x_fan_failure_det_req() local
13963 port, &phy) in bnx2x_fan_failure_det_req()
13965 DP(NETIF_MSG_LINK, "populate phy failed\n"); in bnx2x_fan_failure_det_req()
13968 fan_failure_det_req |= (phy.flags & in bnx2x_fan_failure_det_req()
13977 struct bnx2x *bp = params->bp; in bnx2x_hw_reset_phy()
13979 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + params->port*4, in bnx2x_hw_reset_phy()
13987 if (params->phy[phy_index].hw_reset) { in bnx2x_hw_reset_phy()
13988 params->phy[phy_index].hw_reset( in bnx2x_hw_reset_phy()
13989 ¶ms->phy[phy_index], in bnx2x_hw_reset_phy()
13991 params->phy[phy_index] = phy_null; in bnx2x_hw_reset_phy()
14011 struct bnx2x_phy phy; in bnx2x_init_mod_abs_int() local
14015 shmem2_base, port, &phy) in bnx2x_init_mod_abs_int()
14017 DP(NETIF_MSG_LINK, "populate phy failed\n"); in bnx2x_init_mod_abs_int()
14020 if (phy.type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) { in bnx2x_init_mod_abs_int()
14038 vars->aeu_int_mask = AEU_INPUTS_ATTN_BITS_GPIO0_FUNCTION_0 << in bnx2x_init_mod_abs_int()
14044 REG_WR(bp, sync_offset, vars->aeu_int_mask); in bnx2x_init_mod_abs_int()
14046 DP(NETIF_MSG_LINK, "Setting MOD_ABS (GPIO%d_P%d) AEU to 0x%x\n", in bnx2x_init_mod_abs_int()
14047 gpio_num, gpio_port, vars->aeu_int_mask); in bnx2x_init_mod_abs_int()
14056 aeu_mask |= vars->aeu_int_mask; in bnx2x_init_mod_abs_int()