aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2010-09-02 22:11:11 -0400
committerColin Cross <ccross@android.com>2011-02-21 02:36:49 -0500
commit2b84cb4faab698b1708ce841c554546b1c9b2261 (patch)
tree72429f0ab55dc3ec1e8b7b1a9c811b4b7c692892
parent375b19cd34ea9b1ab338deac20b4bd2c553bf57b (diff)
ARM: tegra: clock: enable clk reset for non-peripheral clocks
Add a new 'reset' clk op. This can be provided for any clock, not just peripherals. Signed-off-by: Dima Zavin <dima@android.com> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Colin Cross <ccross@android.com>
-rw-r--r--arch/arm/mach-tegra/clock.h1
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c29
2 files changed, 19 insertions, 11 deletions
diff --git a/arch/arm/mach-tegra/clock.h b/arch/arm/mach-tegra/clock.h
index 083a4cfc6cf0..42f00c0af0de 100644
--- a/arch/arm/mach-tegra/clock.h
+++ b/arch/arm/mach-tegra/clock.h
@@ -86,6 +86,7 @@ struct clk_ops {
86 int (*set_parent)(struct clk *, struct clk *); 86 int (*set_parent)(struct clk *, struct clk *);
87 int (*set_rate)(struct clk *, unsigned long); 87 int (*set_rate)(struct clk *, unsigned long);
88 long (*round_rate)(struct clk *, unsigned long); 88 long (*round_rate)(struct clk *, unsigned long);
89 void (*reset)(struct clk *, bool);
89}; 90};
90 91
91enum clk_state { 92enum clk_state {
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index 49b3edaca496..6442abe0120d 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -263,6 +263,18 @@ static struct clk_ops tegra_clk_m_ops = {
263 .disable = tegra2_clk_m_disable, 263 .disable = tegra2_clk_m_disable,
264}; 264};
265 265
266void tegra2_periph_reset_assert(struct clk *c)
267{
268 BUG_ON(!c->ops->reset);
269 c->ops->reset(c, true);
270}
271
272void tegra2_periph_reset_deassert(struct clk *c)
273{
274 BUG_ON(!c->ops->reset);
275 c->ops->reset(c, false);
276}
277
266/* super clock functions */ 278/* super clock functions */
267/* "super clocks" on tegra have two-stage muxes and a clock skipping 279/* "super clocks" on tegra have two-stage muxes and a clock skipping
268 * super divider. We will ignore the clock skipping divider, since we 280 * super divider. We will ignore the clock skipping divider, since we
@@ -895,23 +907,17 @@ static void tegra2_periph_clk_disable(struct clk *c)
895 CLK_OUT_ENB_CLR + PERIPH_CLK_TO_ENB_SET_REG(c)); 907 CLK_OUT_ENB_CLR + PERIPH_CLK_TO_ENB_SET_REG(c));
896} 908}
897 909
898void tegra2_periph_reset_deassert(struct clk *c) 910static void tegra2_periph_clk_reset(struct clk *c, bool assert)
899{ 911{
900 pr_debug("%s on clock %s\n", __func__, c->name); 912 unsigned long base = assert ? RST_DEVICES_SET : RST_DEVICES_CLR;
901 if (!(c->flags & PERIPH_NO_RESET))
902 clk_writel(PERIPH_CLK_TO_ENB_BIT(c),
903 RST_DEVICES_CLR + PERIPH_CLK_TO_ENB_SET_REG(c));
904}
905 913
906void tegra2_periph_reset_assert(struct clk *c) 914 pr_debug("%s %s on clock %s\n", __func__,
907{ 915 assert ? "assert" : "deassert", c->name);
908 pr_debug("%s on clock %s\n", __func__, c->name);
909 if (!(c->flags & PERIPH_NO_RESET)) 916 if (!(c->flags & PERIPH_NO_RESET))
910 clk_writel(PERIPH_CLK_TO_ENB_BIT(c), 917 clk_writel(PERIPH_CLK_TO_ENB_BIT(c),
911 RST_DEVICES_SET + PERIPH_CLK_TO_ENB_SET_REG(c)); 918 base + PERIPH_CLK_TO_ENB_SET_REG(c));
912} 919}
913 920
914
915static int tegra2_periph_clk_set_parent(struct clk *c, struct clk *p) 921static int tegra2_periph_clk_set_parent(struct clk *c, struct clk *p)
916{ 922{
917 u32 val; 923 u32 val;
@@ -1002,6 +1008,7 @@ static struct clk_ops tegra_periph_clk_ops = {
1002 .set_parent = &tegra2_periph_clk_set_parent, 1008 .set_parent = &tegra2_periph_clk_set_parent,
1003 .set_rate = &tegra2_periph_clk_set_rate, 1009 .set_rate = &tegra2_periph_clk_set_rate,
1004 .round_rate = &tegra2_periph_clk_round_rate, 1010 .round_rate = &tegra2_periph_clk_round_rate,
1011 .reset = &tegra2_periph_clk_reset,
1005}; 1012};
1006 1013
1007/* Clock doubler ops */ 1014/* Clock doubler ops */