* [PATCH 0/3] ARM: berlin: add cpufreq support for the BG2Q
@ 2015-07-30 12:35 Antoine Tenart
2015-07-30 12:35 ` [PATCH 1/3] clk: berlin: add cpuclk Antoine Tenart
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Antoine Tenart @ 2015-07-30 12:35 UTC (permalink / raw)
To: linux-arm-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] 9+ messages in thread
* [PATCH 1/3] clk: berlin: add cpuclk
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-08-07 23:59 ` Stephen Boyd
2015-08-10 19:55 ` Sebastian Hesselbarth
2015-07-30 12:35 ` [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q Antoine Tenart
2015-07-30 12:35 ` [PATCH 3/3] ARM: berlin: dts: add the cpufreq-dt bindings on " Antoine Tenart
2 siblings, 2 replies; 9+ messages in thread
From: Antoine Tenart @ 2015-07-30 12:35 UTC (permalink / raw)
To: linux-arm-kernel
Add cpuclk in the Berlin BG2Q clock driver. This clk has a divider
fixed to 1.
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
drivers/clk/berlin/bg2q.c | 14 +++++++-------
include/dt-bindings/clock/berlin2q.h | 3 ++-
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c
index 221f40c2b850..72d2f3500db8 100644
--- a/drivers/clk/berlin/bg2q.c
+++ b/drivers/clk/berlin/bg2q.c
@@ -45,7 +45,7 @@
#define REG_SDIO0XIN_CLKCTL 0x0158
#define REG_SDIO1XIN_CLKCTL 0x015c
-#define MAX_CLKS 27
+#define MAX_CLKS 28
static struct clk *clks[MAX_CLKS];
static struct clk_onecell_data clk_data;
static DEFINE_SPINLOCK(lock);
@@ -356,13 +356,13 @@ static void __init berlin2q_clock_setup(struct device_node *np)
gd->bit_idx, 0, &lock);
}
- /*
- * twdclk is derived from cpu/3
- * TODO: use cpupll until cpuclk is not available
- */
+ /* cpuclk divider is fixed to 1 */
+ clks[CLKID_CPU] =
+ clk_register_fixed_factor(NULL, "cpu", clk_names[CPUPLL],
+ 0, 1, 1);
+ /* twdclk is derived from cpu/3 */
clks[CLKID_TWD] =
- clk_register_fixed_factor(NULL, "twd", clk_names[CPUPLL],
- 0, 1, 3);
+ clk_register_fixed_factor(NULL, "twd", "cpu", 0, 1, 3);
/* check for errors on leaf clocks */
for (n = 0; n < MAX_CLKS; n++) {
diff --git a/include/dt-bindings/clock/berlin2q.h b/include/dt-bindings/clock/berlin2q.h
index 287fc3b4afb2..a80c3272794d 100644
--- a/include/dt-bindings/clock/berlin2q.h
+++ b/include/dt-bindings/clock/berlin2q.h
@@ -28,4 +28,5 @@
#define CLKID_NFC 23
#define CLKID_SMEMC 24
#define CLKID_PCIE 25
-#define CLKID_TWD 26
+#define CLKID_CPU 26
+#define CLKID_TWD 27
--
2.5.0
^ permalink raw reply related [flat|nested] 9+ 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 ` [PATCH 1/3] clk: berlin: add cpuclk 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
2 siblings, 1 reply; 9+ messages in thread
From: Antoine Tenart @ 2015-07-30 12:35 UTC (permalink / raw)
To: linux-arm-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] 9+ 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 1/3] clk: berlin: add cpuclk Antoine Tenart
2015-07-30 12:35 ` [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q Antoine Tenart
@ 2015-07-30 12:35 ` Antoine Tenart
2 siblings, 0 replies; 9+ messages in thread
From: Antoine Tenart @ 2015-07-30 12:35 UTC (permalink / raw)
To: linux-arm-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 at 1 {
--
2.5.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q
2015-07-30 12:35 ` [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q Antoine Tenart
@ 2015-07-31 6:16 ` Jisheng Zhang
2015-08-10 20:22 ` Sebastian Hesselbarth
0 siblings, 1 reply; 9+ messages in thread
From: Jisheng Zhang @ 2015-07-31 6:16 UTC (permalink / raw)
To: linux-arm-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] 9+ messages in thread
* [PATCH 1/3] clk: berlin: add cpuclk
2015-07-30 12:35 ` [PATCH 1/3] clk: berlin: add cpuclk Antoine Tenart
@ 2015-08-07 23:59 ` Stephen Boyd
2015-08-10 19:55 ` Sebastian Hesselbarth
1 sibling, 0 replies; 9+ messages in thread
From: Stephen Boyd @ 2015-08-07 23:59 UTC (permalink / raw)
To: linux-arm-kernel
On 07/30, Antoine Tenart wrote:
> Add cpuclk in the Berlin BG2Q clock driver. This clk has a divider
> fixed to 1.
>
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> ---
I didn't get anything besides 1/3, but this looks ok. If you
don't want us to take this through clk-tree, feel to take my ack
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> drivers/clk/berlin/bg2q.c | 14 +++++++-------
> include/dt-bindings/clock/berlin2q.h | 3 ++-
> 2 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c
> index 221f40c2b850..72d2f3500db8 100644
> --- a/drivers/clk/berlin/bg2q.c
> +++ b/drivers/clk/berlin/bg2q.c
> @@ -45,7 +45,7 @@
> #define REG_SDIO0XIN_CLKCTL 0x0158
> #define REG_SDIO1XIN_CLKCTL 0x015c
>
> -#define MAX_CLKS 27
> +#define MAX_CLKS 28
Maybe you should move this into the dt-bindings.h file.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] clk: berlin: add cpuclk
2015-07-30 12:35 ` [PATCH 1/3] clk: berlin: add cpuclk Antoine Tenart
2015-08-07 23:59 ` Stephen Boyd
@ 2015-08-10 19:55 ` Sebastian Hesselbarth
1 sibling, 0 replies; 9+ messages in thread
From: Sebastian Hesselbarth @ 2015-08-10 19:55 UTC (permalink / raw)
To: linux-arm-kernel
On 30.07.2015 14:35, Antoine Tenart wrote:
> Add cpuclk in the Berlin BG2Q clock driver. This clk has a divider
> fixed to 1.
>
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> ---
> drivers/clk/berlin/bg2q.c | 14 +++++++-------
> include/dt-bindings/clock/berlin2q.h | 3 ++-
> 2 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c
> index 221f40c2b850..72d2f3500db8 100644
> --- a/drivers/clk/berlin/bg2q.c
> +++ b/drivers/clk/berlin/bg2q.c
> @@ -45,7 +45,7 @@
> #define REG_SDIO0XIN_CLKCTL 0x0158
> #define REG_SDIO1XIN_CLKCTL 0x015c
>
> -#define MAX_CLKS 27
> +#define MAX_CLKS 28
Following Stephen's suggesting, how about moving this to the
dt-bindings include?
> static struct clk *clks[MAX_CLKS];
> static struct clk_onecell_data clk_data;
> static DEFINE_SPINLOCK(lock);
> @@ -356,13 +356,13 @@ static void __init berlin2q_clock_setup(struct device_node *np)
> gd->bit_idx, 0, &lock);
> }
>
> - /*
> - * twdclk is derived from cpu/3
> - * TODO: use cpupll until cpuclk is not available
> - */
> + /* cpuclk divider is fixed to 1 */
> + clks[CLKID_CPU] =
> + clk_register_fixed_factor(NULL, "cpu", clk_names[CPUPLL],
> + 0, 1, 1);
> + /* twdclk is derived from cpu/3 */
> clks[CLKID_TWD] =
> - clk_register_fixed_factor(NULL, "twd", clk_names[CPUPLL],
> - 0, 1, 3);
> + clk_register_fixed_factor(NULL, "twd", "cpu", 0, 1, 3);
>
> /* check for errors on leaf clocks */
> for (n = 0; n < MAX_CLKS; n++) {
> diff --git a/include/dt-bindings/clock/berlin2q.h b/include/dt-bindings/clock/berlin2q.h
> index 287fc3b4afb2..a80c3272794d 100644
> --- a/include/dt-bindings/clock/berlin2q.h
> +++ b/include/dt-bindings/clock/berlin2q.h
> @@ -28,4 +28,5 @@
> #define CLKID_NFC 23
> #define CLKID_SMEMC 24
> #define CLKID_PCIE 25
> -#define CLKID_TWD 26
> +#define CLKID_CPU 26
> +#define CLKID_TWD 27
Is there any good reason to brake existing dts[i] by moving TWD to 27
instead of adding CPU as 27?
Sebastian
^ permalink raw reply [flat|nested] 9+ messages in thread
* [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; 9+ messages in thread
From: Sebastian Hesselbarth @ 2015-08-10 20:22 UTC (permalink / raw)
To: linux-arm-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] 9+ messages in thread
* [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; 9+ messages in thread
From: Jisheng Zhang @ 2015-08-11 2:44 UTC (permalink / raw)
To: linux-arm-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] 9+ messages in thread
end of thread, other threads:[~2015-08-11 2:44 UTC | newest]
Thread overview: 9+ 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 1/3] clk: berlin: add cpuclk Antoine Tenart
2015-08-07 23:59 ` Stephen Boyd
2015-08-10 19:55 ` Sebastian Hesselbarth
2015-07-30 12:35 ` [PATCH 2/3] ARM: berlin: register cpufreq-dt for the BG2Q 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).