Skip to contentSkip to conversation

clk: ti: Notify AVS driver upon setting clock rate

PATCH Superseded Udit Kumar 2 participants 3 messages Sep 19, 2023

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Udit Kumar

author
#0 lore raw

PATCH 1/1 clk: ti: Notify AVS driver upon setting clock rate

AVS is enabled at R5 SPL stage, where clk-k3 is used instead if clk-sci driver.

clk-k3 driver to notify AVS driver upon setting clock rate so that voltage is changed accordingly.

Fixes e0aa873bc7cd ("clk: clk-ti-sci: Notify AVS driver upon setting clock rate")
---
 drivers/clk/ti/clk-k3.c  | 5 +++++
 drivers/clk/ti/clk-sci.c | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/clk/ti/clk-k3.c +5 -0
index ba925fa3c4..8016c3784a 100644
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <soc.h>
 #include <clk-uclass.h>
+#include <k3-avs.h>
 #include "k3-clk.h"
 
 #define PLL_MIN_FREQ	800000000
@@ -339,6 +340,10 @@ static ulong ti_clk_set_rate(struct clk *clk, ulong rate)
 		}
 	}
 
+	if (IS_ENABLED(CONFIG_K3_AVS0))
+		k3_avs_notify_freq(data->map[clk->id].dev_id,
+				   data->map[clk->id].clk_id, rate);
+
 	return new_rate;
 }
 
drivers/clk/ti/clk-sci.c +0 -5
index 74df5a397b..298fa9dc8b 100644
@@ -17,7 +17,6 @@
 #include <dm/device_compat.h>
 #include <linux/err.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
-#include <k3-avs.h>
 
 /**
  * struct ti_sci_clk_data - clock controller information structure
@@ -94,10 +93,6 @@ static ulong ti_sci_clk_set_rate(struct clk *clk, ulong rate)
 
 	debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
 
-#ifdef CONFIG_K3_AVS0
-	k3_avs_notify_freq(clk->id, clk->data, rate);
-#endif
-
 	ret = cops->set_freq(sci, clk->id, clk->data, 0, rate, ULONG_MAX);
 	if (ret) {
 		dev_err(clk->dev, "%s: set_freq failed (%d)\n", __func__, ret);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 51 lines · Udit Kumar

AVS is enabled at R5 SPL stage, where clk-k3 is used instead if clk-sci driver.

clk-k3 driver to notify AVS driver upon setting clock rate so that voltage is changed accordingly.

Fixes e0aa873bc7cd ("clk: clk-ti-sci: Notify AVS driver upon setting clock rate")
---
 drivers/clk/ti/clk-k3.c  | 5 +++++
 drivers/clk/ti/clk-sci.c | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/clk/ti/clk-k3.c +5 -0
index ba925fa3c4..8016c3784a 100644
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <soc.h>
 #include <clk-uclass.h>
+#include <k3-avs.h>
 #include "k3-clk.h"
 
 #define PLL_MIN_FREQ	800000000
@@ -339,6 +340,10 @@ static ulong ti_clk_set_rate(struct clk *clk, ulong rate)
 		}
 	}
 
+	if (IS_ENABLED(CONFIG_K3_AVS0))
+		k3_avs_notify_freq(data->map[clk->id].dev_id,
+				   data->map[clk->id].clk_id, rate);
+
 	return new_rate;
 }
 
drivers/clk/ti/clk-sci.c +0 -1
index 74df5a397b..298fa9dc8b 100644
@@ -17,7 +17,6 @@
 #include <dm/device_compat.h>
 #include <linux/err.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
-#include <k3-avs.h>
 
 /**
  * struct ti_sci_clk_data - clock controller information structure

drivers/clk/ti/clk-sci.c static ulong ti_sci_clk_set_rate(struct clk *clk, ulong rate) · line 100

Quoted 7 lines
drivers/clk/ti/clk-sci.c +0 -4
@@ -94,10 +93,6 @@ static ulong ti_sci_clk_set_rate(struct clk *clk, ulong rate)
 
 	debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
 
-#ifdef CONFIG_K3_AVS0
-	k3_avs_notify_freq(clk->id, clk->data, rate);
-#endif
-

Why drop from here? we do have am64 and am65 that use ti-sci, correct?

Quoted 6 lines
drivers/clk/ti/clk-sci.c +0 -0
 	ret = cops->set_freq(sci, clk->id, clk->data, 0, rate, ULONG_MAX);
 	if (ret) {
 		dev_err(clk->dev, "%s: set_freq failed (%d)\n", __func__, ret);
Signature · 1 line
2.34.1
Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#2 lore raw
Quoted 6 lines · Nishanth Menon
Quoted 4 lines · Udit Kumar

AVS is enabled at R5 SPL stage, where clk-k3 is used instead if clk-sci driver.

[..]

Why drop from here? we do have am64 and am65 that use ti-sci, correct?

Thanks,

am64/am65 slipped out of my mind while creating this patch.

will fix in v2.

Quoted 6 lines
Quoted 6 lines

ret = cops->set_freq(sci, clk->id, clk->data, 0, rate, ULONG_MAX); if (ret) {
dev_err(clk->dev, "%s: set_freq failed (%d)\n", __func__, ret);

Signature · 1 line
2.34.1