linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] clocksource: sun4i: Fix a few minor issues
@ 2013-10-14 19:07 Maxime Ripard
  2013-10-14 19:07 ` [PATCH 1/3] clocksource: sun4i: Select CLKSRC_MMIO Maxime Ripard
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Maxime Ripard @ 2013-10-14 19:07 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, linux-arm-kernel, Maxime Ripard

Hi everyone,

Here is a few fixes for a few mistakes found during the review of the High
Speed Timers patches, that also applies to the timer code we had previously.

It's mostly a few things here and there, so it can wait for 3.13.

Thanks,
Maxime

Maxime Ripard (3):
  clocksource: sun4i: Select CLKSRC_MMIO
  clocksource: sun4i: Report the minimum tick that we can program
  clocksource: sun4i: remove IRQF_DISABLED

 drivers/clocksource/Kconfig       |  1 +
 drivers/clocksource/sun4i_timer.c | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
1.8.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] clocksource: sun4i: Select CLKSRC_MMIO
  2013-10-14 19:07 [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
@ 2013-10-14 19:07 ` Maxime Ripard
  2013-10-14 19:07 ` [PATCH 2/3] clocksource: sun4i: Report the minimum tick that we can program Maxime Ripard
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2013-10-14 19:07 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, linux-arm-kernel, Maxime Ripard

The Allwinner SoCs timer use the clocksource MMIO functions. We thus
need to select them in Kconfig.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clocksource/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 41c6946..cea50f0 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -33,6 +33,7 @@ config ORION_TIMER
 	bool
 
 config SUN4I_TIMER
+	select CLKSRC_MMIO
 	bool
 
 config VT8500_TIMER
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] clocksource: sun4i: Report the minimum tick that we can program
  2013-10-14 19:07 [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
  2013-10-14 19:07 ` [PATCH 1/3] clocksource: sun4i: Select CLKSRC_MMIO Maxime Ripard
