diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 17:44:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 17:44:15 -0500 |
commit | 979ecef5b89a8003902299566d9cdc08de34a3ee (patch) | |
tree | 2a695d557adab1dec5263f014789f5b59238bac8 /include | |
parent | e8cbce976050a9f874a8b07012ddeb9b9eb59603 (diff) | |
parent | 8c3b2296f1aa13d7504d2c09bc819cef3759562a (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 'include')
-rw-r--r-- | include/linux/clk.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h index 7213b52b2c0e..b9d46fa154b4 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk) | |||
107 | } | 107 | } |
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | /* clk_prepare_enable helps cases using clk_enable in non-atomic context. */ | ||
111 | static inline int clk_prepare_enable(struct clk *clk) | ||
112 | { | ||
113 | int ret; | ||
114 | |||
115 | ret = clk_prepare(clk); | ||
116 | if (ret) | ||
117 | return ret; | ||
118 | ret = clk_enable(clk); | ||
119 | if (ret) | ||
120 | clk_unprepare(clk); | ||
121 | |||
122 | return ret; | ||
123 | } | ||
124 | |||
125 | /* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */ | ||
126 | static inline void clk_disable_unprepare(struct clk *clk) | ||
127 | { | ||
128 | clk_disable(clk); | ||
129 | clk_unprepare(clk); | ||
130 | } | ||
131 | |||
110 | /** | 132 | /** |
111 | * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. | 133 | * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. |
112 | * This is only valid once the clock source has been enabled. | 134 | * This is only valid once the clock source has been enabled. |