All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: linux-arm-msm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	"Russell King - ARM Linux" <linux@arm.linux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	"Saravana Kannan" <skannan@codeaurora.org>,
	"Daniel Walker" <dwalker@codeaurora.org>,
	"Nicolas Pitre" <nicolas.pitre@linaro.org>,
	"John Stultz" <johnstul@us.ibm.com>,
	"Brian Swetland" <swetland@google.com>,
	"Arve Hj�nnev�g" <arve@android.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: [PATCHv4 4/4] msm: timer: Migrate to timer based __delay()
Date: Mon, 20 Dec 2010 14:20:33 -0800	[thread overview]
Message-ID: <1292883633-19553-5-git-send-email-sboyd@codeaurora.org> (raw)
In-Reply-To: <1292883633-19553-1-git-send-email-sboyd@codeaurora.org>

We have to provide a dummy set_mode for the DGT since we don't
want it to ever turn off.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

This is more of an illustration patch. This code needs to be
fixed to always leave clocksources running.

 arch/arm/mach-msm/include/mach/timex.h |    1 +
 arch/arm/mach-msm/timer.c              |   16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/include/mach/timex.h b/arch/arm/mach-msm/include/mach/timex.h
index a62e6b2..52b602b 100644
--- a/arch/arm/mach-msm/include/mach/timex.h
+++ b/arch/arm/mach-msm/include/mach/timex.h
@@ -17,5 +17,6 @@
 #define __ASM_ARCH_MSM_TIMEX_H
 
 #define CLOCK_TICK_RATE		1000000
+#define ARCH_HAS_READ_CURRENT_TIMER
 
 #endif
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 950100f..9da4908 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -84,6 +84,12 @@ static cycle_t msm_dgt_read(struct clocksource *cs)
 	return readl(MSM_DGT_BASE + TIMER_COUNT_VAL) >> MSM_DGT_SHIFT;
 }
 
+int read_current_timer(unsigned long *timer_val)
+{
+	*timer_val = readl(MSM_DGT_BASE + TIMER_COUNT_VAL);
+	return 0;
+}
+
 static int msm_timer_set_next_event(unsigned long cycles,
 				    struct clock_event_device *evt)
 {
@@ -122,6 +128,12 @@ static void msm_timer_set_mode(enum clock_event_mode mode,
 	}
 }
 
