diff mbox series

phy: zynqmp: Allow variation in refclk rate

Message ID 20230711194542.898230-1-sean.anderson@seco.com
State Accepted
Commit ea64a79fa6aebf6900f6cba0d6dd9c141010fda8
Headers show
Series phy: zynqmp: Allow variation in refclk rate | expand

Commit Message

Sean Anderson July 11, 2023, 7:45 p.m. UTC
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>
---

 drivers/phy/xilinx/phy-zynqmp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Vinod Koul July 12, 2023, 5:03 a.m. UTC | #1
On Tue, 11 Jul 2023 15:45:39 -0400, Sean Anderson wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] phy: zynqmp: Allow variation in refclk rate
      commit: ea64a79fa6aebf6900f6cba0d6dd9c141010fda8

Best regards,
diff mbox series

Patch

diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
index b0c2045b886e..2559c6594cea 100644
--- a/drivers/phy/xilinx/phy-zynqmp.c
+++ b/drivers/phy/xilinx/phy-zynqmp.c
@@ -904,7 +904,10 @@  static int xpsgtr_get_ref_clocks(struct xpsgtr_dev *gtr_dev)
 		rate = clk_get_rate(clk);
 
 		for (i = 0 ; i < ARRAY_SIZE(ssc_lookup); i++) {
-			if (rate == ssc_lookup[i].refclk_rate) {
+			/* Allow an error of 100 ppm */
+			unsigned long error = ssc_lookup[i].refclk_rate / 10000;
+
+			if (abs(rate - ssc_lookup[i].refclk_rate) < error) {
 				gtr_dev->refclk_sscs[refclk] = &ssc_lookup[i];
 				break;
 			}