]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
arm/tegra: prepare clock code for multiple tegra variants
authorPeter De Schrijver <pdeschrijver@nvidia.com>
Wed, 14 Dec 2011 15:03:15 +0000 (17:03 +0200)
committerOlof Johansson <olof@lixom.net>
Sun, 18 Dec 2011 04:14:45 +0000 (20:14 -0800)
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>
arch/arm/mach-tegra/clock.c
arch/arm/mach-tegra/clock.h
arch/arm/mach-tegra/include/mach/clk.h
arch/arm/mach-tegra/tegra2_clocks.c

index f8d41ffc0ca984a5685f8ed5975b27c8c513e5c1..a8f359d8ae174f1bec4e7bb0a9f3ea61e708dc30 100644 (file)
@@ -387,13 +387,15 @@ EXPORT_SYMBOL(tegra_clk_init_from_table);
 
 void tegra_periph_reset_deassert(struct clk *c)
 {
-       tegra2_periph_reset_deassert(c);
+       BUG_ON(!c->ops->reset);
+       c->ops->reset(c, false);
 }
 EXPORT_SYMBOL(tegra_periph_reset_deassert);
 
 void tegra_periph_reset_assert(struct clk *c)
 {
-       tegra2_periph_reset_assert(c);
+       BUG_ON(!c->ops->reset);
+       c->ops->reset(c, true);
 }
 EXPORT_SYMBOL(tegra_periph_reset_assert);
 
@@ -402,20 +404,6 @@ void __init tegra_init_clock(void)
        tegra2_init_clocks();
 }
 
-/*
- * The SDMMC controllers have extra bits in the clock source register that
- * adjust the delay between the clock and data to compenstate for delays
- * on the PCB.
- */
-void tegra_sdmmc_tap_delay(struct clk *c, int delay)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&c->spinlock, flags);
-       tegra2_sdmmc_tap_delay(c, delay);
-       spin_unlock_irqrestore(&c->spinlock, flags);
-}
-
 #ifdef CONFIG_DEBUG_FS
 
 static int __clk_lock_all_spinlocks(void)
index 688316abc64e6a272fa59e33ae4bc1f7e79549f2..8c18e81a9f56d976866dc0d0c366545b269ea0aa 100644 (file)
@@ -146,8 +146,6 @@ struct tegra_clk_init_table {
 };
 
 void tegra2_init_clocks(void);
-void tegra2_periph_reset_deassert(struct clk *c);
-void tegra2_periph_reset_assert(struct clk *c);
 void clk_init(struct clk *clk);
 struct clk *tegra_get_clock_by_name(const char *name);
 unsigned long clk_measure_input_freq(void);
@@ -155,6 +153,5 @@ int clk_reparent(struct clk *c, struct clk *parent);
 void tegra_clk_init_from_table(struct tegra_clk_init_table *table);
 unsigned long clk_get_rate_locked(struct clk *c);
 int clk_set_rate_locked(struct clk *c, unsigned long rate);
-void tegra2_sdmmc_tap_delay(struct clk *c, int delay);
 
 #endif
index c8baf8f80d234aeaa7ae3377b1b1edd09c229506..fc3ecb66de08607a938cb23d45190ac32263a6a2 100644 (file)
@@ -26,6 +26,6 @@ void tegra_periph_reset_deassert(struct clk *c);
 void tegra_periph_reset_assert(struct clk *c);
 
 unsigned long clk_get_rate_all_locked(struct clk *c);
-void tegra_sdmmc_tap_delay(struct clk *c, int delay);
+void tegra2_sdmmc_tap_delay(struct clk *c, int delay);
 
 #endif
index 371869d8ea01f1c63a4125dc8cccd0a3022b577d..c78abab86253abb5dd8c31a96797617925a5ff2f 100644 (file)
@@ -278,18 +278,6 @@ static struct clk_ops tegra_clk_m_ops = {
        .disable        = tegra2_clk_m_disable,
 };
 
-void tegra2_periph_reset_assert(struct clk *c)
-{
-       BUG_ON(!c->ops->reset);
-       c->ops->reset(c, true);
-}
-
-void tegra2_periph_reset_deassert(struct clk *c)
-{
-       BUG_ON(!c->ops->reset);
-       c->ops->reset(c, false);
-}
-
 /* super clock functions */
 /* "super clocks" on tegra have two-stage muxes and a clock skipping
  * super divider.  We will ignore the clock skipping divider, since we
@@ -1132,6 +1120,9 @@ static struct clk_ops tegra_periph_clk_ops = {
 void tegra2_sdmmc_tap_delay(struct clk *c, int delay)
 {
        u32 reg;
+       unsigned long flags;
+
+       spin_lock_irqsave(&c->spinlock, flags);
 
        delay = clamp(delay, 0, 15);
        reg = clk_readl(c->reg);
@@ -1139,6 +1130,8 @@ void tegra2_sdmmc_tap_delay(struct clk *c, int delay)
        reg |= SDMMC_CLK_INT_FB_SEL;
        reg |= delay << SDMMC_CLK_INT_FB_DLY_SHIFT;
        clk_writel(reg, c->reg);
+
+       spin_unlock_irqrestore(&c->spinlock, flags);
 }
 
 /* External memory controller clock ops */