Skip to content

Commit 6db5f2c

Browse files
kubalewskianguy11
authored andcommitted
ice: dpll: fix output pin capabilities
The dpll output pins which are used to feed clock signal of PHY and MAC circuits cannot be disconnected, those integrated circuits require clock signal for operation. By stopping assignment of DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE pin capability, prevent the user from invoking the state set callback on those pins, setting the state on those pins already returns error, as firmware doesn't allow the change of their state. Fixes: d7999f5 ("ice: implement dpll interface to control cgu") Fixes: 8a3a565 ("ice: add admin commands to access cgu configuration") Reviewed-by: Andrii Staikov <andrii.staikov@intel.com> Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 4a4027f commit 6db5f2c

3 files changed

Lines changed: 64 additions & 4 deletions

File tree

drivers/net/ethernet/intel/ice/ice_dpll.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,7 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
18231823
int num_pins, i, ret = -EINVAL;
18241824
struct ice_hw *hw = &pf->hw;
18251825
struct ice_dpll_pin *pins;
1826+
unsigned long caps;
18261827
u8 freq_supp_num;
18271828
bool input;
18281829

@@ -1842,6 +1843,7 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
18421843
}
18431844

18441845
for (i = 0; i < num_pins; i++) {
1846+
caps = 0;
18451847
pins[i].idx = i;
18461848
pins[i].prop.board_label = ice_cgu_get_pin_name(hw, i, input);
18471849
pins[i].prop.type = ice_cgu_get_pin_type(hw, i, input);
@@ -1854,8 +1856,8 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
18541856
&dp->input_prio[i]);
18551857
if (ret)
18561858
return ret;
1857-
pins[i].prop.capabilities |=
1858-
DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE;
1859+
caps |= (DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE |
1860+
DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE);
18591861
pins[i].prop.phase_range.min =
18601862
pf->dplls.input_phase_adj_max;
18611863
pins[i].prop.phase_range.max =
@@ -1865,9 +1867,11 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
18651867
pf->dplls.output_phase_adj_max;
18661868
pins[i].prop.phase_range.max =
18671869
-pf->dplls.output_phase_adj_max;
1870+
ret = ice_cgu_get_output_pin_state_caps(hw, i, &caps);
1871+
if (ret)
1872+
return ret;
18681873
}
1869-
pins[i].prop.capabilities |=
1870-
DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;
1874+
pins[i].prop.capabilities = caps;
18711875
ret = ice_dpll_pin_state_update(pf, &pins[i], pin_type, NULL);
18721876
if (ret)
18731877
return ret;

drivers/net/ethernet/intel/ice/ice_ptp_hw.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,3 +3961,57 @@ int ice_get_cgu_rclk_pin_info(struct ice_hw *hw, u8 *base_idx, u8 *pin_num)
39613961

39623962
return ret;
39633963
}
3964+
3965+
/**
3966+
* ice_cgu_get_output_pin_state_caps - get output pin state capabilities
3967+
* @hw: pointer to the hw struct
3968+
* @pin_id: id of a pin
3969+
* @caps: capabilities to modify
3970+
*
3971+
* Return:
3972+
* * 0 - success, state capabilities were modified
3973+
* * negative - failure, capabilities were not modified
3974+
*/
3975+
int ice_cgu_get_output_pin_state_caps(struct ice_hw *hw, u8 pin_id,
3976+
unsigned long *caps)
3977+
{
3978+
bool can_change = true;
3979+
3980+
switch (hw->device_id) {
3981+
case ICE_DEV_ID_E810C_SFP:
3982+
if (pin_id == ZL_OUT2 || pin_id == ZL_OUT3)
3983+
can_change = false;
3984+
break;
3985+
case ICE_DEV_ID_E810C_QSFP:
3986+
if (pin_id == ZL_OUT2 || pin_id == ZL_OUT3 || pin_id == ZL_OUT4)
3987+
can_change = false;
3988+
break;
3989+
case ICE_DEV_ID_E823L_10G_BASE_T:
3990+
case ICE_DEV_ID_E823L_1GBE:
3991+
case ICE_DEV_ID_E823L_BACKPLANE:
3992+
case ICE_DEV_ID_E823L_QSFP:
3993+
case ICE_DEV_ID_E823L_SFP:
3994+
case ICE_DEV_ID_E823C_10G_BASE_T:
3995+
case ICE_DEV_ID_E823C_BACKPLANE:
3996+
case ICE_DEV_ID_E823C_QSFP:
3997+
case ICE_DEV_ID_E823C_SFP:
3998+
case ICE_DEV_ID_E823C_SGMII:
3999+
if (hw->cgu_part_number ==
4000+
ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032 &&
4001+
pin_id == ZL_OUT2)
4002+
can_change = false;
4003+
else if (hw->cgu_part_number ==
4004+
ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384 &&
4005+
pin_id == SI_OUT1)
4006+
can_change = false;
4007+
break;
4008+
default:
4009+
return -EINVAL;
4010+
}
4011+
if (can_change)
4012+
*caps |= DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;
4013+
else
4014+
*caps &= ~DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;
4015+
4016+
return 0;
4017+
}

drivers/net/ethernet/intel/ice/ice_ptp_hw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ int ice_get_cgu_state(struct ice_hw *hw, u8 dpll_idx,
282282
int ice_get_cgu_rclk_pin_info(struct ice_hw *hw, u8 *base_idx, u8 *pin_num);
283283

284284
void ice_ptp_init_phy_model(struct ice_hw *hw);
285+
int ice_cgu_get_output_pin_state_caps(struct ice_hw *hw, u8 pin_id,
286+
unsigned long *caps);
285287

286288
#define PFTSYN_SEM_BYTES 4
287289

0 commit comments

Comments
 (0)