linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 13/20] clocksource: armada-370-xp: Enable timer divider only when needed
Date: Mon, 30 Dec 2013 11:19:32 +0100	[thread overview]
Message-ID: <1388398779-11222-13-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1388398779-11222-1-git-send-email-daniel.lezcano@linaro.org>

From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

The current code sets the timer divider bits always. However, when
the 25 MHz timer is enabled, this is not needed and has no effect.
As this causes some confusion, rework the code so the divider is
set only when needed, i.e. when the 25 MHz timer is not in use.

Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/time-armada-370-xp.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index d8e47e5..0450f6b 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -76,6 +76,7 @@
 static void __iomem *timer_base, *local_base;
 static unsigned int timer_clk;
 static bool timer25Mhz = true;
+static u32 enable_mask;
 
 /*
  * Number of timer ticks per jiffy.
@@ -121,8 +122,7 @@ armada_370_xp_clkevt_next_event(unsigned long delta,
 	/*
 	 * Enable the timer.
 	 */
-	local_timer_ctrl_clrset(TIMER0_RELOAD_EN,
-				TIMER0_EN | TIMER0_DIV(TIMER_DIVIDER_SHIFT));
+	local_timer_ctrl_clrset(TIMER0_RELOAD_EN, enable_mask);
 	return 0;
 }
 
@@ -141,9 +141,7 @@ armada_370_xp_clkevt_mode(enum clock_event_mode mode,
 		/*
 		 * Enable timer.
 		 */
-		local_timer_ctrl_clrset(0, TIMER0_RELOAD_EN |
-					   TIMER0_EN |
-					   TIMER0_DIV(TIMER_DIVIDER_SHIFT));
+		local_timer_ctrl_clrset(0, TIMER0_RELOAD_EN | enable_mask);
 	} else {
 		/*
 		 * Disable timer.
@@ -240,10 +238,13 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
 	WARN_ON(!timer_base);
 	local_base = of_iomap(np, 1);
 
-	if (timer25Mhz)
+	if (timer25Mhz) {
 		set = TIMER0_25MHZ;		
-	else
+		enable_mask = TIMER0_EN;
+	} else {
 		clr = TIMER0_25MHZ;
+		enable_mask = TIMER0_EN | TIMER0_DIV(TIMER_DIVIDER_SHIFT);
+	}
 	timer_ctrl_clrset(clr, set);
 	local_timer_ctrl_clrset(clr, set);
 
@@ -267,8 +268,7 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
 	writel(0xffffffff, timer_base + TIMER0_VAL_OFF);
 	writel(0xffffffff, timer_base + TIMER0_RELOAD_OFF);
 
-	timer_ctrl_clrset(0, TIMER0_EN | TIMER0_RELOAD_EN |
-			     TIMER0_DIV(TIMER_DIVIDER_SHIFT));
+	timer_ctrl_clrset(0, TIMER0_RELOAD_EN | enable_mask);
 
 	clocksource_mmio_init(timer_base + TIMER0_VAL_OFF,
 			      "armada_370_xp_clocksource",
-- 
1.7.9.5

  parent reply	other threads:[~2013-12-30 10:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-30 10:14 [GIT PULL] clockevents/clocksource : new material for 3.14 Daniel Lezcano
2013-12-30 10:19 ` [PATCH 01/20] clockevent: sun4i: Fill the irq field in the clockevent structure Daniel Lezcano
2013-12-30 10:19   ` [PATCH 02/20] clocksource: sun4i: Change CPU mask to cpu_possible_mask Daniel Lezcano
2013-12-30 10:19   ` [PATCH 03/20] clocksource: sun4i: Increase a bit the clock event and sources rating Daniel Lezcano
2013-12-30 10:19   ` [PATCH 04/20] clocksource: Add Allwinner SoCs HS timers driver Daniel Lezcano
2013-12-30 10:19   ` [PATCH 05/20] ARM: sun5i: a10s: Add support for the High Speed Timers Daniel Lezcano
2013-12-30 10:19   ` [PATCH 06/20] ARM: sun5i: a13: " Daniel Lezcano
2013-12-30 10:19   ` [PATCH 07/20] ARM: sun7i: a20: " Daniel Lezcano
2013-12-30 10:19   ` [PATCH 08/20] clocksource: arm_global_timer: Switch to sched_clock_register() Daniel Lezcano
2013-12-30 10:19   ` [PATCH 09/20] clocksource: cadence_ttc_timer: " Daniel Lezcano
2013-12-30 10:19   ` [PATCH 10/20] clocksource: sun4i: " Daniel Lezcano
2013-12-30 10:19   ` [PATCH 11/20] clocksource: orion: " Daniel Lezcano
2013-12-30 10:19   ` [PATCH 12/20] clocksource: clksrc-of: Warn if no clock sources are found Daniel Lezcano
2013-12-30 10:19   ` Daniel Lezcano [this message]
2013-12-30 10:19   ` [PATCH 14/20] clocksource: sh_tmu: Remove unnecessary platform_set_drvdata() Daniel Lezcano
2013-12-30 10:19   ` [PATCH 15/20] clocksource: sh_mtu2: " Daniel Lezcano
2013-12-30 10:19   ` [PATCH 16/20] clocksource: misc drivers: Remove deprecated IRQF_DISABLED Daniel Lezcano
2013-12-30 10:19   ` [PATCH 17/20] clocksource: tegra: " Daniel Lezcano
2013-12-30 10:19   ` [PATCH 18/20] clocksource: vt8500: " Daniel Lezcano
2013-12-30 10:19   ` [PATCH 19/20] clocksource: bcm_kona_timer: Remove unused bcm_timer_ids Daniel Lezcano
2013-12-30 10:19   ` [PATCH 20/20] clocksource: sh_cmt: Add clk_prepare/unprepare support Daniel Lezcano
2014-01-12 16:33 ` [GIT PULL] clockevents/clocksource : new material for 3.14 Ingo Molnar
2014-01-13  8:27   ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1388398779-11222-13-git-send-email-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).