diff options
author | Juergen Beisert <j.beisert@pengutronix.de> | 2008-07-05 04:02:47 -0400 |
---|---|---|
committer | Robert Schwebel <r.schwebel@pengutronix.de> | 2008-07-05 04:02:47 -0400 |
commit | c0db2ea4e366c94dd3f880928c02534156e3d1b9 (patch) | |
tree | e8486fedc9d405b2867c3a474ebc18fad394836c /include/asm-arm/arch-mxc/clock.h | |
parent | 38a41fdf94c449c165213e4665c3f8a0d30f8aba (diff) |
MXC family: Add clock handling
Internal clock path handling for the mxc CPUs.
Changed against the original Freescale code (and against clocklib for example):
- clock rate is always calculated whenever one ask for the current rate
(means struct clk has no more a member called "rate"). So switching the PLL
base frequency will propagate immediately to all other clocks that are
depending on this frequency.
Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>
Diffstat (limited to 'include/asm-arm/arch-mxc/clock.h')
-rw-r--r-- | include/asm-arm/arch-mxc/clock.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/include/asm-arm/arch-mxc/clock.h b/include/asm-arm/arch-mxc/clock.h new file mode 100644 index 000000000000..24caa2b7c91d --- /dev/null +++ b/include/asm-arm/arch-mxc/clock.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * Copyright 2008 Juergen Beisert, kernel@pengutronix.de | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version 2 | ||
8 | * of the License, or (at your option) any later version. | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
17 | * MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_ARCH_MXC_CLOCK_H__ | ||
21 | #define __ASM_ARCH_MXC_CLOCK_H__ | ||
22 | |||
23 | #ifndef __ASSEMBLY__ | ||
24 | #include <linux/list.h> | ||
25 | |||
26 | struct module; | ||
27 | |||
28 | struct clk { | ||
29 | struct list_head node; | ||
30 | struct module *owner; | ||
31 | const char *name; | ||
32 | int id; | ||
33 | /* Source clock this clk depends on */ | ||
34 | struct clk *parent; | ||
35 | /* Secondary clock to enable/disable with this clock */ | ||
36 | struct clk *secondary; | ||
37 | /* Reference count of clock enable/disable */ | ||
38 | __s8 usecount; | ||
39 | /* Register bit position for clock's enable/disable control. */ | ||
40 | u8 enable_shift; | ||
41 | /* Register address for clock's enable/disable control. */ | ||
42 | u32 enable_reg; | ||
43 | u32 flags; | ||
44 | /* get the current clock rate (always a fresh value) */ | ||
45 | unsigned long (*get_rate) (struct clk *); | ||
46 | /* Function ptr to set the clock to a new rate. The rate must match a | ||
47 | supported rate returned from round_rate. Leave blank if clock is not | ||
48 | programmable */ | ||
49 | int (*set_rate) (struct clk *, unsigned long); | ||
50 | /* Function ptr to round the requested clock rate to the nearest | ||
51 | supported rate that is less than or equal to the requested rate. */ | ||
52 | unsigned long (*round_rate) (struct clk *, unsigned long); | ||
53 | /* Function ptr to enable the clock. Leave blank if clock can not | ||
54 | be gated. */ | ||
55 | int (*enable) (struct clk *); | ||
56 | /* Function ptr to disable the clock. Leave blank if clock can not | ||
57 | be gated. */ | ||
58 | void (*disable) (struct clk *); | ||
59 | /* Function ptr to set the parent clock of the clock. */ | ||
60 | int (*set_parent) (struct clk *, struct clk *); | ||
61 | }; | ||
62 | |||
63 | int clk_register(struct clk *clk); | ||
64 | void clk_unregister(struct clk *clk); | ||
65 | |||
66 | #endif /* __ASSEMBLY__ */ | ||
67 | #endif /* __ASM_ARCH_MXC_CLOCK_H__ */ | ||