@ 2013-10-14 19:07 ` Maxime Ripard
  2013-10-14 19:07 ` [PATCH 3/3] clocksource: sun4i: remove IRQF_DISABLED Maxime Ripard
  2013-10-22 14:56 ` [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
  3 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2013-10-14 19:07 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, linux-arm-kernel, Maxime Ripard

We need to wait for at least 2 clock cycles whenever we reprogram our
clockevent timer. Report that the minimum number of ticks we can handle
is 3 ticks, and remove 3 ticks to the interval programmed to reflect
this.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clocksource/sun4i_timer.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index 8ead025..46008f9 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -37,6 +37,8 @@
 #define TIMER_INTVAL_REG(val)	(0x10 * (val) + 0x14)
 #define TIMER_CNTVAL_REG(val)	(0x10 * (val) + 0x18)
 
+#define TIMER_SYNC_TICKS	3
+
 static void __iomem *timer_base;
 static u32 ticks_per_jiffy;
 
@@ -50,7 +52,7 @@ static void sun4i_clkevt_sync(void)
 {
 	u32 old = readl(timer_base + TIMER_CNTVAL_REG(1));
 
-	while ((old - readl(timer_base + TIMER_CNTVAL_REG(1))) < 3)
+	while ((old - readl(timer_base + TIMER_CNTVAL_REG(1))) < TIMER_SYNC_TICKS)
 		cpu_relax();
 }
 
@@ -104,7 +106,7 @@ static int sun4i_clkevt_next_event(unsigned long evt,
 				   struct clock_event_device *unused)
 {
 	sun4i_clkevt_time_stop(0);
-	sun4i_clkevt_time_setup(0, evt);
+	sun4i_clkevt_time_setup(0, evt - TIMER_SYNC_TICKS);
 	sun4i_clkevt_time_start(0, false);
 
 	return 0;
@@ -187,8 +189,8 @@ static void __init sun4i_timer_init(struct device_node *node)
 
 	sun4i_clockevent.cpumask = cpumask_of(0);
 
-	clockevents_config_and_register(&sun4i_clockevent, rate, 0x1,
-					0xffffffff);
+	clockevents_config_and_register(&sun4i_clockevent, rate,
+					TIMER_SYNC_TICKS, 0xffffffff);
 }
 CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-timer",
 		       sun4i_timer_init);
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] clocksource: sun4i: remove IRQF_DISABLED
  2013-10-14 19:07 [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
  2013-10-14 19:07 ` [PATCH 1/3] clocksource: sun4i: Select CLKSRC_MMIO Maxime Ripard
  2013-10-14 19:07 ` [PATCH 2/3] clocksource: sun4i: Report the minimum tick that we can program Maxime Ripard
@ 2013-10-14 19:07 ` Maxime Ripard
  2013-10-22 14:56 ` [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
  3 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2013-10-14 19:07 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, linux-arm-kernel, Maxime Ripard

IRQF_DISABLED is a no-op nowadays, so we can safely remove it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clocksource/sun4i_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index 46008f9..2fb4695 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -133,7 +133,7 @@ static irqreturn_t sun4i_timer_interrupt(int irq, void *dev_id)
 
 static struct irqaction sun4i_timer_irq = {
 	.name = "sun4i_timer0",
-	.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+	.flags = IRQF_TIMER | IRQF_IRQPOLL,
 	.handler = sun4i_timer_interrupt,
 	.dev_id = &sun4i_clockevent,
 };
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] clocksource: sun4i: Fix a few minor issues
  2013-10-14 19:07 [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
                   ` (2 preceding siblings ...)
  2013-10-14 19:07 ` [PATCH 3/3] clocksource: sun4i: remove IRQF_DISABLED Maxime Ripard
@ 2013-10-22 14:56 ` Maxime Ripard
  2013-10-22 17:20   ` Daniel Lezcano
  3 siblings, 1 reply; 6+ messages in thread
From: Maxime Ripard @ 2013-10-22 14:56 UTC (permalink / raw)
  To: daniel.lezcano; +Cc: tglx, linux-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

Hi Daniel,

On Mon, Oct 14, 2013 at 09:07:45PM +0200, Maxime Ripard wrote:
> Hi everyone,
> 
> Here is a few fixes for a few mistakes found during the review of the High
> Speed Timers patches, that also applies to the timer code we had previously.
> 
> It's mostly a few things here and there, so it can wait for 3.13.

Ping?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] clocksource: sun4i: Fix a few minor issues
  2013-10-22 14:56 ` [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
@ 2013-10-22 17:20   ` Daniel Lezcano
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2013-10-22 17:20 UTC (permalink / raw)
  To: Maxime Ripard; +Cc: tglx, linux-kernel, linux-arm-kernel

On 10/22/2013 04:56 PM, Maxime Ripard wrote:
> Hi Daniel,
>
> On Mon, Oct 14, 2013 at 09:07:45PM +0200, Maxime Ripard wrote:
>> Hi everyone,
>>
>> Here is a few fixes for a few mistakes found during the review of the High
>> Speed Timers patches, that also applies to the timer code we had previously.
>>
>> It's mostly a few things here and there, so it can wait for 3.13.
>
> Ping?

Pong. I am out of the office for the moment but I saw the patches. I 
will take them for 3.13.

Thanks
   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-10-22 17:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 19:07 [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
2013-10-14 19:07 ` [PATCH 1/3] clocksource: sun4i: Select CLKSRC_MMIO Maxime Ripard
2013-10-14 19:07 ` [PATCH 2/3] clocksource: sun4i: Report the minimum tick that we can program Maxime Ripard
2013-10-14 19:07 ` [PATCH 3/3] clocksource: sun4i: remove IRQF_DISABLED Maxime Ripard
2013-10-22 14:56 ` [PATCH 0/3] clocksource: sun4i: Fix a few minor issues Maxime Ripard
2013-10-22 17:20   ` Daniel Lezcano

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).