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/clkdev.h>
24 #include <linux/list.h>
25 #include <linux/spinlock.h>
27 #define DIV_BUS (1 << 0)
28 #define DIV_U71 (1 << 1)
29 #define DIV_U71_FIXED (1 << 2)
30 #define DIV_2 (1 << 3)
31 #define DIV_U16 (1 << 4)
32 #define PLL_FIXED (1 << 5)
33 #define PLL_HAS_CPCON (1 << 6)
36 #define PERIPH_NO_RESET (1 << 9)
37 #define PERIPH_NO_ENB (1 << 10)
38 #define PERIPH_EMC_ENB (1 << 11)
39 #define PERIPH_MANUAL_RESET (1 << 12)
40 #define PLL_ALT_MISC_REG (1 << 13)
41 #define PLLU (1 << 14)
42 #define ENABLE_ON_INIT (1 << 28)
51 struct clk_pll_freq_table {
52 unsigned long input_rate;
53 unsigned long output_rate;
61 void (*init)(struct clk *);
62 int (*enable)(struct clk *);
63 void (*disable)(struct clk *);
64 int (*set_parent)(struct clk *, struct clk *);
65 int (*set_rate)(struct clk *, unsigned long);
66 long (*round_rate)(struct clk *, unsigned long);
67 void (*reset)(struct clk *, bool);
77 /* node for master clocks list */
78 struct list_head node; /* node for list of all clocks */
79 struct clk_lookup lookup;
81 #ifdef CONFIG_DEBUG_FS
87 unsigned long max_rate;
88 unsigned long min_rate;
98 const struct clk_mux_sel *inputs;
102 struct list_head shared_bus_list;
106 unsigned int clk_num;
109 unsigned long input_min;
110 unsigned long input_max;
111 unsigned long cf_min;
112 unsigned long cf_max;
113 unsigned long vco_min;
114 unsigned long vco_max;
115 const struct clk_pll_freq_table *freq_table;
127 struct list_head node;
136 struct clk_duplicate {
138 struct clk_lookup lookup;
141 struct tegra_clk_init_table {
148 void tegra2_init_clocks(void);
149 void tegra2_periph_reset_deassert(struct clk *c);
150 void tegra2_periph_reset_assert(struct clk *c);
151 void clk_init(struct clk *clk);
152 struct clk *tegra_get_clock_by_name(const char *name);
153 unsigned long clk_measure_input_freq(void);
154 int clk_reparent(struct clk *c, struct clk *parent);
155 void tegra_clk_init_from_table(struct tegra_clk_init_table *table);
156 unsigned long clk_get_rate_locked(struct clk *c);
157 int clk_set_rate_locked(struct clk *c, unsigned long rate);
158 void tegra2_sdmmc_tap_delay(struct clk *c, int delay);