Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
[pandora-kernel.git] / arch / arm / plat-samsung / include / plat / clock.h
1 /* linux/arch/arm/plat-s3c/include/plat/clock.h
2  *
3  * Copyright (c) 2004-2005 Simtec Electronics
4  *      http://www.simtec.co.uk/products/SWLINUX/
5  *      Written by Ben Dooks, <ben@simtec.co.uk>
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
12 #include <linux/spinlock.h>
13 #include <linux/clkdev.h>
14
15 struct clk;
16
17 /**
18  * struct clk_ops - standard clock operations
19  * @set_rate: set the clock rate, see clk_set_rate().
20  * @get_rate: get the clock rate, see clk_get_rate().
21  * @round_rate: round a given clock rate, see clk_round_rate().
22  * @set_parent: set the clock's parent, see clk_set_parent().
23  *
24  * Group the common clock implementations together so that we
25  * don't have to keep setting the same fields again. We leave
26  * enable in struct clk.
27  *
28  * Adding an extra layer of indirection into the process should
29  * not be a problem as it is unlikely these operations are going
30  * to need to be called quickly.
31  */
32 struct clk_ops {
33         int                 (*set_rate)(struct clk *c, unsigned long rate);
34         unsigned long       (*get_rate)(struct clk *c);
35         unsigned long       (*round_rate)(struct clk *c, unsigned long rate);
36         int                 (*set_parent)(struct clk *c, struct clk *parent);
37 };
38
39 struct clk {
40         struct list_head      list;
41         struct module        *owner;
42         struct clk           *parent;
43         const char           *name;
44         const char              *devname;
45         int                   id;
46         int                   usage;
47         unsigned long         rate;
48         unsigned long         ctrlbit;
49
50         struct clk_ops          *ops;
51         int                 (*enable)(struct clk *, int enable);
52         struct clk_lookup       lookup;
53 #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
54         struct dentry           *dent;  /* For visible tree hierarchy */
55 #endif
56 };
57
58 /* other clocks which may be registered by board support */
59
60 extern struct clk s3c24xx_dclk0;
61 extern struct clk s3c24xx_dclk1;
62 extern struct clk s3c24xx_clkout0;
63 extern struct clk s3c24xx_clkout1;
64 extern struct clk s3c24xx_uclk;
65
66 extern struct clk clk_usb_bus;
67
68 /* core clock support */
69
70 extern struct clk clk_f;
71 extern struct clk clk_h;
72 extern struct clk clk_p;
73 extern struct clk clk_mpll;
74 extern struct clk clk_upll;
75 extern struct clk clk_epll;
76 extern struct clk clk_xtal;
77 extern struct clk clk_ext;
78
79 /* S3C64XX specific clocks */
80 extern struct clk clk_h2;
81 extern struct clk clk_27m;
82 extern struct clk clk_48m;
83 extern struct clk clk_xusbxti;
84
85 extern int clk_default_setrate(struct clk *clk, unsigned long rate);
86 extern struct clk_ops clk_ops_def_setrate;
87
88 /* exports for arch/arm/mach-s3c2410
89  *
90  * Please DO NOT use these outside of arch/arm/mach-s3c2410
91 */
92
93 extern spinlock_t clocks_lock;
94
95 extern int s3c2410_clkcon_enable(struct clk *clk, int enable);
96
97 extern int s3c24xx_register_clock(struct clk *clk);
98 extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
99
100 extern void s3c_register_clocks(struct clk *clk, int nr_clks);
101 extern void s3c_disable_clocks(struct clk *clkp, int nr_clks);
102
103 extern int s3c24xx_register_baseclocks(unsigned long xtal);
104
105 extern void s5p_register_clocks(unsigned long xtal_freq);
106
107 extern void s3c24xx_setup_clocks(unsigned long fclk,
108                                  unsigned long hclk,
109                                  unsigned long pclk);
110
111 extern void s3c2410_setup_clocks(void);
112 extern void s3c2412_setup_clocks(void);
113 extern void s3c244x_setup_clocks(void);
114 extern void s3c2443_setup_clocks(void);
115
116 /* S3C64XX specific functions and clocks */
117
118 extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
119
120 /* Init for pwm clock code */
121
122 extern void s3c_pwmclk_init(void);
123