From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] clocksource: sp804: introduce helper sp804_load_mode_set()
Date: Tue, 31 May 2016 10:24:02 +0200 [thread overview]
Message-ID: <574D4A22.703@linaro.org> (raw)
In-Reply-To: <1464428033-52106-3-git-send-email-wangkefeng.wang@huawei.com>
On 05/28/2016 11:33 AM, Kefeng Wang wrote:
> Introduce helper sp804_load_mode_set(), and use it, prepare for 64bit
> mode timer support.
More verbose please.
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> drivers/clocksource/timer-sp804.c | 27 +++++++++++++--------------
> 1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/clocksource/timer-sp804.c b/drivers/clocksource/timer-sp804.c
> index 362e5d0..b8848e5 100644
> --- a/drivers/clocksource/timer-sp804.c
> +++ b/drivers/clocksource/timer-sp804.c
> @@ -73,6 +73,15 @@ static long __init sp804_get_clock_rate(struct clk *clk, const char *name)
> return rate;
> }
>
> +static inline void sp804_load_mode_set(void __iomem *base, unsigned long load, int mode)
> +{
> + unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE |
> + mode | TIMER_CTRL_ENABLE;
> +
> + writel(load, base + TIMER_LOAD);
> + writel(ctrl, base + TIMER_CTRL);
> +}
> +
> static void __iomem *sched_clock_base;
>
> static u64 notrace sp804_read(void)
> @@ -97,10 +106,8 @@ void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
>
> /* setup timer 0 as free-running clocksource */
> writel(0, base + TIMER_CTRL);
> - writel(0xffffffff, base + TIMER_LOAD);
> writel(0xffffffff, base + TIMER_VALUE);
> - writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
> - base + TIMER_CTRL);
> + sp804_load_mode_set(base, 0xffffffff, TIMER_CTRL_PERIODIC & ~TIMER_CTRL_IE);
Can you explain this change ?
> clocksource_mmio_init(base + TIMER_VALUE, name,
> rate, 200, 32, clocksource_mmio_readl_down);
> @@ -143,24 +150,16 @@ static int sp804_shutdown(struct clock_event_device *evt)
>
> static int sp804_set_periodic(struct clock_event_device *evt)
> {
> - unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE |
> - TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
> -
> timer_shutdown(evt);
> - writel(clkevt_reload, clkevt_base + TIMER_LOAD);
> - writel(ctrl, clkevt_base + TIMER_CTRL);
> + sp804_load_mode_set(clkevt_base, clkevt_reload, TIMER_CTRL_PERIODIC);
> return 0;
> }
>
> static int sp804_set_next_event(unsigned long next,
> - struct clock_event_device *evt)
> + struct clock_event_device *evt)
> {
> - unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE |
> - TIMER_CTRL_ONESHOT | TIMER_CTRL_ENABLE;
> -
> - writel(next, clkevt_base + TIMER_LOAD);
> - writel(ctrl, clkevt_base + TIMER_CTRL);
>
> + sp804_load_mode_set(clkevt_base, next, TIMER_CTRL_ONESHOT);
> return 0;
> }
>
>
--
<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
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
Thomas Gleixner <tglx@linutronix.de>,
Rob Herring <robh+dt@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, guohanjun@huawei.com,
Sudeep Holla <sudeep.holla@arm.com>,
Arnd Bergmann <arnd@arndb.de>,
xuwei5@hisilicon.com
Subject: Re: [PATCH 2/4] clocksource: sp804: introduce helper sp804_load_mode_set()
Date: Tue, 31 May 2016 10:24:02 +0200 [thread overview]
Message-ID: <574D4A22.703@linaro.org> (raw)
In-Reply-To: <1464428033-52106-3-git-send-email-wangkefeng.wang@huawei.com>
On 05/28/2016 11:33 AM, Kefeng Wang wrote:
> Introduce helper sp804_load_mode_set(), and use it, prepare for 64bit
> mode timer support.
More verbose please.
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> drivers/clocksource/timer-sp804.c | 27 +++++++++++++--------------
> 1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/clocksource/timer-sp804.c b/drivers/clocksource/timer-sp804.c
> index 362e5d0..b8848e5 100644
> --- a/drivers/clocksource/timer-sp804.c
> +++ b/drivers/clocksource/timer-sp804.c
> @@ -73,6 +73,15 @@ static long __init sp804_get_clock_rate(struct clk *clk, const char *name)
> return rate;
> }
>
> +static inline void sp804_load_mode_set(void __iomem *base, unsigned long load, int mode)
> +{
> + unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE |
> + mode | TIMER_CTRL_ENABLE;
> +
> + writel(load, base + TIMER_LOAD);
> + writel(ctrl, base + TIMER_CTRL);
> +}
> +
> static void __iomem *sched_clock_base;
>
> static u64 notrace sp804_read(void)
> @@ -97,10 +106,8 @@ void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
>
> /* setup timer 0 as free-running clocksource */
> writel(0, base + TIMER_CTRL);
> - writel(0xffffffff, base + TIMER_LOAD);
> writel(0xffffffff, base + TIMER_VALUE);
> - writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
> - base + TIMER_CTRL);
> + sp804_load_mode_set(base, 0xffffffff, TIMER_CTRL_PERIODIC & ~TIMER_CTRL_IE);
Can you explain this change ?
> clocksource_mmio_init(base + TIMER_VALUE, name,
> rate, 200, 32, clocksource_mmio_readl_down);
> @@ -143,24 +150,16 @@ static int sp804_shutdown(struct clock_event_device *evt)
>
> static int sp804_set_periodic(struct clock_event_device *evt)
> {
> - unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE |
> - TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
> -
> timer_shutdown(evt);
> - writel(clkevt_reload, clkevt_base + TIMER_LOAD);
> - writel(ctrl, clkevt_base + TIMER_CTRL);
> + sp804_load_mode_set(clkevt_base, clkevt_reload, TIMER_CTRL_PERIODIC);
> return 0;
> }
>
> static int sp804_set_next_event(unsigned long next,
> - struct clock_event_device *evt)
> + struct clock_event_device *evt)
> {
> - unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE |
> - TIMER_CTRL_ONESHOT | TIMER_CTRL_ENABLE;
> -
> - writel(next, clkevt_base + TIMER_LOAD);
> - writel(ctrl, clkevt_base + TIMER_CTRL);
>
> + sp804_load_mode_set(clkevt_base, next, TIMER_CTRL_ONESHOT);
> return 0;
> }
>
>
--
<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
next prev parent reply other threads:[~2016-05-31 8:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-28 9:33 [PATCH 0/4] Support hisilicon 64bit mode timer Kefeng Wang
2016-05-28 9:33 ` Kefeng Wang
2016-05-28 9:33 ` [PATCH 1/4] clocksource: sp804: cleanup clk_get_sys() Kefeng Wang
2016-05-28 9:33 ` Kefeng Wang
2016-05-28 9:33 ` [PATCH 2/4] clocksource: sp804: introduce helper sp804_load_mode_set() Kefeng Wang
2016-05-28 9:33 ` Kefeng Wang
2016-05-31 8:24 ` Daniel Lezcano [this message]
2016-05-31 8:24 ` Daniel Lezcano
2016-05-28 9:33 ` [PATCH 3/4] clocksource: sp804: use sp804_timer_disable() where possible Kefeng Wang
2016-05-28 9:33 ` Kefeng Wang
2016-05-31 8:25 ` Daniel Lezcano
2016-05-31 8:25 ` Daniel Lezcano
2016-05-28 9:33 ` [PATCH 4/4] clocksource: sp804: support 64bit mode for hisilicon timer64 Kefeng Wang
2016-05-28 9:33 ` Kefeng Wang
2016-05-31 9:44 ` Daniel Lezcano
2016-05-31 9:44 ` Daniel Lezcano
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=574D4A22.703@linaro.org \
--to=daniel.lezcano@linaro.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 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.