Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754229AbbGAOYp (ORCPT ); Wed, 1 Jul 2015 10:24:45 -0400 Received: from fish.king.net.pl ([79.190.246.46]:57996 "EHLO king.net.pl" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754381AbbGAOYj (ORCPT ); Wed, 1 Jul 2015 10:24:39 -0400 Date: Wed, 1 Jul 2015 16:20:48 +0200 (CEST) From: Paul Osmialowski X-X-Sender: newchief@localhost.localdomain To: Thomas Gleixner cc: Paul Osmialowski , Greg Kroah-Hartman , Ian Campbell , Jiri Slaby , Kumar Gala , Linus Walleij , Mark Rutland , Michael Turquette , Pawel Moll , Rob Herring , Russell King , Stephen Boyd , Vinod Koul , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, dmaengine@vger.kernel.org, Arnd Bergmann , Geert Uytterhoeven , Nicolas Pitre , Paul Bolle , Uwe Kleine-Koenig , Anson Huang , Frank Li , Jingchang Lu , Rob Herring , Yuri Tikhonov , Sergei Poselenov , Alexander Potashev Subject: Re: [PATCH v2 4/9] arm: twr-k70f120m: timer driver for Kinetis SoC In-Reply-To: Message-ID: References: <1435667250-28299-1-git-send-email-pawelo@king.net.pl> <1435667250-28299-5-git-send-email-pawelo@king.net.pl> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2136 Lines: 62 On Wed, 1 Jul 2015, Thomas Gleixner wrote: >> >> As I removed this kinetis_pit_enable() line, the timer did not start, >> therefore the system became unusable. What could be possible reason for that? > > Well, you need to move both, the init and the enable into > set_periodic(). > Indeed, something like this worked: diff --git a/drivers/clocksource/timer-kinetis.c b/drivers/clocksource/timer-kinetis.c index 1424308..41ef94f 100644 --- a/drivers/clocksource/timer-kinetis.c +++ b/drivers/clocksource/timer-kinetis.c @@ -61,6 +61,7 @@ struct kinetis_clock_event_ddata { struct clock_event_device evtdev; void __iomem *base; void __iomem *mcr; + unsigned long rate; spinlock_t lock; }; @@ -115,6 +116,7 @@ static int kinetis_clockevent_tmr_set_state_periodic( struct kinetis_clock_event_ddata *pit = container_of(evt, struct kinetis_clock_event_ddata, evtdev); + kinetis_pit_init(pit, (pit->rate / HZ) - 1); kinetis_pit_enable(pit, 1); return 0; @@ -235,6 +237,7 @@ static void __init kinetis_clockevent_init(struct device_node *np) kinetis_clockevent_tmr_set_state_oneshot; kinetis_tmr->base = base; kinetis_tmr->mcr = mcr; + kinetis_tmr->rate = rate; spin_lock_init(&kinetis_tmr->lock); /* @@ -250,9 +253,6 @@ static void __init kinetis_clockevent_init(struct device_node *np) clockevents_register_device(&kinetis_tmr->evtdev); - kinetis_pit_init(kinetis_tmr, (rate / HZ) - 1); - kinetis_pit_enable(kinetis_tmr, 1); - if (request_irq(irq, kinetis_clockevent_tmr_irq_handler, IRQF_TIMER | IRQF_IRQPOLL, "kinetis-timer", -- 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/