* [PATCH v2 0/4] Make Armada 375 use the reference clock when possible
@ 2014-10-25 14:48 Ezequiel Garcia
2014-10-25 14:48 ` [PATCH v2 1/4] clocksource: armada-370-xp: Add missing clock enable Ezequiel Garcia
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Ezequiel Garcia @ 2014-10-25 14:48 UTC (permalink / raw)
To: linux-arm-kernel
Changes from v1:
* Make the A375 timer and watchdog devicetree binding match the hardware
and require the two available clocks: core and reference clock.
This series adds support for the 25 MHz reference clock available on
Armada 375 SoC to be used on the timer and watchdog drivers. It is
similar to the one present in Armada XP SoC.
Given we initially had access to only a very early SoC revision (A375 Z1)
and due to a hardware issue, the timer and watchdog support was originally
submitted to use the core clock.
Now that the A0 SoC revision is out, we can fix this and use the reference
clock. The reason for this change is that the core clock is subject to the
SSCG (Spread Spectrum Clock Generator), so boards where SSCG is enabled
exhibit a very large timer drift.
Notice that this change will produce unpleseant results on A375 Z1, given the
reference 25 MHz clock doesn't work properly on that SoC revision.
But since the Z1 revision is not supported by the recently submitted A375
network driver (mvpp2), and therefore nobody is expected to run mainline
(if there are users at all of this early revision), the support might be
dropped entirely in a near future.
To prevent any compatibility issues when booting with an older devicetree,
this series provides proper fall backs in each case.
The series applies on v3.18-rc1.
Ezequiel Garcia (4):
clocksource: armada-370-xp: Add missing clock enable
watchdog: orion: Use the reference clock on Armada 375 SoC
clocksource: armada-370-xp: Use the reference clock on A375 SoC
ARM: mvebu: Enable the reference clock for timer and watchdog on
Armada 375 SoC
.../bindings/timer/marvell,armada-370-xp-timer.txt | 9 +++--
.../devicetree/bindings/watchdog/marvel.txt | 13 +++++++
arch/arm/boot/dts/armada-375.dtsi | 12 +++++--
drivers/clocksource/time-armada-370-xp.c | 30 ++++++++++++++++
drivers/watchdog/orion_wdt.c | 40 +++++++++++++++++++++-
5 files changed, 98 insertions(+), 6 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 1/4] clocksource: armada-370-xp: Add missing clock enable
2014-10-25 14:48 [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Ezequiel Garcia
@ 2014-10-25 14:48 ` Ezequiel Garcia
2014-11-01 23:05 ` Jason Cooper
2014-10-25 14:48 ` [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC Ezequiel Garcia
` (3 subsequent siblings)
4 siblings, 1 reply; 15+ messages in thread
From: Ezequiel Garcia @ 2014-10-25 14:48 UTC (permalink / raw)
To: linux-arm-kernel
This commit makes sure the timer clock is prepared and enabled
before retrieving its rate.
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
drivers/clocksource/time-armada-370-xp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index 0451e62..d8555f9 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -293,6 +293,7 @@ static void __init armada_xp_timer_init(struct device_node *np)
/* The 25Mhz fixed clock is mandatory, and must always be available */
BUG_ON(IS_ERR(clk));
+ clk_prepare_enable(clk);
timer_clk = clk_get_rate(clk);
armada_370_xp_timer_common_init(np);
@@ -305,6 +306,7 @@ static void __init armada_370_timer_init(struct device_node *np)
struct clk *clk = of_clk_get(np, 0);
BUG_ON(IS_ERR(clk));
+ clk_prepare_enable(clk);
timer_clk = clk_get_rate(clk) / TIMER_DIVIDER;
timer25Mhz = false;
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC
2014-10-25 14:48 [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Ezequiel Garcia
2014-10-25 14:48 ` [PATCH v2 1/4] clocksource: armada-370-xp: Add missing clock enable Ezequiel Garcia
@ 2014-10-25 14:48 ` Ezequiel Garcia
2014-10-31 12:50 ` Thomas Petazzoni
2014-11-01 23:06 ` Jason Cooper
2014-10-25 14:48 ` [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC Ezequiel Garcia
` (2 subsequent siblings)
4 siblings, 2 replies; 15+ messages in thread
From: Ezequiel Garcia @ 2014-10-25 14:48 UTC (permalink / raw)
To: linux-arm-kernel
The 25 MHz reference clock has better stability so its use is preferred over the
core clock. Change the Armada 375 clock initialization to use this reference
clock. To ensure the driver is compatible with an old devicetree, also provide
a fallback path which will silently return to the previous behavior.
While here, add the clock specification to the binding documentation.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
.../devicetree/bindings/watchdog/marvel.txt | 13 +++++++
drivers/watchdog/orion_wdt.c | 40 +++++++++++++++++++++-
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/watchdog/marvel.txt b/Documentation/devicetree/bindings/watchdog/marvel.txt
index 97223fd..858ed92 100644
--- a/Documentation/devicetree/bindings/watchdog/marvel.txt
+++ b/Documentation/devicetree/bindings/watchdog/marvel.txt
@@ -17,6 +17,18 @@ For "marvell,armada-375-wdt" and "marvell,armada-380-wdt":
- reg : A third entry is mandatory and should contain the
shared mask/unmask RSTOUT address.
+Clocks required for compatibles = "marvell,orion-wdt",
+ "marvell,armada-370-wdt":
+- clocks : Must contain a single entry describing the clock input
+
+Clocks required for compatibles = "marvell,armada-xp-wdt"
+ "marvell,armada-375-wdt"
+ "marvell,armada-380-wdt":
+- clocks : Must contain an entry for each entry in clock-names.
+- clock-names : Must include the following entries:
+ "nbclk" (L2/coherency fabric clock),
+ "fixed" (Reference 25 MHz fixed-clock).
+
Optional properties:
- interrupts : Contains the IRQ for watchdog expiration
@@ -30,4 +42,5 @@ Example:
interrupts = <3>;
timeout-sec = <10>;
status = "okay";
+ clocks = <&gate_clk 7>;
};
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 00d0741..6452fa2 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -114,6 +114,44 @@ static int armada370_wdt_clock_init(struct platform_device *pdev,
return 0;
}
+static int armada375_wdt_clock_init(struct platform_device *pdev,
+ struct orion_watchdog *dev)
+{
+ int ret;
+
+ dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed");
+ if (!IS_ERR(dev->clk)) {
+
+ ret = clk_prepare_enable(dev->clk);
+ if (ret) {
+ clk_put(dev->clk);
+ return ret;
+ }
+
+ atomic_io_modify(dev->reg + TIMER_CTRL,
+ WDT_AXP_FIXED_ENABLE_BIT,
+ WDT_AXP_FIXED_ENABLE_BIT);
+ dev->clk_rate = clk_get_rate(dev->clk);
+ return 0;
+ }
+
+ /* Mandatory fallback for proper devicetree backward compatibility */
+ dev->clk = clk_get(&pdev->dev, NULL);
+ if (IS_ERR(dev->clk))
+ return PTR_ERR(dev->clk);
+ ret = clk_prepare_enable(dev->clk);
+ if (ret) {
+ clk_put(dev->clk);
+ return ret;
+ }
+
+ atomic_io_modify(dev->reg + TIMER_CTRL,
+ WDT_A370_RATIO_MASK(WDT_A370_RATIO_SHIFT),
+ WDT_A370_RATIO_MASK(WDT_A370_RATIO_SHIFT));
+ dev->clk_rate = clk_get_rate(dev->clk) / WDT_A370_RATIO;
+ return 0;
+}
+
static int armadaxp_wdt_clock_init(struct platform_device *pdev,
struct orion_watchdog *dev)
{
@@ -394,7 +432,7 @@ static const struct orion_watchdog_data armada375_data = {
.rstout_mask_bit = BIT(10),
.wdt_enable_bit = BIT(8),
.wdt_counter_offset = 0x34,
- .clock_init = armada370_wdt_clock_init,
+ .clock_init = armada375_wdt_clock_init,
.enabled = armada375_enabled,
.start = armada375_start,
.stop = armada375_stop,
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC
2014-10-25 14:48 [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Ezequiel Garcia
2014-10-25 14:48 ` [PATCH v2 1/4] clocksource: armada-370-xp: Add missing clock enable Ezequiel Garcia
2014-10-25 14:48 ` [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC Ezequiel Garcia
@ 2014-10-25 14:48 ` Ezequiel Garcia
2014-10-31 13:06 ` Thomas Petazzoni
` (2 more replies)
2014-10-25 14:48 ` [PATCH v2 4/4] ARM: mvebu: Enable the reference clock for timer and watchdog on Armada 375 SoC Ezequiel Garcia
2014-10-31 13:07 ` [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Thomas Petazzoni
4 siblings, 3 replies; 15+ messages in thread
From: Ezequiel Garcia @ 2014-10-25 14:48 UTC (permalink / raw)
To: linux-arm-kernel
The 25 MHz reference clock has better stability so its use is preferred over the
core clock.
This commit takes advantage of the already introduced Armada 375 devicetree
compatible string and adds a new timer initialization. If available, the timer
will use the reference clock (named as 'fixed'). Otherwise, it falls back to the
previous behavior.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
.../bindings/timer/marvell,armada-370-xp-timer.txt | 9 ++++---
drivers/clocksource/time-armada-370-xp.c | 28 ++++++++++++++++++++++
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt b/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
index f455182..e9c78ce 100644
--- a/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
+++ b/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
@@ -2,8 +2,10 @@ Marvell Armada 370 and Armada XP Timers
---------------------------------------
Required properties:
-- compatible: Should be either "marvell,armada-370-timer" or
- "marvell,armada-xp-timer" as appropriate.
+- compatible: Should be one of the following
+ "marvell,armada-370-timer",
+ "marvell,armada-375-timer",
+ "marvell,armada-xp-timer".
- interrupts: Should contain the list of Global Timer interrupts and
then local timer interrupts
- reg: Should contain location and length for timers register. First
@@ -13,7 +15,8 @@ Required properties:
Clocks required for compatible = "marvell,armada-370-timer":
- clocks : Must contain a single entry describing the clock input
-Clocks required for compatible = "marvell,armada-xp-timer":
+Clocks required for compatibles = "marvell,armada-xp-timer",
+ "marvell,armada-375-timer":
- clocks : Must contain an entry for each entry in clock-names.
- clock-names : Must include the following entries:
"nbclk" (L2/coherency fabric clock),
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index d8555f9..3a0704b 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -301,6 +301,34 @@ static void __init armada_xp_timer_init(struct device_node *np)
CLOCKSOURCE_OF_DECLARE(armada_xp, "marvell,armada-xp-timer",
armada_xp_timer_init);
+static void __init armada_375_timer_init(struct device_node *np)
+{
+ struct clk *clk;
+
+ clk = of_clk_get_by_name(np, "fixed");
+ if (!IS_ERR(clk)) {
+ clk_prepare_enable(clk);
+ timer_clk = clk_get_rate(clk);
+ } else {
+
+ /*
+ * This fallback is required in order to retain proper
+ * devicetree backwards compatibility.
+ */
+ clk = of_clk_get(np, 0);
+
+ /* Must have at least a clock */
+ BUG_ON(IS_ERR(clk));
+ clk_prepare_enable(clk);
+ timer_clk = clk_get_rate(clk) / TIMER_DIVIDER;
+ timer25Mhz = false;
+ }
+
+ armada_370_xp_timer_common_init(np);
+}
+CLOCKSOURCE_OF_DECLARE(armada_375, "marvell,armada-375-timer",
+ armada_375_timer_init);
+
static void __init armada_370_timer_init(struct device_node *np)
{
struct clk *clk = of_clk_get(np, 0);
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 4/4] ARM: mvebu: Enable the reference clock for timer and watchdog on Armada 375 SoC
2014-10-25 14:48 [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Ezequiel Garcia
` (2 preceding siblings ...)
2014-10-25 14:48 ` [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC Ezequiel Garcia
@ 2014-10-25 14:48 ` Ezequiel Garcia
2014-10-31 13:06 ` Thomas Petazzoni
2014-11-01 23:11 ` Jason Cooper
2014-10-31 13:07 ` [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Thomas Petazzoni
4 siblings, 2 replies; 15+ messages in thread
From: Ezequiel Garcia @ 2014-10-25 14:48 UTC (permalink / raw)
To: linux-arm-kernel
Now that the timer and watchdog drivers support the Armada 375 usage of
the reference clock, we can enable it in the devicetree.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
arch/arm/boot/dts/armada-375.dtsi | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index de65714..9721e55 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -36,6 +36,12 @@
#clock-cells = <0>;
clock-frequency = <2000000000>;
};
+ /* 25 MHz reference crystal */
+ refclk: oscillator {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <25000000>;
+ };
};
cpus {
@@ -366,13 +372,15 @@
<&gic GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
<&mpic 5>,
<&mpic 6>;
- clocks = <&coreclk 0>;
+ clocks = <&coreclk 0>, <&refclk>;
+ clock-names = "nbclk", "fixed";
};
watchdog at 20300 {
compatible = "marvell,armada-375-wdt";
reg = <0x20300 0x34>, <0x20704 0x4>, <0x18254 0x4>;
- clocks = <&coreclk 0>;
+ clocks = <&coreclk 0>, <&refclk>;
+ clock-names = "nbclk", "fixed";
};
cpurst at 20800 {
--
2.1.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC
2014-10-25 14:48 ` [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC Ezequiel Garcia
@ 2014-10-31 12:50 ` Thomas Petazzoni
2014-11-01 23:07 ` Jason Cooper
2014-11-01 23:06 ` Jason Cooper
1 sibling, 1 reply; 15+ messages in thread
From: Thomas Petazzoni @ 2014-10-31 12:50 UTC (permalink / raw)
To: linux-arm-kernel
Dear Ezequiel Garcia,
It's really nitpicking, but I find the usage of empty newlines rather
unfortunate in the below function.
On Sat, 25 Oct 2014 11:48:40 -0300, Ezequiel Garcia wrote:
> +static int armada375_wdt_clock_init(struct platform_device *pdev,
> + struct orion_watchdog *dev)
> +{
> + int ret;
> +
> + dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed");
> + if (!IS_ERR(dev->clk)) {
> +
This empty new line seems not needed.
> + ret = clk_prepare_enable(dev->clk);
> + if (ret) {
> + clk_put(dev->clk);
> + return ret;
> + }
> +
> + atomic_io_modify(dev->reg + TIMER_CTRL,
> + WDT_AXP_FIXED_ENABLE_BIT,
> + WDT_AXP_FIXED_ENABLE_BIT);
> + dev->clk_rate = clk_get_rate(dev->clk);
> + return 0;
But one empty new line before the return would be good.
> + }
> +
> + /* Mandatory fallback for proper devicetree backward compatibility */
> + dev->clk = clk_get(&pdev->dev, NULL);
> + if (IS_ERR(dev->clk))
> + return PTR_ERR(dev->clk);
An empty newline would be good here as well.
> + ret = clk_prepare_enable(dev->clk);
> + if (ret) {
> + clk_put(dev->clk);
> + return ret;
> + }
> +
> + atomic_io_modify(dev->reg + TIMER_CTRL,
> + WDT_A370_RATIO_MASK(WDT_A370_RATIO_SHIFT),
> + WDT_A370_RATIO_MASK(WDT_A370_RATIO_SHIFT));
> + dev->clk_rate = clk_get_rate(dev->clk) / WDT_A370_RATIO;
And here.
With this fixed:
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC
2014-10-25 14:48 ` [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC Ezequiel Garcia
@ 2014-10-31 13:06 ` Thomas Petazzoni
2014-11-01 23:08 ` Jason Cooper
2014-11-03 16:51 ` Gregory CLEMENT
2 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2014-10-31 13:06 UTC (permalink / raw)
To: linux-arm-kernel
Dear Ezequiel Garcia,
On Sat, 25 Oct 2014 11:48:41 -0300, Ezequiel Garcia wrote:
> The 25 MHz reference clock has better stability so its use is preferred over the
> core clock.
>
> This commit takes advantage of the already introduced Armada 375 devicetree
> compatible string and adds a new timer initialization. If available, the timer
> will use the reference clock (named as 'fixed'). Otherwise, it falls back to the
> previous behavior.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> .../bindings/timer/marvell,armada-370-xp-timer.txt | 9 ++++---
> drivers/clocksource/time-armada-370-xp.c | 28 ++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 3 deletions(-)
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 4/4] ARM: mvebu: Enable the reference clock for timer and watchdog on Armada 375 SoC
2014-10-25 14:48 ` [PATCH v2 4/4] ARM: mvebu: Enable the reference clock for timer and watchdog on Armada 375 SoC Ezequiel Garcia
@ 2014-10-31 13:06 ` Thomas Petazzoni
2014-11-01 23:11 ` Jason Cooper
1 sibling, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2014-10-31 13:06 UTC (permalink / raw)
To: linux-arm-kernel
Dear Ezequiel Garcia,
On Sat, 25 Oct 2014 11:48:42 -0300, Ezequiel Garcia wrote:
> Now that the timer and watchdog drivers support the Armada 375 usage of
> the reference clock, we can enable it in the devicetree.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> arch/arm/boot/dts/armada-375.dtsi | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 0/4] Make Armada 375 use the reference clock when possible
2014-10-25 14:48 [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Ezequiel Garcia
` (3 preceding siblings ...)
2014-10-25 14:48 ` [PATCH v2 4/4] ARM: mvebu: Enable the reference clock for timer and watchdog on Armada 375 SoC Ezequiel Garcia
@ 2014-10-31 13:07 ` Thomas Petazzoni
4 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2014-10-31 13:07 UTC (permalink / raw)
To: linux-arm-kernel
Dear Ezequiel Garcia,
On Sat, 25 Oct 2014 11:48:38 -0300, Ezequiel Garcia wrote:
> Ezequiel Garcia (4):
> clocksource: armada-370-xp: Add missing clock enable
> watchdog: orion: Use the reference clock on Armada 375 SoC
> clocksource: armada-370-xp: Use the reference clock on A375 SoC
> ARM: mvebu: Enable the reference clock for timer and watchdog on
> Armada 375 SoC
>
> .../bindings/timer/marvell,armada-370-xp-timer.txt | 9 +++--
> .../devicetree/bindings/watchdog/marvel.txt | 13 +++++++
> arch/arm/boot/dts/armada-375.dtsi | 12 +++++--
> drivers/clocksource/time-armada-370-xp.c | 30 ++++++++++++++++
> drivers/watchdog/orion_wdt.c | 40 +++++++++++++++++++++-
> 5 files changed, 98 insertions(+), 6 deletions(-)
For the entire series:
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
I've tested on an Armada 375 A0 platform. Before this series, due to
the SSCG, I had a lot of drift in the system time. With this series,
the platform now uses the 25 Mhz timer not affected by the SSCG, and
I'm no longer experiencing any drift.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 1/4] clocksource: armada-370-xp: Add missing clock enable
2014-10-25 14:48 ` [PATCH v2 1/4] clocksource: armada-370-xp: Add missing clock enable Ezequiel Garcia
@ 2014-11-01 23:05 ` Jason Cooper
0 siblings, 0 replies; 15+ messages in thread
From: Jason Cooper @ 2014-11-01 23:05 UTC (permalink / raw)
To: linux-arm-kernel
Daniel,
On Sat, Oct 25, 2014 at 11:48:39AM -0300, Ezequiel Garcia wrote:
> This commit makes sure the timer clock is prepared and enabled
> before retrieving its rate.
>
> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> drivers/clocksource/time-armada-370-xp.c | 2 ++
> 1 file changed, 2 insertions(+)
Acked-by: Jason Cooper <jason@lakedaemon.net>
thx,
Jason.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC
2014-10-25 14:48 ` [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC Ezequiel Garcia
2014-10-31 12:50 ` Thomas Petazzoni
@ 2014-11-01 23:06 ` Jason Cooper
1 sibling, 0 replies; 15+ messages in thread
From: Jason Cooper @ 2014-11-01 23:06 UTC (permalink / raw)
To: linux-arm-kernel
Wim,
On Sat, Oct 25, 2014 at 11:48:40AM -0300, Ezequiel Garcia wrote:
> The 25 MHz reference clock has better stability so its use is preferred over the
> core clock. Change the Armada 375 clock initialization to use this reference
> clock. To ensure the driver is compatible with an old devicetree, also provide
> a fallback path which will silently return to the previous behavior.
>
> While here, add the clock specification to the binding documentation.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> .../devicetree/bindings/watchdog/marvel.txt | 13 +++++++
> drivers/watchdog/orion_wdt.c | 40 +++++++++++++++++++++-
> 2 files changed, 52 insertions(+), 1 deletion(-)
Acked-by: Jason Cooper <jason@lakedaemon.net>
thx,
Jason.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC
2014-10-31 12:50 ` Thomas Petazzoni
@ 2014-11-01 23:07 ` Jason Cooper
0 siblings, 0 replies; 15+ messages in thread
From: Jason Cooper @ 2014-11-01 23:07 UTC (permalink / raw)
To: linux-arm-kernel
Ezequiel, Wim,
On Fri, Oct 31, 2014 at 01:50:02PM +0100, Thomas Petazzoni wrote:
> Dear Ezequiel Garcia,
>
> It's really nitpicking, but I find the usage of empty newlines rather
> unfortunate in the below function.
oops, I thought this was against patch #3. Ezequiel, please feel free
to add my Ack once these changes are made.
thx,
Jason.
> On Sat, 25 Oct 2014 11:48:40 -0300, Ezequiel Garcia wrote:
>
> > +static int armada375_wdt_clock_init(struct platform_device *pdev,
> > + struct orion_watchdog *dev)
> > +{
> > + int ret;
> > +
> > + dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed");
> > + if (!IS_ERR(dev->clk)) {
> > +
>
> This empty new line seems not needed.
>
> > + ret = clk_prepare_enable(dev->clk);
> > + if (ret) {
> > + clk_put(dev->clk);
> > + return ret;
> > + }
> > +
> > + atomic_io_modify(dev->reg + TIMER_CTRL,
> > + WDT_AXP_FIXED_ENABLE_BIT,
> > + WDT_AXP_FIXED_ENABLE_BIT);
> > + dev->clk_rate = clk_get_rate(dev->clk);
> > + return 0;
>
> But one empty new line before the return would be good.
>
> > + }
> > +
> > + /* Mandatory fallback for proper devicetree backward compatibility */
> > + dev->clk = clk_get(&pdev->dev, NULL);
> > + if (IS_ERR(dev->clk))
> > + return PTR_ERR(dev->clk);
>
> An empty newline would be good here as well.
>
> > + ret = clk_prepare_enable(dev->clk);
> > + if (ret) {
> > + clk_put(dev->clk);
> > + return ret;
> > + }
> > +
> > + atomic_io_modify(dev->reg + TIMER_CTRL,
> > + WDT_A370_RATIO_MASK(WDT_A370_RATIO_SHIFT),
> > + WDT_A370_RATIO_MASK(WDT_A370_RATIO_SHIFT));
> > + dev->clk_rate = clk_get_rate(dev->clk) / WDT_A370_RATIO;
>
> And here.
>
> With this fixed:
>
> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC
2014-10-25 14:48 ` [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC Ezequiel Garcia
2014-10-31 13:06 ` Thomas Petazzoni
@ 2014-11-01 23:08 ` Jason Cooper
2014-11-03 16:51 ` Gregory CLEMENT
2 siblings, 0 replies; 15+ messages in thread
From: Jason Cooper @ 2014-11-01 23:08 UTC (permalink / raw)
To: linux-arm-kernel
Daniel,
On Sat, Oct 25, 2014 at 11:48:41AM -0300, Ezequiel Garcia wrote:
> The 25 MHz reference clock has better stability so its use is preferred over the
> core clock.
>
> This commit takes advantage of the already introduced Armada 375 devicetree
> compatible string and adds a new timer initialization. If available, the timer
> will use the reference clock (named as 'fixed'). Otherwise, it falls back to the
> previous behavior.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> .../bindings/timer/marvell,armada-370-xp-timer.txt | 9 ++++---
> drivers/clocksource/time-armada-370-xp.c | 28 ++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 3 deletions(-)
Acked-by: Jason Cooper <jason@lakedaemon.net>
thx,
Jason.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 4/4] ARM: mvebu: Enable the reference clock for timer and watchdog on Armada 375 SoC
2014-10-25 14:48 ` [PATCH v2 4/4] ARM: mvebu: Enable the reference clock for timer and watchdog on Armada 375 SoC Ezequiel Garcia
2014-10-31 13:06 ` Thomas Petazzoni
@ 2014-11-01 23:11 ` Jason Cooper
1 sibling, 0 replies; 15+ messages in thread
From: Jason Cooper @ 2014-11-01 23:11 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Oct 25, 2014 at 11:48:42AM -0300, Ezequiel Garcia wrote:
> Now that the timer and watchdog drivers support the Armada 375 usage of
> the reference clock, we can enable it in the devicetree.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> arch/arm/boot/dts/armada-375.dtsi | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
Applied to mvebu/dt with a Reviewed-by and a Tested-by from Thomas.
thx,
Jason.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC
2014-10-25 14:48 ` [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC Ezequiel Garcia
2014-10-31 13:06 ` Thomas Petazzoni
2014-11-01 23:08 ` Jason Cooper
@ 2014-11-03 16:51 ` Gregory CLEMENT
2 siblings, 0 replies; 15+ messages in thread
From: Gregory CLEMENT @ 2014-11-03 16:51 UTC (permalink / raw)
To: linux-arm-kernel
Hi Ezequiel,
On 25/10/2014 16:48, Ezequiel Garcia wrote:
> The 25 MHz reference clock has better stability so its use is preferred over the
> core clock.
>
> This commit takes advantage of the already introduced Armada 375 devicetree
> compatible string and adds a new timer initialization. If available, the timer
> will use the reference clock (named as 'fixed'). Otherwise, it falls back to the
> previous behavior.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> .../bindings/timer/marvell,armada-370-xp-timer.txt | 9 ++++---
> drivers/clocksource/time-armada-370-xp.c | 28 ++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 3 deletions(-)
>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Thanks,
Gregory
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2014-11-03 16:51 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-25 14:48 [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Ezequiel Garcia
2014-10-25 14:48 ` [PATCH v2 1/4] clocksource: armada-370-xp: Add missing clock enable Ezequiel Garcia
2014-11-01 23:05 ` Jason Cooper
2014-10-25 14:48 ` [PATCH v2 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC Ezequiel Garcia
2014-10-31 12:50 ` Thomas Petazzoni
2014-11-01 23:07 ` Jason Cooper
2014-11-01 23:06 ` Jason Cooper
2014-10-25 14:48 ` [PATCH v2 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC Ezequiel Garcia
2014-10-31 13:06 ` Thomas Petazzoni
2014-11-01 23:08 ` Jason Cooper
2014-11-03 16:51 ` Gregory CLEMENT
2014-10-25 14:48 ` [PATCH v2 4/4] ARM: mvebu: Enable the reference clock for timer and watchdog on Armada 375 SoC Ezequiel Garcia
2014-10-31 13:06 ` Thomas Petazzoni
2014-11-01 23:11 ` Jason Cooper
2014-10-31 13:07 ` [PATCH v2 0/4] Make Armada 375 use the reference clock when possible Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox