2 * arch/arm/mach-tegra/include/mach/clock.h
4 * Copyright (C) 2010 Google, Inc.
7 * Colin Cross <ccross@google.com>
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
20 #ifndef __MACH_TEGRA_CLOCK_H
21 #define __MACH_TEGRA_CLOCK_H
23 #include <linux/list.h>
24 #include <linux/clkdev.h>
26 #define DIV_BUS (1 << 0)
27 #define DIV_U71 (1 << 1)
28 #define DIV_U71_FIXED (1 << 2)
29 #define DIV_2 (1 << 3)
30 #define DIV_U16 (1 << 4)
31 #define PLL_FIXED (1 << 5)
32 #define PLL_HAS_CPCON (1 << 6)
35 #define PERIPH_NO_RESET (1 << 9)
36 #define PERIPH_NO_ENB (1 << 10)
37 #define PERIPH_EMC_ENB (1 << 11)
38 #define PERIPH_MANUAL_RESET (1 << 12)
39 #define PLL_ALT_MISC_REG (1 << 13)
40 #define PLLU (1 << 14)
41 #define ENABLE_ON_INIT (1 << 28)
50 struct clk_pll_freq_table
{
51 unsigned long input_rate
;
52 unsigned long output_rate
;
60 void (*init
)(struct clk
*);
61 int (*enable
)(struct clk
*);
62 void (*disable
)(struct clk
*);
63 int (*set_parent
)(struct clk
*, struct clk
*);
64 int (*set_rate
)(struct clk
*, unsigned long);
65 long (*round_rate
)(struct clk
*, unsigned long);
66 void (*reset
)(struct clk
*, bool);
76 /* node for master clocks list */
77 struct list_head node
; /* node for list of all clocks */
78 struct list_head children
; /* list of children */
79 struct list_head sibling
; /* node for children */
80 struct clk_lookup lookup
;
82 #ifdef CONFIG_DEBUG_FS
88 unsigned long max_rate
;
98 const struct clk_mux_sel
*inputs
;
104 unsigned int clk_num
;
107 unsigned long input_min
;
108 unsigned long input_max
;
109 unsigned long cf_min
;
110 unsigned long cf_max
;
111 unsigned long vco_min
;
112 unsigned long vco_max
;
113 const struct clk_pll_freq_table
*freq_table
;
128 struct clk_duplicate
{
130 struct clk_lookup lookup
;
133 struct tegra_clk_init_table
{
140 void tegra2_init_clocks(void);
141 void tegra2_periph_reset_deassert(struct clk
*c
);
142 void tegra2_periph_reset_assert(struct clk
*c
);
143 void clk_init(struct clk
*clk
);
144 struct clk
*tegra_get_clock_by_name(const char *name
);
145 unsigned long clk_measure_input_freq(void);
146 void clk_disable_locked(struct clk
*c
);
147 int clk_enable_locked(struct clk
*c
);
148 int clk_set_parent_locked(struct clk
*c
, struct clk
*parent
);
149 int clk_set_rate_locked(struct clk
*c
, unsigned long rate
);
150 int clk_reparent(struct clk
*c
, struct clk
*parent
);
151 void tegra_clk_init_from_table(struct tegra_clk_init_table
*table
);