[ espressobin ] added cpu scaling fixes and adjust min/max parameters to match most recent variants

This commit is contained in:
Igor Pecovnik 2019-04-10 18:43:42 +02:00
parent 3af8f355bb
commit 77c1e16115
2 changed files with 59 additions and 2 deletions

View file

@ -38,8 +38,8 @@ case $BRANCH in
esac
CPUMIN=250000
CPUMAX=1000000
CPUMIN=200000
CPUMAX=1300000
GOVERNOR=ondemand
SERIALCON='ttyMV0'

View file

@ -0,0 +1,57 @@
From 8fe9a4c4a024a6353e810a1dbb5e4bc78bff60a8 Mon Sep 17 00:00:00 2001
From: FlashBurnGitHub <33546258+FlashBurnGitHub@users.noreply.github.com>
Date: Wed, 6 Mar 2019 17:25:46 +0100
Subject: [PATCH] Fix problem with cpu scaling not working
This fixes a problem that the cpu scaling is not working.
First one needs to first unset the parent clock, before setting the same old parent clock again. This solves the problem that the wrong TBG clock source was used for the cpu.
Also one needs to multiply the current cpu frequency with the used divider so that the right cpu frequency gets calculated when applying the dividers. This was need for a 600MHz final cpu frequency to work
---
drivers/cpufreq/armada-37xx-cpufreq.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c
index 75491fc841a6..5c744092f819 100644
--- a/drivers/cpufreq/armada-37xx-cpufreq.c
+++ b/drivers/cpufreq/armada-37xx-cpufreq.c
@@ -167,6 +167,11 @@ static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base,
* we need to use the clock framework
*/
parent = clk_get_parent(clk);
+
+ /* Unset parent clock */
+ clk_set_parent(clk, NULL);
+
+ /* set old parent; this triggers setting needed values for right CPU clock in hardware regs */
clk_set_parent(clk, parent);
}
@@ -360,6 +365,7 @@ static int __init armada37xx_cpufreq_driver_init(void)
struct platform_device *pdev;
unsigned long freq;
unsigned int cur_frequency;
+ unsigned int base_frequency;
struct regmap *nb_pm_base, *avs_base;
struct device *cpu_dev;
int load_lvl, ret;
@@ -412,6 +418,9 @@ static int __init armada37xx_cpufreq_driver_init(void)
clk_put(clk);
return -EINVAL;
}
+
+ /* Get base CPU frequency without divider */
+ base_frequency = cur_frequency * dvfs->divider[ARMADA_37XX_DVFS_LOAD_0];
armada37xx_cpufreq_state = kmalloc(sizeof(*armada37xx_cpufreq_state),
GFP_KERNEL);
@@ -431,7 +440,7 @@ static int __init armada37xx_cpufreq_driver_init(void)
for (load_lvl = ARMADA_37XX_DVFS_LOAD_0; load_lvl < LOAD_LEVEL_NR;
load_lvl++) {
unsigned long u_volt = avs_map[dvfs->avs[load_lvl]] * 1000;
- freq = cur_frequency / dvfs->divider[load_lvl];
+ freq = base_frequency / dvfs->divider[load_lvl];
ret = dev_pm_opp_add(cpu_dev, freq, u_volt);
if (ret)
goto remove_opp;