ARM: 6125/1: ARM TWD: move TWD registers to common header
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-realview / clock.c
bloba7043115de72638022aefa73f7a829a49e515302
1 /*
2 * linux/arch/arm/mach-realview/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/device.h>
14 #include <linux/list.h>
15 #include <linux/errno.h>
16 #include <linux/err.h>
17 #include <linux/string.h>
18 #include <linux/clk.h>
19 #include <linux/mutex.h>
21 #include <asm/hardware/icst307.h>
23 #include "clock.h"
25 int clk_enable(struct clk *clk)
27 return 0;
29 EXPORT_SYMBOL(clk_enable);
31 void clk_disable(struct clk *clk)
34 EXPORT_SYMBOL(clk_disable);
36 unsigned long clk_get_rate(struct clk *clk)
38 return clk->rate;
40 EXPORT_SYMBOL(clk_get_rate);
42 long clk_round_rate(struct clk *clk, unsigned long rate)
44 struct icst307_vco vco;
45 vco = icst307_khz_to_vco(clk->params, rate / 1000);
46 return icst307_khz(clk->params, vco) * 1000;
48 EXPORT_SYMBOL(clk_round_rate);
50 int clk_set_rate(struct clk *clk, unsigned long rate)
52 int ret = -EIO;
54 if (clk->setvco) {
55 struct icst307_vco vco;
57 vco = icst307_khz_to_vco(clk->params, rate / 1000);
58 clk->rate = icst307_khz(clk->params, vco) * 1000;
59 clk->setvco(clk, vco);
60 ret = 0;
62 return ret;
64 EXPORT_SYMBOL(clk_set_rate);