Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752833AbbKKOw0 (ORCPT ); Wed, 11 Nov 2015 09:52:26 -0500 Received: from mail2.asahi-net.or.jp ([202.224.39.198]:53762 "EHLO mail2.asahi-net.or.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752229AbbKKOuk (ORCPT ); Wed, 11 Nov 2015 09:50:40 -0500 From: Yoshinori Sato To: Daniel Lezcano , Thomas Gleixner Cc: Yoshinori Sato , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] h8300: clocksource: Use overflow interrupt Date: Wed, 11 Nov 2015 23:50:13 +0900 Message-Id: <1447253416-13892-2-git-send-email-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1447253416-13892-1-git-send-email-ysato@users.sourceforge.jp> References: <1447063614-4662-1-git-send-email-daniel.lezcano@linaro.org> <1447253416-13892-1-git-send-email-ysato@users.sourceforge.jp> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3012 Lines: 97 Overflow interrupt is used for moving up of a count. Signed-off-by: Yoshinori Sato --- 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 #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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/