From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] h8300: clocksource: Use overflow interrupt
Date: Wed, 11 Nov 2015 23:50:13 +0900 [thread overview]
Message-ID: <1447253416-13892-2-git-send-email-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <1447253416-13892-1-git-send-email-ysato@users.sourceforge.jp>
Overflow interrupt is used for moving up of a count.
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
drivers/clocksource/h8300_timer16.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/clocksource/h8300_timer16.c b/drivers/clocksource/h8300_timer16.c
index f396605..53daf6a 100644
--- a/drivers/clocksource/h8300_timer16.c
+++ b/drivers/clocksource/h8300_timer16.c
@@ -14,7 +14,6 @@
#include <linux/of_irq.h>
#define TSTR 0
-#define TISRA 4
#define TISRC 6
#define TCR 0
@@ -27,10 +26,8 @@ struct timer16_priv {
unsigned long mapcommon;
unsigned short cs_enabled;
unsigned char enb;
- unsigned char imfa;
- unsigned char imiea;
unsigned char ovf;
- struct clk *clk;
+ unsigned char ovie;
};
static unsigned long timer16_get_counter(struct timer16_priv *p)
@@ -59,8 +56,8 @@ static irqreturn_t timer16_interrupt(int irq, void *dev_id)
{
struct timer16_priv *p = (struct timer16_priv *)dev_id;
- ctrl_outb(ctrl_inb(p->mapcommon + TISRA) & ~p->imfa,
- p->mapcommon + TISRA);
+ ctrl_outb(ctrl_inb(p->mapcommon + TISRC) & ~p->ovf,
+ p->mapcommon + TISRC);
p->total_cycles += 0x10000;
return IRQ_HANDLED;
@@ -91,6 +88,8 @@ static int timer16_enable(struct clocksource *cs)
p->total_cycles = 0;
ctrl_outw(0x0000, p->mapbase + TCNT);
ctrl_outb(0x83, p->mapbase + TCR);
+ ctrl_outb(ctrl_inb(p->mapcommon + TISRC) | p->ovie,
+ p->mapcommon + TISRC);
ctrl_outb(ctrl_inb(p->mapcommon + TSTR) | p->enb,
p->mapcommon + TSTR);
@@ -104,6 +103,8 @@ static void timer16_disable(struct clocksource *cs)
WARN_ON(!p->cs_enabled);
+ ctrl_outb(ctrl_inb(p->mapcommon + TISRC) & ~p->ovie,
+ p->mapcommon + TISRC);
ctrl_outb(ctrl_inb(p->mapcommon + TSTR) & ~p->enb,
p->mapcommon + TSTR);
@@ -118,6 +119,7 @@ static struct timer16_priv timer16_priv = {
.enable = timer16_enable,
.disable = timer16_disable,
.mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8),
+ .max_cycles = 0xffffffff,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
},
};
@@ -160,9 +162,9 @@ static void __init h8300_16timer_init(struct device_node *node)
timer16_priv.mapbase = (unsigned long)base[REG_CH];
timer16_priv.mapcommon = (unsigned long)base[REG_COMM];
+ timer16_priv.ovf = 1 << ch;
+ timer16_priv.ovie = 1 << (4 + ch);
timer16_priv.enb = 1 << ch;
- timer16_priv.imfa = 1 << ch;
- timer16_priv.imiea = 1 << (4 + ch);
ret = request_irq(irq, timer16_interrupt,
IRQF_TIMER, timer16_priv.cs.name, &timer16_priv);
@@ -172,7 +174,7 @@ static void __init h8300_16timer_init(struct device_node *node)
}
clocksource_register_hz(&timer16_priv.cs,
- clk_get_rate(timer16_priv.clk) / 8);
+ clk_get_rate(clk) / 8);
return;
unmap_comm:
--
2.6.1
next prev parent reply other threads:[~2015-11-11 14:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 10:06 [PATCH 01/15] clocksource/drivers/h8300_timer8: Fix compilation error with dev_warn Daniel Lezcano
2015-11-09 10:06 ` [PATCH 02/15] clocksource/drivers/h8300_tpu: Remove unused macros Daniel Lezcano
2015-11-11 14:38 ` Yoshinori Sato
2015-11-09 10:06 ` [PATCH 03/15] clocksource/drivers/h8300_tpu: Remove pointless headers for TPU Daniel Lezcano
2015-11-11 14:39 ` Yoshinori Sato
2015-11-09 10:06 ` [PATCH 04/15] clocksource/drivers/h8300_timer8: Remove unused headers Daniel Lezcano
2015-11-09 10:06 ` [PATCH 05/15] clocksource/drivers/h8300_timer8: Remove unused macros Daniel Lezcano
2015-11-09 10:06 ` [PATCH 06/15] clocksource/drivers/h8300_timer8: Remove PERIODIC and ONESHOT macro Daniel Lezcano
2015-11-09 10:06 ` [PATCH 07/15] clocksource/drivers/h8300_timer8: Fix irq return value check Daniel Lezcano
2015-11-09 10:06 ` [PATCH 08/15] clocksource/drivers/h8300_timer8: Remove pointless irq re-entrant safe code Daniel Lezcano
2015-11-09 10:06 ` [PATCH 09/15] clocksource/drivers/h8300_timer8: Remove irq and lock legacy code Daniel Lezcano
2015-11-09 10:06 ` [PATCH 10/15] clocksource/drivers/h8300_timer8: Retrieve the clock rate at init time Daniel Lezcano
2015-11-09 10:06 ` [PATCH 11/15] clocksource/drivers/h8300_timer16: Remove pointless headers Daniel Lezcano
2015-11-09 10:06 ` [PATCH 12/15] clocksource/drivers/h8300_timer16: Remove unused macros Daniel Lezcano
2015-11-09 10:06 ` [PATCH 13/15] clocksource/drivers/h8300_timer16: Remove unused fields in timer16_priv Daniel Lezcano
2015-11-09 10:06 ` [PATCH 14/15] clocksource/drivers/h8300_timer16: Fix irq return value check Daniel Lezcano
2015-11-09 10:06 ` [PATCH 15/15] clocksource/drivers/h8300_timer16: Remove pointless lock Daniel Lezcano
2015-11-09 10:13 ` [PATCH 01/15] clocksource/drivers/h8300_timer8: Fix compilation error with dev_warn Daniel Lezcano
2015-11-11 14:50 ` [PATCH 0/4] h8300: clock driver update Yoshinori Sato
2015-11-11 14:50 ` Yoshinori Sato [this message]
2015-11-12 16:50 ` [PATCH 1/4] h8300: clocksource: Use overflow interrupt Daniel Lezcano
2015-11-11 14:50 ` [PATCH 2/4] h8300: clocksource: Counter overflow fix Yoshinori Sato
2015-11-11 14:50 ` [PATCH 3/4] h8300: clocksource: More simplify timer8_set_next Yoshinori Sato
2015-11-11 14:50 ` [PATCH 4/4] h8300: clocksource: remove unused local-variable Yoshinori Sato
2015-11-12 16:28 ` [PATCH 0/4] h8300: clock driver update Daniel Lezcano
2015-11-17 12:20 ` Daniel Lezcano
2015-11-18 16:58 ` Yoshinori Sato
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=1447253416-13892-2-git-send-email-ysato@users.sourceforge.jp \
--to=ysato@users.sourceforge.jp \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.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 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.