aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2011-12-20 03:12:34 -0500
committerShawn Guo <shawn.guo@linaro.org>2011-12-28 08:35:08 -0500
commit6abda3e129bfe4d74b5c274da7dff0e2b1488818 (patch)
treef9fd67a5c38101d9d1af3e2d858fadd4d19527cc
parent5c77f5608a5081632b9530e5f3260f8b63247bd8 (diff)
ARM: mxs: select HAVE_CLK_PREPARE for clock
This patch adds clk_prepare/clk_unprepare for mxs clock api by renaming the existing non-atomic clk_enable/clk_disable to clk_prepare/clk_unprepare and adding a pair of dummy clk_enable/clk_disable. Then with selecting HAVE_CLK_PREPARE for mxs clock, we can fix the mutex locking warning that has been reported for a few times. Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-mxs/clock.c31
2 files changed, 23 insertions, 9 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 776d76b8cb69..dc461637e778 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -442,6 +442,7 @@ config ARCH_MXS
442 select ARCH_REQUIRE_GPIOLIB 442 select ARCH_REQUIRE_GPIOLIB
443 select CLKDEV_LOOKUP 443 select CLKDEV_LOOKUP
444 select CLKSRC_MMIO 444 select CLKSRC_MMIO
445 select HAVE_CLK_PREPARE
445 help 446 help
446 Support for Freescale MXS-based family of processors 447 Support for Freescale MXS-based family of processors
447 448
diff --git a/arch/arm/mach-mxs/clock.c b/arch/arm/mach-mxs/clock.c
index 755eec0b5a89..97a6f4acc6cc 100644
--- a/arch/arm/mach-mxs/clock.c
+++ b/arch/arm/mach-mxs/clock.c
@@ -74,10 +74,15 @@ static int __clk_enable(struct clk *clk)
74 return 0; 74 return 0;
75} 75}
76 76
77/* This function increments the reference count on the clock and enables the 77/*
78 * clock if not already enabled. The parent clock tree is recursively enabled 78 * The clk_enable/clk_disable could be called by drivers in atomic context,
79 * so they should not really hold mutex. Instead, clk_prepare/clk_unprepare
80 * can hold a mutex, as the pair will only be called in non-atomic context.
81 * Before migrating to common clk framework, we can have __clk_enable and
82 * __clk_disable called in clk_prepare/clk_unprepare with mutex held and
83 * leave clk_enable/clk_disable as the dummy functions.
79 */ 84 */
80int clk_enable(struct clk *clk) 85int clk_prepare(struct clk *clk)
81{ 86{
82 int ret = 0; 87 int ret = 0;
83 88
@@ -90,13 +95,9 @@ int clk_enable(struct clk *clk)
90 95
91 return ret; 96 return ret;
92} 97}
93EXPORT_SYMBOL(clk_enable); 98EXPORT_SYMBOL(clk_prepare);
94 99
95/* This function decrements the reference count on the clock and disables 100void clk_unprepare(struct clk *clk)
96 * the clock when reference count is 0. The parent clock tree is
97 * recursively disabled
98 */
99void clk_disable(struct clk *clk)
100{ 101{
101 if (clk == NULL || IS_ERR(clk)) 102 if (clk == NULL || IS_ERR(clk))
102 return; 103 return;
@@ -105,6 +106,18 @@ void clk_disable(struct clk *clk)
105 __clk_disable(clk); 106 __clk_disable(clk);
106 mutex_unlock(&clocks_mutex); 107 mutex_unlock(&clocks_mutex);
107} 108}
109EXPORT_SYMBOL(clk_unprepare);
110
111int clk_enable(struct clk *clk)
112{
113 return 0;
114}
115EXPORT_SYMBOL(clk_enable);
116
117void clk_disable(struct clk *clk)
118{
119 /* nothing to do */
120}
108EXPORT_SYMBOL(clk_disable); 121EXPORT_SYMBOL(clk_disable);
109 122
110/* Retrieve the *current* clock rate. If the clock itself 123/* Retrieve the *current* clock rate. If the clock itself