Alessandro Rubini | 28ad94e | 2009-07-02 19:06:47 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-nomadik/clock.c |
| 3 | * |
| 4 | * Copyright (C) 2009 Alessandro Rubini |
| 5 | */ |
| 6 | #include <linux/kernel.h> |
| 7 | #include <linux/module.h> |
| 8 | #include <linux/errno.h> |
| 9 | #include <linux/clk.h> |
| 10 | #include <asm/clkdev.h> |
| 11 | #include "clock.h" |
| 12 | |
| 13 | /* |
| 14 | * The nomadik board uses generic clocks, but the serial pl011 file |
| 15 | * calls clk_enable(), clk_disable(), clk_get_rate(), so we provide them |
| 16 | */ |
| 17 | unsigned long clk_get_rate(struct clk *clk) |
| 18 | { |
| 19 | return clk->rate; |
| 20 | } |
| 21 | EXPORT_SYMBOL(clk_get_rate); |
| 22 | |
| 23 | /* enable and disable do nothing */ |
| 24 | int clk_enable(struct clk *clk) |
| 25 | { |
| 26 | return 0; |
| 27 | } |
| 28 | EXPORT_SYMBOL(clk_enable); |
| 29 | |
| 30 | void clk_disable(struct clk *clk) |
| 31 | { |
| 32 | } |
| 33 | EXPORT_SYMBOL(clk_disable); |
| 34 | |
Rabin Vincent | dc6048c | 2010-05-06 10:47:25 +0100 | [diff] [blame] | 35 | /* We have a fixed clock alone, for now */ |
| 36 | static struct clk clk_48 = { |
| 37 | .rate = 48 * 1000 * 1000, |
| 38 | }; |
Alessandro Rubini | 28ad94e | 2009-07-02 19:06:47 +0100 | [diff] [blame] | 39 | |
Rabin Vincent | af7dc22 | 2010-05-06 11:14:17 +0100 | [diff] [blame] | 40 | /* |
| 41 | * Catch-all default clock to satisfy drivers using the clk API. We don't |
| 42 | * model the actual hardware clocks yet. |
| 43 | */ |
| 44 | static struct clk clk_default; |
| 45 | |
Rabin Vincent | dc6048c | 2010-05-06 10:47:25 +0100 | [diff] [blame] | 46 | #define CLK(_clk, dev) \ |
| 47 | { \ |
| 48 | .clk = _clk, \ |
| 49 | .dev_id = dev, \ |
| 50 | } |
| 51 | |
| 52 | static struct clk_lookup lookups[] = { |
| 53 | CLK(&clk_48, "uart0"), |
| 54 | CLK(&clk_48, "uart1"), |
Rabin Vincent | af7dc22 | 2010-05-06 11:14:17 +0100 | [diff] [blame] | 55 | CLK(&clk_default, "gpio.0"), |
| 56 | CLK(&clk_default, "gpio.1"), |
| 57 | CLK(&clk_default, "gpio.2"), |
| 58 | CLK(&clk_default, "gpio.3"), |
Srinidhi Kasagar | 1944cc8 | 2010-05-19 06:49:13 +0100 | [diff] [blame^] | 59 | CLK(&clk_default, "rng"), |
Rabin Vincent | dc6048c | 2010-05-06 10:47:25 +0100 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | static int __init clk_init(void) |
| 63 | { |
| 64 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
Alessandro Rubini | 28ad94e | 2009-07-02 19:06:47 +0100 | [diff] [blame] | 65 | return 0; |
| 66 | } |
Rabin Vincent | dc6048c | 2010-05-06 10:47:25 +0100 | [diff] [blame] | 67 | |
| 68 | arch_initcall(clk_init); |