dpll: zl3073x: Fix ref frequency setting
Subsystems (4)
Ivan Vecera
maintainerPATCH 1/1 dpll: zl3073x: Fix ref frequency setting
The frequency for an input reference is computed as:
frequency = freq_base * freq_mult * freq_ratio_m / freq_ratio_n
Before commit 5bc02b190a3fb ("dpll: zl3073x: Cache all reference properties in zl3073x_ref"), zl3073x_dpll_input_pin_frequency_set() explicitly wrote 1 to both the REF_RATIO_M and REF_RATIO_N hardware registers whenever a new frequency was set. This ensured the FEC ratio was always reset to 1:1 alongside the new base/multiplier values.
The refactoring in that commit introduced zl3073x_ref_freq_set() to update the cached ref state, but this helper only sets freq_base and freq_mult without resetting freq_ratio_m and freq_ratio_n to 1. Because zl3073x_ref_state_set() uses a compare-and-write strategy, unchanged ratio fields are never written to the hardware. If the device previously had non-unity FEC ratio values, they remain in effect after a frequency change, resulting in an incorrect computed frequency.
Explicitly set freq_ratio_m and freq_ratio_n to 1 in zl3073x_ref_freq_set() to restore the original behavior.
--- drivers/dpll/zl3073x/ref.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/dpll/zl3073x/ref.h +2 -0
@@ -91,6 +91,8 @@ zl3073x_ref_freq_set(struct zl3073x_ref *ref, u32 freq) ref->freq_base = base; ref->freq_mult = mult; + ref->freq_ratio_m =1 ; + ref->freq_ratio_n =1 ;return 0 ; }
Signature · 1 line
2.52.0
Quoted 18 lines · Ivan Vecera
The frequency for an input reference is computed as:
frequency =
freq_base*freq_mult*freq_ratio_m/freq_ratio_nBefore commit
5bc02b190a3fb("dpll: zl3073x: Cache all reference properties inzl3073x_ref"),zl3073x_dpll_input_pin_frequency_set()explicitly wrote 1 to both theREF_RATIO_MandREF_RATIO_Nhardware registers whenever a new frequency was set. This ensured the FEC ratio was always reset to 1:1 alongside the new base/multiplier values.The refactoring in that commit introduced
zl3073x_ref_freq_set()to update the cached ref state, but this helper only setsfreq_baseandfreq_multwithout resettingfreq_ratio_mandfreq_ratio_nto 1. Becausezl3073x_ref_state_set()uses a compare-and-write strategy, unchanged ratio fields are never written to the hardware. If the device previously had non-unity FEC ratio values, they remain in effect after a frequency change, resulting in an incorrect computed frequency.
Quoted 5 lines
Explicitly set
freq_ratio_mandfreq_ratio_nto 1 inzl3073x_ref_freq_set()to restore the original behavior.Fixes 5bc02b190a3fb ("dpll: zl3073x: Cache all reference properties in zl3073x_ref")Signed-off-by Ivan Vecera <[email protected]>
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Mon, 16 Feb 2026 20:40:07 +0100 you wrote:
The frequency for an input reference is computed as:
frequency =
freq_base*freq_mult*freq_ratio_m/freq_ratio_nBefore commit
5bc02b190a3fb("dpll: zl3073x: Cache all reference properties inzl3073x_ref"),zl3073x_dpll_input_pin_frequency_set()explicitly wrote 1 to both theREF_RATIO_MandREF_RATIO_Nhardware registers whenever a new frequency was set. This ensured the FEC ratio was always reset to 1:1 alongside the new base/multiplier values.[...]
Here is the summary with links:
- [net] dpll: zl3073x: Fix ref frequency setting
https://git.kernel.org/netdev/net/c/a047497f9528
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html