From: maxime.coquelin@st.com (Maxime Coquelin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] clocksource: st_lpc: Add LPC timer as a clocksource.
Date: Wed, 29 Apr 2015 17:48:11 +0200 [thread overview]
Message-ID: <5540FD3B.1040702@st.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1504211153580.13914@nanos>
Hello Thomas,
On 04/21/2015 11:56 AM, Thomas Gleixner wrote:
> On Fri, 17 Apr 2015, Peter Griffin wrote:
>> +/* Low Power Timer */
>> +#define LPC_LPT_LSB_OFF 0x400
>> +#define LPC_LPT_MSB_OFF 0x404
>> +#define LPC_LPT_START_OFF 0x408
>> +
>> +struct st_lpc {
>> + struct clk *clk;
>> + void __iomem *iomem_cs;
>> +};
>> +
>> +static struct st_lpc *st_lpc;
>> +
>> +static u64 notrace st_lpc_counter_read(void)
>> +{
>> + u64 counter;
>> + u32 lower;
>> + u32 upper, old_upper;
>> +
>> + upper = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_MSB_OFF);
>> + do {
>> + old_upper = upper;
>> + lower = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_LSB_OFF);
>> + upper = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_MSB_OFF);
>> + } while (upper != old_upper);
>> +
>> + counter = upper;
>> + counter <<= 32;
>> + counter |= lower;
>> + return counter;
>
> What's the point of this exercise? The kernel can handle 32bit
> clocksources nicely. So why do you want to artificially expand them to
> 64bit by adding useless loops and hoops to a hotpath?
I agree we should use only the lower 32 bits.
This timer is moreover clocked at a slow rate (30MHz), so we won't have
too much interrupts.
Peter, doing that, you could use something like this directly:
clocksource_mmio_init(st_lpc->iomem_cs + LPC_LPT_LSB_OFF,
"st_lpc_timer", rate,
200, 24, clocksource_mmio_readl_down);
Thanks,
Maxime
>
> Thanks,
>
> tglx
WARNING: multiple messages have this Message-ID (diff)
From: Maxime Coquelin <maxime.coquelin@st.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Peter Griffin <peter.griffin@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com,
patrice.chotard@st.com, daniel.lezcano@linaro.org,
lee.jones@linaro.org, devicetree@vger.kernel.org,
Ajit Pal Singh <ajitpal.singh@st.com>
Subject: Re: [PATCH 1/5] clocksource: st_lpc: Add LPC timer as a clocksource.
Date: Wed, 29 Apr 2015 17:48:11 +0200 [thread overview]
Message-ID: <5540FD3B.1040702@st.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1504211153580.13914@nanos>
Hello Thomas,
On 04/21/2015 11:56 AM, Thomas Gleixner wrote:
> On Fri, 17 Apr 2015, Peter Griffin wrote:
>> +/* Low Power Timer */
>> +#define LPC_LPT_LSB_OFF 0x400
>> +#define LPC_LPT_MSB_OFF 0x404
>> +#define LPC_LPT_START_OFF 0x408
>> +
>> +struct st_lpc {
>> + struct clk *clk;
>> + void __iomem *iomem_cs;
>> +};
>> +
>> +static struct st_lpc *st_lpc;
>> +
>> +static u64 notrace st_lpc_counter_read(void)
>> +{
>> + u64 counter;
>> + u32 lower;
>> + u32 upper, old_upper;
>> +
>> + upper = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_MSB_OFF);
>> + do {
>> + old_upper = upper;
>> + lower = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_LSB_OFF);
>> + upper = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_MSB_OFF);
>> + } while (upper != old_upper);
>> +
>> + counter = upper;
>> + counter <<= 32;
>> + counter |= lower;
>> + return counter;
>
> What's the point of this exercise? The kernel can handle 32bit
> clocksources nicely. So why do you want to artificially expand them to
> 64bit by adding useless loops and hoops to a hotpath?
I agree we should use only the lower 32 bits.
This timer is moreover clocked at a slow rate (30MHz), so we won't have
too much interrupts.
Peter, doing that, you could use something like this directly:
clocksource_mmio_init(st_lpc->iomem_cs + LPC_LPT_LSB_OFF,
"st_lpc_timer", rate,
200, 24, clocksource_mmio_readl_down);
Thanks,
Maxime
>
> Thanks,
>
> tglx
WARNING: multiple messages have this Message-ID (diff)
From: Maxime Coquelin <maxime.coquelin@st.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Peter Griffin <peter.griffin@linaro.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <srinivas.kandagatla@gmail.com>,
<patrice.chotard@st.com>, <daniel.lezcano@linaro.org>,
<lee.jones@linaro.org>, <devicetree@vger.kernel.org>,
Ajit Pal Singh <ajitpal.singh@st.com>
Subject: Re: [PATCH 1/5] clocksource: st_lpc: Add LPC timer as a clocksource.
Date: Wed, 29 Apr 2015 17:48:11 +0200 [thread overview]
Message-ID: <5540FD3B.1040702@st.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1504211153580.13914@nanos>
Hello Thomas,
On 04/21/2015 11:56 AM, Thomas Gleixner wrote:
> On Fri, 17 Apr 2015, Peter Griffin wrote:
>> +/* Low Power Timer */
>> +#define LPC_LPT_LSB_OFF 0x400
>> +#define LPC_LPT_MSB_OFF 0x404
>> +#define LPC_LPT_START_OFF 0x408
>> +
>> +struct st_lpc {
>> + struct clk *clk;
>> + void __iomem *iomem_cs;
>> +};
>> +
>> +static struct st_lpc *st_lpc;
>> +
>> +static u64 notrace st_lpc_counter_read(void)
>> +{
>> + u64 counter;
>> + u32 lower;
>> + u32 upper, old_upper;
>> +
>> + upper = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_MSB_OFF);
>> + do {
>> + old_upper = upper;
>> + lower = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_LSB_OFF);
>> + upper = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_MSB_OFF);
>> + } while (upper != old_upper);
>> +
>> + counter = upper;
>> + counter <<= 32;
>> + counter |= lower;
>> + return counter;
>
> What's the point of this exercise? The kernel can handle 32bit
> clocksources nicely. So why do you want to artificially expand them to
> 64bit by adding useless loops and hoops to a hotpath?
I agree we should use only the lower 32 bits.
This timer is moreover clocked at a slow rate (30MHz), so we won't have
too much interrupts.
Peter, doing that, you could use something like this directly:
clocksource_mmio_init(st_lpc->iomem_cs + LPC_LPT_LSB_OFF,
"st_lpc_timer", rate,
200, 24, clocksource_mmio_readl_down);
Thanks,
Maxime
>
> Thanks,
>
> tglx
next prev parent reply other threads:[~2015-04-29 15:48 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 10:50 [PATCH 0/5] Add st_lpc clocksource timer driver Peter Griffin
2015-04-17 10:50 ` Peter Griffin
2015-04-17 10:50 ` Peter Griffin
2015-04-17 10:50 ` [PATCH 1/5] clocksource: st_lpc: Add LPC timer as a clocksource Peter Griffin
2015-04-17 10:50 ` Peter Griffin
2015-04-17 21:16 ` Paul Bolle
2015-04-17 21:16 ` Paul Bolle
2015-04-20 7:14 ` Peter Griffin
2015-04-20 7:14 ` Peter Griffin
2015-04-21 9:56 ` Thomas Gleixner
2015-04-21 9:56 ` Thomas Gleixner
2015-04-21 9:56 ` Thomas Gleixner
2015-04-29 15:48 ` Maxime Coquelin [this message]
2015-04-29 15:48 ` Maxime Coquelin
2015-04-29 15:48 ` Maxime Coquelin
2015-05-02 16:36 ` Peter Griffin
2015-05-02 16:36 ` Peter Griffin
2015-05-02 16:36 ` Peter Griffin
2015-04-17 10:50 ` [PATCH 2/5] clocksource: st_lpc: Add DT bindings documentation for lpc timer Peter Griffin
2015-04-17 10:50 ` Peter Griffin
2015-04-17 10:50 ` [PATCH 3/5] MAINTAINERS: Add st_lpc.c to ARCH/STI section of maintainers Peter Griffin
2015-04-17 10:50 ` Peter Griffin
2015-04-17 10:50 ` [PATCH 4/5] ARM: sti: Always enable CLKSRC_ST_LPC_CLOCK Peter Griffin
2015-04-17 10:50 ` Peter Griffin
2015-04-17 10:50 ` Peter Griffin
2015-04-17 10:50 ` [PATCH 5/5] ARM: DT: STi: STiH407: Add DT node for st-lpc timer Peter Griffin
2015-04-17 10:50 ` Peter Griffin
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=5540FD3B.1040702@st.com \
--to=maxime.coquelin@st.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.