示例#1
0
/**
 * e1000_init_phy_params_82540 - Init PHY func ptrs.
 * @hw: pointer to the HW structure
 **/
static s32 e1000_init_phy_params_82540(struct e1000_hw *hw)
{
    struct e1000_phy_info *phy = &hw->phy;
    s32 ret_val = E1000_SUCCESS;

    phy->addr                      = 1;
    phy->autoneg_mask              = AUTONEG_ADVERTISE_SPEED_DEFAULT;
    phy->reset_delay_us            = 10000;
    phy->type                      = e1000_phy_m88;

    /* Function Pointers */
    phy->ops.check_polarity        = e1000_check_polarity_m88;
    phy->ops.commit                = e1000_phy_sw_reset_generic;
#if 0
    phy->ops.force_speed_duplex    = e1000_phy_force_speed_duplex_m88;
#endif
#if 0
    phy->ops.get_cable_length      = e1000_get_cable_length_m88;
#endif
    phy->ops.get_cfg_done          = e1000_get_cfg_done_generic;
    phy->ops.read_reg              = e1000_read_phy_reg_m88;
    phy->ops.reset                 = e1000_phy_hw_reset_generic;
    phy->ops.write_reg             = e1000_write_phy_reg_m88;
    phy->ops.get_info              = e1000_get_phy_info_m88;
    phy->ops.power_up              = e1000_power_up_phy_copper;
    phy->ops.power_down            = e1000_power_down_phy_copper_82540;

    ret_val = e1000_get_phy_id(hw);
    if (ret_val)
        goto out;

    /* Verify phy id */
    switch (hw->mac.type) {
    case e1000_82540:
    case e1000_82545:
    case e1000_82545_rev_3:
    case e1000_82546:
    case e1000_82546_rev_3:
        if (phy->id == M88E1011_I_PHY_ID)
            break;
    /* Fall Through */
    default:
        ret_val = -E1000_ERR_PHY;
        goto out;
        break;
    }

out:
    return ret_val;
}
示例#2
0
/**
 *  e1000_init_phy_params_82541 - Init PHY func ptrs.
 *  @hw: pointer to the HW structure
 **/
static s32 e1000_init_phy_params_82541(struct e1000_hw *hw)
{
	struct e1000_phy_info *phy = &hw->phy;
	s32 ret_val = E1000_SUCCESS;

	DEBUGFUNC("e1000_init_phy_params_82541");

	phy->addr                      = 1;
	phy->autoneg_mask              = AUTONEG_ADVERTISE_SPEED_DEFAULT;
	phy->reset_delay_us            = 10000;
	phy->type                      = e1000_phy_igp;

	/* Function Pointers */
	phy->ops.check_polarity        = e1000_check_polarity_igp;
	phy->ops.force_speed_duplex    = e1000_phy_force_speed_duplex_igp;
	phy->ops.get_cable_length      = e1000_get_cable_length_igp_82541;
	phy->ops.get_cfg_done          = e1000_get_cfg_done_generic;
	phy->ops.get_info              = e1000_get_phy_info_igp;
	phy->ops.read_reg              = e1000_read_phy_reg_igp;
	phy->ops.reset                 = e1000_phy_hw_reset_82541;
	phy->ops.set_d3_lplu_state     = e1000_set_d3_lplu_state_82541;
	phy->ops.write_reg             = e1000_write_phy_reg_igp;
	phy->ops.power_up              = e1000_power_up_phy_copper;
	phy->ops.power_down            = e1000_power_down_phy_copper_82541;

	ret_val = e1000_get_phy_id(hw);
	if (ret_val)
		goto out;

	/* Verify phy id */
	if (phy->id != IGP01E1000_I_PHY_ID) {
		ret_val = -E1000_ERR_PHY;
		goto out;
	}

out:
	return ret_val;
}
示例#3
0
/**
 *  e1000_init_phy_params_82543 - Init PHY func ptrs.
 *  @hw: pointer to the HW structure
 **/
static s32 e1000_init_phy_params_82543(struct e1000_hw *hw)
{
	struct e1000_phy_info *phy = &hw->phy;
	s32 ret_val = E1000_SUCCESS;

	DEBUGFUNC("e1000_init_phy_params_82543");

	if (hw->phy.media_type != e1000_media_type_copper) {
		phy->type               = e1000_phy_none;
		goto out;
	} else {
		phy->ops.power_up       = e1000_power_up_phy_copper;
		phy->ops.power_down     = e1000_power_down_phy_copper;
	}

	phy->addr                       = 1;
	phy->autoneg_mask               = AUTONEG_ADVERTISE_SPEED_DEFAULT;
	phy->reset_delay_us             = 10000;
	phy->type                       = e1000_phy_m88;

	/* Function Pointers */
	phy->ops.check_polarity         = e1000_check_polarity_m88;
	phy->ops.commit                 = e1000_phy_sw_reset_generic;
	phy->ops.force_speed_duplex     = e1000_phy_force_speed_duplex_82543;
	phy->ops.get_cable_length       = e1000_get_cable_length_m88;
	phy->ops.get_cfg_done           = e1000_get_cfg_done_generic;
	phy->ops.read_reg               = (hw->mac.type == e1000_82543)
	                                  ? e1000_read_phy_reg_82543
	                                  : e1000_read_phy_reg_m88;
	phy->ops.reset                  = (hw->mac.type == e1000_82543)
	                                  ? e1000_phy_hw_reset_82543
	                                  : e1000_phy_hw_reset_generic;
	phy->ops.write_reg              = (hw->mac.type == e1000_82543)
	                                  ? e1000_write_phy_reg_82543
	                                  : e1000_write_phy_reg_m88;
	phy->ops.get_info               = e1000_get_phy_info_m88;

	/*
	 * The external PHY of the 82543 can be in a funky state.
	 * Resetting helps us read the PHY registers for acquiring
	 * the PHY ID.
	 */
	if (!e1000_init_phy_disabled_82543(hw)) {
		ret_val = phy->ops.reset(hw);
		if (ret_val) {
			DEBUGOUT("Resetting PHY during init failed.\n");
			goto out;
		}
		msec_delay(20);
	}

	ret_val = e1000_get_phy_id(hw);
	if (ret_val)
		goto out;

	/* Verify phy id */
	switch (hw->mac.type) {
	case e1000_82543:
		if (phy->id != M88E1000_E_PHY_ID) {
			ret_val = -E1000_ERR_PHY;
			goto out;
		}
		break;
	case e1000_82544:
		if (phy->id != M88E1000_I_PHY_ID) {
			ret_val = -E1000_ERR_PHY;
			goto out;
		}
		break;
	default:
		ret_val = -E1000_ERR_PHY;
		goto out;
		break;
	}

out:
	return ret_val;
}