Skip to contentSkip to conversation

ARM64: dts: cpufreq: mt8173: Migrate mt8173-cpufreq to use OPPv2 bindings

PATCH Superseded Pi-Cheng Chen 2 participants 7 messages Dec 5, 2015 – Dec 7, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM64: dts: cpufreq: mt8173: Migrate mt8173-cpufreq to use OPPv2 bindings

This series tries to migrate mt8173-cpufreq driver to use operating-points-v2 bindings and add support for mt8173-cpufreq driver

Pi-Cheng Chen (2):
cpufreq: mt8173: migrate to use operating-points-v2 bindings
ARM64: dts: mt8173: Add CPU OPP, clock and regulator supply properties

 arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 18 ++++++
 arch/arm64/boot/dts/mediatek/mt8173.dtsi    | 90 +++++++++++++++++++++++++++++
 drivers/cpufreq/mt8173-cpufreq.c            | 20 +++++--
 3 files changed, 122 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 cpufreq: mt8173: migrate to use operating-points-v2 bindings

Modify mt8173-cpufreq driver to get OPP-sharing information and set up OPP table provided by operating-points-v2 bindings.

---
This patch is based on the series[1] which fixes some issues of mt8173-cpufreq driver.

[1] http://thread.gmane.org/gmane.linux.power-management.general/68692

---
 drivers/cpufreq/mt8173-cpufreq.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/cpufreq/mt8173-cpufreq.c +14 -6
index 257bcb9..17e9cad 100644
@@ -344,6 +344,9 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
 	unsigned long rate;
 	int ret;
 
+	/* Mark the first owner of this CPU DVFS domain information */
+	cpumask_set_cpu(cpu, &info->cpus);
+
 	cpu_dev = get_cpu_device(cpu);
 	if (!cpu_dev) {
 		pr_err("failed to get cpu%d device\n", cpu);
@@ -390,7 +393,15 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
 	/* Both presence and absence of sram regulator are valid cases. */
 	sram_reg = regulator_get_exclusive(cpu_dev, "sram");
 
-	ret = dev_pm_opp_of_add_table(cpu_dev);
+	/* Get OPP-sharing information from "operating-points-v2" bindings */
+	ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, &info->cpus);
+	if (ret) {
+		pr_err("failed to get OPP-sharing information for cpu%d\n",
+		       cpu);
+		goto out_free_resources;
+	}
+
+	ret = dev_pm_opp_of_cpumask_add_table(&info->cpus);
 	if (ret) {
 		pr_warn("no OPP table for cpu%d\n", cpu);
 		goto out_free_resources;
@@ -421,13 +432,10 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
 	 */
 	info->need_voltage_tracking = !IS_ERR(sram_reg);
 
-	/* CPUs in the same cluster share a clock and power domain. */
-	cpumask_copy(&info->cpus, &cpu_topology[cpu].core_sibling);
-
 	return 0;
 
 out_free_opp_table:
-	dev_pm_opp_of_remove_table(cpu_dev);
+	dev_pm_opp_of_cpumask_remove_table(&info->cpus);
 
 out_free_resources:
 	if (!IS_ERR(proc_reg))
@@ -453,7 +461,7 @@ static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info)
 	if (!IS_ERR(info->inter_clk))
 		clk_put(info->inter_clk);
 
-	dev_pm_opp_of_remove_table(info->cpu_dev);
+	dev_pm_opp_of_cpumask_remove_table(&info->cpus);
 }
 
 static int mtk_cpufreq_init(struct cpufreq_policy *policy)
Signature · 1 line
1.9.1
maintainer
#2 lore raw

PATCH 1/2 cpufreq: mt8173: migrate to use operating-points-v2 bindings

drivers/cpufreq/mt8173-cpufreq.c static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) · line 349

Quoted 11 lines · Pi-Cheng Chen
drivers/cpufreq/mt8173-cpufreq.c +3 -0
index 257bcb9..17e9cad 100644
@@ -344,6 +344,9 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
 	unsigned long rate;
 	int ret;
 
