linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/10] ARM: smp_twd: Divorce smp_twd from local timer API
Date: Mon, 11 Mar 2013 18:20:46 -0700	[thread overview]
Message-ID: <513E82EE.2040407@codeaurora.org> (raw)
In-Reply-To: <20130311225004.GR26093@atomide.com>

On 03/11/13 15:50, Tony Lindgren wrote:
> * Stephen Boyd <sboyd@codeaurora.org> [130311 15:22]:
>> Ok. qemu works for me before applying my patches. I've added this into
>> the series before this patch to fix the boot issue.
> OK thanks:
>
>

Actually, it's worse. From reading the code it looks like quite a few
other machines register a clockevent and get jiffies going so they can
calibrate the twd. I also see that Rob Herring's pull request to move
smp_twd to CLKSRC_OF_DECLARE is going to conflict with any changes I
make in the board files. I think we need to make the twd use the
late_time_init callback if there is no clock rate and ignore the other
patch I sent out a few hours ago. Basically, squash this into this 3/10
patch.

----8<-----

diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index a1185d3..c58918f 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -90,8 +90,10 @@ static int twd_timer_ack(void)
 	return 0;
 }
 
-static void twd_timer_stop(struct clock_event_device *clk)
+static void twd_timer_stop(void)
 {
+	struct clock_event_device *clk = __this_cpu_ptr(twd_evt);
+
 	twd_set_mode(CLOCK_EVT_MODE_UNUSED, clk);
 	disable_percpu_irq(clk->irq);
 }
@@ -265,8 +267,9 @@ static void twd_get_clock(struct device_node *np)
 /*
  * Setup the local clock events for a CPU.
  */
-static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
+static void __cpuinit twd_timer_setup(void)
 {
+	struct clock_event_device *clk = __this_cpu_ptr(twd_evt);
 	int cpu = smp_processor_id();
 
 	/*
@@ -275,9 +278,9 @@ static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
 	 */
 	if (per_cpu(percpu_setup_called, cpu)) {
 		__raw_writel(0, twd_base + TWD_TIMER_CONTROL);
-		clockevents_register_device(__this_cpu_ptr(twd_evt));
+		clockevents_register_device(clk);
 		enable_percpu_irq(clk->irq, 0);
-		return 0;
+		return;
 	}
 	per_cpu(percpu_setup_called, cpu) = true;
 
@@ -302,20 +305,18 @@ static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
 					0xf, 0xffffffff);
 	enable_percpu_irq(clk->irq, 0);
 
-	return 0;
+	return;
 }
 
 static int __cpuinit twd_timer_cpu_notify(struct notifier_block *self,
 					   unsigned long action, void *hcpu)
 {
-	struct clock_event_device *evt = this_cpu_ptr(twd_evt);
-
 	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_STARTING:
-		twd_timer_setup(evt);
+		twd_timer_setup();
 		break;
 	case CPU_DYING:
-		twd_timer_stop(evt);
+		twd_timer_stop();
 		break;
 	}
 
@@ -348,8 +349,15 @@ static int __init twd_local_timer_common_register(struct device_node *np)
 
 	twd_get_clock(np);
 
-	/* Immediately configure the timer on the boot CPU */
-	twd_timer_setup(this_cpu_ptr(twd_evt));
+	/*
+	 * Immediately configure the timer on the boot CPU, unless we need
+	 * jiffies to be incrementing to calibrate the rate in which case
+	 * setup the timer in late_time_init.
+	 */
+	if (twd_timer_rate)
+		twd_timer_setup();
+	else
+		late_time_init = twd_timer_setup;
 
 	return 0;
 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2013-03-12  1:20 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07  0:03 [PATCHv2 0/10] Remove ARM local timer API Stephen Boyd
2013-03-07  0:03 ` [PATCH 01/10] clocksource: add generic dummy timer driver Stephen Boyd
2013-03-07 14:00   ` Thomas Gleixner
2013-03-07 21:41     ` Stephen Boyd
2013-03-07  0:03 ` [PATCH 02/10] ARM: smp: Remove duplicate dummy timer implementation Stephen Boyd
2013-03-07  0:03 ` [PATCH 03/10] ARM: smp_twd: Divorce smp_twd from local timer API Stephen Boyd
2013-03-08  0:40   ` Tony Lindgren
2013-03-08  1:14     ` Stephen Boyd
2013-03-08 18:07       ` Tony Lindgren
2013-03-08 18:17         ` Stephen Boyd
2013-03-08 19:48           ` Tony Lindgren
2013-03-08 19:50             ` Stephen Boyd
2013-03-08 20:08               ` Tony Lindgren
2013-03-08 20:17                 ` Stephen Boyd
2013-03-08 20:29                   ` Tony Lindgren
2013-03-09  1:06                     ` Stephen Boyd
2013-03-11 17:28                       ` Tony Lindgren
2013-03-11 22:17                         ` Stephen Boyd
2013-03-11 22:50                           ` Tony Lindgren
2013-03-12  1:20                             ` Stephen Boyd [this message]
2013-03-12 17:06                               ` Tony Lindgren
2013-03-07  0:04 ` [PATCH 04/10] ARM: OMAP2+: Divorce " Stephen Boyd
2013-03-08 19:50   ` Tony Lindgren
2013-03-11 15:29     ` Santosh Shilimkar
2013-03-07  0:04 ` [PATCH 05/10] ARM: EXYNOS4: Divorce mct " Stephen Boyd
2013-03-07  0:04 ` [PATCH 06/10] ARM: PRIMA2: Divorce timer-marco " Stephen Boyd
2013-03-07  0:04 ` [PATCH 07/10] ARM: msm: Divorce msm_timer " Stephen Boyd
2013-03-07  0:04 ` [PATCH 08/10] clocksource: time-armada-370-xp: Fix sparse warning Stephen Boyd
2013-03-07  0:04 ` [PATCH 09/10] clocksource: time-armada-370-xp: Divorce from local timer API Stephen Boyd
2013-03-07  0:04 ` [PATCH 10/10] ARM: smp: Remove " Stephen Boyd
2013-03-08 19:55   ` Tony Lindgren

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=513E82EE.2040407@codeaurora.org \
    --to=sboyd@codeaurora.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).