cputime: Clean up cputime_to_usecs and usecs_to_cputime macros
[linux-2.6/libata-dev.git] / arch / arm / plat-versatile / clock.c
blob5c8b6564fdc225ff49970cf5768f5cc2db1a733a
1 /*
2 * linux/arch/arm/plat-versatile/clock.c
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/errno.h>
14 #include <linux/clk.h>
15 #include <linux/mutex.h>
17 #include <asm/hardware/icst.h>
19 #include <mach/clkdev.h>
21 int clk_enable(struct clk *clk)
23 return 0;
25 EXPORT_SYMBOL(clk_enable);
27 void clk_disable(struct clk *clk)
30 EXPORT_SYMBOL(clk_disable);
32 unsigned long clk_get_rate(struct clk *clk)
34 return clk->rate;
36 EXPORT_SYMBOL(clk_get_rate);
38 long clk_round_rate(struct clk *clk, unsigned long rate)
40 long ret = -EIO;
41 if (clk->ops && clk->ops->round)
42 ret = clk->ops->round(clk, rate);
43 return ret;
45 EXPORT_SYMBOL(clk_round_rate);
47 int clk_set_rate(struct clk *clk, unsigned long rate)
49 int ret = -EIO;
50 if (clk->ops && clk->ops->set)
51 ret = clk->ops->set(clk, rate);
52 return ret;
54 EXPORT_SYMBOL(clk_set_rate);
56 long icst_clk_round(struct clk *clk, unsigned long rate)
58 struct icst_vco vco;
59 vco = icst_hz_to_vco(clk->params, rate);
60 return icst_hz(clk->params, vco);
62 EXPORT_SYMBOL(icst_clk_round);
64 int icst_clk_set(struct clk *clk, unsigned long rate)
66 struct icst_vco vco;
68 vco = icst_hz_to_vco(clk->params, rate);
69 clk->rate = icst_hz(clk->params, vco);
70 clk->ops->setvco(clk, vco);
72 return 0;
74 EXPORT_SYMBOL(icst_clk_set);