+	/* Mark the first owner of this CPU DVFS domain information */
+	cpumask_set_cpu(cpu, &info->cpus);
+

This is bad, sorry about that. Please update dev_pm_opp_of_get_sharing_cpus() to update this as well.

Signature · 1 line
viresh
#3 lore raw

PATCH 1/2 cpufreq: mt8173: migrate to use operating-points-v2 bindings

Quoted 9 lines · Viresh Kumar
Quoted 8 lines · Pi-Cheng Chen
drivers/cpufreq/mt8173-cpufreq.c +0 -0
index 257bcb9..17e9cad 100644
@@ -344,6 +344,9 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
      unsigned long rate;
      int ret;
 
Quoted 6 lines

drivers/cpufreq/mt8173-cpufreq.c static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) · line 349

Quoted 3 lines
drivers/cpufreq/mt8173-cpufreq.c +3 -0
+     /* Mark the first owner of this CPU DVFS domain information */
+     cpumask_set_cpu(cpu, &info->cpus);
+

This is bad, sorry about that. Please update dev_pm_opp_of_get_sharing_cpus() to update this as well.

Hi Viresh,

Thanks for reviewing.
Will do it.

Pi-Cheng

Quoted 3 lines

--
viresh

#4 lore raw

PATCH 2/2 ARM64: dts: mt8173: Add CPU OPP, clock and regulator supply properties

In reply to Pi-Cheng Chen

Add operating-points-v2, clock, and regulator supply properties required by mt8173-cpufreq driver to enable it.

---
This patch is based on the patch[1] that adds underlying clock MUX for MT8173 which is needed by mt8173-cpufreq driver but not yet picked.

[1] http://article.gmane.org/gmane.linux.kernel.clk/325

---
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 18 ++++++
 arch/arm64/boot/dts/mediatek/mt8173.dtsi    | 90 +++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+)
arch/arm64/boot/dts/mediatek/mt8173-evb.dts +18 -0
index 811cb76..5b6321b 100644
@@ -405,6 +405,24 @@
 	status = "okay";
 };
 
+&cpu0 {
+	proc-supply = <&mt6397_vpca15_reg>;
+};
+
+&cpu1 {
+	proc-supply = <&mt6397_vpca15_reg>;
+};
+
+&cpu2 {
+	proc-supply = <&da9211_vcpu_reg>;
+	sram-supply = <&mt6397_vsramca7_reg>;
+};
+
+&cpu3 {
+	proc-supply = <&da9211_vcpu_reg>;
+	sram-supply = <&mt6397_vsramca7_reg>;
+};
+
 &uart0 {
 	status = "okay";
 };
arch/arm64/boot/dts/mediatek/mt8173.dtsi +90 -0

120 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#5 lore raw

PATCH 2/2 ARM64: dts: mt8173: Add CPU OPP, clock and regulator supply properties

arch/arm64/boot/dts/mediatek/mt8173.dtsi line 30

Quoted 4 lines · Pi-Cheng Chen
arch/arm64/boot/dts/mediatek/mt8173.dtsi +4 -0
+	cluster0_opp: opp_table0 {
+		compatible = "operating-points-v2";
+		opp-shared;
+		opp00 {

These have to named like: opp at 50700000, look at linux-next for this.

Signature · 1 line
viresh
#6 lore raw

PATCH 2/2 ARM64: dts: mt8173: Add CPU OPP, clock and regulator supply properties

Quoted 7 lines · Viresh Kumar

arch/arm64/boot/dts/mediatek/mt8173.dtsi line 30

Quoted 4 lines · Pi-Cheng Chen
arch/arm64/boot/dts/mediatek/mt8173.dtsi +4 -0
+     cluster0_opp: opp_table0 {
+             compatible = "operating-points-v2";
+             opp-shared;
+             opp00 {

These have to named like: opp at 50700000, look at linux-next for this.

Will do it.

Thanks,
Pi-Cheng

Quoted 3 lines

--
viresh