blob: 9b027d7491f5e9ba854e496568eaa2fafdc9be5e [file] [log] [blame]
Eric Miao49cbe782009-01-20 14:15:18 +08001/*
2 * linux/arch/arm/mach-mmp/clock.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +01009#include <linux/clkdev.h>
Eric Miao49cbe782009-01-20 14:15:18 +080010
11struct clkops {
12 void (*enable)(struct clk *);
13 void (*disable)(struct clk *);
14 unsigned long (*getrate)(struct clk *);
15};
16
17struct clk {
18 const struct clkops *ops;
19
20 void __iomem *clk_rst; /* clock reset control register */
21 int fnclksel; /* functional clock select (APBC) */
22 uint32_t enable_val; /* value for clock enable (APMU) */
23 unsigned long rate;
24 int enabled;
25};
26
27extern struct clkops apbc_clk_ops;
Haojian Zhuang40928552009-09-10 14:01:22 +080028extern struct clkops apmu_clk_ops;
Eric Miao49cbe782009-01-20 14:15:18 +080029
30#define APBC_CLK(_name, _reg, _fnclksel, _rate) \
31struct clk clk_##_name = { \
32 .clk_rst = (void __iomem *)APBC_##_reg, \
33 .fnclksel = _fnclksel, \
34 .rate = _rate, \
35 .ops = &apbc_clk_ops, \
36}
37
38#define APBC_CLK_OPS(_name, _reg, _fnclksel, _rate, _ops) \
39struct clk clk_##_name = { \
40 .clk_rst = (void __iomem *)APBC_##_reg, \
41 .fnclksel = _fnclksel, \
42 .rate = _rate, \
43 .ops = _ops, \
44}
45
46#define APMU_CLK(_name, _reg, _eval, _rate) \
47struct clk clk_##_name = { \
48 .clk_rst = (void __iomem *)APMU_##_reg, \
49 .enable_val = _eval, \
50 .rate = _rate, \
51 .ops = &apmu_clk_ops, \
52}
53
54#define APMU_CLK_OPS(_name, _reg, _eval, _rate, _ops) \
55struct clk clk_##_name = { \
56 .clk_rst = (void __iomem *)APMU_##_reg, \
57 .enable_val = _eval, \
58 .rate = _rate, \
59 .ops = _ops, \
60}
61
62#define INIT_CLKREG(_clk, _devname, _conname) \
63 { \
64 .clk = _clk, \
65 .dev_id = _devname, \
66 .con_id = _conname, \
67 }
68
69extern struct clk clk_pxa168_gpio;
70extern struct clk clk_pxa168_timers;