From: Peter De Schrijver <pdeschrijver@nvidia.com>
To: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: <linux-tegra@vger.kernel.org>,
Mike Turquette <mturquette@linaro.org>,
Stephen Warren <swarren@wwwdotorg.org>,
Joseph Lo <josephl@nvidia.com>,
Paul Walmsley <pwalmsley@nvidia.com>,
Prashant Gaikwad <pgaikwad@nvidia.com>,
Thierry Reding <thierry.reding@gmail.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v2 4/4] clk: tegra114: table driven PMC clock init
Date: Wed, 4 Sep 2013 17:20:11 +0300 [thread overview]
Message-ID: <1378304438-7780-5-git-send-email-pdeschrijver@nvidia.com> (raw)
In-Reply-To: <1378304438-7780-1-git-send-email-pdeschrijver@nvidia.com>
This patch converts the Tegra114 audio clock registration to be table driven
like the periph clocks.
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
drivers/clk/tegra/clk-tegra114.c | 58 +++++++++++++++-----------------------
1 files changed, 23 insertions(+), 35 deletions(-)
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c
index 0379a19..44ba713 100644
--- a/drivers/clk/tegra/clk-tegra114.c
+++ b/drivers/clk/tegra/clk-tegra114.c
@@ -1583,45 +1583,33 @@ static void __init tegra114_audio_clk_init(void __iomem *clk_base)
}
}
+static struct pmc_clk_init_data tegra_pmc_clk_init_data[] = {
+ TEGRA_INIT_PMC_CLK("clk_out_1", "extern1", clk_out1_parents, 6, 2, TEGRA114_CLK_CLK_OUT_1),
+ TEGRA_INIT_PMC_CLK("clk_out_2", "extern2", clk_out2_parents, 14, 10, TEGRA114_CLK_CLK_OUT_2),
+ TEGRA_INIT_PMC_CLK("clk_out_3", "extern3", clk_out3_parents, 22, 18, TEGRA114_CLK_CLK_OUT_3),
+};
+
static void __init tegra114_pmc_clk_init(void __iomem *pmc_base)
{
struct clk *clk;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(tegra_pmc_clk_init_data); i++) {
+ struct pmc_clk_init_data *data;
- /* clk_out_1 */
- clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents,
- ARRAY_SIZE(clk_out1_parents), 0,
- pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0,
- &clk_out_lock);
- clks[TEGRA114_CLK_CLK_OUT_1_MUX] = clk;
- clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0,
- pmc_base + PMC_CLK_OUT_CNTRL, 2, 0,
- &clk_out_lock);
- clk_register_clkdev(clk, "extern1", "clk_out_1");
- clks[TEGRA114_CLK_CLK_OUT_1] = clk;
-
- /* clk_out_2 */
- clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents,
- ARRAY_SIZE(clk_out2_parents), 0,
- pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0,
- &clk_out_lock);
- clks[TEGRA114_CLK_CLK_OUT_2_MUX] = clk;
- clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0,
- pmc_base + PMC_CLK_OUT_CNTRL, 10, 0,
- &clk_out_lock);
- clk_register_clkdev(clk, "extern2", "clk_out_2");
- clks[TEGRA114_CLK_CLK_OUT_2] = clk;
-
- /* clk_out_3 */
- clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents,
- ARRAY_SIZE(clk_out3_parents), 0,
- pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0,
- &clk_out_lock);
- clks[TEGRA114_CLK_CLK_OUT_3_MUX] = clk;
- clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0,
- pmc_base + PMC_CLK_OUT_CNTRL, 18, 0,
- &clk_out_lock);
- clk_register_clkdev(clk, "extern3", "clk_out_3");
- clks[TEGRA114_CLK_CLK_OUT_3] = clk;
+ data = &tegra_pmc_clk_init_data[i];
+
+ clk = clk_register_mux(NULL, data->mux_name, data->parents,
+ data->num_parents, 0,
+ pmc_base + PMC_CLK_OUT_CNTRL, data->mux_shift,
+ 3, 0, &clk_out_lock);
+ clks[data->mux_id] = clk;
+ clk = clk_register_gate(NULL, data->gate_name, data->mux_name,
+ 0, pmc_base + PMC_CLK_OUT_CNTRL,
+ data->gate_shift, 0, &clk_out_lock);
+ clks[data->gate_id] = clk;
+ clk_register_clkdev(clk, data->dev_name, data->gate_name);
+ }
/* blink */
/* clear the blink timer register to directly output clk_32k */
--
1.7.7.rc0.72.g4b5ea.dirty
next prev parent reply other threads:[~2013-09-04 14:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-04 14:20 [PATCH v2 0/4] Introduce table driven initializations Peter De Schrijver
2013-09-04 14:20 ` [PATCH v2 1/4] clk: tegra: simplify periph clock data Peter De Schrijver
2013-09-04 14:20 ` [PATCH v2 2/4] clk: tegra: convert Tegra114 gate clocks to table Peter De Schrijver
2013-09-04 14:20 ` [PATCH v2 3/4] clk: tegra114: table driven audio clock init Peter De Schrijver
2013-09-04 14:20 ` Peter De Schrijver [this message]
2013-09-04 20:11 ` [PATCH v2 0/4] Introduce table driven initializations 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=1378304438-7780-5-git-send-email-pdeschrijver@nvidia.com \
--to=pdeschrijver@nvidia.com \
--cc=josephl@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=pgaikwad@nvidia.com \
--cc=pwalmsley@nvidia.com \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
/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