diff options
author | Prashant Gaikwad <pgaikwad@nvidia.com> | 2013-01-11 02:46:26 -0500 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2013-01-28 13:19:07 -0500 |
commit | 61fd290d213e25d5a119b8ca25644001ed9f8f2d (patch) | |
tree | 16d8d1da34b5970985145c14cd6b8a624486abba /drivers/clk/tegra | |
parent | b08e8c0ecc42afa3a2e1019851af741980dd5a6b (diff) |
ARM: tegra: migrate to new clock code
Migrate Tegra clock support to drivers/clk/tegra, this involves
moving:
1. definition of tegra_cpu_car_ops to clk.c
2. definition of reset functions to clk-peripheral.c
3. change parent of cpu clock.
4. Remove legacy clock initialization.
5. Initialize clocks using DT.
6. Remove all instance of mach/clk.h
Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com>
[swarren: use to_clk_periph_gate().]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers/clk/tegra')
-rw-r--r-- | drivers/clk/tegra/clk-periph.c | 38 | ||||
-rw-r--r-- | drivers/clk/tegra/clk.c | 16 |
2 files changed, 54 insertions, 0 deletions
diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c index 5978e81b175b..788486e6331a 100644 --- a/drivers/clk/tegra/clk-periph.c +++ b/drivers/clk/tegra/clk-periph.c | |||
@@ -110,6 +110,44 @@ static void clk_periph_disable(struct clk_hw *hw) | |||
110 | gate_ops->disable(gate_hw); | 110 | gate_ops->disable(gate_hw); |
111 | } | 111 | } |
112 | 112 | ||
113 | void tegra_periph_reset_deassert(struct clk *c) | ||
114 | { | ||
115 | struct clk_hw *hw = __clk_get_hw(c); | ||
116 | struct tegra_clk_periph *periph = to_clk_periph(hw); | ||
117 | struct tegra_clk_periph_gate *gate; | ||
118 | |||
119 | if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) { | ||
120 | gate = to_clk_periph_gate(hw); | ||
121 | if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) { | ||
122 | WARN_ON(1); | ||
123 | return; | ||
124 | } | ||
125 | } else { | ||
126 | gate = &periph->gate; | ||
127 | } | ||
128 | |||
129 | tegra_periph_reset(gate, 0); | ||
130 | } | ||
131 | |||
132 | void tegra_periph_reset_assert(struct clk *c) | ||
133 | { | ||
134 | struct clk_hw *hw = __clk_get_hw(c); | ||
135 | struct tegra_clk_periph *periph = to_clk_periph(hw); | ||
136 | struct tegra_clk_periph_gate *gate; | ||
137 | |||
138 | if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) { | ||
139 | gate = to_clk_periph_gate(hw); | ||
140 | if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) { | ||
141 | WARN_ON(1); | ||
142 | return; | ||
143 | } | ||
144 | } else { | ||
145 | gate = &periph->gate; | ||
146 | } | ||
147 | |||
148 | tegra_periph_reset(gate, 1); | ||
149 | } | ||
150 | |||
113 | const struct clk_ops tegra_clk_periph_ops = { | 151 | const struct clk_ops tegra_clk_periph_ops = { |
114 | .get_parent = clk_periph_get_parent, | 152 | .get_parent = clk_periph_get_parent, |
115 | .set_parent = clk_periph_set_parent, | 153 | .set_parent = clk_periph_set_parent, |
diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c index cf023a937208..a603b9af0ad3 100644 --- a/drivers/clk/tegra/clk.c +++ b/drivers/clk/tegra/clk.c | |||
@@ -16,9 +16,14 @@ | |||
16 | 16 | ||
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/clk-provider.h> | 18 | #include <linux/clk-provider.h> |
19 | #include <linux/of.h> | ||
20 | #include <linux/clk/tegra.h> | ||
19 | 21 | ||
20 | #include "clk.h" | 22 | #include "clk.h" |
21 | 23 | ||
24 | /* Global data of Tegra CPU CAR ops */ | ||
25 | struct tegra_cpu_car_ops *tegra_cpu_car_ops; | ||
26 | |||
22 | void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, | 27 | void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, |
23 | struct clk *clks[], int clk_max) | 28 | struct clk *clks[], int clk_max) |
24 | { | 29 | { |
@@ -67,3 +72,14 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl, | |||
67 | } | 72 | } |
68 | } | 73 | } |
69 | } | 74 | } |
75 | |||
76 | static const struct of_device_id tegra_dt_clk_match[] = { | ||
77 | { .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init }, | ||
78 | { .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init }, | ||
79 | { } | ||
80 | }; | ||
81 | |||
82 | void __init tegra_clocks_init(void) | ||
83 | { | ||
84 | of_clk_init(tegra_dt_clk_match); | ||
85 | } | ||