Skip to content

Commit 76009ee

Browse files
sean-anderson-secovinodkoul
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 20b5c6a commit 76009ee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/phy/xilinx/phy-zynqmp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,10 @@ static int xpsgtr_get_ref_clocks(struct xpsgtr_dev *gtr_dev)
904904
rate = clk_get_rate(clk);
905905

906906
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) {
908911
gtr_dev->refclk_sscs[refclk] = &ssc_lookup[i];
909912
break;
910913
}

0 commit comments

Comments
 (0)