From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: vijayakannan.ayyathurai@intel.com, tglx@linutronix.de,
robh+dt@kernel.org, catalin.marinas@arm.com, will@kernel.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
andriy.shevchenko@linux.intel.com, mgross@linux.intel.com,
wan.ahmad.zainie.wan.mohamad@intel.com,
lakshmi.bai.raja.subramanian@intel.com, chen.yong.seow@intel.com
Subject: Re: [PATCH v2 2/2] clocksource: Add Intel Keem Bay Timer Support
Date: Mon, 18 Jan 2021 16:56:17 +0100 [thread overview]
Message-ID: <73330c8b-4633-4a13-b4b5-7405ff1661fe@linaro.org> (raw)
In-Reply-To: <2a7038bc170e31a668995c367bbae018bf805dbe.1609306622.git.vijayakannan.ayyathurai@intel.com>
On 30/12/2020 07:25, vijayakannan.ayyathurai@intel.com wrote:
> From: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
[ ... ]
> +static struct timer_of keembay_ce_to = {
> + .flags = TIMER_OF_IRQ | TIMER_OF_BASE | TIMER_OF_CLOCK,
> + .clkevt = {
> + .name = "keembay_sys_clkevt",
> + .features = CLOCK_EVT_FEAT_PERIODIC |
> + CLOCK_EVT_FEAT_ONESHOT |
> + CLOCK_EVT_FEAT_DYNIRQ,
> + .rating = TIM_RATING,
> + .set_next_event = keembay_timer_set_next_event,
> + .set_state_periodic = keembay_timer_periodic,
> + .set_state_shutdown = keembay_timer_shutdown,
> + },
> + .of_base = {
> + .index = 0,
> + },
> + .of_irq = {
> + .handler = keembay_timer_isr,
> + .flags = IRQF_TIMER | IRQF_IRQPOLL,
Is the IRQPOLL flag really needed here ?
> + },
> +};
> +
> +static int __init keembay_clockevent_init(struct device_node *np,
> + struct keembay_init_data *data)
> +{
> + u32 val;
> + int ret;
> +
> + data->mask = TIM_CONFIG_PRESCALER_ENABLE;
> + data->cfg = &keembay_ce_to;
> + ret = keembay_timer_setup(np, data);
> + if (ret)
> + return ret;
> +
> + val = readl(data->base + TIM_RELOAD_VAL_OFFSET);
> +
> + keembay_ce_to.clkevt.cpumask = cpumask_of(0);
> + keembay_ce_to.of_clk.rate = keembay_ce_to.of_clk.rate / (val + 1);
> +
> + keembay_timer_disable(timer_of_base(&keembay_ce_to));
> +
> + clockevents_config_and_register(&keembay_ce_to.clkevt,
> + timer_of_rate(&keembay_ce_to), 1, U32_MAX);
> + return 0;
> +}
> +
> +static struct timer_of keembay_cs_to = {
> + .flags = TIMER_OF_BASE | TIMER_OF_CLOCK,
> + .of_base = {
> + .index = 1,
> + },
> +};
> +
> +static u64 notrace keembay_clocksource_read(struct clocksource *cs)
> +{
> + return lo_hi_readq(timer_of_base(&keembay_cs_to));
> +}
> +
> +static struct clocksource keembay_counter = {
> + .name = "keembay_sys_counter",
> + .rating = TIM_RATING,
> + .read = keembay_clocksource_read,
> + .mask = CLOCKSOURCE_MASK(TIM_CLKSRC_BITS),
> + .flags = CLOCK_SOURCE_IS_CONTINUOUS |
> + CLOCK_SOURCE_SUSPEND_NONSTOP,
> +};
> +
> +static int __init keembay_clocksource_init(struct device_node *np,
> + struct keembay_init_data *data)
> +{
> + int ret;
> +
> + data->mask = TIM_CONFIG_ENABLE;
> + data->cfg = &keembay_cs_to;
> + ret = keembay_timer_setup(np, data);
> + if (ret)
> + return ret;
> +
> + return clocksource_register_hz(&keembay_counter, timer_of_rate(&keembay_cs_to));
> +}
> +
> +static int __init keembay_timer_init(struct device_node *np)
> +{
> + struct keembay_init_data data;
> + int ret;
> +
> + data.base = of_iomap(np, 2);
> + if (!data.base)
> + return -ENXIO;
> +
> + ret = keembay_clocksource_init(np, &data);
> + if (ret)
> + goto exit;
> +
> + ret = keembay_clockevent_init(np, &data);
Is this missing ?
if (ret)
goto exit;
return 0;
> +
> +exit:
> + keembay_timer_cleanup(np, &data);
> +
> + return ret;
> +}
> +
> +TIMER_OF_DECLARE(keembay_timer, "intel,keembay-timer", keembay_timer_init);
>
--
<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:[~2021-01-18 16:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-30 6:25 [PATCH v2 0/2] Add drivers for Intel Keem Bay SoC timer block vijayakannan.ayyathurai
2020-12-30 6:25 ` [PATCH v2 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC timer vijayakannan.ayyathurai
2020-12-31 15:34 ` Rob Herring
2021-01-01 16:12 ` Ayyathurai, Vijayakannan
2020-12-30 6:25 ` [PATCH v2 2/2] clocksource: Add Intel Keem Bay Timer Support vijayakannan.ayyathurai
2021-01-18 15:56 ` Daniel Lezcano [this message]
2021-01-19 2:56 ` Ayyathurai, Vijayakannan
2021-01-19 8:50 ` andriy.shevchenko
2021-01-20 19:18 ` Ayyathurai, Vijayakannan
2021-01-13 10:54 ` [PATCH v2 0/2] Add drivers for Intel Keem Bay SoC timer block Ayyathurai, Vijayakannan
2021-01-18 15:34 ` Daniel Lezcano
2021-01-19 1:55 ` Ayyathurai, Vijayakannan
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=73330c8b-4633-4a13-b4b5-7405ff1661fe@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=catalin.marinas@arm.com \
--cc=chen.yong.seow@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=lakshmi.bai.raja.subramanian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
--cc=vijayakannan.ayyathurai@intel.com \
--cc=wan.ahmad.zainie.wan.mohamad@intel.com \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®