LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
David Lechner <david@lechnology.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [RFC v2 1/2] clocksource: davinci-timer: add support for clockevents
Date: Sat, 25 May 2019 16:16:11 +0200 [thread overview]
Message-ID: <a4585f30-5fa7-7fde-bbbd-c32464c0f060@linaro.org> (raw)
In-Reply-To: <CAMRc=MeFMQ9rz-=8GktGtaQm1j-X66RsCBTqR3-mofc4Bju8-w@mail.gmail.com>
On 24/05/2019 13:53, Bartosz Golaszewski wrote:
> pt., 24 maj 2019 o 10:59 Daniel Lezcano <daniel.lezcano@linaro.org> napisał(a):
>>
>> On 24/05/2019 09:28, Bartosz Golaszewski wrote:
>>> czw., 23 maj 2019 o 18:38 Daniel Lezcano <daniel.lezcano@linaro.org> napisał(a):
>>>>
>>>> On 23/05/2019 14:58, Bartosz Golaszewski wrote:
>>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>>
>>>>> Currently the clocksource and clockevent support for davinci platforms
>>>>> lives in mach-davinci. It hard-codes many things, uses global variables,
>>>>> implements functionalities unused by any platform and has code fragments
>>>>> scattered across many (often unrelated) files.
>>>>>
>>>>> Implement a new, modern and simplified timer driver and put it into
>>>>> drivers/clocksource. We still need to support legacy board files so
>>>>> export a config structure and a function that allows machine code to
>>>>> register the timer.
>>>>>
>>>>> The timer we're using is 64-bit but can be programmed in dual 32-bit
>>>>> mode (both chained and unchained). We're using dual 32-bit mode to
>>>>> have separate counters for clockevents and clocksource.
>>>>>
>>>>> This patch contains the core code and support for clockevent. The
>>>>> clocksource code will be included in a subsequent patch.
>>>>>
[ ... ]
>>>>> +static unsigned int
>>>>> +davinci_clockevent_read(struct davinci_clockevent *clockevent,
>>>>> + unsigned int reg)
>>>>> +{
>>>>> + return readl_relaxed(clockevent->base + reg);
>>>>> +}
>>>>> +
>>>>> +static void davinci_clockevent_write(struct davinci_clockevent *clockevent,
>>>>> + unsigned int reg, unsigned int val)
>>>>> +{
>>>>> + writel_relaxed(val, clockevent->base + reg);
>>>>> +}
>>>>> +
>>>>> +static void davinci_tcr_update(void __iomem *base,
>>>>> + unsigned int mask, unsigned int val)
>>>>> +{
>>>>> + davinci_tcr &= ~mask;
>>>>> + davinci_tcr |= val & mask;
>>>>
>>>>
>>>> I don't see when the davinci_tcr is initialized.
>>>>
>>>
>>> It's set to 0x0 by the compiler and we're setting the register to 0x0
>>> in davinci_timer_init().
>>
>> Why did you need to readl before in the previous version? The idea of
>> caching the value was to save an extra readl.
>>
>> If it is always zero, then we don't need this variable neither the read,
>> just doing:
>>
>> writel_relaxed(val & mask, base + DAVINCI_TIMER_REG_TCR);
>>
>> should work no ?
>
> It's not always zero. Its reset value is zero and we write 0 to it at
> init time just to make sure, but then we modify it according to the
> configuration. The single TCR register controls both halves of the
> timer, so we do need an actual update, not a simple write.
Ok but the driver can be oneshot or disabled in the code (mutually
exclusive), no ?
So doing
- writel(oneshot, base);
- writel(disabled, base);
works without any mask computation, no?
Well the above assumes other part of the register aren't changed by
other subsystems (or by the timer itself).
-- :
<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:[~2019-05-25 14:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 12:58 [RFC v2 0/2] clocksource: davinci-timer: new driver Bartosz Golaszewski
2019-05-23 12:58 ` [RFC v2 1/2] clocksource: davinci-timer: add support for clockevents Bartosz Golaszewski
2019-05-23 16:38 ` Daniel Lezcano
2019-05-24 7:28 ` Bartosz Golaszewski
2019-05-24 8:59 ` Daniel Lezcano
2019-05-24 11:53 ` Bartosz Golaszewski
2019-05-25 14:16 ` Daniel Lezcano [this message]
2019-05-26 8:16 ` Bartosz Golaszewski
2019-05-31 12:21 ` Bartosz Golaszewski
2019-05-23 12:58 ` [RFC v2 2/2] clocksource: timer-davinci: add support for clocksource 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=a4585f30-5fa7-7fde-bbbd-c32464c0f060@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=bgolaszewski@baylibre.com \
--cc=brgl@bgdev.pl \
--cc=david@lechnology.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=tglx@linutronix.de \
--subject='Re: [RFC v2 1/2] clocksource: davinci-timer: add support for clockevents' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).