From patchwork Sat Jun 7 16:09:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 4315721 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 E38B59F170 for ; Sat, 7 Jun 2014 16:14:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6CFB201F4 for ; Sat, 7 Jun 2014 16:14:07 +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 8C25C2017A for ; Sat, 7 Jun 2014 16:14:06 +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 1WtJC6-0000pv-6j; Sat, 07 Jun 2014 16:10:10 +0000 Received: from smtp48.i.mail.ru ([94.100.177.108]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WtJC2-0008Bp-VH for linux-arm-kernel@lists.infradead.org; Sat, 07 Jun 2014 16:10:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=5ZGzy0RvzK6byC0feiZ2re6+GbWwfWp6YuL4BKCpvRE=; b=P6c2uZ94k+a6T4OATk9+nlQ5YDAxHA0U0dv+AUgEJCm9qyK9zjMDvY4MlzmKfiHIgZqZUY4g1uYFRY56V64idcibyjffn1H4lu3HC28K5JYI1Hbe8b/R4MkEdwKiXIBt2zLDLmroPTZljG1Xve7f2c++Cleiu7jsT4i7d7iWO9I=; Received: from [5.18.98.7] (port=34602 helo=shc.zet) by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1WtJBd-0001qA-Gu; Sat, 07 Jun 2014 20:09:41 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] ARM: i.MX27 clk: Separate DT and non-DT init procedure Date: Sat, 7 Jun 2014 20:09:25 +0400 Message-Id: <1402157366-25134-1-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.5.5 X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140607_091007_613893_B30727C0 X-CRM114-Status: GOOD ( 12.22 ) X-Spam-Score: -0.1 (/) Cc: Alexander Shiyan , Sascha Hauer , Shawn Guo 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=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 This patch separates DT and non-DT clock initialization procedure, so we can avoid a lot of unneeded clk_register_clkdev() for DT case. Signed-off-by: Alexander Shiyan --- arch/arm/mach-imx/clk-imx27.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 317a662..f5a6a3f 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -89,10 +89,9 @@ enum mx27_clks { static struct clk *clk[clk_max]; static struct clk_onecell_data clk_data; -int __init mx27_clocks_init(unsigned long fref) +static void __init _mx27_clocks_init(unsigned long fref) { - int i; - struct device_node *np; + unsigned i; clk[dummy] = imx_clk_fixed("dummy", 0); clk[ckih] = imx_clk_fixed("ckih", fref); @@ -206,12 +205,16 @@ int __init mx27_clocks_init(unsigned long fref) pr_err("i.MX27 clk %d: register failed with %ld\n", i, PTR_ERR(clk[i])); - np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm"); - if (np) { - clk_data.clks = clk; - clk_data.clk_num = ARRAY_SIZE(clk); - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); - } + clk_register_clkdev(clk[cpu_div], NULL, "cpu0"); + + clk_prepare_enable(clk[emi_ahb_gate]); + + imx_print_silicon_rev("i.MX27", mx27_revision()); +} + +int __init mx27_clocks_init(unsigned long fref) +{ + _mx27_clocks_init(fref); clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0"); clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.0"); @@ -274,14 +277,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "imx27-camera.0"); clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0"); clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0"); - clk_register_clkdev(clk[cpu_div], NULL, "cpu0"); mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1); - clk_prepare_enable(clk[emi_ahb_gate]); - - imx_print_silicon_rev("i.MX27", mx27_revision()); - return 0; } @@ -298,5 +296,16 @@ int __init mx27_clocks_init_dt(void) break; } - return mx27_clocks_init(fref); + _mx27_clocks_init(fref); + + np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm"); + BUG_ON(!np); + + clk_data.clks = clk; + clk_data.clk_num = ARRAY_SIZE(clk); + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); + + mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx1-gpt")); + + return 0; }