Skip to content

Commit

Permalink
cpufreq: imx6q-cpufreq: assign cpu_dev correctly to cpu0 device
Browse files Browse the repository at this point in the history
Commit cdc58d6 "cpufreq: imx6q-cpufreq:
remove device tree parsing for cpu nodes" assumed the pdev->dev is set to
cpu0 device in the platform code. But it actually points to the virtual
cpufreq-cpu0 platform device which is not present in the device tree.
Most of the information needed by cpufreq is stored in cpu0 DT node.
So cpu_dev must point to cpu0 device.

This patch fixes the wrong assignment to cpu_dev.

Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Sudeep KarkadaNagesha authored and Rafael J. Wysocki committed Sep 19, 2013
1 parent e1825b2 commit b494b48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions arch/arm/mach-imx/mach-imx6q.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,15 @@ static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev)
of_node_put(np);
}

static void __init imx6q_opp_init(struct device *cpu_dev)
static void __init imx6q_opp_init(void)
{
struct device_node *np;
struct device *cpu_dev = get_cpu_device(0);

if (!cpu_dev) {
pr_warn("failed to get cpu0 device\n");
return;
}
np = of_node_get(cpu_dev->of_node);
if (!np) {
pr_warn("failed to find cpu0 node\n");
Expand Down Expand Up @@ -268,7 +273,7 @@ static void __init imx6q_init_late(void)
imx6q_cpuidle_init();

if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) {
imx6q_opp_init(&imx6q_cpufreq_pdev.dev);
imx6q_opp_init();
platform_device_register(&imx6q_cpufreq_pdev);
}
}
Expand Down
7 changes: 6 additions & 1 deletion drivers/cpufreq/imx6q-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include <linux/clk.h>
#include <linux/cpu.h>
#include <linux/cpufreq.h>
#include <linux/delay.h>
#include <linux/err.h>
Expand Down Expand Up @@ -202,7 +203,11 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
unsigned long min_volt, max_volt;
int num, ret;

cpu_dev = &pdev->dev;
cpu_dev = get_cpu_device(0);
if (!cpu_dev) {
pr_err("failed to get cpu0 device\n");
return -ENODEV;
}

np = of_node_get(cpu_dev->of_node);
if (!np) {
Expand Down

0 comments on commit b494b48

Please sign in to comment.