From patchwork Thu Oct 18 16:38:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 1612101 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1E3C23FE36 for ; Thu, 18 Oct 2012 16:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756819Ab2JRQis (ORCPT ); Thu, 18 Oct 2012 12:38:48 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:35841 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756693Ab2JRQir (ORCPT ); Thu, 18 Oct 2012 12:38:47 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q9IGcha5001028; Thu, 18 Oct 2012 11:38:43 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q9IGchIE012391; Thu, 18 Oct 2012 11:38:43 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Thu, 18 Oct 2012 11:38:42 -0500 Received: from localhost (uglx0174654.ucm2.emeaucm.ext.ti.com [10.167.145.249]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id q9IGcg6D016911; Thu, 18 Oct 2012 11:38:42 -0500 From: Grygorii Strashko To: Paul Walmsley CC: Mike Turquette , Kevin Hilman , Tony Lindgren , , , Grygorii Strashko Subject: [RFC PATCH 1/2] ARM: OMAP2+: clock: Add omap2_clks_register API Date: Thu, 18 Oct 2012 19:38:16 +0300 Message-ID: <1350578297-22572-2-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350578297-22572-1-git-send-email-grygorii.strashko@ti.com> References: <1350578297-22572-1-git-send-email-grygorii.strashko@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Now the cpu_mask is used to differentiate clocks per each OMAP platform, SoC version or revision. Such approach has few disadvantages: - the specific CK_XXX flag need to be added and maintained for each OMAP SoC; - it's difficult to update clock tree data in case of differences between OMAP SoC revisions. In addition, there are duplicated code in each clockXXX_data.c files, so it seems, reasonable to remove it: - call clk_preinit() for each clock; - call clkdev_add(); clk_register(); omap2_init_clk_clkdm(); for each clock; Hence, add omap4_clks_register() API which would allow to register and init few set of clocks and to organize clocks data in the following way (for example for OMAP4): - struct omap_clk omap44xx_clks[]; - common clocks set for all OMAP4 SoCs - struct omap_clk omap443x_clks[]; - specific clocks set for OMAP443x SoCs - struct omap_clk omap446x_clks[]; - specific clocks set for OMAP446x SoCs Signed-off-by: Grygorii Strashko --- arch/arm/mach-omap2/clock.c | 36 ++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock.h | 3 +++ 2 files changed, 39 insertions(+) diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 961ac8f..d84f174 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -521,3 +521,39 @@ struct clk_functions omap2_clk_functions = { .clk_disable_unused = omap2_clk_disable_unused, }; +/** + * omap_clks_register() - register set of clocks + * @clks: array of clock definitions + * + * The last array item should contain NULL value in c->lk.clk. + */ +int __init omap2_clks_register(struct omap_clk *clks) +{ + struct omap_clk *c; + int r; + + if (!clks) + return -EINVAL; + + c = clks; + while (c->lk.clk) { + clk_preinit(c->lk.clk); + c++; + } + + c = clks; + while (c->lk.clk) { + clkdev_add(&c->lk); + r = clk_register(c->lk.clk); + if (r < 0) { + pr_warn("%s: Clock register failure %d.\n", + c->lk.clk->name, r); + } + + omap2_init_clk_clkdm(c->lk.clk); + + c++; + } + + return 0; +} diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 35ec5f3..920f3f2 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h @@ -19,6 +19,7 @@ #include #include +#include /* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ #define CORE_CLK_SRC_32K 0x0 @@ -132,6 +133,8 @@ void omap2_clk_print_new_rates(const char *hfclkin_ck_name, const char *core_ck_name, const char *mpu_ck_name); +int omap2_clks_register(struct omap_clk *clks); + extern u16 cpu_mask; extern const struct clkops clkops_omap2_dflt_wait;