Commit 836a1e25 authored by Linus Walleij's avatar Linus Walleij Committed by Rafael J. Wysocki

mfd: db8500-prcmu: Get rid of cpufreq dependency

The ARMSS clock, also known as the operating point of the
CPU, should not cross-depend on cpufreq like this. Move
the code to use just frequencies and remove the false
frequency (1GHz) and put in the actual frequency provided
by the ARMSS clock (998400000 Hz) as part of the process.

After this and the related cpufreq patch, the DB8500 will
simply use the standard DT cpufreq driver to change the
operating points through the common clock framework using
the ARMSS clock.
Acked-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent ff6c349f
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <linux/mfd/abx500/ab8500.h> #include <linux/mfd/abx500/ab8500.h>
#include <linux/regulator/db8500-prcmu.h> #include <linux/regulator/db8500-prcmu.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/cpufreq.h>
#include <linux/platform_data/ux500_wdt.h> #include <linux/platform_data/ux500_wdt.h>
#include <linux/platform_data/db8500_thermal.h> #include <linux/platform_data/db8500_thermal.h>
#include "dbx500-prcmu-regs.h" #include "dbx500-prcmu-regs.h"
...@@ -1692,32 +1691,27 @@ static long round_clock_rate(u8 clock, unsigned long rate) ...@@ -1692,32 +1691,27 @@ static long round_clock_rate(u8 clock, unsigned long rate)
return rounded_rate; return rounded_rate;
} }
/* CPU FREQ table, may be changed due to if MAX_OPP is supported. */ static const unsigned long armss_freqs[] = {
static struct cpufreq_frequency_table db8500_cpufreq_table[] = { 200000000,
{ .frequency = 200000, .driver_data = ARM_EXTCLK,}, 400000000,
{ .frequency = 400000, .driver_data = ARM_50_OPP,}, 800000000,
{ .frequency = 800000, .driver_data = ARM_100_OPP,}, 998400000
{ .frequency = CPUFREQ_TABLE_END,}, /* To be used for MAX_OPP. */
{ .frequency = CPUFREQ_TABLE_END,},
}; };
static long round_armss_rate(unsigned long rate) static long round_armss_rate(unsigned long rate)
{ {
struct cpufreq_frequency_table *pos; unsigned long freq = 0;
long freq = 0; int i;
/* cpufreq table frequencies is in KHz. */
rate = rate / 1000;
/* Find the corresponding arm opp from the cpufreq table. */ /* Find the corresponding arm opp from the cpufreq table. */
cpufreq_for_each_entry(pos, db8500_cpufreq_table) { for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
freq = pos->frequency; freq = armss_freqs[i];
if (freq == rate) if (rate <= freq)
break; break;
} }
/* Return the last valid value, even if a match was not found. */ /* Return the last valid value, even if a match was not found. */
return freq * 1000; return freq;
} }
#define MIN_PLL_VCO_RATE 600000000ULL #define MIN_PLL_VCO_RATE 600000000ULL
...@@ -1854,21 +1848,23 @@ static void set_clock_rate(u8 clock, unsigned long rate) ...@@ -1854,21 +1848,23 @@ static void set_clock_rate(u8 clock, unsigned long rate)
static int set_armss_rate(unsigned long rate) static int set_armss_rate(unsigned long rate)
{ {
struct cpufreq_frequency_table *pos; unsigned long freq;
u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP };
/* cpufreq table frequencies is in KHz. */ int i;
rate = rate / 1000;
/* Find the corresponding arm opp from the cpufreq table. */ /* Find the corresponding arm opp from the cpufreq table. */
cpufreq_for_each_entry(pos, db8500_cpufreq_table) for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) {
if (pos->frequency == rate) freq = armss_freqs[i];
if (rate == freq)
break; break;
}
if (pos->frequency != rate) if (rate != freq)
return -EINVAL; return -EINVAL;
/* Set the new arm opp. */ /* Set the new arm opp. */
return db8500_prcmu_set_arm_opp(pos->driver_data); pr_debug("SET ARM OPP 0x%02x\n", opps[i]);
return db8500_prcmu_set_arm_opp(opps[i]);
} }
static int set_plldsi_rate(unsigned long rate) static int set_plldsi_rate(unsigned long rate)
...@@ -3048,12 +3044,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = { ...@@ -3048,12 +3044,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = {
.platform_data = &db8500_regulators, .platform_data = &db8500_regulators,
.pdata_size = sizeof(db8500_regulators), .pdata_size = sizeof(db8500_regulators),
}, },
{
.name = "cpufreq-ux500",
.of_compatible = "stericsson,cpufreq-ux500",
.platform_data = &db8500_cpufreq_table,
.pdata_size = sizeof(db8500_cpufreq_table),
},
{ {
.name = "cpuidle-dbx500", .name = "cpuidle-dbx500",
.of_compatible = "stericsson,cpuidle-dbx500", .of_compatible = "stericsson,cpuidle-dbx500",
...@@ -3067,14 +3057,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = { ...@@ -3067,14 +3057,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = {
}, },
}; };
static void db8500_prcmu_update_cpufreq(void)
{
if (prcmu_has_arm_maxopp()) {
db8500_cpufreq_table[3].frequency = 1000000;
db8500_cpufreq_table[3].driver_data = ARM_MAX_OPP;
}
}
static int db8500_prcmu_register_ab8500(struct device *parent) static int db8500_prcmu_register_ab8500(struct device *parent)
{ {
struct device_node *np; struct device_node *np;
...@@ -3160,8 +3142,6 @@ static int db8500_prcmu_probe(struct platform_device *pdev) ...@@ -3160,8 +3142,6 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET);
db8500_prcmu_update_cpufreq();
err = mfd_add_devices(&pdev->dev, 0, common_prcmu_devs, err = mfd_add_devices(&pdev->dev, 0, common_prcmu_devs,
ARRAY_SIZE(common_prcmu_devs), NULL, 0, db8500_irq_domain); ARRAY_SIZE(common_prcmu_devs), NULL, 0, db8500_irq_domain);
if (err) { if (err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment