From patchwork Thu Dec 27 14:47:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Gaikwad X-Patchwork-Id: 1913131 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 E9EB13FC66 for ; Thu, 27 Dec 2012 14:54:24 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1ToEnN-0004F9-Ak; Thu, 27 Dec 2012 14:50:54 +0000 Received: from hqemgate04.nvidia.com ([216.228.121.35]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1ToEl9-0003J4-S5 for linux-arm-kernel@lists.infradead.org; Thu, 27 Dec 2012 14:48:45 +0000 Received: from hqnvupgp06.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Thu, 27 Dec 2012 06:48:16 -0800 Received: from hqemhub03.nvidia.com ([172.17.108.22]) by hqnvupgp06.nvidia.com (PGP Universal service); Thu, 27 Dec 2012 06:46:28 -0800 X-PGP-Universal: processed; by hqnvupgp06.nvidia.com on Thu, 27 Dec 2012 06:46:28 -0800 Received: from localhost.localdomain (172.20.144.16) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server (TLS) id 8.3.279.1; Thu, 27 Dec 2012 06:48:34 -0800 From: Prashant Gaikwad To: , Subject: [PATCH v2 09/11] clk: tegra: add dt support Date: Thu, 27 Dec 2012 20:17:22 +0530 Message-ID: <1356619644-18565-10-git-send-email-pgaikwad@nvidia.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1356619644-18565-1-git-send-email-pgaikwad@nvidia.com> References: <1356619644-18565-1-git-send-email-pgaikwad@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121227_094836_306946_73352976 X-CRM114-Status: GOOD ( 12.52 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [216.228.121.35 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-tegra@vger.kernel.org, Prashant Gaikwad , linux-kernel@vger.kernel.org, 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: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add support to initialize clock from DT. Signed-off-by: Prashant Gaikwad --- drivers/clk/tegra/clk.c | 23 +++++++++++++++++++++++ drivers/clk/tegra/clk.h | 2 ++ include/linux/clk/tegra.h | 1 + 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c index cf023a9..314d5bd 100644 --- a/drivers/clk/tegra/clk.c +++ b/drivers/clk/tegra/clk.c @@ -67,3 +67,26 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl, } } } + +static const struct of_device_id tegra_dt_clk_match[] = { + { .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init }, + { .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init }, + { } +}; + +void __init tegra_dt_init_clk(void) +{ + struct device_node *np; + const struct of_device_id *match; + of_tegra_clk_init_func_t clk_init_func; + + np = of_find_matching_node(NULL, tegra_dt_clk_match); + if (!np) + return; + + match = of_match_node(tegra_dt_clk_match, np); + + clk_init_func = match->data; + + clk_init_func(np); +} diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h index f1ed1d0..ca1f0e4 100644 --- a/drivers/clk/tegra/clk.h +++ b/drivers/clk/tegra/clk.h @@ -20,6 +20,8 @@ #include #include +typedef void (*of_tegra_clk_init_func_t)(struct device_node *); + /** * struct tegra_clk_sync_source - external clock source from codec * diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h index 0977f2a..a97e241 100644 --- a/include/linux/clk/tegra.h +++ b/include/linux/clk/tegra.h @@ -118,6 +118,7 @@ static inline void tegra_cpu_clock_resume(void) } #endif +void tegra_dt_init_clk(void); void tegra20_cpu_car_ops_init(void); void tegra30_cpu_car_ops_init(void);