aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clock.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2006-01-17 18:31:18 -0500
committerTony Lindgren <tony@atomide.com>2006-01-17 18:31:18 -0500
commitfde0fd49419177ddd69254b8d532edde9ce6a543 (patch)
tree6d7f3cd6d3d6b1d97748d766e034a05b38ed22a0 /arch/arm/mach-omap2/clock.c
parent10b55794134b279e2ce37713972e324c0dd507ab (diff)
ARM: OMAP: 3/4 Fix clock framework to use clk_enable/disable for omap2
This patch fixes OMAP clock framework to use clk_enable/disable instead of clk_use/unuse as specified in include/linux/clk.h. Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/clock.c')
-rw-r--r--arch/arm/mach-omap2/clock.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 5407b9549150..180f675c9064 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -111,7 +111,7 @@ static void omap2_clk_fixed_enable(struct clk *clk)
111/* Enables clock without considering parent dependencies or use count 111/* Enables clock without considering parent dependencies or use count
112 * REVISIT: Maybe change this to use clk->enable like on omap1? 112 * REVISIT: Maybe change this to use clk->enable like on omap1?
113 */ 113 */
114static int omap2_clk_enable(struct clk * clk) 114static int _omap2_clk_enable(struct clk * clk)
115{ 115{
116 u32 regval32; 116 u32 regval32;
117 117
@@ -150,7 +150,7 @@ static void omap2_clk_fixed_disable(struct clk *clk)
150} 150}
151 151
152/* Disables clock without considering parent dependencies or use count */ 152/* Disables clock without considering parent dependencies or use count */
153static void omap2_clk_disable(struct clk *clk) 153static void _omap2_clk_disable(struct clk *clk)
154{ 154{
155 u32 regval32; 155 u32 regval32;
156 156
@@ -167,23 +167,23 @@ static void omap2_clk_disable(struct clk *clk)
167 __raw_writel(regval32, clk->enable_reg); 167 __raw_writel(regval32, clk->enable_reg);
168} 168}
169 169
170static int omap2_clk_use(struct clk *clk) 170static int omap2_clk_enable(struct clk *clk)
171{ 171{
172 int ret = 0; 172 int ret = 0;
173 173
174 if (clk->usecount++ == 0) { 174 if (clk->usecount++ == 0) {
175 if (likely((u32)clk->parent)) 175 if (likely((u32)clk->parent))
176 ret = omap2_clk_use(clk->parent); 176 ret = omap2_clk_enable(clk->parent);
177 177
178 if (unlikely(ret != 0)) { 178 if (unlikely(ret != 0)) {
179 clk->usecount--; 179 clk->usecount--;
180 return ret; 180 return ret;
181 } 181 }
182 182
183 ret = omap2_clk_enable(clk); 183 ret = _omap2_clk_enable(clk);
184 184
185 if (unlikely(ret != 0) && clk->parent) { 185 if (unlikely(ret != 0) && clk->parent) {
186 omap2_clk_unuse(clk->parent); 186 omap2_clk_disable(clk->parent);
187 clk->usecount--; 187 clk->usecount--;
188 } 188 }
189 } 189 }
@@ -191,12 +191,12 @@ static int omap2_clk_use(struct clk *clk)
191 return ret; 191 return ret;
192} 192}
193 193
194static void omap2_clk_unuse(struct clk *clk) 194static void omap2_clk_disable(struct clk *clk)
195{ 195{
196 if (clk->usecount > 0 && !(--clk->usecount)) { 196 if (clk->usecount > 0 && !(--clk->usecount)) {
197 omap2_clk_disable(clk); 197 _omap2_clk_disable(clk);
198 if (likely((u32)clk->parent)) 198 if (likely((u32)clk->parent))
199 omap2_clk_unuse(clk->parent); 199 omap2_clk_disable(clk->parent);
200 } 200 }
201} 201}
202 202
@@ -873,7 +873,7 @@ static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
873 reg = (void __iomem *)src_sel; 873 reg = (void __iomem *)src_sel;
874 874
875 if (clk->usecount > 0) 875 if (clk->usecount > 0)
876 omap2_clk_disable(clk); 876 _omap2_clk_disable(clk);
877 877
878 /* Set new source value (previous dividers if any in effect) */ 878 /* Set new source value (previous dividers if any in effect) */
879 reg_val = __raw_readl(reg) & ~(field_mask << src_off); 879 reg_val = __raw_readl(reg) & ~(field_mask << src_off);
@@ -884,7 +884,7 @@ static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
884 __raw_writel(0x1, (void __iomem *)&PRCM_CLKCFG_CTRL); 884 __raw_writel(0x1, (void __iomem *)&PRCM_CLKCFG_CTRL);
885 885
886 if (clk->usecount > 0) 886 if (clk->usecount > 0)
887 omap2_clk_enable(clk); 887 _omap2_clk_enable(clk);
888 888
889 clk->parent = new_parent; 889 clk->parent = new_parent;
890 890
@@ -999,8 +999,6 @@ static int omap2_select_table_rate(struct clk * clk, unsigned long rate)
999static struct clk_functions omap2_clk_functions = { 999static struct clk_functions omap2_clk_functions = {
1000 .clk_enable = omap2_clk_enable, 1000 .clk_enable = omap2_clk_enable,
1001 .clk_disable = omap2_clk_disable, 1001 .clk_disable = omap2_clk_disable,
1002 .clk_use = omap2_clk_use,
1003 .clk_unuse = omap2_clk_unuse,
1004 .clk_round_rate = omap2_clk_round_rate, 1002 .clk_round_rate = omap2_clk_round_rate,
1005 .clk_set_rate = omap2_clk_set_rate, 1003 .clk_set_rate = omap2_clk_set_rate,
1006 .clk_set_parent = omap2_clk_set_parent, 1004 .clk_set_parent = omap2_clk_set_parent,
@@ -1045,7 +1043,7 @@ static void __init omap2_disable_unused_clocks(void)
1045 continue; 1043 continue;
1046 1044
1047 printk(KERN_INFO "Disabling unused clock \"%s\"\n", ck->name); 1045 printk(KERN_INFO "Disabling unused clock \"%s\"\n", ck->name);
1048 omap2_clk_disable(ck); 1046 _omap2_clk_disable(ck);
1049 } 1047 }
1050} 1048}
1051late_initcall(omap2_disable_unused_clocks); 1049late_initcall(omap2_disable_unused_clocks);
@@ -1120,10 +1118,10 @@ int __init omap2_clk_init(void)
1120 * Only enable those clocks we will need, let the drivers 1118 * Only enable those clocks we will need, let the drivers
1121 * enable other clocks as necessary 1119 * enable other clocks as necessary
1122 */ 1120 */
1123 clk_use(&sync_32k_ick); 1121 clk_enable(&sync_32k_ick);
1124 clk_use(&omapctrl_ick); 1122 clk_enable(&omapctrl_ick);
1125 if (cpu_is_omap2430()) 1123 if (cpu_is_omap2430())
1126 clk_use(&sdrc_ick); 1124 clk_enable(&sdrc_ick);
1127 1125
1128 return 0; 1126 return 0;
1129} 1127}