blob: 989ecf5f5c4685a9b8afedf0677e8e0a88d63f82 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-integrator/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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/errno.h>
Russell Kingf8ce2542006-01-07 16:15:52 +000014#include <linux/clk.h>
Arjan van de Ven00431702006-01-12 18:42:23 +000015#include <linux/mutex.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Russell Kingd72fbdf2008-11-08 20:08:08 +000017#include <asm/clkdev.h>
18#include <mach/clkdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
20int clk_enable(struct clk *clk)
21{
22 return 0;
23}
24EXPORT_SYMBOL(clk_enable);
25
26void clk_disable(struct clk *clk)
27{
28}
29EXPORT_SYMBOL(clk_disable);
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031unsigned long clk_get_rate(struct clk *clk)
32{
33 return clk->rate;
34}
35EXPORT_SYMBOL(clk_get_rate);
36
37long clk_round_rate(struct clk *clk, unsigned long rate)
38{
39 struct icst525_vco vco;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 vco = icst525_khz_to_vco(clk->params, rate / 1000);
41 return icst525_khz(clk->params, vco) * 1000;
42}
43EXPORT_SYMBOL(clk_round_rate);
44
45int clk_set_rate(struct clk *clk, unsigned long rate)
46{
47 int ret = -EIO;
Russell Kingd72fbdf2008-11-08 20:08:08 +000048
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 if (clk->setvco) {
50 struct icst525_vco vco;
51
52 vco = icst525_khz_to_vco(clk->params, rate / 1000);
53 clk->rate = icst525_khz(clk->params, vco) * 1000;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 clk->setvco(clk, vco);
55 ret = 0;
56 }
Russell Kingd72fbdf2008-11-08 20:08:08 +000057 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058}
59EXPORT_SYMBOL(clk_set_rate);