Lines Matching +full:leds +full:- +full:trigger +full:- +full:pattern
1 /* Copyright 2008-2013 Broadcom Corporation
8 * at http://www.gnu.org/licenses/gpl-2.0.html (the "GPL").
43 #define I2C_WA_PWR_ITER (I2C_WA_RETRY_CNT - 1)
205 (_phy)->def_md_devad, \
211 (_phy)->def_md_devad, \
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
925 return -EINVAL; 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()
965 return -EINVAL; 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()
1058 return -EINVAL; in bnx2x_ets_e3b0_sp_set_pri_cli_reg()
1073 return -EINVAL; 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()
1148 return -EINVAL; in bnx2x_ets_e3b0_config()
1151 if ((ets_params->num_of_cos > max_num_of_cos)) { in bnx2x_ets_e3b0_config()
1154 return -EINVAL; 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()
1200 return -EINVAL; in bnx2x_ets_e3b0_config()
1233 struct bnx2x *bp = params->bp; 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()
1309 struct bnx2x *bp = params->bp; 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()
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()
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()
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()
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()
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()
1662 "XMAC already out of reset in 4-port mode\n"); 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()
1738 struct bnx2x *bp = params->bp; 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()
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()
1822 if (vars->phy_flags & PHY_XGXS_FLAG) { in bnx2x_emac_enable()
1823 u32 ser_lane = ((params->lane_config & in bnx2x_emac_enable()
1828 /* select the master lanes (out of 0-3) */ 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()
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()
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()
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()
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()
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()
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()
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()
2336 struct bnx2x *bp = params->bp; in bnx2x_bmac2_enable()
2337 u8 port = params->port; 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()
2487 count--; 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()
2521 return -EINVAL; in bnx2x_pbf_update()
2539 * bnx2x_get_emac_base - retrive emac base address
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()
2617 rc = -EFAULT; in bnx2x_cl22_write()
2619 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, mode); in bnx2x_cl22_write()
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()
2656 rc = -EFAULT; in bnx2x_cl22_read()
2658 REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, mode); in bnx2x_cl22_read()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
2962 vars->eee_status &= ~SHMEM_EEE_ADV_STATUS_MASK; in bnx2x_eee_disable()
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()
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()
3008 struct bnx2x *bp = params->bp; 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()
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()
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()
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()
3150 rc = -EFAULT; in bnx2x_bsc_read()
3156 if (rc == -EFAULT) in bnx2x_bsc_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()
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()
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()
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()
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()
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()
3366 port = params->port; in bnx2x_xgxs_deassert()
3374 bnx2x_xgxs_specific_func(¶ms->phy[INT_PHY], params, in bnx2x_xgxs_deassert()
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()
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()
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()
3465 struct bnx2x *bp = params->bp; 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()
3492 struct bnx2x *bp = params->bp; in bnx2x_pause_resolve()
3497 vars->flow_ctrl = BNX2X_FLOW_CTRL_TX; 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()
3515 vars->flow_ctrl = BNX2X_FLOW_CTRL_BOTH; in bnx2x_pause_resolve()
3518 vars->flow_ctrl = BNX2X_FLOW_CTRL_RX; 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()
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()
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()
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()
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()
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()
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()
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()
3705 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_lpi_passthrough()
3718 struct bnx2x *bp = params->bp; in bnx2x_warpcore_restart_AN_KR()
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()
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()
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()
3790 if (phy->flags & FLAGS_WC_DUAL_MODE) 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()
3824 vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; in bnx2x_warpcore_enable_AN_KR()
3828 /* Over 1G - AN local device user page 1 */ 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()
3849 /* Enable Auto-Detect to support 1G over CL37 as well */ in bnx2x_warpcore_enable_AN_KR()
3852 wc_lane_config = REG_RD(bp, params->shmem_base + in bnx2x_warpcore_enable_AN_KR()
3858 * parallel-detect loop when CL73 and CL37 are enabled. in bnx2x_warpcore_enable_AN_KR()
3885 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_10G_KR()
3953 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_10G_XFI()
3969 /* Disable 100FX Enable and Auto-Detect */ in bnx2x_warpcore_set_10G_XFI()
3981 /* Turn off auto-detect & fiber mode */ 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()
4089 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_20G_force_KR2()
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()
4206 if (always_autoneg || phy->req_line_speed == SPEED_AUTO_NEG) { in bnx2x_warpcore_set_sgmii_speed()
4216 switch (phy->req_line_speed) { 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()
4238 phy->req_line_speed); in bnx2x_warpcore_set_sgmii_speed()
4263 /* Re-enable parallel detect */ in bnx2x_warpcore_set_sgmii_speed()
4296 struct bnx2x *bp = params->bp; in bnx2x_warpcore_clear_regs()
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()
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()
4389 struct bnx2x *bp = params->bp; in bnx2x_warpcore_get_sigdet()
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()
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()
4429 vars->rx_tx_asic_rst = 0; in bnx2x_warpcore_config_runtime()
4439 vars->rx_tx_asic_rst--; 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()
4456 struct bnx2x *bp = params->bp; 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()
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()
4486 if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_20G) in bnx2x_sfp_e3_set_transmitter()
4494 struct bnx2x *bp = params->bp; 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()
4504 vars->line_speed, serdes_net_if); 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()
4520 if (params->loopback_mode != LOOPBACK_EXT) in bnx2x_warpcore_config_init()
4523 DP(NETIF_MSG_LINK, "Setting KR 10G-Force\n"); in bnx2x_warpcore_config_init()
4530 if (vars->line_speed == SPEED_10000) { 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()
4567 if (vars->line_speed != SPEED_20000) { in bnx2x_warpcore_config_init()
4578 if (!params->loopback_mode) { in bnx2x_warpcore_config_init()
4581 DP(NETIF_MSG_LINK, "Setting KR 20G-Force\n"); in bnx2x_warpcore_config_init()
4601 struct bnx2x *bp = params->bp; in bnx2x_warpcore_link_reset()
4617 /* Update those 1-copy registers */ in bnx2x_warpcore_link_reset()
4620 /* Enable 1G MDIO (1-copy) */ in bnx2x_warpcore_link_reset()
4632 if (phy->flags & FLAGS_WC_DUAL_MODE) in bnx2x_warpcore_link_reset()
4641 if (phy->flags & FLAGS_WC_DUAL_MODE) { in bnx2x_warpcore_link_reset()
4656 struct bnx2x *bp = params->bp; 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()
4669 /* Enable 1G MDIO (1-copy) */ in bnx2x_set_warpcore_loopback()
4673 /* Set 1G loopback based on lane (1-copy) */ in bnx2x_set_warpcore_loopback()
4678 if (phy->flags & FLAGS_WC_DUAL_MODE) in bnx2x_set_warpcore_loopback()
4684 /* Switch back to 4-copy registers */ in bnx2x_set_warpcore_loopback()
4687 /* 10G / 20G-DXGXS */ 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()
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()
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()
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()
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()
4866 vars->link_status, vars->phy_link_up, vars->aeu_int_mask); in bnx2x_link_status_update()
4868 vars->line_speed, vars->duplex, vars->flow_ctrl); in bnx2x_link_status_update()
4874 struct bnx2x *bp = params->bp; in bnx2x_set_master_ln()
4876 ser_lane = ((params->lane_config & in bnx2x_set_master_ln()
4896 struct bnx2x *bp = params->bp; in bnx2x_reset_unicore()
4910 bnx2x_set_serdes_access(bp, params->port); 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()
4932 return -EINVAL; in bnx2x_reset_unicore()
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()
4981 struct bnx2x *bp = params->bp; 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()
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()
5036 struct bnx2x *bp = params->bp; in bnx2x_set_autoneg()
5045 if (vars->line_speed == SPEED_AUTO_NEG) in bnx2x_set_autoneg()
5063 if (vars->line_speed == SPEED_AUTO_NEG) in bnx2x_set_autoneg()
5077 if (vars->line_speed == SPEED_AUTO_NEG) { in bnx2x_set_autoneg()
5111 if (phy->speed_cap_mask & in bnx2x_set_autoneg()
5114 if (phy->speed_cap_mask & in bnx2x_set_autoneg()
5139 struct bnx2x *bp = params->bp; in bnx2x_program_serdes()
5149 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_program_serdes()
5156 * - needed only if the speed is greater than 1G (2.5G or 10G) 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()
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()
5208 struct bnx2x *bp = params->bp; in bnx2x_set_ieee_aneg_advertisement()
5229 struct bnx2x *bp = params->bp; in bnx2x_restart_autoneg()
5269 struct bnx2x *bp = params->bp; in bnx2x_initialize_sgmii_process()
5289 if (!(vars->line_speed == SPEED_AUTO_NEG)) { in bnx2x_initialize_sgmii_process()
5301 switch (vars->line_speed) { 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()
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()
5354 params->port); in bnx2x_direct_parallel_detect_used()
5365 params->port); in bnx2x_direct_parallel_detect_used()
5379 struct bnx2x *bp = params->bp; in bnx2x_update_adv_fc()
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()
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()
5438 vars->flow_ctrl = params->req_fc_auto_adv; in bnx2x_flow_ctrl_resolve()
5443 DP(NETIF_MSG_LINK, "flow_ctrl 0x%x\n", vars->flow_ctrl); in bnx2x_flow_ctrl_resolve()
5449 struct bnx2x *bp = params->bp; in bnx2x_check_fallback_to_cl37()
5477 DP(NETIF_MSG_LINK, "CL73 state-machine is not stable. " in bnx2x_check_fallback_to_cl37()
5501 * restart cl37 auto-neg in bnx2x_check_fallback_to_cl37()
5520 vars->link_status |= in bnx2x_xgxs_an_resolve()
5524 vars->link_status |= in bnx2x_xgxs_an_resolve()
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()
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()
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()
5602 return -EINVAL; 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()
5614 vars->phy_link_up, vars->line_speed); in bnx2x_get_link_speed_duplex()
5622 struct bnx2x *bp = params->bp; in bnx2x_link_settings_status()
5641 if (rc == -EINVAL) in bnx2x_link_settings_status()
5646 vars->duplex = duplex; in bnx2x_link_settings_status()
5648 if (phy->req_line_speed == SPEED_AUTO_NEG) in bnx2x_link_settings_status()
5653 if ((phy->req_line_speed == SPEED_AUTO_NEG) && in bnx2x_link_settings_status()
5662 (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE)) { in bnx2x_link_settings_status()
5669 vars->link_status |= in bnx2x_link_settings_status()
5673 vars->link_status |= in bnx2x_link_settings_status()
5680 vars->link_status |= in bnx2x_link_settings_status()
5683 vars->link_status |= in bnx2x_link_settings_status()
5688 vars->duplex, vars->flow_ctrl, vars->link_status); in bnx2x_link_settings_status()
5696 struct bnx2x *bp = params->bp; 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()
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()
5716 DP(NETIF_MSG_LINK, "PCS RX link status = 0x%x-->0x%x\n", in bnx2x_warpcore_read_status()
5731 if (phy->supported & SUPPORTED_20000baseKR2_Full) { in bnx2x_warpcore_read_status()
5741 if (phy->req_line_speed == SPEED_AUTO_NEG) { in bnx2x_warpcore_read_status()
5747 vars->link_status |= in bnx2x_warpcore_read_status()
5755 vars->link_status |= 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()
5771 vars->link_status |= in bnx2x_warpcore_read_status()
5775 vars->link_status |= in bnx2x_warpcore_read_status()
5782 vars->link_status |= in bnx2x_warpcore_read_status()
5785 vars->link_status |= 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()
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()
5839 bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0)) { 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()
5869 switch (vars->line_speed) { 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()
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()
5915 phy->rx_preemphasis[i]); in bnx2x_set_preemphasis()
5919 bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0), i++) { in bnx2x_set_preemphasis()
5923 phy->tx_preemphasis[i]); in bnx2x_set_preemphasis()
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()
5941 if (vars->line_speed != SPEED_AUTO_NEG || in bnx2x_xgxs_config_init()
5943 params->loopback_mode == LOOPBACK_EXT)) { in bnx2x_xgxs_config_init()
5960 vars->ieee_fc); in bnx2x_xgxs_config_init()
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()
5997 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) in bnx2x_prepare_xgxs()
6007 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) { in bnx2x_prepare_xgxs()
6022 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) 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()
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()
6058 params->phy[INT_PHY].type != in bnx2x_link_int_enable()
6068 params->phy[INT_PHY].type != in bnx2x_link_int_enable()
6079 (params->switch_cfg == SWITCH_CFG_10G), in bnx2x_link_int_enable()
6096 * status register. Link down indication is high-active-signal, 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()
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()
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()
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()
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()
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()
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()
6483 return -ESRCH; in bnx2x_test_link()
6486 if (params->loopback_mode == LOOPBACK_XGXS) in bnx2x_test_link()
6489 switch (params->num_phys) { 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()
6536 vars->line_speed = params->phy[INT_PHY].req_line_speed; in bnx2x_link_initialize()
6543 bnx2x_prepare_xgxs(¶ms->phy[INT_PHY], params, vars); 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()
6552 if (vars->line_speed == SPEED_AUTO_NEG && 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()
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()
6578 if (params->phy[phy_index].supported & in bnx2x_link_initialize()
6580 vars->link_status |= LINK_STATUS_SERDES_LINK; in bnx2x_link_initialize()
6589 params->phy[phy_index].config_init( in bnx2x_link_initialize()
6590 ¶ms->phy[phy_index], in bnx2x_link_initialize()
6596 params->port*4, in bnx2x_link_initialize()
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()
6615 struct bnx2x *bp = params->bp; in bnx2x_common_ext_link_reset()
6621 gpio_port = params->port; 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()
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()
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()
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()
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
6795 * - DUAL_MEDIA - The link between the 577xx and the first
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()
6830 port, (vars->phy_flags & PHY_XGXS_FLAG), 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()
6858 if (!phy->read_status) in bnx2x_link_update()
6861 cur_link_up = phy->read_status(phy, params, 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()
6903 params->multi_phy_config); in bnx2x_link_update()
6909 prev_line_speed = vars->line_speed; 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()
6928 vars->flow_ctrl = phy_vars[active_external_phy].flow_ctrl; 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()
6938 if (params->phy[EXT_PHY2].phy_specific_func) { 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()
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()
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()
7002 * Note that after link down-up as result of cable plug, the xgxs 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()
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()
7089 phy->ver_addr); in bnx2x_save_bcm_spirom_ver()
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()
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()
7124 (vars->flow_ctrl == BNX2X_FLOW_CTRL_NONE)) { in bnx2x_8073_resolve_fc()
7193 rc = -EINVAL; in bnx2x_8073_8727_external_rom_boot()
7206 ((fw_msgout & 0xff) != 0x03 && (phy->type == in bnx2x_8073_8727_external_rom_boot()
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()
7304 DP(NETIF_MSG_LINK, "Warning: XAUI work-around timeout !!!\n"); in bnx2x_8073_xaui_wa()
7305 return -EINVAL; in bnx2x_8073_xaui_wa()
7326 struct bnx2x *bp = params->bp; 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()
7360 struct bnx2x *bp = params->bp; in bnx2x_8073_specific_func()
7376 struct bnx2x *bp = params->bp; in bnx2x_8073_config_init()
7384 gpio_port = params->port; 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()
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()
7432 if (params->loopback_mode == LOOPBACK_EXT) { 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()
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()
7490 (tmp1 | ((phy->req_duplex == DUPLEX_FULL) ? in bnx2x_8073_config_init()
7523 struct bnx2x *bp = params->bp; 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()
7563 ((phy->req_line_speed != SPEED_10000))) { in bnx2x_8073_read_status()
7577 DP(NETIF_MSG_LINK, "KR PMA status 0x%x->0x%x," 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()
7604 params->port); in bnx2x_8073_read_status()
7607 vars->line_speed = SPEED_2500; in bnx2x_8073_read_status()
7609 params->port); in bnx2x_8073_read_status()
7612 vars->line_speed = SPEED_1000; in bnx2x_8073_read_status()
7614 params->port); in bnx2x_8073_read_status()
7618 params->port); in bnx2x_8073_read_status()
7623 if (params->lane_config & in bnx2x_8073_read_status()
7632 if (vars->line_speed == SPEED_1000) { 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()
7654 vars->link_status |= in bnx2x_8073_read_status()
7657 vars->link_status |= in bnx2x_8073_read_status()
7667 struct bnx2x *bp = params->bp; in bnx2x_8073_link_reset()
7672 gpio_port = params->port; in bnx2x_8073_link_reset()
7687 struct bnx2x *bp = params->bp; 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()
7706 bnx2x_save_spirom_version(bp, params->port, params->shmem_base, 0); in bnx2x_8705_config_init()
7715 struct bnx2x *bp = params->bp; in bnx2x_8705_read_status()
7736 vars->line_speed = SPEED_10000; in bnx2x_8705_read_status()
7749 struct bnx2x *bp = params->bp; in bnx2x_set_disable_pmd_transmit()
7754 if (params->feature_config_flags & 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()
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()
7828 gpio_pin = tx_en_mode - PORT_HW_CFG_TX_LASER_GPIO0; in bnx2x_sfp_e1e2_set_transmitter()
7843 struct bnx2x *bp = params->bp; in bnx2x_sfp_set_transmitter()
7856 struct bnx2x *bp = params->bp; in bnx2x_8726_read_sfp_module_eeprom()
7862 return -EINVAL; in bnx2x_8726_read_sfp_module_eeprom()
7895 return -EINVAL; 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()
7949 struct bnx2x *bp = params->bp; 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()
7985 struct bnx2x *bp = params->bp; 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()
8031 /* Wait appropriate time for two-wire command to finish before in bnx2x_8727_read_sfp_module_eeprom()
8052 return -EFAULT; in bnx2x_8727_read_sfp_module_eeprom()
8073 return -EINVAL; in bnx2x_8727_read_sfp_module_eeprom()
8080 struct bnx2x *bp = params->bp; 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()
8110 byte_cnt -= xfer_size; in bnx2x_read_sfp_module_eeprom()
8121 struct bnx2x *bp = params->bp; in bnx2x_get_edc_mode()
8125 phy->media_type = ETH_PHY_UNSPECIFIED; 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()
8153 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) in bnx2x_get_edc_mode()
8169 "Unknown copper-cable-type\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()
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()
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()
8246 return -EINVAL; in bnx2x_get_edc_mode()
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()
8277 if (params->feature_config_flags & 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()
8287 return -EINVAL; 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()
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()
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()
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()
8468 /* Keep the MSB 8-bits, and set the LSB 8-bits with the edc_mode */ in bnx2x_8727_set_limiting_mode()
8486 struct bnx2x *bp = params->bp; in bnx2x_8727_specific_func()
8493 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) 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()
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()
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()
8579 struct bnx2x *bp = params->bp; in bnx2x_set_sfp_module_fault_led()
8593 struct bnx2x *bp = params->bp; in bnx2x_warpcore_hw_reset()
8608 struct bnx2x *bp = params->bp; 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()
8629 struct bnx2x *bp = params->bp; in bnx2x_warpcore_set_limiting_mode()
8657 /* Restart microcode to re-read the new mode */ in bnx2x_warpcore_set_limiting_mode()
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()
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()
8694 params->port); in bnx2x_sfp_module_detection()
8699 return -EINVAL; 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()
8716 /* Turn off fault module-detected led */ in bnx2x_sfp_module_detection()
8738 struct bnx2x *bp = params->bp; in bnx2x_handle_module_detect_int()
8743 phy = ¶ms->phy[INT_PHY]; 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()
8784 (params->link_flags & in bnx2x_handle_module_detect_int()
8801 phy->media_type = ETH_PHY_NOT_PRESENT; in bnx2x_handle_module_detect_int()
8837 struct bnx2x *bp = params->bp; 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()
8870 vars->line_speed = SPEED_1000; in bnx2x_8706_8726_read_status()
8872 vars->line_speed = SPEED_10000; 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()
8884 vars->fault_detected = 1; in bnx2x_8706_8726_read_status()
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()
8917 if ((params->feature_config_flags & in bnx2x_8706_config_init()
8923 i*(MDIO_XS_8706_REG_BANK_RX1 - in bnx2x_8706_config_init()
8929 val |= (phy->rx_preemphasis[i] & 0x7); in bnx2x_8706_config_init()
8931 " reg 0x%x <-- val 0x%x\n", reg, val); in bnx2x_8706_config_init()
8936 if (phy->req_line_speed == SPEED_10000) { in bnx2x_8706_config_init()
8956 /* Enable Full-Duplex advertisement on CL37 */ in bnx2x_8706_config_init()
8976 bnx2x_save_bcm_spirom_ver(bp, phy, params->port); 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()
9010 struct bnx2x *bp = params->bp; in bnx2x_8726_config_loopback()
9018 struct bnx2x *bp = params->bp; in bnx2x_8726_external_rom_boot()
9022 /* Micro controller re-boot */ in bnx2x_8726_external_rom_boot()
9050 bnx2x_save_bcm_spirom_ver(bp, phy, params->port); in bnx2x_8726_external_rom_boot()
9057 struct bnx2x *bp = params->bp; in bnx2x_8726_read_status()
9067 vars->line_speed = 0; in bnx2x_8726_read_status()
9078 struct bnx2x *bp = params->bp; in bnx2x_8726_config_init()
9093 if (phy->req_line_speed == SPEED_1000) { 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()
9123 /* Enable RX-ALARM control to receive interrupt for 1G speed in bnx2x_8726_config_init()
9138 if ((params->feature_config_flags & 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()
9147 phy->tx_preemphasis[0]); in bnx2x_8726_config_init()
9152 phy->tx_preemphasis[1]); in bnx2x_8726_config_init()
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()
9174 struct bnx2x *bp = params->bp; in bnx2x_8727_set_link_led()
9179 if (!(phy->flags & FLAGS_NOC)) in bnx2x_8727_set_link_led()
9224 struct bnx2x *bp = params->bp; in bnx2x_8727_hw_reset()
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()
9248 /* Power down the XAUI until link is up in case of dual-media 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()
9295 struct bnx2x *bp = params->bp; in bnx2x_8727_config_init()
9313 if (!(phy->flags & FLAGS_NOC)) in bnx2x_8727_config_init()
9333 if ((params->feature_config_flags & 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()
9340 phy->tx_preemphasis[0]); in bnx2x_8727_config_init()
9344 phy->tx_preemphasis[1]); 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()
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()
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()
9424 if (!(phy->flags & FLAGS_NOC)) in bnx2x_8727_handle_mod_abs()
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()
9479 vars->line_speed = 0; in bnx2x_8727_read_status()
9490 /* Clear MSG-OUT */ 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()
9505 oc_port = BP_PATH(bp) + (params->port << 1); in bnx2x_8727_read_status()
9509 netdev_err(bp->dev, "Error: Power fault on Port %d has " in bnx2x_8727_read_status()
9534 bnx2x_8727_power_module(params->bp, phy, 0); in bnx2x_8727_read_status()
9548 if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) { 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()
9567 params->port); in bnx2x_8727_read_status()
9570 vars->line_speed = SPEED_1000; in bnx2x_8727_read_status()
9572 params->port); 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()
9588 vars->fault_detected = 1; 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()
9603 /* In case of dual-media board and 1G, power up the XAUI side, in bnx2x_8727_read_status()
9620 struct bnx2x *bp = params->bp; in bnx2x_8727_link_reset()
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()
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()
9678 phy->ver_addr); in bnx2x_save_848xx_spirom_version()
9697 phy->ver_addr); in bnx2x_save_848xx_spirom_version()
9707 phy->ver_addr); in bnx2x_save_848xx_spirom_version()
9724 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) { in bnx2x_848xx_set_led()
9747 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) in bnx2x_848xx_set_led()
9763 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) in bnx2x_848xx_set_led()
9769 /* stretch_en for LEDs */ in bnx2x_848xx_set_led()
9780 struct bnx2x *bp = params->bp; in bnx2x_848xx_specific_func()
9785 bnx2x_save_848xx_spirom_version(phy, bp, params->port); in bnx2x_848xx_specific_func()
9791 bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, in bnx2x_848xx_specific_func()
9803 struct bnx2x *bp = params->bp; 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()
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()
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()
9909 if (phy->req_duplex == DUPLEX_FULL) 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()
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()
9972 struct bnx2x *bp = params->bp; in bnx2x_84858_cmd_hdlr()
9991 return -EINVAL; in bnx2x_84858_cmd_hdlr()
10026 return -EINVAL; in bnx2x_84858_cmd_hdlr()
10048 struct bnx2x *bp = params->bp; in bnx2x_84833_cmd_hdlr()
10076 return -EINVAL; in bnx2x_84833_cmd_hdlr()
10101 rc = -EINVAL; in bnx2x_84833_cmd_hdlr()
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()
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()
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()
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()
10228 shmem_base_path[0] = params->shmem_base; in bnx2x_84833_hw_reset_phy()
10232 params->chip_id); in bnx2x_84833_hw_reset_phy()
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()
10266 struct bnx2x *bp = params->bp; in bnx2x_8483x_enable_eee()
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()
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()
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()
10373 if (params->phy[EXT_PHY2].req_line_speed == SPEED_1000) in bnx2x_848x3_config_init()
10379 params->multi_phy_config, val); in bnx2x_848x3_config_init()
10398 bnx2x_save_848xx_spirom_version(phy, bp, params->port); 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()
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()
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()
10460 /* Enable expansion register 0x46 (Pattern Generator status) */ in bnx2x_848x3_config_init()
10484 struct bnx2x *bp = params->bp; in bnx2x_848xx_read_status()
10489 /* Check 10G-BaseT link status */ 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()
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()
10541 vars->line_speed, in bnx2x_848xx_read_status()
10542 (vars->duplex == DUPLEX_FULL)); in bnx2x_848xx_read_status()
10549 vars->link_status |= in bnx2x_848xx_read_status()
10556 vars->link_status |= in bnx2x_848xx_read_status()
10562 vars->line_speed); 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()
10588 vars->link_status |= in bnx2x_848xx_read_status()
10591 vars->link_status |= in bnx2x_848xx_read_status()
10598 vars->link_status |= in bnx2x_848xx_read_status()
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()
10638 bnx2x_cl45_write(params->bp, phy, in bnx2x_8481_link_reset()
10640 bnx2x_cl45_write(params->bp, phy, in bnx2x_8481_link_reset()
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()
10674 struct bnx2x *bp = params->bp; in bnx2x_848xx_set_link_led()
10681 port = params->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()
10719 if (phy->type == in bnx2x_848xx_set_link_led()
10739 if ((params->hw_led_mode << SHARED_HW_CFG_LED_MODE_SHIFT) == 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()
10790 if (phy->type == in bnx2x_848xx_set_link_led()
10809 if ((params->hw_led_mode << SHARED_HW_CFG_LED_MODE_SHIFT) == 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()
10897 if ((params->hw_led_mode << SHARED_HW_CFG_LED_MODE_SHIFT) == in bnx2x_848xx_set_link_led()
10942 val = ((params->hw_led_mode << in bnx2x_848xx_set_link_led()
10962 if (phy->type == 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()
10982 if (params->link_flags & in bnx2x_848xx_set_link_led()
10985 params->link_flags &= in bnx2x_848xx_set_link_led()
11009 struct bnx2x *bp = params->bp; in bnx2x_54618se_specific_func()
11038 struct bnx2x *bp = params->bp; 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()
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()
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()
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()
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()
11179 if ((phy->flags & FLAGS_EEE) && bnx2x_eee_has_cap(params)) { 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()
11205 DP(NETIF_MSG_LINK, "Don't Advertise 1GBase-T EEE\n"); 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()
11231 if (phy->req_duplex == DUPLEX_FULL) in bnx2x_54618se_config_init()
11242 struct bnx2x *bp = params->bp; in bnx2x_5461x_set_link_led()
11278 struct bnx2x *bp = params->bp; 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()
11304 struct bnx2x *bp = params->bp; 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()
11349 vars->line_speed, in bnx2x_54618se_read_status()
11350 (vars->duplex == DUPLEX_FULL)); in bnx2x_54618se_read_status()
11357 vars->link_status |= in bnx2x_54618se_read_status()
11363 vars->link_status |= in bnx2x_54618se_read_status()
11367 vars->line_speed); in bnx2x_54618se_read_status()
11371 if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) { 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()
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()
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()
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()
11453 struct bnx2x *bp = params->bp; in bnx2x_7101_config_loopback()
11464 struct bnx2x *bp = params->bp; 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()
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()
11502 struct bnx2x *bp = params->bp; 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()
11515 DP(NETIF_MSG_LINK, "10G-base-T PMA status 0x%x->0x%x\n", 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()
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()
11561 /* Writes a self-clearing reset */ in bnx2x_sfx7101_sp_sw_reset()
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()
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()
11590 struct bnx2x *bp = params->bp; in bnx2x_7101_set_link_led()
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()
12198 return -EINVAL; in bnx2x_get_ext_phy_config()
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()
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()
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()
12334 port, phy->addr, phy->mdio_ctrl); in bnx2x_populate_int_phy()
12372 phy->flags |= FLAGS_NOC; in bnx2x_populate_ext_phy()
12398 phy->flags |= FLAGS_EEE; in bnx2x_populate_ext_phy()
12405 return -EINVAL; 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()
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()
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()
12464 phy->addr, phy->mdio_ctrl); in bnx2x_populate_ext_phy()
12471 phy->type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN; in bnx2x_populate_phy()
12483 struct bnx2x *bp = params->bp; 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()
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()
12592 params->num_phys = 0; in bnx2x_phy_probe()
12594 phy_config_swapped = params->multi_phy_config & 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()
12613 params->num_phys = 0; 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()
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()
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()
12828 if (phy->phy_specific_func) { 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()
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()
12951 params->req_line_speed[0], params->req_flow_ctrl[0]); 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()
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()
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()
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()
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()
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()
13214 return -EINVAL; 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()
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()
13314 /* Use port1 because of the static port-swap */ in bnx2x_8726_common_init_phy()
13339 return -EINVAL; in bnx2x_8726_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()
13455 return -EINVAL; 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()
13487 phy_blk[port]->addr); in bnx2x_8727_common_init_phy()
13490 return -EINVAL; in bnx2x_8727_common_init_phy()
13555 rc = -EINVAL; in bnx2x_ext_phy_common_init()
13565 netdev_err(bp->dev, "Warning: PHY was not initialized," in bnx2x_ext_phy_common_init()
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()
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()
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()
13710 /* C. Trigger General Attention */ 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()
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()
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()
13829 struct bnx2x *bp = params->bp; in bnx2x_kr2_recovery()
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()
13855 if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { in bnx2x_check_kr2_wa()
13873 if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { 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()
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()
13923 struct bnx2x_phy *phy = ¶ms->phy[INT_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()
13931 if (vars->rx_tx_asic_rst) 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()
13941 } else if (vars->link_status & in bnx2x_period_func()
13943 /* Clean trail, interrupt corrects the leds */ 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()
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()
14031 /* Set GPIO3 to trigger SFP+ module insertion/removal */ 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()
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()
14059 /* Enable the GPIO to trigger interrupt */ in bnx2x_init_mod_abs_int()