blob: f035f4185274160757e11d32377509defbdfb1b7 [file] [log] [blame]
Alessandro Rubini28ad94e2009-07-02 19:06:47 +01001/*
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 */
17unsigned long clk_get_rate(struct clk *clk)
18{
19 return clk->rate;
20}
21EXPORT_SYMBOL(clk_get_rate);
22
23/* enable and disable do nothing */
24int clk_enable(struct clk *clk)
25{
26 return 0;
27}
28EXPORT_SYMBOL(clk_enable);
29
30void clk_disable(struct clk *clk)
31{
32}
33EXPORT_SYMBOL(clk_disable);
34
Linus Walleijba327b12010-05-26 07:38:54 +010035static struct clk clk_24 = {
36 .rate = 2400000,
37};
38
Rabin Vincentdc6048c2010-05-06 10:47:25 +010039static struct clk clk_48 = {
40 .rate = 48 * 1000 * 1000,
41};
Alessandro Rubini28ad94e2009-07-02 19:06:47 +010042
Rabin Vincentaf7dc222010-05-06 11:14:17 +010043/*
44 * Catch-all default clock to satisfy drivers using the clk API. We don't
45 * model the actual hardware clocks yet.
46 */
47static struct clk clk_default;
48
Rabin Vincentdc6048c2010-05-06 10:47:25 +010049#define CLK(_clk, dev) \
50 { \
51 .clk = _clk, \
52 .dev_id = dev, \
53 }
54
55static struct clk_lookup lookups[] = {
Linus Walleijba327b12010-05-26 07:38:54 +010056 CLK(&clk_24, "mtu0"),
57 CLK(&clk_24, "mtu1"),
Rabin Vincentdc6048c2010-05-06 10:47:25 +010058 CLK(&clk_48, "uart0"),
59 CLK(&clk_48, "uart1"),
Rabin Vincentaf7dc222010-05-06 11:14:17 +010060 CLK(&clk_default, "gpio.0"),
61 CLK(&clk_default, "gpio.1"),
62 CLK(&clk_default, "gpio.2"),
63 CLK(&clk_default, "gpio.3"),
Srinidhi Kasagar1944cc82010-05-19 06:49:13 +010064 CLK(&clk_default, "rng"),
Rabin Vincentdc6048c2010-05-06 10:47:25 +010065};
66
Linus Walleijba327b12010-05-26 07:38:54 +010067int __init clk_init(void)
Rabin Vincentdc6048c2010-05-06 10:47:25 +010068{
69 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
Alessandro Rubini28ad94e2009-07-02 19:06:47 +010070 return 0;
71}