aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bresticker <abrestic@chromium.org>2015-02-24 22:56:05 -0500
committerRalf Baechle <ralf@linux-mips.org>2015-03-31 05:59:17 -0400
commit44960ab862a6db088f46fbf582d16a25fb999a83 (patch)
tree48fd65faee4a3ab80c185a8d4469ff47f132901a
parentb35d7c33419cb0d000d23d3a5ab524ab8d3d8bf9 (diff)
CLK: Pistachio: Register peripheral clocks
Register the clocks generated by the peripheral clock controller. This includes the clocks for several peripherals, including I2C, PWM, watchdog, and timer. Signed-off-by: Damien Horsley <Damien.Horsley@imgtec.com> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Cc: Mike Turquette <mturquette@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: devicetree@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Cc: Ezequiel Garcia <ezequiel.garcia@imgtec.com> Cc: James Hartley <james.hartley@imgtec.com> Cc: James Hogan <james.hogan@imgtec.com> Acked-by: Stephen Boyd <sboyd@codeaurora.org> Patchwork: https://patchwork.linux-mips.org/patch/9320/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--drivers/clk/pistachio/clk-pistachio.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/clk/pistachio/clk-pistachio.c b/drivers/clk/pistachio/clk-pistachio.c
index 12a45e246fd1..0eabb542b006 100644
--- a/drivers/clk/pistachio/clk-pistachio.c
+++ b/drivers/clk/pistachio/clk-pistachio.c
@@ -197,3 +197,70 @@ static void __init pistachio_clk_init(struct device_node *np)
197 ARRAY_SIZE(pistachio_critical_clks)); 197 ARRAY_SIZE(pistachio_critical_clks));
198} 198}
199CLK_OF_DECLARE(pistachio_clk, "img,pistachio-clk", pistachio_clk_init); 199CLK_OF_DECLARE(pistachio_clk, "img,pistachio-clk", pistachio_clk_init);
200
201static struct pistachio_gate pistachio_periph_gates[] __initdata = {
202 GATE(PERIPH_CLK_SYS, "sys", "periph_sys", 0x100, 0),
203 GATE(PERIPH_CLK_SYS_BUS, "bus_sys", "periph_sys", 0x100, 1),
204 GATE(PERIPH_CLK_DDR, "ddr", "periph_sys", 0x100, 2),
205 GATE(PERIPH_CLK_ROM, "rom", "rom_div", 0x100, 3),
206 GATE(PERIPH_CLK_COUNTER_FAST, "counter_fast", "counter_fast_div",
207 0x100, 4),
208 GATE(PERIPH_CLK_COUNTER_SLOW, "counter_slow", "counter_slow_div",
209 0x100, 5),
210 GATE(PERIPH_CLK_IR, "ir", "ir_div", 0x100, 6),
211 GATE(PERIPH_CLK_WD, "wd", "wd_div", 0x100, 7),
212 GATE(PERIPH_CLK_PDM, "pdm", "pdm_div", 0x100, 8),
213 GATE(PERIPH_CLK_PWM, "pwm", "pwm_div", 0x100, 9),
214 GATE(PERIPH_CLK_I2C0, "i2c0", "i2c0_div", 0x100, 10),
215 GATE(PERIPH_CLK_I2C1, "i2c1", "i2c1_div", 0x100, 11),
216 GATE(PERIPH_CLK_I2C2, "i2c2", "i2c2_div", 0x100, 12),
217 GATE(PERIPH_CLK_I2C3, "i2c3", "i2c3_div", 0x100, 13),
218};
219
220static struct pistachio_div pistachio_periph_divs[] __initdata = {
221 DIV(PERIPH_CLK_ROM_DIV, "rom_div", "periph_sys", 0x10c, 7),
222 DIV(PERIPH_CLK_COUNTER_FAST_DIV, "counter_fast_div", "periph_sys",
223 0x110, 7),
224 DIV(PERIPH_CLK_COUNTER_SLOW_PRE_DIV, "counter_slow_pre_div",
225 "periph_sys", 0x114, 7),
226 DIV(PERIPH_CLK_COUNTER_SLOW_DIV, "counter_slow_div",
227 "counter_slow_pre_div", 0x118, 7),
228 DIV_F(PERIPH_CLK_IR_PRE_DIV, "ir_pre_div", "periph_sys", 0x11c, 7,
229 CLK_DIVIDER_ROUND_CLOSEST),
230 DIV_F(PERIPH_CLK_IR_DIV, "ir_div", "ir_pre_div", 0x120, 7,
231 CLK_DIVIDER_ROUND_CLOSEST),
232 DIV_F(PERIPH_CLK_WD_PRE_DIV, "wd_pre_div", "periph_sys", 0x124, 7,
233 CLK_DIVIDER_ROUND_CLOSEST),
234 DIV_F(PERIPH_CLK_WD_DIV, "wd_div", "wd_pre_div", 0x128, 7,
235 CLK_DIVIDER_ROUND_CLOSEST),
236 DIV(PERIPH_CLK_PDM_PRE_DIV, "pdm_pre_div", "periph_sys", 0x12c, 7),
237 DIV(PERIPH_CLK_PDM_DIV, "pdm_div", "pdm_pre_div", 0x130, 7),
238 DIV(PERIPH_CLK_PWM_PRE_DIV, "pwm_pre_div", "periph_sys", 0x134, 7),
239 DIV(PERIPH_CLK_PWM_DIV, "pwm_div", "pwm_pre_div", 0x138, 7),
240 DIV(PERIPH_CLK_I2C0_PRE_DIV, "i2c0_pre_div", "periph_sys", 0x13c, 7),
241 DIV(PERIPH_CLK_I2C0_DIV, "i2c0_div", "i2c0_pre_div", 0x140, 7),
242 DIV(PERIPH_CLK_I2C1_PRE_DIV, "i2c1_pre_div", "periph_sys", 0x144, 7),
243 DIV(PERIPH_CLK_I2C1_DIV, "i2c1_div", "i2c1_pre_div", 0x148, 7),
244 DIV(PERIPH_CLK_I2C2_PRE_DIV, "i2c2_pre_div", "periph_sys", 0x14c, 7),
245 DIV(PERIPH_CLK_I2C2_DIV, "i2c2_div", "i2c2_pre_div", 0x150, 7),
246 DIV(PERIPH_CLK_I2C3_PRE_DIV, "i2c3_pre_div", "periph_sys", 0x154, 7),
247 DIV(PERIPH_CLK_I2C3_DIV, "i2c3_div", "i2c3_pre_div", 0x158, 7),
248};
249
250static void __init pistachio_clk_periph_init(struct device_node *np)
251{
252 struct pistachio_clk_provider *p;
253
254 p = pistachio_clk_alloc_provider(np, PERIPH_CLK_NR_CLKS);
255 if (!p)
256 return;
257
258 pistachio_clk_register_div(p, pistachio_periph_divs,
259 ARRAY_SIZE(pistachio_periph_divs));
260 pistachio_clk_register_gate(p, pistachio_periph_gates,
261 ARRAY_SIZE(pistachio_periph_gates));
262
263 pistachio_clk_register_provider(p);
264}
265CLK_OF_DECLARE(pistachio_clk_periph, "img,pistachio-clk-periph",
266 pistachio_clk_periph_init);