aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter De Schrijver <pdeschrijver@nvidia.com>2013-09-02 11:43:56 -0400
committerPeter De Schrijver <pdeschrijver@nvidia.com>2013-11-26 11:46:20 -0500
commit5bb9d26700c3db54d5a4346c3b6621b8889f3813 (patch)
treee2a25e11c91601efe56ce027b7b11b45fab35177
parent343a607cb79259429afbb9820bf524d33084e66c (diff)
clk: tegra: Add TEGRA_PERIPH_NO_DIV flag
This flag indicates the peripheral clock does not have a divider. It will simplify the initialization tables and avoids some very similar code. Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
-rw-r--r--drivers/clk/tegra/clk-periph.c11
-rw-r--r--drivers/clk/tegra/clk.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index 5102d5e58c04..b5feccca2f1e 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -173,12 +173,16 @@ const struct clk_ops tegra_clk_periph_nodiv_ops = {
173static struct clk *_tegra_clk_register_periph(const char *name, 173static struct clk *_tegra_clk_register_periph(const char *name,
174 const char **parent_names, int num_parents, 174 const char **parent_names, int num_parents,
175 struct tegra_clk_periph *periph, 175 struct tegra_clk_periph *periph,
176 void __iomem *clk_base, u32 offset, bool div, 176 void __iomem *clk_base, u32 offset,
177 unsigned long flags) 177 unsigned long flags)
178{ 178{
179 struct clk *clk; 179 struct clk *clk;
180 struct clk_init_data init; 180 struct clk_init_data init;
181 struct tegra_clk_periph_regs *bank; 181 struct tegra_clk_periph_regs *bank;
182 bool div = !(periph->gate.flags & TEGRA_PERIPH_NO_DIV);
183
184 flags |= periph->gate.flags & TEGRA_PERIPH_NO_DIV ?
185 CLK_SET_RATE_PARENT : 0;
182 186
183 init.name = name; 187 init.name = name;
184 init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops; 188 init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops;
@@ -216,7 +220,7 @@ struct clk *tegra_clk_register_periph(const char *name,
216 u32 offset, unsigned long flags) 220 u32 offset, unsigned long flags)
217{ 221{
218 return _tegra_clk_register_periph(name, parent_names, num_parents, 222 return _tegra_clk_register_periph(name, parent_names, num_parents,
219 periph, clk_base, offset, true, flags); 223 periph, clk_base, offset, flags);
220} 224}
221 225
222struct clk *tegra_clk_register_periph_nodiv(const char *name, 226struct clk *tegra_clk_register_periph_nodiv(const char *name,
@@ -224,6 +228,7 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name,
224 struct tegra_clk_periph *periph, void __iomem *clk_base, 228 struct tegra_clk_periph *periph, void __iomem *clk_base,
225 u32 offset) 229 u32 offset)
226{ 230{
231 periph->gate.flags |= TEGRA_PERIPH_NO_DIV;
227 return _tegra_clk_register_periph(name, parent_names, num_parents, 232 return _tegra_clk_register_periph(name, parent_names, num_parents,
228 periph, clk_base, offset, false, CLK_SET_RATE_PARENT); 233 periph, clk_base, offset, CLK_SET_RATE_PARENT);
229} 234}
diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h
index 997357ef059e..a82672084718 100644
--- a/drivers/clk/tegra/clk.h
+++ b/drivers/clk/tegra/clk.h
@@ -397,6 +397,7 @@ struct tegra_clk_periph_gate {
397#define TEGRA_PERIPH_MANUAL_RESET BIT(1) 397#define TEGRA_PERIPH_MANUAL_RESET BIT(1)
398#define TEGRA_PERIPH_ON_APB BIT(2) 398#define TEGRA_PERIPH_ON_APB BIT(2)
399#define TEGRA_PERIPH_WAR_1005168 BIT(3) 399#define TEGRA_PERIPH_WAR_1005168 BIT(3)
400#define TEGRA_PERIPH_NO_DIV BIT(4)
400 401
401void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert); 402void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert);
402extern const struct clk_ops tegra_clk_periph_gate_ops; 403extern const struct clk_ops tegra_clk_periph_gate_ops;