From patchwork Wed Jun 1 13:29:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Sander X-Patchwork-Id: 98186 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C0043B6F84 for ; Wed, 1 Jun 2011 23:30:04 +1000 (EST) Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRlUk-0000aK-0l; Wed, 01 Jun 2011 13:29:58 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QRlUj-0003H8-Q8; Wed, 01 Jun 2011 13:29:57 +0000 Received: from gateway.hbm.com ([213.157.30.2] helo=hbmntx5.hbm.com) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QRlUf-0003GY-Je for linux-arm-kernel@lists.infradead.org; Wed, 01 Jun 2011 13:29:54 +0000 thread-index: AcwgX/w9PhYq7dMDRAib/93h7tBu7g== Thread-Topic: [PATCH 1/1] fix epit sched clock plat-mxc 2.6.39 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4841 Received: from dabox.localnet ([172.19.1.44]) by hbmntx5.hbm.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 1 Jun 2011 15:29:51 +0200 From: "Tim Sander" Organization: Hottinger Baldwin Messtechnik To: Subject: [PATCH 1/1] fix epit sched clock plat-mxc 2.6.39 Date: Wed, 1 Jun 2011 15:29:37 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.39; KDE/4.4.5; x86_64; ; ) MIME-Version: 1.0 Message-ID: <201106011529.37958.tim.sander@hbm.com> X-OriginalArrivalTime: 01 Jun 2011 13:29:51.0089 (UTC) FILETIME=[FC20C610:01CC205F] X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110601_092953_831617_A74FEB69 X-CRM114-Status: GOOD ( 12.99 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Hi The attached patch fixes booting the 2.6.39 kernel with epit timer enabled. 2.6.39 introduces "HAVE_SCHED_CLOCK" for ARCH_MXC. This breaks using MXC_USE_EPIT and the system just hangs on boot with no message at all. The patch below fixes this problem against 2.6.39. The new and shiny 3.0-rc1 has also a problem with MXC_USE_EPIT on i.mx35 (which means it hangs on boot). Any hints how to add the functionality of this patch to the more generic aproach are very welcome. The change introduced in 3.0-rc1 which conlicts with this patch is: bfe45e0be88d8a2e408226d473bff60da4a97d1f Signed-off-by: Tim Sander --- arch/arm/plat-mxc/epit.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c index d69d343..17a7c0d 100644 --- a/arch/arm/plat-mxc/epit.c +++ b/arch/arm/plat-mxc/epit.c @@ -53,6 +53,7 @@ #include #include +#include #include static struct clock_event_device clockevent_epit; @@ -88,18 +89,33 @@ static cycle_t epit_read(struct clocksource *cs) return 0 - __raw_readl(timer_base + EPITCNR); } +static cycle_t dummy_get_cycles(struct clocksource *cs) +{ + return 0; +} + static struct clocksource clocksource_epit = { .name = "epit", .rating = 200, - .read = epit_read, + .read = dummy_get_cycles, .mask = CLOCKSOURCE_MASK(32), .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; +static DEFINE_CLOCK_DATA(cd); + +static void notrace epit_update_sched_clock(void) +{ + cycle_t cyc = clocksource_epit.read(&clocksource_epit); + update_sched_clock(&cd, cyc, (u32)~0); +} + static int __init epit_clocksource_init(struct clk *timer_clk) { unsigned int c = clk_get_rate(timer_clk); + clocksource_epit.read = epit_read; + init_sched_clock(&cd,epit_update_sched_clock, 32, c); clocksource_register_hz(&clocksource_epit, c); return 0;