All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] davinci: Add cpufreq support when booting with device tree
@ 2017-09-09 12:05 Adam Ford
  2017-09-11  8:05 ` Sekhar Nori
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Ford @ 2017-09-09 12:05 UTC (permalink / raw)
  To: linux-arm-kernel

While cpufreq itself doesn't appear to directly support the
device tree, we can register it inside da850_init_machine
when we register other devices.

Signed-off-by: Adam Ford <aford173@gmail.com>
---
 arch/arm/mach-davinci/da8xx-dt.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 5699ce3..57e2ade 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -14,6 +14,7 @@
 #include <linux/platform_data/ti-aemif.h>
 
 #include <asm/mach/arch.h>
+#include <asm/system_info.h>
 
 #include <mach/common.h>
 #include "cp_intc.h"
@@ -57,6 +58,28 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	{}
 };
 
+#ifdef CONFIG_CPU_FREQ
+static __init int da850_init_cpufreq(void)
+{
+	switch (system_rev & 0xF) {
+	case 3:
+		da850_max_speed = 456000;
+		break;
+	case 2:
+		da850_max_speed = 408000;
+		break;
+	case 1:
+		da850_max_speed = 372000;
+		break;
+	}
+
+	return da850_register_cpufreq("pll0_sysclk3");
+}
+#else
+static __init int da850_init_cpufreq(void) { return 0; }
+#endif
+
+
 #ifdef CONFIG_ARCH_DAVINCI_DA850
 
 static void __init da850_init_machine(void)
@@ -80,6 +103,10 @@ static void __init da850_init_machine(void)
 		pr_warn("%s: registering SATA REFCLK failed: %d",
 			__func__, ret);
 
+	ret = da850_init_cpufreq();
+	if (ret)
+		pr_warn("%s: cpufreq registration failed: %d\n", __func__, ret);
+
 	of_platform_default_populate(NULL, da850_auxdata_lookup, NULL);
 	davinci_pm_init();
 	pdata_quirks_init();
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] davinci: Add cpufreq support when booting with device tree
  2017-09-09 12:05 [PATCH] davinci: Add cpufreq support when booting with device tree Adam Ford
@ 2017-09-11  8:05 ` Sekhar Nori
  0 siblings, 0 replies; 2+ messages in thread
From: Sekhar Nori @ 2017-09-11  8:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Adam,

On Saturday 09 September 2017 05:35 PM, Adam Ford wrote:
> While cpufreq itself doesn't appear to directly support the
> device tree, we can register it inside da850_init_machine
> when we register other devices.
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>

There is an OPP-based, DT-enabled cpufreq driver available. Please see
support in drivers/cpufreq/cpufreq-dt-platdev.c

We should use that instead of this platform specific hack.

Looking at Documentation/devicetree/bindings/opp/opp.txt, it seems like
we should use the v2 bindings from the start. They do have useful
features like disabling certain OPPs on certain parts depending on the
parametrics[1]

Thanks,
Sekhar

[1] http://www.ti.com/product/AM1808#parametrics

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-11  8:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-09 12:05 [PATCH] davinci: Add cpufreq support when booting with device tree Adam Ford
2017-09-11  8:05 ` Sekhar Nori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.