aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris BREZILLON <b.brezillon@overkiz.com>2013-10-02 08:35:20 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2013-10-03 10:28:23 -0400
commit0e746ec55812a2f8f5ab986aeedd5291e3b6fad4 (patch)
tree7faca507c2a8244b40d7b58e9b98bc5c1b35b31f
parent191124efb4d6e5e47fe073b4b97350873523e88c (diff)
clocksource: tcb_clksrc: Replace clk_enable/disable with clk_prepare_enable/disable_unprepare
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings. Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--drivers/clocksource/tcb_clksrc.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index 8a6187225dd0..048156291fa0 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -100,7 +100,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
100 || tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) { 100 || tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) {
101 __raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR)); 101 __raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR));
102 __raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR)); 102 __raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR));
103 clk_disable(tcd->clk); 103 clk_disable_unprepare(tcd->clk);
104 } 104 }
105 105
106 switch (m) { 106 switch (m) {
@@ -109,7 +109,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
109 * of oneshot, we get lower overhead and improved accuracy. 109 * of oneshot, we get lower overhead and improved accuracy.
110 */ 110 */
111 case CLOCK_EVT_MODE_PERIODIC: 111 case CLOCK_EVT_MODE_PERIODIC:
112 clk_enable(tcd->clk); 112 clk_prepare_enable(tcd->clk);
113 113
114 /* slow clock, count up to RC, then irq and restart */ 114 /* slow clock, count up to RC, then irq and restart */
115 __raw_writel(timer_clock 115 __raw_writel(timer_clock
@@ -126,7 +126,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
126 break; 126 break;
127 127
128 case CLOCK_EVT_MODE_ONESHOT: 128 case CLOCK_EVT_MODE_ONESHOT:
129 clk_enable(tcd->clk); 129 clk_prepare_enable(tcd->clk);
130 130
131 /* slow clock, count up to RC, then irq and stop */ 131 /* slow clock, count up to RC, then irq and stop */
132 __raw_writel(timer_clock | ATMEL_TC_CPCSTOP 132 __raw_writel(timer_clock | ATMEL_TC_CPCSTOP
@@ -265,6 +265,7 @@ static int __init tcb_clksrc_init(void)
265 int best_divisor_idx = -1; 265 int best_divisor_idx = -1;
266 int clk32k_divisor_idx = -1; 266 int clk32k_divisor_idx = -1;
267 int i; 267 int i;
268 int ret;
268 269
269 tc = atmel_tc_alloc(CONFIG_ATMEL_TCB_CLKSRC_BLOCK, clksrc.name); 270 tc = atmel_tc_alloc(CONFIG_ATMEL_TCB_CLKSRC_BLOCK, clksrc.name);
270 if (!tc) { 271 if (!tc) {
@@ -275,7 +276,11 @@ static int __init tcb_clksrc_init(void)
275 pdev = tc->pdev; 276 pdev = tc->pdev;
276 277
277 t0_clk = tc->clk[0]; 278 t0_clk = tc->clk[0];
278 clk_enable(t0_clk); 279 ret = clk_prepare_enable(t0_clk);
280 if (ret) {
281 pr_debug("can't enable T0 clk\n");
282 goto err_free_tc;
283 }
279 284
280 /* How fast will we be counting? Pick something over 5 MHz. */ 285 /* How fast will we be counting? Pick something over 5 MHz. */
281 rate = (u32) clk_get_rate(t0_clk); 286 rate = (u32) clk_get_rate(t0_clk);
@@ -313,7 +318,11 @@ static int __init tcb_clksrc_init(void)
313 /* tclib will give us three clocks no matter what the 318 /* tclib will give us three clocks no matter what the
314 * underlying platform supports. 319 * underlying platform supports.
315 */ 320 */
316 clk_enable(tc->clk[1]); 321 ret = clk_prepare_enable(tc->clk[1]);
322 if (ret) {
323 pr_debug("can't enable T1 clk\n");
324 goto err_disable_t0;
325 }
317 /* setup both channel 0 & 1 */ 326 /* setup both channel 0 & 1 */
318 tcb_setup_dual_chan(tc, best_divisor_idx); 327 tcb_setup_dual_chan(tc, best_divisor_idx);
319 } 328 }
@@ -325,5 +334,12 @@ static int __init tcb_clksrc_init(void)
325 setup_clkevents(tc, clk32k_divisor_idx); 334 setup_clkevents(tc, clk32k_divisor_idx);
326 335
327 return 0; 336 return 0;
337
338err_disable_t0:
339 clk_disable_unprepare(t0_clk);
340
341err_free_tc:
342 atmel_tc_free(tc);
343 return ret;
328} 344}
329arch_initcall(tcb_clksrc_init); 345arch_initcall(tcb_clksrc_init);