diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/arm/mach-nomadik/clock.c | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
Diffstat (limited to 'arch/arm/mach-nomadik/clock.c')
| -rw-r--r-- | arch/arm/mach-nomadik/clock.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/arm/mach-nomadik/clock.c b/arch/arm/mach-nomadik/clock.c new file mode 100644 index 00000000000..48a59f24e10 --- /dev/null +++ b/arch/arm/mach-nomadik/clock.c | |||
| @@ -0,0 +1,75 @@ | |||
| 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 <linux/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 | |||
| 35 | static struct clk clk_24 = { | ||
| 36 | .rate = 2400000, | ||
| 37 | }; | ||
| 38 | |||
| 39 | static struct clk clk_48 = { | ||
| 40 | .rate = 48 * 1000 * 1000, | ||
| 41 | }; | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Catch-all default clock to satisfy drivers using the clk API. We don't | ||
| 45 | * model the actual hardware clocks yet. | ||
| 46 | */ | ||
| 47 | static struct clk clk_default; | ||
| 48 | |||
| 49 | #define CLK(_clk, dev) \ | ||
| 50 | { \ | ||
| 51 | .clk = _clk, \ | ||
| 52 | .dev_id = dev, \ | ||
| 53 | } | ||
| 54 | |||
| 55 | static struct clk_lookup lookups[] = { | ||
| 56 | { | ||
| 57 | .con_id = "apb_pclk", | ||
| 58 | .clk = &clk_default, | ||
| 59 | }, | ||
| 60 | CLK(&clk_24, "mtu0"), | ||
| 61 | CLK(&clk_24, "mtu1"), | ||
| 62 | CLK(&clk_48, "uart0"), | ||
| 63 | CLK(&clk_48, "uart1"), | ||
| 64 | CLK(&clk_default, "gpio.0"), | ||
| 65 | CLK(&clk_default, "gpio.1"), | ||
| 66 | CLK(&clk_default, "gpio.2"), | ||
| 67 | CLK(&clk_default, "gpio.3"), | ||
| 68 | CLK(&clk_default, "rng"), | ||
| 69 | }; | ||
| 70 | |||
| 71 | int __init clk_init(void) | ||
| 72 | { | ||
| 73 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | ||
| 74 | return 0; | ||
| 75 | } | ||
