Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1251075

[PATCH 1/9] clockevents/drivers/mtk: Fix spurious interrupt leading to crash

From Daniel Lezcano <daniel.lezcano@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 1/9] clockevents/drivers/mtk: Fix spurious interrupt leading to crash
Date 2015-10-19 23:10 +0200
Message-ID <qlpQR-7V3-7@gated-at.bofh.it> (permalink)
References <qlpHc-7uj-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


After analysis done by Yingjoe Chen, the timer appears to have a pending
interrupt when it is enabled.

Fix this by acknowledging the pending interrupt when enabling the timer
interrupt.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 drivers/clocksource/mtk_timer.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 50f0641..c8badc4 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -141,14 +141,6 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
-{
-	/* Disable all interrupts */
-	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
-	/* Acknowledge all interrupts */
-	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
-}
-
 static void
 mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 {
@@ -168,6 +160,12 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
 {
 	u32 val;
 
+	/* Disable all interrupts */
+	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
+
+	/* Acknowledge all spurious pending interrupts */
+	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
+
 	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
 	writel(val | GPT_IRQ_ENABLE(timer),
 			evt->gpt_base + GPT_IRQ_EN_REG);
@@ -220,8 +218,6 @@ static void __init mtk_timer_init(struct device_node *node)
 	}
 	rate = clk_get_rate(clk);
 
-	mtk_timer_global_reset(evt);
-
 	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
 			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
 		pr_warn("failed to setup irq %d\n", evt->dev.irq);
-- 
1.9.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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PULL] : clockevents for 4.4 Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:00 +0200
  [PATCH 2/9] clocksource/drivers/mediatek: Use GPT as sched clock source Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
  [PATCH 1/9] clockevents/drivers/mtk: Fix spurious interrupt leading to crash Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
    [PATCH 8/9] clocksource/drivers/tango_xtal: Add new timer for Tango SoCs Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
    [PATCH 4/9] clocksource/drivers/sh_cmt: Remove unneeded memset() in sh_cmt_setup() Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
    [PATCH 7/9] clocksource/drivers/imx: Allow timer irq affinity change Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
    [PATCH 5/9] clocksource/drivers/h8300_*: Remove unneeded memset()s Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
      Re: [PATCH 5/9] clocksource/drivers/h8300_*: Remove unneeded memset()s Yoshinori Sato <ysato@users.sourceforge.jp> - 2015-10-20 06:50 +0200
    [PATCH 6/9] clocksource/drivers/exynos_mct: Use container_of() instead of this_cpu_ptr() Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
    [PATCH 9/9] clocksource/drivers/armada-370-xp: Implement ARM delay timer Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
    [PATCH 3/9] clocksource/drivers/em_sti: Remove unneeded memset()s Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-10-19 23:10 +0200
    Re: [PATCH 1/9] clockevents/drivers/mtk: Fix spurious interrupt  leading to crash Matthias Brugger <matthias.bgg@gmail.com> - 2015-10-22 22:00 +0200

csiph-web