From patchwork Sat Nov 24 21:17:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 1798851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id D0FF63FC23 for ; Sat, 24 Nov 2012 21:22:51 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TcN8e-0002mt-Vm; Sat, 24 Nov 2012 21:19:49 +0000 Received: from mail-da0-f49.google.com ([209.85.210.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TcN7l-0002WG-Ow for linux-arm-kernel@lists.infradead.org; Sat, 24 Nov 2012 21:18:56 +0000 Received: by mail-da0-f49.google.com with SMTP id v40so3171208dad.36 for ; Sat, 24 Nov 2012 13:18:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=O+sQv65dvt0IfEm9MRlL/tP1z6Rgzq1OCqNq9Dsmx0w=; b=mG9ReKrJNy8AxmUEtblr4YaehmwgDunZvxO6OcBtO8bMr1PZ57DfqLFt+ufb8NGk04 blQxnFzbap/pEJwkKjgLBUI4P2jAVFFJ4RNENHkTpSCEwKf9pj+VBvQzopx/Xub5d6EN lXKyRip+UFWO5bmg8dmvghYww6OLbI6UFYJwa9/kY1OvUXiHucOD82IFE0AKofBmq4Xa EzPZm6Po6TR9j5OGxtSUO/zjI0HfxDthF/ZfWVdZnG4LiXN8sV4AdAbNhL7jzRS9mnM7 RlWzcMNTSzBwyPNdrDgXZE4QHJ6qKJ2HJ7neGtkYL1IdOpMQSNvu2i1xqU/Ts/W2dydX ydSg== Received: by 10.68.213.6 with SMTP id no6mr25233871pbc.113.1353791932344; Sat, 24 Nov 2012 13:18:52 -0800 (PST) Received: from localhost.localdomain ([14.99.191.127]) by mx.google.com with ESMTPS id nf9sm5984822pbc.17.2012.11.24.13.18.46 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Nov 2012 13:18:51 -0800 (PST) From: Thomas Abraham To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 04/12] ARM: Exynos: Rework timer initialization sequence Date: Sun, 25 Nov 2012 02:47:57 +0530 Message-Id: <1353791885-2566-5-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1353791885-2566-1-git-send-email-thomas.abraham@linaro.org> References: <1353791885-2566-1-git-send-email-thomas.abraham@linaro.org> X-Gm-Message-State: ALoCoQkd0H63RPYXYXMpFjg/4/n4Jdor0QYPMyhKGMIxo8kbnaTjM4hjCAr29tInCF29ldC0lol0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121124_161854_051772_7DF6B3C5 X-CRM114-Status: GOOD ( 17.98 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, mturquette@linaro.org, devicetree-discuss@lists.ozlabs.org, Thomas Abraham , sylvester.nawrocki@gmail.com, t.figa@samsung.com, mturquette@ti.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org A seperate timer initialization function for all exynos based platforms is created. This new initialization function will help to identify the type of timer used and call their corresponding initialization function. Since the clock initialization should be completed prior to the mct timer initialization, the clock initialization can be initiated from this new timer initialization function. Signed-off-by: Thomas Abraham --- arch/arm/mach-exynos/common.c | 27 +++++++++++++++++++++++++++ arch/arm/mach-exynos/common.h | 3 ++- arch/arm/mach-exynos/mach-armlex4210.c | 2 +- arch/arm/mach-exynos/mach-exynos4-dt.c | 2 +- arch/arm/mach-exynos/mach-exynos5-dt.c | 2 +- arch/arm/mach-exynos/mach-nuri.c | 2 +- arch/arm/mach-exynos/mach-origen.c | 2 +- arch/arm/mach-exynos/mach-smdk4x12.c | 4 ++-- arch/arm/mach-exynos/mach-smdkv310.c | 4 ++-- arch/arm/mach-exynos/mct.c | 13 +------------ 10 files changed, 39 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 8fafac5..f814600 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -23,6 +23,8 @@ #include #include +#include +#include #include #include #include @@ -415,6 +417,31 @@ static void __init exynos5_init_clocks(int xtal) exynos5_setup_clocks(); } +void __init exynos_timer_init(void) +{ + /* + * Temporary support for Exynos4 based non-dt platforms. This should + * go away soon. + */ + if (!of_have_populated_dt() && (soc_is_exynos4210() || + soc_is_exynos4212() || soc_is_exynos4412())) { + exynos_mct_init(); + return; + } + + /* quick check to see if this machine uses arch timer */ + if (of_machine_is_compatible("samsung,exynos5440")) { + if (arch_timer_of_register()) + panic("%s: could not initialize timer\n", __func__); + } else { + exynos_mct_init(); + } +} + +struct sys_timer exynos_timer = { + .init = exynos_timer_init, +}; + #define COMBINER_ENABLE_SET 0x0 #define COMBINER_ENABLE_CLEAR 0x4 #define COMBINER_INT_STATUS 0xC diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index dac146d..eafcb5d 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -12,7 +12,7 @@ #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H #define __ARCH_ARM_MACH_EXYNOS_COMMON_H -extern struct sys_timer exynos4_timer; +extern struct sys_timer exynos_timer; struct map_desc; void exynos_init_io(struct map_desc *mach_desc, int size); @@ -21,6 +21,7 @@ void exynos5_init_irq(void); void exynos4_restart(char mode, const char *cmd); void exynos5_restart(char mode, const char *cmd); void exynos_init_late(void); +extern void exynos_mct_init(void); #ifdef CONFIG_PM_GENERIC_DOMAINS int exynos_pm_late_initcall(void); diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c index 3f37a5e..68b4bb4 100644 --- a/arch/arm/mach-exynos/mach-armlex4210.c +++ b/arch/arm/mach-exynos/mach-armlex4210.c @@ -205,6 +205,6 @@ MACHINE_START(ARMLEX4210, "ARMLEX4210") .handle_irq = gic_handle_irq, .init_machine = armlex4210_machine_init, .init_late = exynos_init_late, - .timer = &exynos4_timer, + .timer = &exynos_timer, .restart = exynos4_restart, MACHINE_END diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c index 8858068..dcf5b30 100644 --- a/arch/arm/mach-exynos/mach-exynos4-dt.c +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c @@ -109,7 +109,7 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") .handle_irq = gic_handle_irq, .init_machine = exynos4_dt_machine_init, .init_late = exynos_init_late, - .timer = &exynos4_timer, + .timer = &exynos_timer, .dt_compat = exynos4_dt_compat, .restart = exynos4_restart, MACHINE_END diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index 845d8e2..c546287 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c @@ -178,7 +178,7 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") .handle_irq = gic_handle_irq, .init_machine = exynos5_dt_machine_init, .init_late = exynos_init_late, - .timer = &exynos4_timer, + .timer = &exynos_timer, .dt_compat = exynos5_dt_compat, .restart = exynos5_restart, .reserve = exynos5_reserve, diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index 27d4ed8..03d5ddf 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c @@ -1382,7 +1382,7 @@ MACHINE_START(NURI, "NURI") .handle_irq = gic_handle_irq, .init_machine = nuri_machine_init, .init_late = exynos_init_late, - .timer = &exynos4_timer, + .timer = &exynos_timer, .reserve = &nuri_reserve, .restart = exynos4_restart, MACHINE_END diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c index e6f4191..c5ee414 100644 --- a/arch/arm/mach-exynos/mach-origen.c +++ b/arch/arm/mach-exynos/mach-origen.c @@ -817,7 +817,7 @@ MACHINE_START(ORIGEN, "ORIGEN") .handle_irq = gic_handle_irq, .init_machine = origen_machine_init, .init_late = exynos_init_late, - .timer = &exynos4_timer, + .timer = &exynos_timer, .reserve = &origen_reserve, .restart = exynos4_restart, MACHINE_END diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c index a1555a7..03f133a 100644 --- a/arch/arm/mach-exynos/mach-smdk4x12.c +++ b/arch/arm/mach-exynos/mach-smdk4x12.c @@ -378,7 +378,7 @@ MACHINE_START(SMDK4212, "SMDK4212") .map_io = smdk4x12_map_io, .handle_irq = gic_handle_irq, .init_machine = smdk4x12_machine_init, - .timer = &exynos4_timer, + .timer = &exynos_timer, .restart = exynos4_restart, .reserve = &smdk4x12_reserve, MACHINE_END @@ -393,7 +393,7 @@ MACHINE_START(SMDK4412, "SMDK4412") .handle_irq = gic_handle_irq, .init_machine = smdk4x12_machine_init, .init_late = exynos_init_late, - .timer = &exynos4_timer, + .timer = &exynos_timer, .restart = exynos4_restart, .reserve = &smdk4x12_reserve, MACHINE_END diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c index 063cb94..f99cc71 100644 --- a/arch/arm/mach-exynos/mach-smdkv310.c +++ b/arch/arm/mach-exynos/mach-smdkv310.c @@ -426,7 +426,7 @@ MACHINE_START(SMDKV310, "SMDKV310") .map_io = smdkv310_map_io, .handle_irq = gic_handle_irq, .init_machine = smdkv310_machine_init, - .timer = &exynos4_timer, + .timer = &exynos_timer, .reserve = &smdkv310_reserve, .restart = exynos4_restart, MACHINE_END @@ -440,7 +440,7 @@ MACHINE_START(SMDKC210, "SMDKC210") .handle_irq = gic_handle_irq, .init_machine = smdkv310_machine_init, .init_late = exynos_init_late, - .timer = &exynos4_timer, + .timer = &exynos_timer, .reserve = &smdkv310_reserve, .restart = exynos4_restart, MACHINE_END diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c index bf359f6..448ce86 100644 --- a/arch/arm/mach-exynos/mct.c +++ b/arch/arm/mach-exynos/mct.c @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -31,7 +30,6 @@ #include #include -#include #define EXYNOS4_MCTREG(x) (x) #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) @@ -513,16 +511,11 @@ static void __init exynos4_timer_resources(struct device_node *np) #endif /* CONFIG_LOCAL_TIMERS */ } -static void __init exynos_timer_init(void) +void __init exynos_mct_init(void) { struct device_node *np; u32 nr_irqs, i; - if (soc_is_exynos5440()) { - arch_timer_of_register(); - return; - } - np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-mct"); if (np) { if (of_machine_is_compatible("samsung,exynos4210") || @@ -551,7 +544,3 @@ static void __init exynos_timer_init(void) exynos4_clocksource_init(); exynos4_clockevent_init(); } - -struct sys_timer exynos4_timer = { - .init = exynos_timer_init, -};