Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 1 | /* |
| 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 King | cf30fb4 | 2008-11-08 20:05:55 +0000 | [diff] [blame] | 13 | #include <linux/device.h> |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 14 | #include <linux/list.h> |
| 15 | #include <linux/errno.h> |
| 16 | #include <linux/err.h> |
Russell King | cf30fb4 | 2008-11-08 20:05:55 +0000 | [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> |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 20 | |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 21 | #include <asm/hardware/icst307.h> |
| 22 | |
| 23 | #include "clock.h" |
| 24 | |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 25 | int clk_enable(struct clk *clk) |
| 26 | { |
| 27 | return 0; |
| 28 | } |
| 29 | EXPORT_SYMBOL(clk_enable); |
| 30 | |
| 31 | void clk_disable(struct clk *clk) |
| 32 | { |
| 33 | } |
| 34 | EXPORT_SYMBOL(clk_disable); |
| 35 | |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 36 | unsigned long clk_get_rate(struct clk *clk) |
| 37 | { |
| 38 | return clk->rate; |
| 39 | } |
| 40 | EXPORT_SYMBOL(clk_get_rate); |
| 41 | |
| 42 | long clk_round_rate(struct clk *clk, unsigned long rate) |
| 43 | { |
Russell King | cf30fb4 | 2008-11-08 20:05:55 +0000 | [diff] [blame] | 44 | struct icst307_vco vco; |
| 45 | vco = icst307_khz_to_vco(clk->params, rate / 1000); |
| 46 | return icst307_khz(clk->params, vco) * 1000; |
Catalin Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 47 | } |
| 48 | EXPORT_SYMBOL(clk_round_rate); |
| 49 | |
| 50 | int 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 Marinas | 8ad68bb | 2005-10-31 14:25:02 +0000 | [diff] [blame] | 59 | clk->setvco(clk, vco); |
| 60 | ret = 0; |
| 61 | } |
| 62 | return ret; |
| 63 | } |
| 64 | EXPORT_SYMBOL(clk_set_rate); |