From patchwork Sun Sep 22 16:46:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 2924661 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A1F36BFF05 for ; Sun, 22 Sep 2013 16:47:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7BC82052A for ; Sun, 22 Sep 2013 16:47:26 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F1A920529 for ; Sun, 22 Sep 2013 16:47:25 +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 1VNmob-0001Ju-2M; Sun, 22 Sep 2013 16:47:21 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VNmoY-0003oK-IZ; Sun, 22 Sep 2013 16:47:18 +0000 Received: from mail-bk0-x22e.google.com ([2a00:1450:4008:c01::22e]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VNmoV-0003ni-9x for linux-arm-kernel@lists.infradead.org; Sun, 22 Sep 2013 16:47:16 +0000 Received: by mail-bk0-f46.google.com with SMTP id 6so836173bkj.33 for ; Sun, 22 Sep 2013 09:46:53 -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:in-reply-to:references; bh=1ixY67h0OlgUlKpjDjXhLYzUicZcKwLYA9zuWhj/MT4=; b=yOnAVs7uqPgTdswF3gXRbgLBGiiRsO37fMfJAyqmSQyPqQGXe7QFw+JzjoMxDO6N7M qe1kn6Zsjw9ps3eF4vhh57LcBNuAgfgA62vVUrHJNiMvIS0fpOKUnrg4FuyOsKW/toPe C9EOEa9zreeCP/eg038jvmLISvSmtcz4hKhTEFxOJsDEvR0NXMGJZGxrfrYEkAz1miHX LV60TeGf9JUnig0L8dnCmkJtzNtgOfVM+PulaW0lRg5pOcsIPE8LiBrcUn/4Lwp+UVc5 J6lmDmopJ3kHw7TKVwDVVO7Tqu+fuD7cwvarY4H8sNWdGYZsxAcNyMpwjNCzmmFcBdVK BryA== X-Received: by 10.204.103.199 with SMTP id l7mr14193741bko.11.1379868413034; Sun, 22 Sep 2013 09:46:53 -0700 (PDT) Received: from topkick.lan (dslc-082-083-247-252.pools.arcor-ip.net. [82.83.247.252]) by mx.google.com with ESMTPSA id qe6sm7384128bkb.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 22 Sep 2013 09:46:52 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v2 03/26] clk: nomadik: declare OF clock provider Date: Sun, 22 Sep 2013 18:46:22 +0200 Message-Id: <1379868382-2877-1-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1379526839-14798-4-git-send-email-sebastian.hesselbarth@gmail.com> References: <1379526839-14798-4-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130922_124715_621588_4057B049 X-CRM114-Status: GOOD ( 16.84 ) X-Spam-Score: -2.0 (--) Cc: Mike Turquette , Arnd Bergmann , Linus Walleij , linux-kernel@vger.kernel.org, STEricsson , Olof Johansson , Russell King , linux-arm-kernel@lists.infradead.org, Alessandro Rubini 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=-6.4 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 Common clock framework allows to register clock providers to get called on of_clk_init() by using CLK_OF_DECLARE. This converts nomadik clock provider to make use of it and get rid of the mach specific clk init call. As clocks require system reset controller base address to be initialized each clock driver checks src_base and calls new nomadik_src_init if required. Signed-off-by: Sebastian Hesselbarth Acked-by: Linus Walleij --- Changelog: v1->v2: - adapt to clk-nomadik changes Cc: Olof Johansson Cc: Arnd Bergmann Cc: Alessandro Rubini Cc: Linus Walleij Cc: STEricsson Cc: Mike Turquette Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/arm/mach-nomadik/cpu-8815.c | 5 ++-- drivers/clk/clk-nomadik.c | 45 ++++++++++------------------- include/linux/platform_data/clk-nomadik.h | 2 -- 3 files changed, 17 insertions(+), 35 deletions(-) delete mode 100644 include/linux/platform_data/clk-nomadik.h diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index 0fcb149..2be38a0 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -115,8 +115,7 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd) static void __init cpu8815_timer_init_of(void) { - /* We need this to be up now */ - nomadik_clk_init(); + of_clk_init(NULL); clocksource_of_init(); } diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index 06b29c26..ce2d6b3 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c @@ -512,6 +512,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np) const char *parent_name; u32 pll_id; + if (!src_base) + nomadik_src_init(); + if (of_property_read_u32(np, "pll-id", &pll_id)) { pr_err("%s: PLL \"%s\" missing pll-id property\n", __func__, clk_name); @@ -522,6 +525,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np) if (!IS_ERR(clk)) of_clk_add_provider(np, of_clk_src_simple_get, clk); } +CLK_OF_DECLARE(nomadik_pll_clk, + "st,nomadik-pll-clock", of_nomadik_pll_setup); static void __init of_nomadik_hclk_setup(struct device_node *np) { @@ -529,6 +534,9 @@ static void __init of_nomadik_hclk_setup(struct device_node *np) const char *clk_name = np->name; const char *parent_name; + if (!src_base) + nomadik_src_init(); + parent_name = of_clk_get_parent_name(np, 0); /* * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4. @@ -541,6 +549,8 @@ static void __init of_nomadik_hclk_setup(struct device_node *np) if (!IS_ERR(clk)) of_clk_add_provider(np, of_clk_src_simple_get, clk); } +CLK_OF_DECLARE(nomadik_hclk_clk, + "st,nomadik-hclk-clock", of_nomadik_hclk_setup); static void __init of_nomadik_src_clk_setup(struct device_node *np) { @@ -549,6 +559,9 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np) const char *parent_name; u32 clk_id; + if (!src_base) + nomadik_src_init(); + if (of_property_read_u32(np, "clock-id", &clk_id)) { pr_err("%s: SRC clock \"%s\" missing clock-id property\n", __func__, clk_name); @@ -559,33 +572,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np) if (!IS_ERR(clk)) of_clk_add_provider(np, of_clk_src_simple_get, clk); } - -static const struct of_device_id nomadik_src_clk_match[] __initconst = { - { - .compatible = "fixed-clock", - .data = of_fixed_clk_setup, - }, - { - .compatible = "fixed-factor-clock", - .data = of_fixed_factor_clk_setup, - }, - { - .compatible = "st,nomadik-pll-clock", - .data = of_nomadik_pll_setup, - }, - { - .compatible = "st,nomadik-hclk-clock", - .data = of_nomadik_hclk_setup, - }, - { - .compatible = "st,nomadik-src-clock", - .data = of_nomadik_src_clk_setup, - }, - { /* sentinel */ } -}; - -void __init nomadik_clk_init(void) -{ - nomadik_src_init(); - of_clk_init(nomadik_src_clk_match); -} +CLK_OF_DECLARE(nomadik_src_clk, + "st,nomadik-src-clock", of_nomadik_src_clk_setup); diff --git a/include/linux/platform_data/clk-nomadik.h b/include/linux/platform_data/clk-nomadik.h deleted file mode 100644 index 5713c87..0000000 --- a/include/linux/platform_data/clk-nomadik.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Minimal platform data header */ -void nomadik_clk_init(void);