blob: a7043115de72638022aefa73f7a829a49e515302 [file] [log] [blame]
Catalin Marinas8ad68bb2005-10-31 14:25:02 +00001/*
2 * linux/arch/arm/mach-realview/clock.c
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
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.
10 */
11#include <linux/module.h>
12#include <linux/kernel.h>
Russell Kingcf30fb42008-11-08 20:05:55 +000013#include <linux/device.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000014#include <linux/list.h>
15#include <linux/errno.h>
16#include <linux/err.h>
Russell Kingcf30fb42008-11-08 20:05:55 +000017#include <linux/string.h>
Russell Kingf8ce2542006-01-07 16:15:52 +000018#include <linux/clk.h>
Arjan van de Ven00431702006-01-12 18:42:23 +000019#include <linux/mutex.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000020
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000021#include <asm/hardware/icst307.h>
22
23#include "clock.h"
24
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000025int clk_enable(struct clk *clk)
26{
27 return 0;
28}
29EXPORT_SYMBOL(clk_enable);
30
31void clk_disable(struct clk *clk)
32{
33}
34EXPORT_SYMBOL(clk_disable);
35
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000036unsigned long clk_get_rate(struct clk *clk)
37{
38 return clk->rate;
39}
40EXPORT_SYMBOL(clk_get_rate);
41
42long clk_round_rate(struct clk *clk, unsigned long rate)
43{
Russell Kingcf30fb42008-11-08 20:05:55 +000044 struct icst307_vco vco;
45 vco = icst307_khz_to_vco(clk->params, rate / 1000);
46 return icst307_khz(clk->params, vco) * 1000;
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000047}
48EXPORT_SYMBOL(clk_round_rate);
49
50int clk_set_rate(struct clk *clk, unsigned long rate)
51{
52 int ret = -EIO;
53
54 if (clk->setvco) {
55 struct icst307_vco vco;
56
57 vco = icst307_khz_to_vco(clk->params, rate / 1000);
58 clk->rate = icst307_khz(clk->params, vco) * 1000;
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000059 clk->setvco(clk, vco);
60 ret = 0;
61 }
62 return ret;
63}
64EXPORT_SYMBOL(clk_set_rate);