blob: 753a5988d85c16e9c28181f632462d9e47e60c74 [file] [log] [blame]
Juergen Beisertc0db2ea2008-07-05 10:02:47 +02001/*
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
26struct module;
27
28struct clk {
Juergen Beisertc0db2ea2008-07-05 10:02:47 +020029 int id;
30 /* Source clock this clk depends on */
31 struct clk *parent;
32 /* Secondary clock to enable/disable with this clock */
33 struct clk *secondary;
34 /* Reference count of clock enable/disable */
35 __s8 usecount;
36 /* Register bit position for clock's enable/disable control. */
37 u8 enable_shift;
38 /* Register address for clock's enable/disable control. */
Luotao Fudefa8c32008-09-09 10:19:43 +020039 void __iomem *enable_reg;
Juergen Beisertc0db2ea2008-07-05 10:02:47 +020040 u32 flags;
41 /* get the current clock rate (always a fresh value) */
42 unsigned long (*get_rate) (struct clk *);
43 /* Function ptr to set the clock to a new rate. The rate must match a
44 supported rate returned from round_rate. Leave blank if clock is not
45 programmable */
46 int (*set_rate) (struct clk *, unsigned long);
47 /* Function ptr to round the requested clock rate to the nearest
48 supported rate that is less than or equal to the requested rate. */
49 unsigned long (*round_rate) (struct clk *, unsigned long);
50 /* Function ptr to enable the clock. Leave blank if clock can not
51 be gated. */
52 int (*enable) (struct clk *);
53 /* Function ptr to disable the clock. Leave blank if clock can not
54 be gated. */
55 void (*disable) (struct clk *);
56 /* Function ptr to set the parent clock of the clock. */
57 int (*set_parent) (struct clk *, struct clk *);
58};
59
60int clk_register(struct clk *clk);
61void clk_unregister(struct clk *clk);
62
Sascha Hauera2865192009-01-26 15:41:16 +010063unsigned long mxc_decode_pll(unsigned int pll, u32 f_ref);
64
Juergen Beisertc0db2ea2008-07-05 10:02:47 +020065#endif /* __ASSEMBLY__ */
66#endif /* __ASM_ARCH_MXC_CLOCK_H__ */