aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-mxs/clock.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 14:44:15 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 14:44:15 -0800
commit979ecef5b89a8003902299566d9cdc08de34a3ee (patch)
tree2a695d557adab1dec5263f014789f5b59238bac8 /arch/arm/mach-mxs/clock.c
parente8cbce976050a9f874a8b07012ddeb9b9eb59603 (diff)
parent8c3b2296f1aa13d7504d2c09bc819cef3759562a (diff)
Merge tag 'clk' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
clock management changes for i.MX Another simple series related to clock management, this time only for imx. * tag 'clk' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: ARM: mxs: select HAVE_CLK_PREPARE for clock clk: add config option HAVE_CLK_PREPARE into Kconfig ASoC: mxs-saif: convert to clk_prepare/clk_unprepare video: mxsfb: convert to clk_prepare/clk_unprepare serial: mxs-auart: convert to clk_prepare/clk_unprepare net: flexcan: convert to clk_prepare/clk_unprepare mtd: gpmi-lib: convert to clk_prepare/clk_unprepare mmc: mxs-mmc: convert to clk_prepare/clk_unprepare dma: mxs-dma: convert to clk_prepare/clk_unprepare net: fec: add clk_prepare/clk_unprepare ARM: mxs: convert platform code to clk_prepare/clk_unprepare clk: add helper functions clk_prepare_enable and clk_disable_unprepare Fix up trivial conflicts in drivers/net/ethernet/freescale/fec.c due to commit 0ebafefcaa7a ("net: fec: add clk_prepare/clk_unprepare") clashing trivially with commit e163cc97f9ac ("net/fec: fix the .remove code").
Diffstat (limited to 'arch/arm/mach-mxs/clock.c')
-rw-r--r--arch/arm/mach-mxs/clock.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/arch/arm/mach-mxs/clock.c b/arch/arm/mach-mxs/clock.c
index a7093c88e6a..97a6f4acc6c 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)
return 0;
}
-/* This function increments the reference count on the clock and enables the
- * clock if not already enabled. The parent clock tree is recursively enabled
+/*
+ * The clk_enable/clk_disable could be called by drivers in atomic context,
+ * so they should not really hold mutex. Instead, clk_prepare/clk_unprepare
+ * can hold a mutex, as the pair will only be called in non-atomic context.
+ * Before migrating to common clk framework, we can have __clk_enable and
+ * __clk_disable called in clk_prepare/clk_unprepare with mutex held and
+ * leave clk_enable/clk_disable as the dummy functions.
*/
-int clk_enable(struct clk *clk)
+int clk_prepare(struct clk *clk)
{
int ret = 0;
@@ -90,13 +95,9 @@ int clk_enable(struct clk *clk)
return ret;
}
-EXPORT_SYMBOL(clk_enable);
+EXPORT_SYMBOL(clk_prepare);
-/* This function decrements the reference count on the clock and disables
- * the clock when reference count is 0. The parent clock tree is
- * recursively disabled
- */
-void clk_disable(struct clk *clk)
+void clk_unprepare(struct clk *clk)
{
if (clk == NULL || IS_ERR(clk))
return;
@@ -105,6 +106,18 @@ void clk_disable(struct clk *clk)
__clk_disable(clk);
mutex_unlock(&clocks_mutex);
}
+EXPORT_SYMBOL(clk_unprepare);
+
+int clk_enable(struct clk *clk)
+{
+ return 0;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+ /* nothing to do */
+}
EXPORT_SYMBOL(clk_disable);
/* Retrieve the *current* clock rate. If the clock itself
@@ -166,7 +179,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
return ret;
if (clk->usecount)
- clk_enable(parent);
+ clk_prepare_enable(parent);
mutex_lock(&clocks_mutex);
ret = clk->set_parent(clk, parent);