Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Russell King | f4b8b31 | 2010-01-14 12:48:06 +0000 | [diff] [blame] | 2 | * linux/arch/arm/plat-versatile/clock.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/errno.h> |
Russell King | f8ce254 | 2006-01-07 16:15:52 +0000 | [diff] [blame] | 14 | #include <linux/clk.h> |
Arjan van de Ven | 0043170 | 2006-01-12 18:42:23 +0000 | [diff] [blame] | 15 | #include <linux/mutex.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Russell King | c5a0adb | 2010-01-16 20:16:10 +0000 | [diff] [blame] | 17 | #include <asm/hardware/icst.h> |
Russell King | f4b8b31 | 2010-01-14 12:48:06 +0000 | [diff] [blame] | 18 | |
Russell King | d72fbdf | 2008-11-08 20:08:08 +0000 | [diff] [blame] | 19 | #include <mach/clkdev.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
| 21 | int clk_enable(struct clk *clk) |
| 22 | { |
| 23 | return 0; |
| 24 | } |
| 25 | EXPORT_SYMBOL(clk_enable); |
| 26 | |
| 27 | void clk_disable(struct clk *clk) |
| 28 | { |
| 29 | } |
| 30 | EXPORT_SYMBOL(clk_disable); |
| 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | unsigned long clk_get_rate(struct clk *clk) |
| 33 | { |
| 34 | return clk->rate; |
| 35 | } |
| 36 | EXPORT_SYMBOL(clk_get_rate); |
| 37 | |
| 38 | long clk_round_rate(struct clk *clk, unsigned long rate) |
| 39 | { |
Russell King | 9bf5b2e | 2010-03-01 16:18:39 +0000 | [diff] [blame] | 40 | long ret = -EIO; |
| 41 | if (clk->ops && clk->ops->round) |
| 42 | ret = clk->ops->round(clk, rate); |
| 43 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | } |
| 45 | EXPORT_SYMBOL(clk_round_rate); |
| 46 | |
| 47 | int clk_set_rate(struct clk *clk, unsigned long rate) |
| 48 | { |
| 49 | int ret = -EIO; |
Russell King | 9bf5b2e | 2010-03-01 16:18:39 +0000 | [diff] [blame] | 50 | if (clk->ops && clk->ops->set) |
| 51 | ret = clk->ops->set(clk, rate); |
Russell King | d72fbdf | 2008-11-08 20:08:08 +0000 | [diff] [blame] | 52 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | } |
| 54 | EXPORT_SYMBOL(clk_set_rate); |
Russell King | 9bf5b2e | 2010-03-01 16:18:39 +0000 | [diff] [blame] | 55 | |
| 56 | long icst_clk_round(struct clk *clk, unsigned long rate) |
| 57 | { |
| 58 | struct icst_vco vco; |
| 59 | vco = icst_hz_to_vco(clk->params, rate); |
| 60 | return icst_hz(clk->params, vco); |
| 61 | } |
| 62 | EXPORT_SYMBOL(icst_clk_round); |
| 63 | |
| 64 | int icst_clk_set(struct clk *clk, unsigned long rate) |
| 65 | { |
| 66 | struct icst_vco vco; |
| 67 | |
| 68 | vco = icst_hz_to_vco(clk->params, rate); |
| 69 | clk->rate = icst_hz(clk->params, vco); |
| 70 | clk->ops->setvco(clk, vco); |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | EXPORT_SYMBOL(icst_clk_set); |