| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | *  linux/arch/arm/mach-versatile/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 King | 71a06da | 2008-11-08 20:13:53 +0000 | [diff] [blame] | 13 | #include <linux/device.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/list.h> | 
|  | 15 | #include <linux/errno.h> | 
|  | 16 | #include <linux/err.h> | 
| Tim Schmielau | 4e57b68 | 2005-10-30 15:03:48 -0800 | [diff] [blame] | 17 | #include <linux/string.h> | 
| Russell King | f8ce254 | 2006-01-07 16:15:52 +0000 | [diff] [blame] | 18 | #include <linux/clk.h> | 
| Arjan van de Ven | 0043170 | 2006-01-12 18:42:23 +0000 | [diff] [blame] | 19 | #include <linux/mutex.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 |  | 
| Russell King | 71a06da | 2008-11-08 20:13:53 +0000 | [diff] [blame] | 21 | #include <asm/clkdev.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <asm/hardware/icst307.h> | 
|  | 23 |  | 
|  | 24 | #include "clock.h" | 
|  | 25 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | int clk_enable(struct clk *clk) | 
|  | 27 | { | 
|  | 28 | return 0; | 
|  | 29 | } | 
|  | 30 | EXPORT_SYMBOL(clk_enable); | 
|  | 31 |  | 
|  | 32 | void clk_disable(struct clk *clk) | 
|  | 33 | { | 
|  | 34 | } | 
|  | 35 | EXPORT_SYMBOL(clk_disable); | 
|  | 36 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | unsigned long clk_get_rate(struct clk *clk) | 
|  | 38 | { | 
|  | 39 | return clk->rate; | 
|  | 40 | } | 
|  | 41 | EXPORT_SYMBOL(clk_get_rate); | 
|  | 42 |  | 
|  | 43 | long clk_round_rate(struct clk *clk, unsigned long rate) | 
|  | 44 | { | 
| Russell King | 71a06da | 2008-11-08 20:13:53 +0000 | [diff] [blame] | 45 | struct icst307_vco vco; | 
|  | 46 | vco = icst307_khz_to_vco(clk->params, rate / 1000); | 
|  | 47 | return icst307_khz(clk->params, vco) * 1000; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | } | 
|  | 49 | EXPORT_SYMBOL(clk_round_rate); | 
|  | 50 |  | 
|  | 51 | int clk_set_rate(struct clk *clk, unsigned long rate) | 
|  | 52 | { | 
|  | 53 | int ret = -EIO; | 
|  | 54 |  | 
|  | 55 | if (clk->setvco) { | 
|  | 56 | struct icst307_vco vco; | 
|  | 57 |  | 
|  | 58 | vco = icst307_khz_to_vco(clk->params, rate / 1000); | 
|  | 59 | clk->rate = icst307_khz(clk->params, vco) * 1000; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | clk->setvco(clk, vco); | 
|  | 61 | ret = 0; | 
|  | 62 | } | 
|  | 63 | return ret; | 
|  | 64 | } | 
|  | 65 | EXPORT_SYMBOL(clk_set_rate); |