aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Bailon <abailon@baylibre.com>2016-12-09 11:59:32 -0500
committerSekhar Nori <nsekhar@ti.com>2017-01-02 05:40:42 -0500
commit48cd30b49527f04078ef7de217cc188157f76ba6 (patch)
tree062d3553ca1d5467bdf92717a5c23c8848c070a9
parentef37427ac5677331145ab27a17e6f5f1b43f0c11 (diff)
ARM: davinci: Make __clk_{enable,disable} functions public
In some cases, there is a need to enable a clock as part of clock enable callback of a different clock. For example, USB 2.0 PHY clock enable requires USB 2.0 clock to be enabled. In this case, it is safe to instead call __clk_enable() since the clock framework lock is already taken. Calling clk_enable() causes recursive locking error. A similar case arises in the clock disable path. To enable such usage, make __clk_{enable,disable} functions publicly available outside of clock.c. Also, call them davinci_clk_{enable|disable} now to be consistent with how other davinci-specific clock functions are named. Note that these functions are not exported to drivers. They are meant for usage in platform specific clock management code. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Suggested-by: David Lechner <david@lechnology.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r--arch/arm/mach-davinci/clock.c12
-rw-r--r--arch/arm/mach-davinci/clock.h2
2 files changed, 8 insertions, 6 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index df42c93a93d6..f5dce9b4e617 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -31,10 +31,10 @@ static LIST_HEAD(clocks);
31static DEFINE_MUTEX(clocks_mutex); 31static DEFINE_MUTEX(clocks_mutex);
32static DEFINE_SPINLOCK(clockfw_lock); 32static DEFINE_SPINLOCK(clockfw_lock);
33 33
34static void __clk_enable(struct clk *clk) 34void davinci_clk_enable(struct clk *clk)
35{ 35{
36 if (clk->parent) 36 if (clk->parent)
37 __clk_enable(clk->parent); 37 davinci_clk_enable(clk->parent);
38 if (clk->usecount++ == 0) { 38 if (clk->usecount++ == 0) {
39 if (clk->flags & CLK_PSC) 39 if (clk->flags & CLK_PSC)
40 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, 40 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
@@ -44,7 +44,7 @@ static void __clk_enable(struct clk *clk)
44 } 44 }
45} 45}
46 46
47static void __clk_disable(struct clk *clk) 47void davinci_clk_disable(struct clk *clk)
48{ 48{
49 if (WARN_ON(clk->usecount == 0)) 49 if (WARN_ON(clk->usecount == 0))
50 return; 50 return;
@@ -56,7 +56,7 @@ static void __clk_disable(struct clk *clk)
56 clk->clk_disable(clk); 56 clk->clk_disable(clk);
57 } 57 }
58 if (clk->parent) 58 if (clk->parent)
59 __clk_disable(clk->parent); 59 davinci_clk_disable(clk->parent);
60} 60}
61 61
62int davinci_clk_reset(struct clk *clk, bool reset) 62int davinci_clk_reset(struct clk *clk, bool reset)
@@ -103,7 +103,7 @@ int clk_enable(struct clk *clk)
103 return -EINVAL; 103 return -EINVAL;
104 104
105 spin_lock_irqsave(&clockfw_lock, flags); 105 spin_lock_irqsave(&clockfw_lock, flags);
106 __clk_enable(clk); 106 davinci_clk_enable(clk);
107 spin_unlock_irqrestore(&clockfw_lock, flags); 107 spin_unlock_irqrestore(&clockfw_lock, flags);
108 108
109 return 0; 109 return 0;
@@ -118,7 +118,7 @@ void clk_disable(struct clk *clk)
118 return; 118 return;
119 119
120 spin_lock_irqsave(&clockfw_lock, flags); 120 spin_lock_irqsave(&clockfw_lock, flags);
121 __clk_disable(clk); 121 davinci_clk_disable(clk);
122 spin_unlock_irqrestore(&clockfw_lock, flags); 122 spin_unlock_irqrestore(&clockfw_lock, flags);
123} 123}
124EXPORT_SYMBOL(clk_disable); 124EXPORT_SYMBOL(clk_disable);
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index e2a5437a1aee..fa2b83752e03 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -132,6 +132,8 @@ int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate);
132int davinci_set_refclk_rate(unsigned long rate); 132int davinci_set_refclk_rate(unsigned long rate);
133int davinci_simple_set_rate(struct clk *clk, unsigned long rate); 133int davinci_simple_set_rate(struct clk *clk, unsigned long rate);
134int davinci_clk_reset(struct clk *clk, bool reset); 134int davinci_clk_reset(struct clk *clk, bool reset);
135void davinci_clk_enable(struct clk *clk);
136void davinci_clk_disable(struct clk *clk);
135 137
136extern struct platform_device davinci_wdt_device; 138extern struct platform_device davinci_wdt_device;
137extern void davinci_watchdog_reset(struct platform_device *); 139extern void davinci_watchdog_reset(struct platform_device *);