mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Prashant Gaikwad <pgaikwad@nvidia.com>
To: <swarren@wwwdotorg.org>, <mturquette@linaro.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-tegra@vger.kernel.org>,
	Prashant Gaikwad <pgaikwad@nvidia.com>
Subject: [PATCH v2 09/11] clk: tegra: add dt support
Date: Thu, 27 Dec 2012 20:17:22 +0530	[thread overview]
Message-ID: <1356619644-18565-10-git-send-email-pgaikwad@nvidia.com> (raw)
In-Reply-To: <1356619644-18565-1-git-send-email-pgaikwad@nvidia.com>

Add support to initialize clock from DT.

Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com>
---
 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 <linux/clk-provider.h>
 #include <linux/clkdev.h>
 
+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);
 
-- 
1.7.4.1


  parent reply	other threads:[~2012-12-27 14:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27 14:47 [PATCH v2 00/11] Migrate Tegra to common clock framework Prashant Gaikwad
2012-12-27 14:47 ` [PATCH v2 01/11] clk: tegra: Add tegra specific clocks Prashant Gaikwad
2013-01-07 12:13   ` Peter De Schrijver
2012-12-27 14:47 ` [PATCH v2 02/11] arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h Prashant Gaikwad
2012-12-27 14:47 ` [PATCH v2 03/11] ARM: tegra: Define Tegra20 CAR binding Prashant Gaikwad
2012-12-27 14:47 ` [PATCH v2 04/11] ARM: Tegra: Define Tegra30 " Prashant Gaikwad
2013-01-09 14:41   ` Peter De Schrijver
2012-12-27 14:47 ` [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC Prashant Gaikwad
2013-01-02 22:00   ` Stephen Warren
2013-01-03  6:11     ` Prashant Gaikwad
2013-01-03 16:11       ` Stephen Warren
2013-01-04  1:48         ` Prashant Gaikwad
2013-01-04  3:05           ` Stephen Warren
2013-01-04  3:23             ` Prashant Gaikwad
2013-01-04  4:00               ` Stephen Warren
2013-01-04  4:26                 ` Prashant Gaikwad
2013-01-04  5:21                   ` Stephen Warren
2013-01-04  5:31                     ` Prashant Gaikwad
2013-01-04 11:56                 ` Laxman Dewangan
2013-01-04 19:57                   ` Stephen Warren
2012-12-27 14:47 ` [PATCH v2 06/11] ARM: dt: tegra20: " Prashant Gaikwad
2012-12-27 14:47 ` [PATCH v2 07/11] clk: tegra: add clock support for tegra20 Prashant Gaikwad
2012-12-27 14:47 ` [PATCH v2 08/11] clk: tegra: add clock support for tegra30 Prashant Gaikwad
2013-01-07 14:54   ` Peter De Schrijver
2012-12-27 14:47 ` Prashant Gaikwad [this message]
2013-01-02 22:06   ` [PATCH v2 09/11] clk: tegra: add dt support Stephen Warren
2012-12-27 14:47 ` [PATCH v2 10/11] arm: tegra: Migrate to new clock code Prashant Gaikwad
2012-12-27 14:47 ` [PATCH v2 11/11] arm: tegra: Remove legacy " Prashant Gaikwad
2013-01-02 22:09 ` [PATCH v2 00/11] Migrate Tegra to common clock framework Stephen Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356619644-18565-10-git-send-email-pgaikwad@nvidia.com \
    --to=pgaikwad@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=swarren@wwwdotorg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®