From patchwork Tue Dec 10 19:16:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 3320021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 892E9C0D4A for ; Tue, 10 Dec 2013 19:19:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 745B0201D5 for ; Tue, 10 Dec 2013 19:19:12 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 712322012D for ; Tue, 10 Dec 2013 19:19:11 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqSoN-0005dO-0I; Tue, 10 Dec 2013 19:17:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqSny-0002N2-0D; Tue, 10 Dec 2013 19:17:14 +0000 Received: from mail-we0-f174.google.com ([74.125.82.174]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqSnR-0002HX-0u for linux-arm-kernel@lists.infradead.org; Tue, 10 Dec 2013 19:16:43 +0000 Received: by mail-we0-f174.google.com with SMTP id q58so5489914wes.33 for ; Tue, 10 Dec 2013 11:16:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Fmkepbqovb2rgK4I9T3ADLzzgB6Pnue5AAips3dOnX4=; b=VSf2oMikFpRT1TKQlXFAYCLzs6udlrn8cFq1IITvUYl5f32tMdli9S+uNGfPClKCZP 1mmMYD9tJZBoQXC62N40lpfdUugMIfiFHw245R3Fmbup81Q/oN2FioTdcPN4fHaab3qK tU1ynWEYj1j3V7bAsheAFD7vUxzLjJGDo3U097w3cXOJSLouWh0tF+lJ5W/NJx2WkGeW efLBEsAy/Rmnll40QgCAs6IXOjTlGxDcCN+rw/1+XKfBhXFBTaGuUCOUKBM0pafxzqfk DT/3X87OVhH5wuWZ4dfQuCb1Qun3S5SQ0wmqGWhdDmcojeSYpcOe9AyAhSBEezNsayXV G0sw== X-Gm-Message-State: ALoCoQkvJ6TiF/r2ACabszqUpg45VUjY1NxR/qOOq+WPcbfYB8G2thd6Pn0OmyqLD1lMGjlkWmYD X-Received: by 10.180.82.161 with SMTP id j1mr20665083wiy.23.1386702977799; Tue, 10 Dec 2013 11:16:17 -0800 (PST) Received: from localhost.localdomain (AToulouse-654-1-288-187.w90-5.abo.wanadoo.fr. [90.5.191.187]) by mx.google.com with ESMTPSA id xn17sm7758084wib.1.2013.12.10.11.16.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 11:16:17 -0800 (PST) From: Daniel Lezcano To: mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/6] clocksource: sunxi: Stop timer from ticking before enabling interrupts Date: Tue, 10 Dec 2013 20:16:10 +0100 Message-Id: <1386702972-25565-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386702972-25565-1-git-send-email-daniel.lezcano@linaro.org> References: <52A767CB.3010501@linaro.org> <1386702972-25565-1-git-send-email-daniel.lezcano@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131210_141641_229372_009171CB X-CRM114-Status: GOOD ( 11.64 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier The sun4i timer can still be ticking when we enable the interrupt. If another timer is actually used (A7 architected timer, for example), odds are that the interrupt will eventually fire with the event_handler pointer being NULL. The obvious fix it to stop the timer before registering the interrupt. Observed and tested on sun7i (cubietruck). Cc: Daniel Lezcano Acked-by: Maxime Ripard Signed-off-by: Marc Zyngier Signed-off-by: Daniel Lezcano --- drivers/clocksource/sun4i_timer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c index 2fb4695..a4f6119 100644 --- a/drivers/clocksource/sun4i_timer.c +++ b/drivers/clocksource/sun4i_timer.c @@ -179,6 +179,9 @@ static void __init sun4i_timer_init(struct device_node *node) writel(TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M), timer_base + TIMER_CTL_REG(0)); + /* Make sure timer is stopped before playing with interrupts */ + sun4i_clkevt_time_stop(0); + ret = setup_irq(irq, &sun4i_timer_irq); if (ret) pr_warn("failed to setup irq %d\n", irq);