| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 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 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 | d72fbdf | 2008-11-08 20:08:08 +0000 | [diff] [blame] | 17 | #include <asm/clkdev.h> | 
 | 18 | #include <mach/clkdev.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 |  | 
 | 20 | int clk_enable(struct clk *clk) | 
 | 21 | { | 
 | 22 | 	return 0; | 
 | 23 | } | 
 | 24 | EXPORT_SYMBOL(clk_enable); | 
 | 25 |  | 
 | 26 | void clk_disable(struct clk *clk) | 
 | 27 | { | 
 | 28 | } | 
 | 29 | EXPORT_SYMBOL(clk_disable); | 
 | 30 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | unsigned long clk_get_rate(struct clk *clk) | 
 | 32 | { | 
 | 33 | 	return clk->rate; | 
 | 34 | } | 
 | 35 | EXPORT_SYMBOL(clk_get_rate); | 
 | 36 |  | 
 | 37 | long clk_round_rate(struct clk *clk, unsigned long rate) | 
 | 38 | { | 
 | 39 | 	struct icst525_vco vco; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | 	vco = icst525_khz_to_vco(clk->params, rate / 1000); | 
 | 41 | 	return icst525_khz(clk->params, vco) * 1000; | 
 | 42 | } | 
 | 43 | EXPORT_SYMBOL(clk_round_rate); | 
 | 44 |  | 
 | 45 | int clk_set_rate(struct clk *clk, unsigned long rate) | 
 | 46 | { | 
 | 47 | 	int ret = -EIO; | 
| Russell King | d72fbdf | 2008-11-08 20:08:08 +0000 | [diff] [blame] | 48 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | 	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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | 		clk->setvco(clk, vco); | 
 | 55 | 		ret = 0; | 
 | 56 | 	} | 
| Russell King | d72fbdf | 2008-11-08 20:08:08 +0000 | [diff] [blame] | 57 | 	return ret; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | } | 
 | 59 | EXPORT_SYMBOL(clk_set_rate); |