aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
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
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')
-rw-r--r--arch/arm/mach-omap2/clock.c32
-rw-r--r--arch/arm/mach-omap2/clock.h12
2 files changed, 21 insertions, 23 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}
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 4aeab5591bd3..6cab20b1d3c1 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -24,7 +24,7 @@ static void omap2_propagate_rate(struct clk * clk);
24static void omap2_mpu_recalc(struct clk * clk); 24static void omap2_mpu_recalc(struct clk * clk);
25static int omap2_select_table_rate(struct clk * clk, unsigned long rate); 25static int omap2_select_table_rate(struct clk * clk, unsigned long rate);
26static long omap2_round_to_table_rate(struct clk * clk, unsigned long rate); 26static long omap2_round_to_table_rate(struct clk * clk, unsigned long rate);
27static void omap2_clk_unuse(struct clk *clk); 27static void omap2_clk_disable(struct clk *clk);
28static void omap2_sys_clk_recalc(struct clk * clk); 28static void omap2_sys_clk_recalc(struct clk * clk);
29static u32 omap2_clksel_to_divisor(u32 div_sel, u32 field_val); 29static u32 omap2_clksel_to_divisor(u32 div_sel, u32 field_val);
30static u32 omap2_clksel_get_divisor(struct clk *clk); 30static u32 omap2_clksel_get_divisor(struct clk *clk);
@@ -859,7 +859,7 @@ static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */
859 859
860static struct clk usb_l4_ick = { /* FS-USB interface clock */ 860static struct clk usb_l4_ick = { /* FS-USB interface clock */
861 .name = "usb_l4_ick", 861 .name = "usb_l4_ick",
862 .parent = &core_ck, 862 .parent = &core_l3_ck,
863 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 863 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
864 RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP | 864 RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP |
865 CONFIG_PARTICIPANT, 865 CONFIG_PARTICIPANT,
@@ -1045,7 +1045,7 @@ static struct clk gpt1_ick = {
1045 .name = "gpt1_ick", 1045 .name = "gpt1_ick",
1046 .parent = &l4_ck, 1046 .parent = &l4_ck,
1047 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1047 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1048 .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, /* Bit4 */ 1048 .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, /* Bit0 */
1049 .enable_bit = 0, 1049 .enable_bit = 0,
1050 .recalc = &omap2_followparent_recalc, 1050 .recalc = &omap2_followparent_recalc,
1051}; 1051};
@@ -1055,7 +1055,7 @@ static struct clk gpt1_fck = {
1055 .parent = &func_32k_ck, 1055 .parent = &func_32k_ck,
1056 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 1056 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
1057 CM_WKUP_SEL1, 1057 CM_WKUP_SEL1,
1058 .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, 1058 .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, /* Bit0 */
1059 .enable_bit = 0, 1059 .enable_bit = 0,
1060 .src_offset = 0, 1060 .src_offset = 0,
1061 .recalc = &omap2_followparent_recalc, 1061 .recalc = &omap2_followparent_recalc,
@@ -1065,7 +1065,7 @@ static struct clk gpt2_ick = {
1065 .name = "gpt2_ick", 1065 .name = "gpt2_ick",
1066 .parent = &l4_ck, 1066 .parent = &l4_ck,
1067 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1067 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1068 .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* bit4 */ 1068 .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* Bit4 */
1069 .enable_bit = 0, 1069 .enable_bit = 0,
1070 .recalc = &omap2_followparent_recalc, 1070 .recalc = &omap2_followparent_recalc,
1071}; 1071};
@@ -1839,7 +1839,7 @@ static struct clk usb_fck = {
1839 1839
1840static struct clk usbhs_ick = { 1840static struct clk usbhs_ick = {
1841 .name = "usbhs_ick", 1841 .name = "usbhs_ick",
1842 .parent = &l4_ck, 1842 .parent = &core_l3_ck,
1843 .flags = CLOCK_IN_OMAP243X, 1843 .flags = CLOCK_IN_OMAP243X,
1844 .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, 1844 .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE,
1845 .enable_bit = 6, 1845 .enable_bit = 6,