mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter De Schrijver <pdeschrijver@nvidia.com>
To: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Mike Turquette <mturquette@linaro.org>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Prashant Gaikwad <pgaikwad@nvidia.com>,
	Thierry Reding <thierry.reding@avionic-design.de>,
	Joseph Lo <josephl@nvidia.com>,
	Paul Walmsley <pwalmsley@nvidia.com>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-tegra@vger.kernel.org>
Subject: [PATCH v2 10/12] clk: tegra: move fixed clocks to common file
Date: Mon, 23 Sep 2013 17:25:02 +0300	[thread overview]
Message-ID: <1379946381-20125-11-git-send-email-pdeschrijver@nvidia.com> (raw)
In-Reply-To: <1379946381-20125-1-git-send-email-pdeschrijver@nvidia.com>

Introduce a new file for fixed clocks common between several Tegra
SoCs and move Tegra114 to this new infrastructure.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 drivers/clk/tegra/Makefile          |    1 +
 drivers/clk/tegra/clk-tegra-fixed.c |   62 +++++++++++++++++++++++++++++++++++
 drivers/clk/tegra/clk-tegra114.c    |   26 +--------------
 drivers/clk/tegra/clk.h             |    1 +
 4 files changed, 65 insertions(+), 25 deletions(-)
 create mode 100644 drivers/clk/tegra/clk-tegra-fixed.c

diff --git a/drivers/clk/tegra/Makefile b/drivers/clk/tegra/Makefile
index f415246..a02e9a9 100644
--- a/drivers/clk/tegra/Makefile
+++ b/drivers/clk/tegra/Makefile
@@ -9,6 +9,7 @@ obj-y					+= clk-super.o
 obj-y					+= clk-tegra-audio.o
 obj-y					+= clk-tegra-periph.o
 obj-y					+= clk-tegra-pmc.o
+obj-y					+= clk-tegra-fixed.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += clk-tegra20.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)         += clk-tegra30.o
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= clk-tegra114.o
diff --git a/drivers/clk/tegra/clk-tegra-fixed.c b/drivers/clk/tegra/clk-tegra-fixed.c
new file mode 100644
index 0000000..252d710
--- /dev/null
+++ b/drivers/clk/tegra/clk-tegra-fixed.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2012, 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+void __init tegra_fixed_clk_init(struct tegra_clk *tegra_clks)
+{
+	struct clk *clk;
+	struct clk **dt_clk;
+
+	/* clk_32k */
+	dt_clk = tegra_lookup_dt_id(tegra_clk_clk_32k, tegra_clks);
+	if (dt_clk) {
+		clk = clk_register_fixed_rate(NULL, "clk_32k", NULL,
+					CLK_IS_ROOT, 32768);
+		clk_register_clkdev(clk, "clk_32k", NULL);
+		*dt_clk = clk;
+	}
+
+	/* clk_m_div2 */
+	dt_clk = tegra_lookup_dt_id(tegra_clk_clk_m_div2, tegra_clks);
+	if (dt_clk) {
+		clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m",
+					CLK_SET_RATE_PARENT, 1, 2);
+		clk_register_clkdev(clk, "clk_m_div2", NULL);
+		*dt_clk = clk;
+	}
+
+	/* clk_m_div4 */
+	dt_clk = tegra_lookup_dt_id(tegra_clk_clk_m_div4, tegra_clks);
+	if (dt_clk) {
+		clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m",
+					CLK_SET_RATE_PARENT, 1, 4);
+		clk_register_clkdev(clk, "clk_m_div4", NULL);
+		*dt_clk = clk;
+	}
+}
+
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c
index 19cd57b..2598477 100644
--- a/drivers/clk/tegra/clk-tegra114.c
+++ b/drivers/clk/tegra/clk-tegra114.c
@@ -827,30 +827,6 @@ static int __init tegra114_osc_clk_init(void __iomem *clk_base)
 	return 0;
 }
 
