From patchwork Mon Aug 6 12:23:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 1278691 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 32D853FC23 for ; Mon, 6 Aug 2012 12:27:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SyMLs-0001X9-HP; Mon, 06 Aug 2012 12:24:04 +0000 Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SyMLl-0001WJ-Qc for linux-arm-kernel@lists.infradead.org; Mon, 06 Aug 2012 12:23:59 +0000 Received: by mail-bk0-f49.google.com with SMTP id ji2so1168040bkc.36 for ; Mon, 06 Aug 2012 05:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=d9Zpuj5Rar0WKb31cRtQVN63FTMMdKBBIYnLDRck7y8=; b=fVS22KshCAv146jY+PNd9X31j3iiaks9j9SJ6hI963ojJCGedbRahjaRzdaZR5mSPR 2nZiBctsr0l9y5pbwJTrU0IM472Lx+wvvGP3rhwz1AfdF7/OQuIqXBVSUhIRKbOmArmU e1ZPCZbS87k4RVIxvN8oaPWeQSgDITYk6+eU1t8l23U7R2KCzAEcx1+1PxKV7yOJG96q 4VGtbWfSgJXzyu5sIjfRIE3Ijb13WzLNFFvhlsuvjOsFJRRmI8h6RqgUCkSdgq0p2IL9 jxNGZ6GvC3DUDVVUxnxWoPMeEBXsFRZVfVuNq3iDnaQlAm0IpKkeww8GDdb1JsxccmWW 8KSA== Received: by 10.204.157.146 with SMTP id b18mr4000240bkx.108.1344255837384; Mon, 06 Aug 2012 05:23:57 -0700 (PDT) Received: from edge.mip.uni-hannover.de (ip116.244.mip.uni-hannover.de. [130.75.244.116]) by mx.google.com with ESMTPS id hg13sm7341595bkc.7.2012.08.06.05.23.54 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 06 Aug 2012 05:23:56 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH 1/6] ARM: dove: unify clock setup Date: Mon, 6 Aug 2012 14:23:29 +0200 Message-Id: <1344255815-4457-2-git-send-email-sebastian.hesselbarth@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1344255815-4457-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1344255815-4457-1-git-send-email-sebastian.hesselbarth@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sebastian.hesselbarth[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Andrew Lunn , Russell King , Jason Cooper , Arnd Bergmann , linux-kernel@vger.kernel.org, Rabeeh Khoury , Maen Suleiman , Olof Johansson , Ian Molton , linux-arm-kernel@lists.infradead.org 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 This patch synchronizes the clock setup of dove with other orion-based platforms. In dove_find_tclk there was a note about DOVE_SAMPLE_HI/LO register to detect tclk. While it might be possible to set a different tclk frequency with reset strapping the Dove datasheets don't tell anything about tclk frequency here. Therefore, I removed that comment. Also, the patch ensures that tclk is always clocked by prepare/enable. Signed-off-by: Sebastian Hesselbarth Cc: Russell King Cc: Jason Cooper Cc: Andrew Lunn Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: Rabeeh Khoury Cc: Ian Molton Cc: Arnd Bergmann Cc: Maen Suleiman Cc: Olof Johansson --- arch/arm/mach-dove/common.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index 4db5de5..20b765c 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c @@ -33,8 +33,6 @@ #include #include "common.h" -static int get_tclk(void); - /***************************************************************************** * I/O Address Mapping ****************************************************************************/ @@ -70,14 +68,18 @@ void __init dove_map_io(void) /***************************************************************************** * CLK tree ****************************************************************************/ +static int dove_tclk; static struct clk *tclk; -static void __init clk_init(void) +static void __init dove_clk_init(void) { tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, - get_tclk()); + dove_tclk); orion_clkdev_init(tclk); + + /* Ensure tclk is always clocked */ + clk_prepare_enable(tclk); } /***************************************************************************** @@ -187,16 +189,16 @@ void __init dove_init_early(void) orion_time_set_base(TIMER_VIRT_BASE); } -static int get_tclk(void) +static int __init dove_find_tclk(void) { - /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */ return 166666667; } static void __init dove_timer_init(void) { + dove_tclk = dove_find_tclk(); orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR, - IRQ_DOVE_BRIDGE, get_tclk()); + IRQ_DOVE_BRIDGE, dove_tclk); } struct sys_timer dove_timer = { @@ -284,8 +286,8 @@ void __init dove_sdio1_init(void) void __init dove_init(void) { - printk(KERN_INFO "Dove 88AP510 SoC, "); - printk(KERN_INFO "TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000); + pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n", + (dove_tclk + 499999) / 1000000); #ifdef CONFIG_CACHE_TAUROS2 tauros2_init(); @@ -293,7 +295,7 @@ void __init dove_init(void) dove_setup_cpu_mbus(); /* Setup root of clk tree */ - clk_init(); + dove_clk_init(); /* internal devices that every board has */ dove_rtc_init();