From patchwork Thu Mar 6 03:28:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 3780841 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 226F59F370 for ; Thu, 6 Mar 2014 03:28:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43D3620225 for ; Thu, 6 Mar 2014 03:28:09 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 597862021B for ; Thu, 6 Mar 2014 03:28:08 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WLOy4-00057d-PW; Thu, 06 Mar 2014 03:27:33 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WLOxx-00013e-St; Thu, 06 Mar 2014 03:27:25 +0000 Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WLOxu-00012e-5T for linux-arm-kernel@lists.infradead.org; Thu, 06 Mar 2014 03:27:23 +0000 Received: by mail-pd0-f172.google.com with SMTP id p10so1927951pdj.31 for ; Wed, 05 Mar 2014 19:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=kGCWWHShLAtvFOhZlV/mFA5nGJs1up+iiFDY/4o5AQE=; b=wjTp4fknw5g/WIJfLIzYhkpWUGgWrtVmOV0rum+/d0PvnS9hLXI+5GImNlLYz2GHL0 ENi0Ln9hpWcQfIaLkvsI7l0u32bX/oh5UQzViMKKxYX6jHGYM9Nb//rtEu+XUJTWgEyq EhlpoMVKrA8xT+P2Eix/D/txY8/ut5LVJfZqLbG4Ab0884eTKE78irl3Rao0lYgZpno7 8ZoQ2EGFm7n2/yuhAdutg3qRaLHVB5RbsOiJG3KExjNEZ7GHJ2IsBbGANKra/YRK58xN ls7KgkvpNv/V4hi6WTZQjCjVHT8wcwf6/8bcwn1rSeizQmm4ET6bYh9OuGETcSaN5qsq q6pg== X-Received: by 10.68.172.37 with SMTP id az5mr11270246pbc.139.1394076420534; Wed, 05 Mar 2014 19:27:00 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id ug2sm27015499pac.21.2014.03.05.19.26.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Mar 2014 19:26:59 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Date: Thu, 06 Mar 2014 12:28:24 +0900 Message-Id: <20140306032824.10814.21953.sendpatchset@w520> In-Reply-To: <20140306032814.10814.2949.sendpatchset@w520> References: <20140306032814.10814.2949.sendpatchset@w520> Subject: [PATCH 01/02] ARM: shmobile: Add shared shmobile_init_delay() X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140305_222722_336025_30B637EC X-CRM114-Status: GOOD ( 11.81 ) X-Spam-Score: -2.0 (--) Cc: horms@verge.net.au, Magnus Damm , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Magnus Damm Introduce shmobile_init_delay() that gets CPU specific parameters from DT and sets up the early delay from there. This allows us to both remove frequency information from the C code and consolidate existing code. Signed-off-by: Magnus Damm --- arch/arm/mach-shmobile/include/mach/common.h | 1 arch/arm/mach-shmobile/timer.c | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) --- 0001/arch/arm/mach-shmobile/include/mach/common.h +++ work/arch/arm/mach-shmobile/include/mach/common.h 2014-03-06 12:06:03.000000000 +0900 @@ -4,6 +4,7 @@ extern void shmobile_earlytimer_init(void); extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz, unsigned int mult, unsigned int div); +extern void shmobile_init_delay(void); struct twd_local_timer; extern void shmobile_setup_console(void); extern void shmobile_boot_vector(void); --- 0001/arch/arm/mach-shmobile/timer.c +++ work/arch/arm/mach-shmobile/timer.c 2014-03-06 12:06:03.000000000 +0900 @@ -21,6 +21,7 @@ #include #include #include +#include void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, unsigned int mult, unsigned int div) @@ -39,6 +40,33 @@ void __init shmobile_setup_delay(unsigne preset_lpj = max_cpu_core_mhz * value; } +void __init shmobile_init_delay(void) +{ + struct device_node *np, *parent; + u32 max_freq, freq; + + max_freq = 0; + + parent = of_find_node_by_path("/cpus"); + if (parent) { + for_each_child_of_node(parent, np) { + if (!of_property_read_u32(np, "clock-frequency", &freq)) + max_freq = max(max_freq, freq); + } + of_node_put(parent); + } + + if (max_freq) { + if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8")) + shmobile_setup_delay(max_freq, 1, 3); + else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9")) + shmobile_setup_delay(max_freq, 1, 3); + else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15")) + if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) + shmobile_setup_delay(max_freq, 2, 4); + } +} + static void __init shmobile_late_time_init(void) { /*