* [PATCH 0/3] ARM: berlin: add cpufreq support for the BG2Q @ 2015-07-30 12:35 Antoine Tenart 2015-07-30 12:35 ` [PATCH 2/3] ARM: berlin: register cpufreq-dt " Antoine Tenart 2015-07-30 12:35 ` [PATCH 3/3] ARM: berlin: dts: add the cpufreq-dt bindings on " Antoine Tenart 0 siblings, 2 replies; 6+ messages in thread From: Antoine Tenart @ 2015-07-30 12:35 UTC (permalink / raw) To: sebastian.hesselbarth, mturquette, sboyd Cc: Antoine Tenart, zmxu, jszhang, linux-arm-kernel, linux-pm, linux-kernel Hi, This series adds the cpufreq support to the Berlin BG2Q SoC only, as I told this couldn't be done for BG2 and BG2CD. First, the cpuclk clock is added to the Berlin clock driver. This clock has a divider fixed to 1, so we use a fixed factor clock here. Then register a platform device for cpufreq-dt, when using a BG2Q. I also added the OPP table definition in the BG2Q device tree. Some bootloaders may update this table when booting. Mine doesn't. Tested on a BG2Q DMP. Thanks, Antoine Antoine Tenart (3): clk: berlin: add cpuclk ARM: berlin: register cpufreq-dt for the BG2Q ARM: berlin: dts: add the cpufreq-dt bindings on the BG2Q arch/arm/boot/dts/berlin2q.dtsi | 11 +++++++++++ arch/arm/mach-berlin/berlin.c | 13 +++++++++++++ drivers/clk/berlin/bg2q.c | 14 +++++++------- include/dt-bindings/clock/berlin2q.h | 3 ++- 4 files changed, 33 insertions(+), 8 deletions(-) -- 2.5.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q 2015-07-30 12:35 [PATCH 0/3] ARM: berlin: add cpufreq support for the BG2Q Antoine Tenart @ 2015-07-30 12:35 ` Antoine Tenart 2015-07-31 6:16 ` Jisheng Zhang 2015-07-30 12:35 ` [PATCH 3/3] ARM: berlin: dts: add the cpufreq-dt bindings on " Antoine Tenart 1 sibling, 1 reply; 6+ messages in thread From: Antoine Tenart @ 2015-07-30 12:35 UTC (permalink / raw) To: sebastian.hesselbarth Cc: Antoine Tenart, zmxu, jszhang, linux-arm-kernel, linux-pm, linux-kernel The BG2Q SoC uses cpufreq-dt for cpufreq. Register a platform device for this. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> --- arch/arm/mach-berlin/berlin.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c index ac181c6797ee..0de906374994 100644 --- a/arch/arm/mach-berlin/berlin.c +++ b/arch/arm/mach-berlin/berlin.c @@ -15,9 +15,21 @@ #include <linux/io.h> #include <linux/kernel.h> #include <linux/of_platform.h> +#include <linux/platform_device.h> #include <asm/hardware/cache-l2x0.h> #include <asm/mach/arch.h> +static const struct of_device_id berlin2q_match[] = { + { .compatible = "marvell,berlin2q" }, + { }, +}; + +static void __init berlin_init_late(void) +{ + if (of_find_matching_node(NULL, berlin2q_match)) + platform_device_register_simple("cpufreq-dt", -1, NULL, 0); +} + static const char * const berlin_dt_compat[] = { "marvell,berlin", NULL, @@ -25,6 +37,7 @@ static const char * const berlin_dt_compat[] = { DT_MACHINE_START(BERLIN_DT, "Marvell Berlin") .dt_compat = berlin_dt_compat, + .init_late = berlin_init_late, /* * with DT probing for L2CCs, berlin_init_machine can be removed. * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc -- 2.5.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q 2015-07-30 12:35 ` [PATCH 2/3] ARM: berlin: register cpufreq-dt " Antoine Tenart @ 2015-07-31 6:16 ` Jisheng Zhang 2015-08-10 20:22 ` Sebastian Hesselbarth 0 siblings, 1 reply; 6+ messages in thread From: Jisheng Zhang @ 2015-07-31 6:16 UTC (permalink / raw) To: Antoine Tenart Cc: sebastian.hesselbarth, zmxu, linux-arm-kernel, linux-pm, linux-kernel Hi Antoine, On Thu, 30 Jul 2015 14:35:51 +0200 Antoine Tenart <antoine.tenart@free-electrons.com> wrote: > The BG2Q SoC uses cpufreq-dt for cpufreq. Register a platform device for > this. > > Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> > --- > arch/arm/mach-berlin/berlin.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c > index ac181c6797ee..0de906374994 100644 > --- a/arch/arm/mach-berlin/berlin.c > +++ b/arch/arm/mach-berlin/berlin.c > @@ -15,9 +15,21 @@ > #include <linux/io.h> > #include <linux/kernel.h> > #include <linux/of_platform.h> > +#include <linux/platform_device.h> > #include <asm/hardware/cache-l2x0.h> > #include <asm/mach/arch.h> > > +static const struct of_device_id berlin2q_match[] = { > + { .compatible = "marvell,berlin2q" }, > + { }, > +}; > + > +static void __init berlin_init_late(void) > +{ > + if (of_find_matching_node(NULL, berlin2q_match)) > + platform_device_register_simple("cpufreq-dt", -1, NULL, 0); I'm not sure is it acceptable to always register cpufreq-dt platform device. In cpufreq-dt driver, the probe will exit if there's no cpuclk node. > +} > + > static const char * const berlin_dt_compat[] = { > "marvell,berlin", > NULL, > @@ -25,6 +37,7 @@ static const char * const berlin_dt_compat[] = { > > DT_MACHINE_START(BERLIN_DT, "Marvell Berlin") > .dt_compat = berlin_dt_compat, > + .init_late = berlin_init_late, > /* > * with DT probing for L2CCs, berlin_init_machine can be removed. > * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q 2015-07-31 6:16 ` Jisheng Zhang @ 2015-08-10 20:22 ` Sebastian Hesselbarth 2015-08-11 2:44 ` Jisheng Zhang 0 siblings, 1 reply; 6+ messages in thread From: Sebastian Hesselbarth @ 2015-08-10 20:22 UTC (permalink / raw) To: Jisheng Zhang, Antoine Tenart Cc: zmxu, linux-arm-kernel, linux-pm, linux-kernel On 31.07.2015 08:16, Jisheng Zhang wrote: > On Thu, 30 Jul 2015 14:35:51 +0200 > Antoine Tenart <antoine.tenart@free-electrons.com> wrote: > >> The BG2Q SoC uses cpufreq-dt for cpufreq. Register a platform device for >> this. >> >> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> >> --- [...] >> diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c >> index ac181c6797ee..0de906374994 100644 >> --- a/arch/arm/mach-berlin/berlin.c >> +++ b/arch/arm/mach-berlin/berlin.c >> @@ -15,9 +15,21 @@ [...] >> +static void __init berlin_init_late(void) >> +{ >> + if (of_find_matching_node(NULL, berlin2q_match)) >> + platform_device_register_simple("cpufreq-dt", -1, NULL, 0); > > I'm not sure is it acceptable to always register cpufreq-dt platform device. > In cpufreq-dt driver, the probe will exit if there's no cpuclk node. Jisheng, registering the _device_ without checking for any requirements of the _driver_ is usual practice. It it the driver's job to check all of them and report an error or warning. So, I am fine with adding the device unconditionally. Using the .init_late() callback seems reasonable - but can you evaluate if we can have cpufreq-dt also for BG2/BG2CD? I'd also accept a single, default operating-point. BTW, there is one true point about Jisheng's comment: try to order your patches logically correct to avoid unnecessary warnings, i.e. 1/3 add cpuclk 2/3 add cpufreq-dt properties 3/3 register cpufreq-dt device If you consider a git-bisect run, you can land in between any of the three patches but they are always in the above order - so ordering is important. Sebastian >> +} >> + >> static const char * const berlin_dt_compat[] = { >> "marvell,berlin", >> NULL, >> @@ -25,6 +37,7 @@ static const char * const berlin_dt_compat[] = { >> >> DT_MACHINE_START(BERLIN_DT, "Marvell Berlin") >> .dt_compat = berlin_dt_compat, >> + .init_late = berlin_init_late, >> /* >> * with DT probing for L2CCs, berlin_init_machine can be removed. >> * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q 2015-08-10 20:22 ` Sebastian Hesselbarth @ 2015-08-11 2:44 ` Jisheng Zhang 0 siblings, 0 replies; 6+ messages in thread From: Jisheng Zhang @ 2015-08-11 2:44 UTC (permalink / raw) To: Sebastian Hesselbarth Cc: Antoine Tenart, zmxu, linux-arm-kernel, linux-pm, linux-kernel Dear Sebastian, On Mon, 10 Aug 2015 22:22:44 +0200 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> wrote: > On 31.07.2015 08:16, Jisheng Zhang wrote: > > On Thu, 30 Jul 2015 14:35:51 +0200 > > Antoine Tenart <antoine.tenart@free-electrons.com> wrote: > > > >> The BG2Q SoC uses cpufreq-dt for cpufreq. Register a platform device for > >> this. > >> > >> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> > >> --- > [...] > >> diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c > >> index ac181c6797ee..0de906374994 100644 > >> --- a/arch/arm/mach-berlin/berlin.c > >> +++ b/arch/arm/mach-berlin/berlin.c > >> @@ -15,9 +15,21 @@ > [...] > >> +static void __init berlin_init_late(void) > >> +{ > >> + if (of_find_matching_node(NULL, berlin2q_match)) > >> + platform_device_register_simple("cpufreq-dt", -1, NULL, 0); > > > > I'm not sure is it acceptable to always register cpufreq-dt platform device. > > In cpufreq-dt driver, the probe will exit if there's no cpuclk node. > > Jisheng, > > registering the _device_ without checking for any requirements of > the _driver_ is usual practice. It it the driver's job to check > all of them and report an error or warning. So, I am fine with > adding the device unconditionally. > > Using the .init_late() callback seems reasonable - but can you > evaluate if we can have cpufreq-dt also for BG2/BG2CD? I'd also > accept a single, default operating-point. hmm, if so, we can enable cpufreq-dt for BG2/BG2CD. In fact, there's no any problem if we don't touch the voltage, only changing the cpufreq should not introduce stable issues. > > BTW, there is one true point about Jisheng's comment: try to order > your patches logically correct to avoid unnecessary warnings, i.e. > > 1/3 add cpuclk > 2/3 add cpufreq-dt properties > 3/3 register cpufreq-dt device > > If you consider a git-bisect run, you can land in between any of the > three patches but they are always in the above order - so ordering is > important. > > Sebastian > > >> +} > >> + > >> static const char * const berlin_dt_compat[] = { > >> "marvell,berlin", > >> NULL, > >> @@ -25,6 +37,7 @@ static const char * const berlin_dt_compat[] = { > >> > >> DT_MACHINE_START(BERLIN_DT, "Marvell Berlin") > >> .dt_compat = berlin_dt_compat, > >> + .init_late = berlin_init_late, > >> /* > >> * with DT probing for L2CCs, berlin_init_machine can be removed. > >> * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] ARM: berlin: dts: add the cpufreq-dt bindings on the BG2Q 2015-07-30 12:35 [PATCH 0/3] ARM: berlin: add cpufreq support for the BG2Q Antoine Tenart 2015-07-30 12:35 ` [PATCH 2/3] ARM: berlin: register cpufreq-dt " Antoine Tenart @ 2015-07-30 12:35 ` Antoine Tenart 1 sibling, 0 replies; 6+ messages in thread From: Antoine Tenart @ 2015-07-30 12:35 UTC (permalink / raw) To: sebastian.hesselbarth Cc: Antoine Tenart, zmxu, jszhang, linux-arm-kernel, linux-pm, linux-kernel The BG2Q uses cpugreq-dt. Add the corresponding bindings. The operating points can be updated by the bootloader. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> --- arch/arm/boot/dts/berlin2q.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi index 63a48490e2f9..58f6792c0d77 100644 --- a/arch/arm/boot/dts/berlin2q.dtsi +++ b/arch/arm/boot/dts/berlin2q.dtsi @@ -53,6 +53,17 @@ device_type = "cpu"; next-level-cache = <&l2>; reg = <0>; + + clocks = <&chip_clk CLKID_CPU>; + clock-latency = <100000>; + /* Can be modified by the bootloader */ + operating-points = < + /* kHz uV */ + 1200000 1200000 + 1000000 1200000 + 800000 1200000 + 600000 1200000 + >; }; cpu@1 { -- 2.5.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-08-11 2:44 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-07-30 12:35 [PATCH 0/3] ARM: berlin: add cpufreq support for the BG2Q Antoine Tenart 2015-07-30 12:35 ` [PATCH 2/3] ARM: berlin: register cpufreq-dt " Antoine Tenart 2015-07-31 6:16 ` Jisheng Zhang 2015-08-10 20:22 ` Sebastian Hesselbarth 2015-08-11 2:44 ` Jisheng Zhang 2015-07-30 12:35 ` [PATCH 3/3] ARM: berlin: dts: add the cpufreq-dt bindings on " Antoine Tenart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).