linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: markz@nvidia.com (Mark Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] clk: tegra: Add reset only clock node flag and COP
Date: Wed, 7 Aug 2013 19:25:06 +0800	[thread overview]
Message-ID: <1375874709-10438-2-git-send-email-markz@nvidia.com> (raw)
In-Reply-To: <1375874709-10438-1-git-send-email-markz@nvidia.com>

From: Peter De Schrijver <pdeschrijver@nvidia.com>

COP is a reset only clock. So this patch adds NO_CLK support
then adds the COP clock.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Mark Zhang <markz@nvidia.com>
---
 drivers/clk/tegra/clk-periph-gate.c |   15 +++++++++++++++
 drivers/clk/tegra/clk-tegra114.c    |    9 ++++++++-
 drivers/clk/tegra/clk.h             |    2 ++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-periph-gate.c b/drivers/clk/tegra/clk-periph-gate.c
index bafee98..092f256 100644
--- a/drivers/clk/tegra/clk-periph-gate.c
+++ b/drivers/clk/tegra/clk-periph-gate.c
@@ -51,6 +51,11 @@ static int clk_periph_is_enabled(struct clk_hw *hw)
 	struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
 	int state = 1;
 
+	if (gate->flags & TEGRA_PERIPH_NO_CLK) {
+		WARN_ON(1);
+		return 0;
+	}
+
 	if (!(read_enb(gate) & periph_clk_to_bit(gate)))
 		state = 0;
 
@@ -66,6 +71,11 @@ static int clk_periph_enable(struct clk_hw *hw)
 	struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
 	unsigned long flags = 0;
 
+	if (gate->flags & TEGRA_PERIPH_NO_CLK) {
+		WARN_ON(1);
+		return -EINVAL;
+	}
+
 	spin_lock_irqsave(&periph_ref_lock, flags);
 
 	gate->enable_refcnt[gate->clk_num]++;
@@ -102,6 +112,11 @@ static void clk_periph_disable(struct clk_hw *hw)
 	struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
 	unsigned long flags = 0;
 
+	if (gate->flags & TEGRA_PERIPH_NO_CLK) {
+		WARN_ON(1);
+		return;
+	}
+
 	spin_lock_irqsave(&periph_ref_lock, flags);
 
 	gate->enable_refcnt[gate->clk_num]--;
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c
index 71db736..7172faf 100644
--- a/drivers/clk/tegra/clk-tegra114.c
+++ b/drivers/clk/tegra/clk-tegra114.c
@@ -863,7 +863,7 @@ static unsigned long tegra114_input_freq[] = {
 			mux_d_audio_clk_idx, 0)
 
 enum tegra114_clk {
-	rtc = 4, timer = 5, uarta = 6, sdmmc2 = 9, i2s1 = 11, i2c1 = 12,
+	cop = 1, rtc = 4, timer = 5, uarta = 6, sdmmc2 = 9, i2s1 = 11, i2c1 = 12,
 	ndflash = 13, sdmmc1 = 14, sdmmc4 = 15, pwm = 17, i2s2 = 18, epp = 19,
 	gr_2d = 21, usbd = 22, isp = 23, gr_3d = 24, disp2 = 26, disp1 = 27,
 	host1x = 28, vcp = 29, i2s0 = 30, apbdma = 34, kbc = 36, kfuse = 40,
@@ -1921,6 +1921,13 @@ static __init void tegra114_periph_clk_init(void __iomem *clk_base)
 	int i;
 	u32 val;
 
+	/* cop */
+	clk = tegra_clk_register_periph_gate("cop", NULL, TEGRA_PERIPH_NO_CLK,
+						clk_base, CLK_IGNORE_UNUSED, 1,
+						&periph_l_regs,
+						periph_clk_enb_refcnt);
+	clks[cop] = clk;
+
 	/* apbdma */
 	clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base,
 				  0, 34, &periph_h_regs,
diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h
index 07cfacd..0124e11 100644
--- a/drivers/clk/tegra/clk.h
+++ b/drivers/clk/tegra/clk.h
@@ -375,6 +375,7 @@ struct tegra_clk_periph_regs {
  *     bus to flush the write operation in apb bus. This flag indicates
  *     that this peripheral is in apb bus.
  * TEGRA_PERIPH_WAR_1005168 - Apply workaround for Tegra114 MSENC bug
+ * TEGRA_PERIPH_NO_CLK - Reset only clock node
  */
 struct tegra_clk_periph_gate {
 	u32			magic;
@@ -395,6 +396,7 @@ struct tegra_clk_periph_gate {
 #define TEGRA_PERIPH_MANUAL_RESET BIT(1)
 #define TEGRA_PERIPH_ON_APB BIT(2)
 #define TEGRA_PERIPH_WAR_1005168 BIT(3)
+#define TEGRA_PERIPH_NO_CLK BIT(4)
 
 void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert);
 extern const struct clk_ops tegra_clk_periph_gate_ops;
-- 
1.7.9.5

  reply	other threads:[~2013-08-07 11:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07 11:25 [PATCH 1/5] clk: tegra: Correct sbc mux width & parent Mark Zhang
2013-08-07 11:25 ` Mark Zhang [this message]
2013-08-07 16:58   ` [PATCH 2/5] clk: tegra: Add reset only clock node flag and COP Stephen Warren
2013-08-08  5:50     ` Mark Zhang
2013-08-19 14:53     ` Peter De Schrijver
2013-08-19 16:25       ` Stephen Warren
2013-08-07 11:25 ` [PATCH 3/5] clk: tegra: Fix vde/2d/3d clock src offset Mark Zhang
2013-08-07 17:00   ` Stephen Warren
2013-08-20  8:47   ` Peter De Schrijver
2013-08-07 11:25 ` [PATCH 4/5] clk: tegra: Set the clock parent of gr2d/gr3d to pll_c2 Mark Zhang
2013-08-20  8:47   ` Peter De Schrijver
2013-08-07 11:25 ` [PATCH 5/5] clk: tegra: Set the clk parent of host1x to pll_p Mark Zhang
2013-08-07 16:56 ` [PATCH 1/5] clk: tegra: Correct sbc mux width & parent Stephen Warren
2013-08-08  1:26   ` Mark Zhang

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=1375874709-10438-2-git-send-email-markz@nvidia.com \
    --to=markz@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).