From patchwork Mon Oct 6 23:08:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 5039951 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 C2E6DC11AB for ; Mon, 6 Oct 2014 23:11:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EACAE2013D for ; Mon, 6 Oct 2014 23:11:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 20C5120131 for ; Mon, 6 Oct 2014 23:11:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XbHOi-0007Rp-0M; Mon, 06 Oct 2014 23:08:56 +0000 Received: from smtp05.smtpout.orange.fr ([80.12.242.127] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XbHOT-0007Le-1d for linux-arm-kernel@lists.infradead.org; Mon, 06 Oct 2014 23:08:42 +0000 Received: from localhost.localdomain ([109.222.127.212]) by mwinf5d09 with ME id zz8H1o0054b5KPR03z8LAf; Tue, 07 Oct 2014 01:08:20 +0200 X-ME-Helo: localhost.localdomain X-ME-Date: Tue, 07 Oct 2014 01:08:20 +0200 X-ME-IP: 109.222.127.212 From: Robert Jarzmik To: Mike Turquette , Haojian Zhuang , Arnd Bergmann Subject: [PATCH v1 4/5] DON'T MERGE ME: arm: pxa: change clocks init sequence Date: Tue, 7 Oct 2014 01:08:00 +0200 Message-Id: <1412636881-6211-5-git-send-email-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1412636881-6211-1-git-send-email-robert.jarzmik@free.fr> References: <1412636881-6211-1-git-send-email-robert.jarzmik@free.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141006_160841_429201_BA240A59 X-CRM114-Status: GOOD ( 11.95 ) X-Spam-Score: 0.0 (/) Cc: Robert Jarzmik , linux-arm-kernel@lists.infradead.org, Daniel Mack X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_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 Since pxa clocks were ported to the clock framework, an ordering issue appears between clocks and clocksource initialization. As a consequence, the pxa timer clock cannot be acquired in pxa_timer, and is disabled by clock framework because it is "unused". The ordering issue is that in the kernel boot sequence : start_kernel() ... time_init() -> pxa_timer() -> here the clocksource is initialized ... rest_init() kernel_init() initcalls -> here the clocks are initialized In the current sequence, the clocks are initialized way after pxa_timer, which cannot acquire the OSTIMER0 clock. To solve this issue, the clocks initialization is moved to pxa_timer(), so that clocks are initialized before clocksource for non device-tree. For device-tree, the standard arm time_init() will take care of the ordering. Signed-off-by: Robert Jarzmik --- arch/arm/mach-pxa/generic.c | 2 ++ arch/arm/mach-pxa/generic.h | 1 + drivers/clk/pxa/clk-pxa27x.c | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index 04b013f..4ca801b 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c @@ -63,6 +63,8 @@ EXPORT_SYMBOL(get_clock_tick_rate); */ void __init pxa_timer_init(void) { + if (cpu_is_pxa27x()) + pxa27x_clocks_init(); pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000), get_clock_tick_rate()); } diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h index 8963984..7fda082 100644 --- a/arch/arm/mach-pxa/generic.h +++ b/arch/arm/mach-pxa/generic.h @@ -14,6 +14,7 @@ struct irq_data; extern void pxa_timer_init(void); +extern int pxa27x_clocks_init(void); extern void __init pxa_map_io(void); diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c index 5f9b54b..2b8343a 100644 --- a/drivers/clk/pxa/clk-pxa27x.c +++ b/drivers/clk/pxa/clk-pxa27x.c @@ -362,12 +362,11 @@ static void __init pxa27x_base_clocks_init(void) clk_register_clk_pxa27x_lcd_base(); } -static int __init pxa27x_clocks_init(void) +int __init pxa27x_clocks_init(void) { pxa27x_base_clocks_init(); return clk_pxa_cken_init(pxa27x_clocks, ARRAY_SIZE(pxa27x_clocks)); } -postcore_initcall(pxa27x_clocks_init); static void __init pxa27x_dt_clocks_init(struct device_node *np) {