Commit 84b86944 authored by Karol Kolacinski's avatar Karol Kolacinski Committed by Tony Nguyen
Browse files

ice: fall back to TCXO on TSPLL lock fail



TSPLL can fail when trying to lock to TIME_REF as a clock source, e.g.
when the external clock source is not stable or connected to the board.
To continue operation after failure, try to lock again to internal TCXO
and inform user about this.

Reviewed-by: default avatarMilena Olech <milena.olech@intel.com>
Signed-off-by: default avatarKarol Kolacinski <karol.kolacinski@intel.com>
Tested-by: default avatarRinitha S <sx.rinitha@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent df3f3c56
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -605,5 +605,17 @@ int ice_tspll_init(struct ice_hw *hw)
	/* Configure the TSPLL using the parameters from the function
	 * capabilities.
	 */
	return ice_tspll_cfg(hw, tspll_freq, clk_src);
	err = ice_tspll_cfg(hw, tspll_freq, clk_src);
	if (err) {
		dev_warn(ice_hw_to_dev(hw), "Failed to lock TSPLL to predefined frequency. Retrying with fallback frequency.\n");

		/* Try to lock to internal TCXO as a fallback. */
		tspll_freq = ice_tspll_default_freq(hw->mac_type);
		clk_src = ICE_CLK_SRC_TCXO;
		err = ice_tspll_cfg(hw, tspll_freq, clk_src);
		if (err)
			dev_warn(ice_hw_to_dev(hw), "Failed to lock TSPLL to fallback frequency.\n");
	}

	return err;
}