-static void __init tegra114_fixed_clk_init(void __iomem *clk_base)
-{
-	struct clk *clk;
-
-	/* clk_32k */
-	clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT,
-				      32768);
-	clk_register_clkdev(clk, "clk_32k", NULL);
-	clks[TEGRA114_CLK_CLK_32K] = clk;
-
-	/* clk_m_div2 */
-	clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m",
-					CLK_SET_RATE_PARENT, 1, 2);
-	clk_register_clkdev(clk, "clk_m_div2", NULL);
-	clks[TEGRA114_CLK_CLK_M_DIV2] = clk;
-
-	/* clk_m_div4 */
-	clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m",
-					CLK_SET_RATE_PARENT, 1, 4);
-	clk_register_clkdev(clk, "clk_m_div4", NULL);
-	clks[TEGRA114_CLK_CLK_M_DIV4] = clk;
-
-}
-
 static __init void tegra114_utmi_param_configure(void __iomem *clk_base)
 {
 	u32 reg;
@@ -1434,7 +1410,7 @@ static void __init tegra114_clock_init(struct device_node *np)
 	if (tegra114_osc_clk_init(clk_base) < 0)
 		return;
 
-	tegra114_fixed_clk_init(clk_base);
+	tegra_fixed_clk_init(tegra114_clks);
 	tegra114_pll_init(clk_base, pmc_base);
 	tegra114_periph_clk_init(clk_base, pmc_base);
 	tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks, NULL);
diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h
index 3ce60c2..1f24f2a 100644
--- a/drivers/clk/tegra/clk.h
+++ b/drivers/clk/tegra/clk.h
@@ -609,6 +609,7 @@ void tegra_audio_clk_init(void __iomem *clk_base,
 void tegra_periph_clk_init(void __iomem *clk_base, void __iomem *pmc_base,
 			struct tegra_clk *tegra_clks);
 void tegra_pmc_clk_init(void __iomem *pmc_base, struct tegra_clk *tegra_clks);
+void tegra_fixed_clk_init(struct tegra_clk *tegra_clks);
 
 void tegra114_clock_tune_cpu_trimmers_high(void);
 void tegra114_clock_tune_cpu_trimmers_low(void);
-- 
1.7.7.rc0.72.g4b5ea.dirty


  parent reply	other threads:[~2013-09-23 14:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23 14:24 [PATCH v2 00/12] Introduce common infra for tegra clocks Peter De Schrijver
2013-09-23 14:24 ` [PATCH v2 01/12] clk: tegra: simplify periph clock data Peter De Schrijver
2013-09-23 14:24 ` [PATCH v2 02/12] clk: tegra: common periph_clk_enb_refcnt and clks Peter De Schrijver
2013-09-23 14:24 ` [PATCH v2 03/12] clk: tegra: Add TEGRA_PERIPH_NO_DIV flag Peter De Schrijver
2013-09-23 14:24 ` [PATCH v2 04/12] clk: tegra: move some PLLC and PLLXC init to clk-pll.c Peter De Schrijver
2013-09-23 14:24 ` [PATCH v2 05/12] clk: tegra: add header for common tegra clock IDs Peter De Schrijver
2013-09-23 14:24 ` [PATCH v2 06/12] clk: tegra: add common infra for DT clocks Peter De Schrijver
2013-09-23 14:24 ` [PATCH v2 07/12] clk: tegra: move audio clk to common file Peter De Schrijver
2013-09-23 14:25 ` [PATCH v2 08/12] clk: tegra: move periph clocks " Peter De Schrijver
2013-09-23 14:25 ` [PATCH v2 09/12] clk: tegra: move PMC " Peter De Schrijver
2013-09-23 14:25 ` Peter De Schrijver [this message]
2013-09-23 14:25 ` [PATCH v2 11/12] clk: tegra: introduce common tegra_osc_clk_init Peter De Schrijver
2013-09-23 14:25 ` [PATCH v2 12/12] clk: tegra: introduce common gen4 super clock Peter De Schrijver
2013-10-01 17:39 ` [PATCH v2 00/12] Introduce common infra for tegra clocks Stephen Warren
2013-10-03  9:16   ` Peter De Schrijver

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=1379946381-20125-11-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@avionic-design.de \
    /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®