All of lore.kernel.org
 help / color / mirror / Atom feed
From: alexandre.belloni@bootlin.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 0/6] clocksource: rework Atmel TCB timer driver
Date: Wed, 28 Mar 2018 17:50:33 +0200	[thread overview]
Message-ID: <20180328155033.GH13942@piout.net> (raw)
In-Reply-To: <20180328153135.GG13942@piout.net>

On 28/03/2018 at 17:31:35 +0200, Alexandre Belloni wrote:
> > Do you have an explanation of why the rate is much higher ?
> > 
> 
> The core is giving deltas of 31 clocks instead of much more than that, I
> guess I messed up the initialization somewhere.
> 

I did mess up.

Alexander, can you test that:

diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c
index 7fde9cfbf203..bbbacf8c46b0 100644
--- a/drivers/clocksource/timer-atmel-tcb.c
+++ b/drivers/clocksource/timer-atmel-tcb.c
@@ -222,7 +222,7 @@ static int __init tc_clkevt_register(struct device_node *node,
 		goto err_slow;
 	clk_disable(tce.clk);
 
-	clockevents_config_and_register(&tce.clkevt, 32768, 1, bits - 1);
+	clockevents_config_and_register(&tce.clkevt, 32768, 1, BIT(bits) - 1);
 
 	ret = request_irq(tce.irq, tc_clkevt2_irq, IRQF_TIMER | IRQF_SHARED,
 			  tce.clkevt.name, &tce);

This will behave exactly the same as before on 16bits TCB and will have
much less interrupts on 32 bits platforms.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Alexander Dahl <ada@thorsis.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v3 0/6] clocksource: rework Atmel TCB timer driver
Date: Wed, 28 Mar 2018 17:50:33 +0200	[thread overview]
Message-ID: <20180328155033.GH13942@piout.net> (raw)
In-Reply-To: <20180328153135.GG13942@piout.net>

On 28/03/2018 at 17:31:35 +0200, Alexandre Belloni wrote:
> > Do you have an explanation of why the rate is much higher ?
> > 
> 
> The core is giving deltas of 31 clocks instead of much more than that, I
> guess I messed up the initialization somewhere.
> 

I did mess up.

Alexander, can you test that:

diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c
index 7fde9cfbf203..bbbacf8c46b0 100644
--- a/drivers/clocksource/timer-atmel-tcb.c
+++ b/drivers/clocksource/timer-atmel-tcb.c
@@ -222,7 +222,7 @@ static int __init tc_clkevt_register(struct device_node *node,
 		goto err_slow;
 	clk_disable(tce.clk);
 
-	clockevents_config_and_register(&tce.clkevt, 32768, 1, bits - 1);
+	clockevents_config_and_register(&tce.clkevt, 32768, 1, BIT(bits) - 1);
 
 	ret = request_irq(tce.irq, tc_clkevt2_irq, IRQF_TIMER | IRQF_SHARED,
 			  tce.clkevt.name, &tce);

This will behave exactly the same as before on 16bits TCB and will have
much less interrupts on 32 bits platforms.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-03-28 15:50 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-23 17:15 [PATCH v3 0/6] clocksource: rework Atmel TCB timer driver Alexandre Belloni
2018-02-23 17:15 ` Alexandre Belloni
2018-02-23 17:15 ` [PATCH v3 1/6] ARM: at91: add TCB registers definitions Alexandre Belloni
2018-02-23 17:15   ` Alexandre Belloni
2018-02-23 17:15 ` [PATCH v3 2/6] clocksource/drivers: Add a new driver for the Atmel ARM TC blocks Alexandre Belloni
2018-02-23 17:15   ` Alexandre Belloni
2018-02-23 17:15 ` [PATCH v3 3/6] clocksource/drivers: atmel-pit: make option silent Alexandre Belloni
2018-02-23 17:15   ` Alexandre Belloni
2018-02-23 17:15 ` [PATCH v3 4/6] ARM: at91: Implement clocksource selection Alexandre Belloni
2018-02-23 17:15   ` Alexandre Belloni
2018-02-23 17:15 ` [PATCH v3 5/6] ARM: configs: at91: use new TCB timer driver Alexandre Belloni
2018-02-23 17:15   ` Alexandre Belloni
2018-02-23 17:15 ` [PATCH v3 6/6] ARM: configs: at91: unselect PIT Alexandre Belloni
2018-02-23 17:15   ` Alexandre Belloni
2018-03-22 15:33 ` [PATCH v3 0/6] clocksource: rework Atmel TCB timer driver Alexandre Belloni
2018-03-22 15:33   ` Alexandre Belloni
2018-03-27 10:41 ` Alexander Dahl
2018-03-27 10:41   ` Alexander Dahl
2018-03-27 11:30   ` Daniel Lezcano
2018-03-27 11:30     ` Daniel Lezcano
2018-03-28 10:29     ` Alexander Dahl
2018-03-28 10:29       ` Alexander Dahl
2018-03-28 13:03       ` Daniel Lezcano
2018-03-28 13:03         ` Daniel Lezcano
2018-03-28 14:16         ` Alexandre Belloni
2018-03-28 14:16           ` Alexandre Belloni
2018-03-28 14:36           ` Daniel Lezcano
2018-03-28 14:36             ` Daniel Lezcano
2018-03-28 15:31             ` Alexandre Belloni
2018-03-28 15:31               ` Alexandre Belloni
2018-03-28 15:50               ` Alexandre Belloni [this message]
2018-03-28 15:50                 ` Alexandre Belloni
2018-03-29  8:01                 ` Alexander Dahl
2018-03-29  8:01                   ` Alexander Dahl
2018-03-29 10:45                   ` Alexandre Belloni
2018-03-29 10:45                     ` Alexandre Belloni
2018-03-29 11:31                     ` Alexander Dahl
2018-03-29 11:31                       ` Alexander Dahl
2018-03-29 11:42                       ` Alexandre Belloni
2018-03-29 11:42                         ` Alexandre Belloni
2018-03-29 12:07                         ` Daniel Lezcano
2018-03-29 12:07                           ` Daniel Lezcano
2018-03-29 13:02                           ` Alexandre Belloni
2018-03-29 13:02                             ` Alexandre Belloni
2018-03-29 15:11                   ` Alexander Dahl
2018-03-29 15:11                     ` Alexander Dahl

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=20180328155033.GH13942@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --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 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.