+static void msm_timer_set_mode_nop(enum clock_event_mode mode,
+				struct clock_event_device *evt)
+{
+	/* The timer is always ticking so do nothing */
+}
+
 static struct msm_clock msm_clocks[] = {
 	{
 		.clockevent = {
@@ -157,7 +169,7 @@ static struct msm_clock msm_clocks[] = {
 			.shift          = 32 + MSM_DGT_SHIFT,
 			.rating         = 300,
 			.set_next_event = msm_timer_set_next_event,
-			.set_mode       = msm_timer_set_mode,
+			.set_mode       = msm_timer_set_mode_nop,
 		},
 		.clocksource = {
 			.name           = "dg_timer",
@@ -218,6 +230,8 @@ static void __init msm_timer_init(void)
 
 		clockevents_register_device(ce);
 	}
+	writel(TIMER_ENABLE_EN, MSM_DGT_BASE + TIMER_ENABLE);
+	set_delay_fn(read_current_timer_delay_loop);
 }
 
 struct sys_timer msm_timer = {
-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv4 4/4] msm: timer: Migrate to timer based __delay()
Date: Mon, 20 Dec 2010 14:20:33 -0800	[thread overview]
Message-ID: <1292883633-19553-5-git-send-email-sboyd@codeaurora.org> (raw)
In-Reply-To: <1292883633-19553-1-git-send-email-sboyd@codeaurora.org>

We have to provide a dummy set_mode for the DGT since we don't
want it to ever turn off.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

This is more of an illustration patch. This code needs to be
fixed to always leave clocksources running.

 arch/arm/mach-msm/include/mach/timex.h |    1 +
 arch/arm/mach-msm/timer.c              |   16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/include/mach/timex.h b/arch/arm/mach-msm/include/mach/timex.h
index a62e6b2..52b602b 100644
--- a/arch/arm/mach-msm/include/mach/timex.h
+++ b/arch/arm/mach-msm/include/mach/timex.h
@@ -17,5 +17,6 @@
 #define __ASM_ARCH_MSM_TIMEX_H
 
 #define CLOCK_TICK_RATE		1000000
+#define ARCH_HAS_READ_CURRENT_TIMER
 
 #endif
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 950100f..9da4908 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -84,6 +84,12 @@ static cycle_t msm_dgt_read(struct clocksource *cs)
 	return readl(MSM_DGT_BASE + TIMER_COUNT_VAL) >> MSM_DGT_SHIFT;
 }
 
+int read_current_timer(unsigned long *timer_val)
+{
+	*timer_val = readl(MSM_DGT_BASE + TIMER_COUNT_VAL);
+	return 0;
+}
+
 static int msm_timer_set_next_event(unsigned long cycles,
 				    struct clock_event_device *evt)
 {
@@ -122,6 +128,12 @@ static void msm_timer_set_mode(enum clock_event_mode mode,
 	}
 }
 
+static void msm_timer_set_mode_nop(enum clock_event_mode mode,
+				struct clock_event_device *evt)
+{
+	/* The timer is always ticking so do nothing */
+}
+
 static struct msm_clock msm_clocks[] = {
 	{
 		.clockevent = {
@@ -157,7 +169,7 @@ static struct msm_clock msm_clocks[] = {
 			.shift          = 32 + MSM_DGT_SHIFT,
 			.rating         = 300,
 			.set_next_event = msm_timer_set_next_event,
-			.set_mode       = msm_timer_set_mode,
+			.set_mode       = msm_timer_set_mode_nop,
 		},
 		.clocksource = {
 			.name           = "dg_timer",
@@ -218,6 +230,8 @@ static void __init msm_timer_init(void)
 
 		clockevents_register_device(ce);
 	}
+	writel(TIMER_ENABLE_EN, MSM_DGT_BASE + TIMER_ENABLE);
+	set_delay_fn(read_current_timer_delay_loop);
 }
 
 struct sys_timer msm_timer = {
-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  parent reply	other threads:[~2010-12-20 22:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20 22:20 [PATCHv4 0/4] ARM: Fixing udelay() for SMP and non-SMP systems Stephen Boyd
2010-12-20 22:20 ` Stephen Boyd
2010-12-20 22:20 ` [PATCHv4 1/4] ARM: Translate delay.S into (mostly) C Stephen Boyd
2010-12-20 22:20   ` Stephen Boyd
2010-12-20 22:20 ` [PATCHv4 2/4] ARM: Allow machines to override __delay() Stephen Boyd
2010-12-20 22:20   ` Stephen Boyd
2011-04-05 22:13   ` Linus Walleij
2011-04-05 22:13     ` Linus Walleij
2011-04-05 23:29     ` Stephen Boyd
2011-04-05 23:29       ` Stephen Boyd
2010-12-20 22:20 ` [PATCHv4 3/4] ARM: Implement a timer based __delay() loop Stephen Boyd
2010-12-20 22:20   ` Stephen Boyd
2010-12-20 22:20 ` Stephen Boyd [this message]
2010-12-20 22:20   ` [PATCHv4 4/4] msm: timer: Migrate to timer based __delay() Stephen Boyd
2011-03-04 10:10 ` [PATCHv4 0/4] ARM: Fixing udelay() for SMP and non-SMP systems Linus Walleij
2011-03-04 10:10   ` Linus Walleij
2011-03-04 23:48   ` Saravana Kannan
2011-03-04 23:48     ` Saravana Kannan

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=1292883633-19553-5-git-send-email-sboyd@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=akpm@linux-foundation.org \
    --cc=arve@android.com \
    --cc=dwalker@codeaurora.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nicolas.pitre@linaro.org \
    --cc=skannan@codeaurora.org \
    --cc=swetland@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.