From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Sekhar Nori <nsekhar@ti.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
David Lechner <david@lechnology.com>,
Kevin Hilman <khilman@kernel.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] clocksource: davinci: work around a clocksource problem on dm365 SoC
Date: Fri, 13 Dec 2019 17:24:51 +0100 [thread overview]
Message-ID: <20191213162453.15691-2-brgl@bgdev.pl> (raw)
In-Reply-To: <20191213162453.15691-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The DM365 platform has a strange quirk (only present when using ancient
u-boot - mainline u-boot v2013.01 and later works fine) where if we
enable the second half of the timer in periodic mode before we do its
initialization - the time won't start flowing and we can't boot.
When using more recent u-boot, we can enable the timer, then reinitialize
it and all works fine.
I've been unable to figure out why that is, but a workaround for this
is straightforward - just cache the enable bits for tim34.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
drivers/clocksource/timer-davinci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/timer-davinci.c b/drivers/clocksource/timer-davinci.c
index 62745c962049..1c22443acaeb 100644
--- a/drivers/clocksource/timer-davinci.c
+++ b/drivers/clocksource/timer-davinci.c
@@ -64,6 +64,8 @@ static struct {
unsigned int tim_off;
} davinci_clocksource;
+static unsigned int davinci_clocksource_tim32_mode;
+
static struct davinci_clockevent *
to_davinci_clockevent(struct clock_event_device *clockevent)
{
@@ -94,7 +96,7 @@ static void davinci_tim12_shutdown(void __iomem *base)
* halves. In this case TIM34 runs in periodic mode and we must
* not modify it.
*/
- tcr |= DAVINCI_TIMER_ENAMODE_PERIODIC <<
+ tcr |= davinci_clocksource_tim32_mode <<
DAVINCI_TIMER_ENAMODE_SHIFT_TIM34;
writel_relaxed(tcr, base + DAVINCI_TIMER_REG_TCR);
@@ -107,7 +109,7 @@ static void davinci_tim12_set_oneshot(void __iomem *base)
tcr = DAVINCI_TIMER_ENAMODE_ONESHOT <<
DAVINCI_TIMER_ENAMODE_SHIFT_TIM12;
/* Same as above. */
- tcr |= DAVINCI_TIMER_ENAMODE_PERIODIC <<
+ tcr |= davinci_clocksource_tim32_mode <<
DAVINCI_TIMER_ENAMODE_SHIFT_TIM34;
writel_relaxed(tcr, base + DAVINCI_TIMER_REG_TCR);
@@ -206,6 +208,8 @@ static void davinci_clocksource_init_tim34(void __iomem *base)
writel_relaxed(0x0, base + DAVINCI_TIMER_REG_TIM34);
writel_relaxed(UINT_MAX, base + DAVINCI_TIMER_REG_PRD34);
writel_relaxed(tcr, base + DAVINCI_TIMER_REG_TCR);
+
+ davinci_clocksource_tim32_mode = DAVINCI_TIMER_ENAMODE_PERIODIC;
}
/*
--
2.23.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-12-13 22:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 16:24 [PATCH 0/3] ARM: davinci: convert dm365 to using the new clocksource driver Bartosz Golaszewski
2019-12-13 16:24 ` Bartosz Golaszewski [this message]
2019-12-16 17:58 ` [PATCH 1/3] clocksource: davinci: work around a clocksource problem on dm365 SoC David Lechner
2019-12-17 8:00 ` Bartosz Golaszewski
2019-12-17 17:01 ` David Lechner
2019-12-18 9:28 ` Sekhar Nori
2019-12-19 8:59 ` Bartosz Golaszewski
2019-12-13 16:24 ` [PATCH 2/3] ARM: davinci: dm365: switch to using the clocksource driver Bartosz Golaszewski
2019-12-13 16:24 ` [PATCH 3/3] 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=20191213162453.15691-2-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=bgolaszewski@baylibre.com \
--cc=daniel.lezcano@linaro.org \
--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 \
/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;
as well as URLs for NNTP newsgroup(s).