From: Sekhar Nori <nsekhar@ti.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
Kevin Hilman <khilman@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Thomas Gleixner <tglx@linutronix.de>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH v2 02/12] clocksource: davinci-timer: new driver
Date: Fri, 8 Feb 2019 18:54:12 +0530 [thread overview]
Message-ID: <7243573a-884d-cce2-380b-1be73636fafb@ti.com> (raw)
In-Reply-To: <20190204171757.32073-3-brgl@bgdev.pl>
On 04/02/19 10:47 PM, Bartosz Golaszewski wrote:
> +static unsigned int davinci_timer_read(struct davinci_timer_data *timer,
> + unsigned int reg)
> +{
> + return __raw_readl(timer->base + reg);
> +}
> +
> +static void davinci_timer_write(struct davinci_timer_data *timer,
> + unsigned int reg, unsigned int val)
> +{
> + __raw_writel(val, timer->base + reg);
> +}
Since its a new driver, please use readl_relaxed() and writel_relaxed().
> +static void davinci_timer_init(void __iomem *base)
> +{
> + /* Set clock to internal mode and disable it. */
> + __raw_writel(0x0, base + DAVINCI_TIMER_REG_TCR);
> + /*
> + * Reset both 32-bit timers, set no prescaler for timer 34, set the
> + * timer to dual 32-bit unchained mode, unreset both 32-bit timers.
> + */
> + __raw_writel(DAVINCI_TIMER_TGCR_DEFAULT, base + DAVINCI_TIMER_REG_TGCR);
> + /* Init both counters to zero. */
> + __raw_writel(0x0, base + DAVINCI_TIMER_REG_TIM12);
> + __raw_writel(0x0, base + DAVINCI_TIMER_REG_TIM34);
here too.
> +}
> +
> +int __init davinci_timer_register(struct clk *clk,
> + const struct davinci_timer_cfg *timer_cfg)
> +{
[...]
> + clocksource = kzalloc(sizeof(*clocksource), GFP_KERNEL);
> + if (!clocksource) {
> + pr_err("%s: Error allocating memory for clocksource data\n",
> + __func__);
> + return -ENOMEM;
> + }
> +
> + clocksource->dev.name = "tim34";
> + clocksource->dev.rating = 300;
> + clocksource->dev.read = davinci_timer_clksrc_read;
> + clocksource->dev.mask = CLOCKSOURCE_MASK(DAVINCI_TIMER_CLKSRC_BITS);
> + clocksource->dev.flags = CLOCK_SOURCE_IS_CONTINUOUS;
> + clocksource->timer.set_period = davinci_timer_set_period_std;
> + clocksource->timer.mode = DAVINCI_TIMER_MODE_PERIODIC;
> + clocksource->timer.base = base;
> +
> + if (timer_cfg->cmp_off)
> + clocksource->timer.regs = &davinci_timer_tim12_regs;
> + else
> + clocksource->timer.regs = &davinci_timer_tim34_regs;
We should set clocksource->dev.name based on cmp_off too, otherwise it
will be confusing to have a device called "tim34" using tim12 registers.
> +/**
> + * struct davinci_timer_cfg - davinci clocksource driver configuration struct
> + * @reg: register range resource
> + * @irq: clockevent and clocksource interrupt resources
> + * @cmp_off: if set - it specifies the compare register used for clockevent
> + *
> + * Note: if the compare register is specified, the driver will use the bottom
> + * clock half for both clocksource and clockevent and the compare register
> + * to generate event irqs. The user must supply the correct compare register
> + * interrupt number.
> + *
> + * This is only used by da830 the DSP of which uses the top half. The timer
> + * driver still configures the top half to run in free-run mode.
This note helps. Thanks!
Regards,
Sekhar
next prev parent reply other threads:[~2019-02-08 13:24 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-04 17:17 [PATCH v2 00/12] ARM: davinci: modernize the timer support Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 01/12] ARM: dts: da850: fix interrupt numbers for clocksource Bartosz Golaszewski
2019-02-05 1:18 ` David Lechner
2019-02-08 13:09 ` Sekhar Nori
2019-02-04 17:17 ` [PATCH v2 02/12] clocksource: davinci-timer: new driver Bartosz Golaszewski
2019-02-05 2:13 ` David Lechner
2019-02-05 2:37 ` David Lechner
2019-02-08 13:24 ` Sekhar Nori [this message]
2019-02-04 17:17 ` [PATCH v2 03/12] ARM: davinci: enable the clocksource driver for DT mode Bartosz Golaszewski
2019-02-05 2:16 ` David Lechner
2019-02-04 17:17 ` [PATCH v2 04/12] ARM: davinci: WARN_ON() if clk_get() fails Bartosz Golaszewski
2019-02-05 2:18 ` David Lechner
2019-02-26 12:08 ` Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 05/12] ARM: davinci: da850: switch to using the clocksource driver Bartosz Golaszewski
2019-02-05 2:35 ` David Lechner
2019-02-08 12:06 ` Sekhar Nori
2019-02-08 12:34 ` Bartosz Golaszewski
2019-02-08 12:37 ` Sekhar Nori
2019-02-08 12:47 ` Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 06/12] ARM: davinci: da830: " Bartosz Golaszewski
2019-02-05 2:36 ` David Lechner
2019-02-08 12:23 ` Sekhar Nori
2019-02-08 12:46 ` Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 07/12] ARM: davinci: move timer definitions to davinci.h Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 08/12] ARM: davinci: dm355: switch to using the clocksource driver Bartosz Golaszewski
2019-02-08 12:34 ` Sekhar Nori
2019-02-26 12:09 ` Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 09/12] ARM: davinci: dm365: " Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 10/12] ARM: davinci: dm644x: " Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 11/12] ARM: davinci: dm646x: " Bartosz Golaszewski
2019-02-04 17:17 ` [PATCH v2 12/12] ARM: davinci: remove legacy timer support Bartosz Golaszewski
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=7243573a-884d-cce2-380b-1be73636fafb@ti.com \
--to=nsekhar@ti.com \
--cc=bgolaszewski@baylibre.com \
--cc=brgl@bgdev.pl \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
/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®