Skip to contentSkip to conversation

clk: ti: clk-sci: Notify AVS driver based upon clock rate

PATCH In review Udit Kumar 2 participants 2 messages Sep 21, 2023 – Oct 12, 2023

Subsystems (2)
lore
Share & tools
lore

Udit Kumar

author
#0 lore raw

PATCH 1/1 clk: ti: clk-sci: Notify AVS driver based upon clock rate

AVS driver needs to be notified before or after clock change, depending upon new rate is greater or less than current clock rate.

Fixes 1e0aa873bc7cd ("clk: clk-ti-sci: Notify AVS driver upon setting clock rate")

---
Boot logs
https://gist.github.com/uditkumarti/5a05f9b18b8e5bc347ef98c901cc13d4

Separate patch for clk-sci driver to handle AVS,
as per review feedback in
https://lore.kernel.org/all/[email protected]/

 drivers/clk/ti/clk-sci.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/clk/ti/clk-sci.c +6 -3
index 74df5a397b..8fc3254c99 100644
@@ -91,12 +91,12 @@ static ulong ti_sci_clk_set_rate(struct clk *clk, ulong rate)
 	const struct ti_sci_handle *sci = data->sci;
 	const struct ti_sci_clk_ops *cops = &sci->ops.clk_ops;
 	int ret;
+	int freq_scale_up = rate >= ti_sci_clk_get_rate(clk) ? 1 : 0;
 
 	debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
 
-#ifdef CONFIG_K3_AVS0
-	k3_avs_notify_freq(clk->id, clk->data, rate);
-#endif
+	if (IS_ENABLED(CONFIG_K3_AVS0) && freq_scale_up)
+		k3_avs_notify_freq(clk->id, clk->data, rate);
 
 	ret = cops->set_freq(sci, clk->id, clk->data, 0, rate, ULONG_MAX);
 	if (ret) {
@@ -104,6 +104,9 @@ static ulong ti_sci_clk_set_rate(struct clk *clk, ulong rate)
 		return ret;
 	}
 
+	if (IS_ENABLED(CONFIG_K3_AVS0) && !freq_scale_up)
+		k3_avs_notify_freq(clk->id, clk->data, rate);
+
 	return rate;
 }
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Udit Kumar

AVS driver needs to be notified before or after clock change, depending upon new rate is greater or less than current clock rate.

Fixes 1e0aa873bc7cd ("clk: clk-ti-sci: Notify AVS driver upon setting clock rate")

Applied to u-boot/master, thanks!

Signature · 1 line
Tom