diff mbox series

[02/12] clk: mediatek: return XTAL rate for infrasys get_mux_rate

Message ID 20240628174114.8675-3-ansuelsmth@gmail.com
State Accepted
Commit bf6ba78143e988178848e13a2c0b0c7db41c9bb7
Delegated to: Sean Anderson
Headers show
Series clk: mediatek: add OPs to support OF_UPSTREAM | expand

Commit Message

Christian Marangi June 28, 2024, 5:40 p.m. UTC
We currently return 0 if XTAL rate is requested in get_mux_rate. This
deviates from what is done in get_factor_rate and is totally wrong as it
can cause unwanted results (division by 0 crash)

For infrasys that makes use of CLK_XTAL, assume xtal_rate to be defined
in clk_tree and return the rate when BYPASS_XTAL is not enabled with
clk ID 0 index parents.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/clk/mediatek/clk-mtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c
index e68beccc060..555e2220748 100644
--- a/drivers/clk/mediatek/clk-mtk.c
+++ b/drivers/clk/mediatek/clk-mtk.c
@@ -376,7 +376,7 @@  static ulong mtk_infrasys_get_mux_rate(struct clk *clk, u32 off)
 			break;
 		}
 	}
-	return 0;
+	return priv->tree->xtal_rate;
 }
 
 static ulong mtk_topckgen_get_rate(struct clk *clk)