Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: zynqmp: Allow variation in refclk rate

Due to limited available frequency ratios, the reference clock rate may
not be exactly the same as the required rate. Allow a small (100 ppm)
deviation.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Link: https://lore.kernel.org/r/20230711194542.898230-1-sean.anderson@seco.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Sean Anderson and committed by
Vinod Koul
76009ee7 20b5c6ae

+4 -1
+4 -1
drivers/phy/xilinx/phy-zynqmp.c
··· 904 904 rate = clk_get_rate(clk); 905 905 906 906 for (i = 0 ; i < ARRAY_SIZE(ssc_lookup); i++) { 907 - if (rate == ssc_lookup[i].refclk_rate) { 907 + /* Allow an error of 100 ppm */ 908 + unsigned long error = ssc_lookup[i].refclk_rate / 10000; 909 + 910 + if (abs(rate - ssc_lookup[i].refclk_rate) < error) { 908 911 gtr_dev->refclk_sscs[refclk] = &ssc_lookup[i]; 909 912 break; 910 913 }