diff options
author | Peter De Schrijver <pdeschrijver@nvidia.com> | 2011-12-14 10:03:15 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2011-12-17 23:14:45 -0500 |
commit | 742face03f57727b5a86d0df631e47a1ef0498d2 (patch) | |
tree | bd0623063ba085b19a70e8337cb045519b5d0f08 /arch | |
parent | b2bbbc4d5bfde68d4a2b45ee8592d012826ffa70 (diff) |
arm/tegra: prepare clock code for multiple tegra variants
Rework the tegra20 clock code to support multiple tegra variants :
* remove tegra2_periph_reset_assert/tegra2_periph_reset_deassert. This
functionality should be in clock.c.
* remove tegra_sdmmc_tap_delay and export tegra2_sdmmc_tap_delay
directly. This feature is handled inside the sdmmc block from tegra30
onwards. So there is no need for support in the clock code beyond
tegra20. There are no in tree users of this function.
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/clock.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-tegra/clock.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/clk.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra2_clocks.c | 17 |
4 files changed, 10 insertions, 32 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index f8d41ffc0ca9..a8f359d8ae17 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c | |||
@@ -387,13 +387,15 @@ EXPORT_SYMBOL(tegra_clk_init_from_table); | |||
387 | 387 | ||
388 | void tegra_periph_reset_deassert(struct clk *c) | 388 | void tegra_periph_reset_deassert(struct clk *c) |
389 | { | 389 | { |
390 | tegra2_periph_reset_deassert(c); | 390 | BUG_ON(!c->ops->reset); |
391 | c->ops->reset(c, false); | ||
391 | } | 392 | } |
392 | EXPORT_SYMBOL(tegra_periph_reset_deassert); | 393 | EXPORT_SYMBOL(tegra_periph_reset_deassert); |
393 | 394 | ||
394 | void tegra_periph_reset_assert(struct clk *c) | 395 | void tegra_periph_reset_assert(struct clk *c) |
395 | { | 396 | { |
396 | tegra2_periph_reset_assert(c); | 397 | BUG_ON(!c->ops->reset); |
398 | c->ops->reset(c, true); | ||
397 | } | 399 | } |
398 | EXPORT_SYMBOL(tegra_periph_reset_assert); | 400 | EXPORT_SYMBOL(tegra_periph_reset_assert); |
399 | 401 | ||
@@ -402,20 +404,6 @@ void __init tegra_init_clock(void) | |||
402 | tegra2_init_clocks(); | 404 | tegra2_init_clocks(); |
403 | } | 405 | } |
404 | 406 | ||
405 | /* | ||
406 | * The SDMMC controllers have extra bits in the clock source register that | ||
407 | * adjust the delay between the clock and data to compenstate for delays | ||
408 | * on the PCB. | ||
409 | */ | ||
410 | void tegra_sdmmc_tap_delay(struct clk *c, int delay) | ||
411 | { | ||
412 | unsigned long flags; | ||
413 | |||
414 | spin_lock_irqsave(&c->spinlock, flags); | ||
415 | tegra2_sdmmc_tap_delay(c, delay); | ||
416 | spin_unlock_irqrestore(&c->spinlock, flags); | ||
417 | } | ||
418 | |||
419 | #ifdef CONFIG_DEBUG_FS | 407 | #ifdef CONFIG_DEBUG_FS |
420 | 408 | ||
421 | static int __clk_lock_all_spinlocks(void) | 409 | static int __clk_lock_all_spinlocks(void) |
diff --git a/arch/arm/mach-tegra/clock.h b/arch/arm/mach-tegra/clock.h index 688316abc64e..8c18e81a9f56 100644 --- a/arch/arm/mach-tegra/clock.h +++ b/arch/arm/mach-tegra/clock.h | |||
@@ -146,8 +146,6 @@ struct tegra_clk_init_table { | |||
146 | }; | 146 | }; |
147 | 147 | ||
148 | void tegra2_init_clocks(void); | 148 | void tegra2_init_clocks(void); |
149 | void tegra2_periph_reset_deassert(struct clk *c); | ||
150 | void tegra2_periph_reset_assert(struct clk *c); | ||
151 | void clk_init(struct clk *clk); | 149 | void clk_init(struct clk *clk); |
152 | struct clk *tegra_get_clock_by_name(const char *name); | 150 | struct clk *tegra_get_clock_by_name(const char *name); |
153 | unsigned long clk_measure_input_freq(void); | 151 | unsigned long clk_measure_input_freq(void); |
@@ -155,6 +153,5 @@ int clk_reparent(struct clk *c, struct clk *parent); | |||
155 | void tegra_clk_init_from_table(struct tegra_clk_init_table *table); | 153 | void tegra_clk_init_from_table(struct tegra_clk_init_table *table); |
156 | unsigned long clk_get_rate_locked(struct clk *c); | 154 | unsigned long clk_get_rate_locked(struct clk *c); |
157 | int clk_set_rate_locked(struct clk *c, unsigned long rate); | 155 | int clk_set_rate_locked(struct clk *c, unsigned long rate); |
158 | void tegra2_sdmmc_tap_delay(struct clk *c, int delay); | ||
159 | 156 | ||
160 | #endif | 157 | #endif |
diff --git a/arch/arm/mach-tegra/include/mach/clk.h b/arch/arm/mach-tegra/include/mach/clk.h index c8baf8f80d23..fc3ecb66de08 100644 --- a/arch/arm/mach-tegra/include/mach/clk.h +++ b/arch/arm/mach-tegra/include/mach/clk.h | |||
@@ -26,6 +26,6 @@ void tegra_periph_reset_deassert(struct clk *c); | |||
26 | void tegra_periph_reset_assert(struct clk *c); | 26 | void tegra_periph_reset_assert(struct clk *c); |
27 | 27 | ||
28 | unsigned long clk_get_rate_all_locked(struct clk *c); | 28 | unsigned long clk_get_rate_all_locked(struct clk *c); |
29 | void tegra_sdmmc_tap_delay(struct clk *c, int delay); | 29 | void tegra2_sdmmc_tap_delay(struct clk *c, int delay); |
30 | 30 | ||
31 | #endif | 31 | #endif |
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c index 371869d8ea01..c78abab86253 100644 --- a/arch/arm/mach-tegra/tegra2_clocks.c +++ b/arch/arm/mach-tegra/tegra2_clocks.c | |||
@@ -278,18 +278,6 @@ static struct clk_ops tegra_clk_m_ops = { | |||
278 | .disable = tegra2_clk_m_disable, | 278 | .disable = tegra2_clk_m_disable, |
279 | }; | 279 | }; |
280 | 280 | ||
281 | void tegra2_periph_reset_assert(struct clk *c) | ||
282 | { | ||
283 | BUG_ON(!c->ops->reset); | ||
284 | c->ops->reset(c, true); | ||
285 | } | ||
286 | |||
287 | void tegra2_periph_reset_deassert(struct clk *c) | ||
288 | { | ||
289 | BUG_ON(!c->ops->reset); | ||
290 | c->ops->reset(c, false); | ||
291 | } | ||
292 | |||
293 | /* super clock functions */ | 281 | /* super clock functions */ |
294 | /* "super clocks" on tegra have two-stage muxes and a clock skipping | 282 | /* "super clocks" on tegra have two-stage muxes and a clock skipping |
295 | * super divider. We will ignore the clock skipping divider, since we | 283 | * super divider. We will ignore the clock skipping divider, since we |
@@ -1132,6 +1120,9 @@ static struct clk_ops tegra_periph_clk_ops = { | |||
1132 | void tegra2_sdmmc_tap_delay(struct clk *c, int delay) | 1120 | void tegra2_sdmmc_tap_delay(struct clk *c, int delay) |
1133 | { | 1121 | { |
1134 | u32 reg; | 1122 | u32 reg; |
1123 | unsigned long flags; | ||
1124 | |||
1125 | spin_lock_irqsave(&c->spinlock, flags); | ||
1135 | 1126 | ||
1136 | delay = clamp(delay, 0, 15); | 1127 | delay = clamp(delay, 0, 15); |
1137 | reg = clk_readl(c->reg); | 1128 | reg = clk_readl(c->reg); |
@@ -1139,6 +1130,8 @@ void tegra2_sdmmc_tap_delay(struct clk *c, int delay) | |||
1139 | reg |= SDMMC_CLK_INT_FB_SEL; | 1130 | reg |= SDMMC_CLK_INT_FB_SEL; |
1140 | reg |= delay << SDMMC_CLK_INT_FB_DLY_SHIFT; | 1131 | reg |= delay << SDMMC_CLK_INT_FB_DLY_SHIFT; |
1141 | clk_writel(reg, c->reg); | 1132 | clk_writel(reg, c->reg); |
1133 | |||
1134 | spin_unlock_irqrestore(&c->spinlock, flags); | ||
1142 | } | 1135 | } |
1143 | 1136 | ||
1144 | /* External memory controller clock ops */ | 1137 | /* External memory controller clock ops */ |