From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/9] clocksource: dw_apb_timer: quirk for inverted timer mode setting
Date: Sat, 6 Jul 2013 00:55:31 +0200 [thread overview]
Message-ID: <201307060055.31882.heiko@sntech.de> (raw)
In-Reply-To: <201307060051.09716.heiko@sntech.de>
From: Ulrich Prinz <ulrich.prinz@googlemail.com>
Some variants of SOCs using dw_apb_timer have inverted logic for the
bit that sets one-shot / periodic mode or free running timer. This
commit adds the new APBTMR_QUIRK_INVERSE_PERIODIC.
Signed-off-by: Ulrich Prinz <ulrich.prinz@googlemail.com>
---
drivers/clocksource/dw_apb_timer.c | 11 +++++++++--
include/linux/dw_apb_timer.h | 6 ++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/dw_apb_timer.c
b/drivers/clocksource/dw_apb_timer.c
index 7705d13..a2e8306 100644
--- a/drivers/clocksource/dw_apb_timer.c
+++ b/drivers/clocksource/dw_apb_timer.c
@@ -159,7 +159,11 @@ static void apbt_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_PERIODIC:
period = DIV_ROUND_UP(timer->freq, HZ);
ctrl = apbt_readl(timer, timer->reg_control);
- ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
+
+ if (timer->quirks & APBTMR_QUIRK_INVERSE_PERIODIC)
+ ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
+ else
+ ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
apbt_writel(timer, ctrl, timer->reg_control);
/*
* DW APB p. 46, have to disable timer before load counter,
@@ -186,7 +190,10 @@ static void apbt_set_mode(enum clock_event_mode mode,
* the next event, therefore emulate the one-shot mode.
*/
ctrl &= ~APBTMR_CONTROL_ENABLE;
- ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
+ if (timer->quirks & APBTMR_QUIRK_INVERSE_PERIODIC)
+ ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
+ else
+ ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
apbt_writel(timer, ctrl, timer->reg_control);
/* write again to set free running mode */
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index 7d36d91..5d9210cc 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -36,6 +36,12 @@
*/
#define APBTMR_QUIRK_INVERSE_INTMASK BIT(2)
+/* The IP uses inverted logic for the bit setting periodic mode.
+ * Periodic means it times out after the period is over and is set to
+ * 1 in the original IP. This IP uses 1 for free running mode.
+ */
+#define APBTMR_QUIRK_INVERSE_PERIODIC BIT(3)
+
struct dw_apb_timer {
void __iomem *base;
unsigned long freq;
--
1.7.10.4
WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
To: John Stultz <john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Ulrich Prinz
<ulrich.prinz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: [PATCH 7/9] clocksource: dw_apb_timer: quirk for inverted timer mode setting
Date: Sat, 6 Jul 2013 00:55:31 +0200 [thread overview]
Message-ID: <201307060055.31882.heiko@sntech.de> (raw)
In-Reply-To: <201307060051.09716.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
From: Ulrich Prinz <ulrich.prinz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Some variants of SOCs using dw_apb_timer have inverted logic for the
bit that sets one-shot / periodic mode or free running timer. This
commit adds the new APBTMR_QUIRK_INVERSE_PERIODIC.
Signed-off-by: Ulrich Prinz <ulrich.prinz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
---
drivers/clocksource/dw_apb_timer.c | 11 +++++++++--
include/linux/dw_apb_timer.h | 6 ++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/dw_apb_timer.c
b/drivers/clocksource/dw_apb_timer.c
index 7705d13..a2e8306 100644
--- a/drivers/clocksource/dw_apb_timer.c
+++ b/drivers/clocksource/dw_apb_timer.c
@@ -159,7 +159,11 @@ static void apbt_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_PERIODIC:
period = DIV_ROUND_UP(timer->freq, HZ);
ctrl = apbt_readl(timer, timer->reg_control);
- ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
+
+ if (timer->quirks & APBTMR_QUIRK_INVERSE_PERIODIC)
+ ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
+ else
+ ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
apbt_writel(timer, ctrl, timer->reg_control);
/*
* DW APB p. 46, have to disable timer before load counter,
@@ -186,7 +190,10 @@ static void apbt_set_mode(enum clock_event_mode mode,
* the next event, therefore emulate the one-shot mode.
*/
ctrl &= ~APBTMR_CONTROL_ENABLE;
- ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
+ if (timer->quirks & APBTMR_QUIRK_INVERSE_PERIODIC)
+ ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
+ else
+ ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
apbt_writel(timer, ctrl, timer->reg_control);
/* write again to set free running mode */
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index 7d36d91..5d9210cc 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -36,6 +36,12 @@
*/
#define APBTMR_QUIRK_INVERSE_INTMASK BIT(2)
+/* The IP uses inverted logic for the bit setting periodic mode.
+ * Periodic means it times out after the period is over and is set to
+ * 1 in the original IP. This IP uses 1 for free running mode.
+ */
+#define APBTMR_QUIRK_INVERSE_PERIODIC BIT(3)
+
struct dw_apb_timer {
void __iomem *base;
unsigned long freq;
--
1.7.10.4
WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko@sntech.de>
To: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Jamie Iles <jamie@jamieiles.com>,
Dinh Nguyen <dinguyen@altera.com>,
Grant Likely <grant.likely@linaro.org>,
linux-arm-kernel@lists.infradead.org,
Rob Herring <rob.herring@calxeda.com>,
devicetree-discuss@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Olof Johansson <olof@lixom.net>,
Ulrich Prinz <ulrich.prinz@googlemail.com>
Subject: [PATCH 7/9] clocksource: dw_apb_timer: quirk for inverted timer mode setting
Date: Sat, 6 Jul 2013 00:55:31 +0200 [thread overview]
Message-ID: <201307060055.31882.heiko@sntech.de> (raw)
In-Reply-To: <201307060051.09716.heiko@sntech.de>
From: Ulrich Prinz <ulrich.prinz@googlemail.com>
Some variants of SOCs using dw_apb_timer have inverted logic for the
bit that sets one-shot / periodic mode or free running timer. This
commit adds the new APBTMR_QUIRK_INVERSE_PERIODIC.
Signed-off-by: Ulrich Prinz <ulrich.prinz@googlemail.com>
---
drivers/clocksource/dw_apb_timer.c | 11 +++++++++--
include/linux/dw_apb_timer.h | 6 ++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/dw_apb_timer.c
b/drivers/clocksource/dw_apb_timer.c
index 7705d13..a2e8306 100644
--- a/drivers/clocksource/dw_apb_timer.c
+++ b/drivers/clocksource/dw_apb_timer.c
@@ -159,7 +159,11 @@ static void apbt_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_PERIODIC:
period = DIV_ROUND_UP(timer->freq, HZ);
ctrl = apbt_readl(timer, timer->reg_control);
- ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
+
+ if (timer->quirks & APBTMR_QUIRK_INVERSE_PERIODIC)
+ ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
+ else
+ ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
apbt_writel(timer, ctrl, timer->reg_control);
/*
* DW APB p. 46, have to disable timer before load counter,
@@ -186,7 +190,10 @@ static void apbt_set_mode(enum clock_event_mode mode,
* the next event, therefore emulate the one-shot mode.
*/
ctrl &= ~APBTMR_CONTROL_ENABLE;
- ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
+ if (timer->quirks & APBTMR_QUIRK_INVERSE_PERIODIC)
+ ctrl |= APBTMR_CONTROL_MODE_PERIODIC;
+ else
+ ctrl &= ~APBTMR_CONTROL_MODE_PERIODIC;
apbt_writel(timer, ctrl, timer->reg_control);
/* write again to set free running mode */
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index 7d36d91..5d9210cc 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -36,6 +36,12 @@
*/
#define APBTMR_QUIRK_INVERSE_INTMASK BIT(2)
+/* The IP uses inverted logic for the bit setting periodic mode.
+ * Periodic means it times out after the period is over and is set to
+ * 1 in the original IP. This IP uses 1 for free running mode.
+ */
+#define APBTMR_QUIRK_INVERSE_PERIODIC BIT(3)
+
struct dw_apb_timer {
void __iomem *base;
unsigned long freq;
--
1.7.10.4
next prev parent reply other threads:[~2013-07-05 22:55 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-05 22:51 [PATCH 0/9] clocksource: dw_apb_timer: support for timer variant used in rk3188 SoCs Heiko Stübner
2013-07-05 22:51 ` Heiko Stübner
2013-07-05 22:51 ` Heiko Stübner
2013-07-05 22:51 ` [PATCH 1/9] clocksource: dw_apb_timer: infrastructure to handle quirks Heiko Stübner
2013-07-05 22:51 ` Heiko Stübner
2013-07-05 22:52 ` [PATCH 2/9] clocksource: dw_apb_timer: flexible register addresses Heiko Stübner
2013-07-05 22:52 ` Heiko Stübner
2013-07-05 22:53 ` [PATCH 3/9] clocksource: dw_apb_timer: quirk for variants with 64bit counter Heiko Stübner
2013-07-05 22:53 ` Heiko Stübner
2013-07-05 23:45 ` Thomas Gleixner
2013-07-05 23:45 ` Thomas Gleixner
2013-07-05 23:45 ` Thomas Gleixner
2013-07-06 20:19 ` Ulrich Prinz
2013-07-06 20:19 ` Ulrich Prinz
2013-07-05 22:53 ` [PATCH 4/9] clocksource: dw_apb_timer: use the eoi callback to clear pending interrupts Heiko Stübner
2013-07-05 22:53 ` Heiko Stübner
2013-07-05 22:59 ` Heiko Stübner
2013-07-05 22:59 ` Heiko Stübner
2013-07-05 22:54 ` [PATCH 5/9] clocksource: dw_apb_timer: quirk for variants without EOI register Heiko Stübner
2013-07-05 22:54 ` Heiko Stübner
2013-07-05 22:58 ` Heiko Stübner
2013-07-05 22:58 ` Heiko Stübner
2013-07-05 22:58 ` Heiko Stübner
2013-07-05 23:49 ` Thomas Gleixner
2013-07-05 23:49 ` Thomas Gleixner
2013-07-05 23:49 ` Thomas Gleixner
2013-07-05 22:54 ` [PATCH 6/9] clocksource: dw_apb_timer: quirk for inverted int mask Heiko Stübner
2013-07-05 22:54 ` Heiko Stübner
2013-07-05 22:58 ` Heiko Stübner
2013-07-05 22:58 ` Heiko Stübner
2013-07-05 23:51 ` Thomas Gleixner
2013-07-05 23:51 ` Thomas Gleixner
2013-07-05 23:51 ` Thomas Gleixner
2013-07-05 22:55 ` Heiko Stübner [this message]
2013-07-05 22:55 ` [PATCH 7/9] clocksource: dw_apb_timer: quirk for inverted timer mode setting Heiko Stübner
2013-07-05 22:55 ` Heiko Stübner
2013-07-05 22:56 ` [PATCH 8/9] clocksource: dw_apb_timer_of: add quirk handling Heiko Stübner
2013-07-05 22:56 ` Heiko Stübner
2013-07-05 22:56 ` [PATCH 9/9] clocksource: dw_apb_timer: special variant for rockchip rk3188 timers Heiko Stübner
2013-07-05 22:56 ` Heiko Stübner
2013-07-06 0:12 ` Thomas Gleixner
2013-07-06 0:12 ` Thomas Gleixner
2013-07-06 0:12 ` Thomas Gleixner
2013-07-06 20:28 ` Ulrich Prinz
2013-07-06 20:28 ` Ulrich Prinz
2013-07-06 21:00 ` Thomas Gleixner
2013-07-06 21:00 ` Thomas Gleixner
2013-07-06 21:00 ` Thomas Gleixner
2013-07-11 22:44 ` Ulrich Prinz
2013-07-11 22:44 ` Ulrich Prinz
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=201307060055.31882.heiko@sntech.de \
--to=heiko@sntech.de \
--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.