blob: 9979b7f7e767a376fda6d608a782045b40e596fd [file] [log] [blame]
Viresh Kumar55b8fd42012-04-10 09:02:35 +05301/*
2 * Clock framework definitions for SPEAr platform
3 *
4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com>
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __SPEAR_CLK_H
13#define __SPEAR_CLK_H
14
15#include <linux/clk-provider.h>
16#include <linux/spinlock_types.h>
17#include <linux/types.h>
18
19/* VCO-PLL clk */
20struct pll_rate_tbl {
21 u8 mode;
22 u16 m;
23 u8 n;
24 u8 p;
25};
26
27struct clk_vco {
28 struct clk_hw hw;
29 void __iomem *mode_reg;
30 void __iomem *cfg_reg;
31 struct pll_rate_tbl *rtbl;
32 u8 rtbl_cnt;
33 spinlock_t *lock;
34};
35
36struct clk_pll {
37 struct clk_hw hw;
38 struct clk_vco *vco;
39 const char *parent[1];
40 spinlock_t *lock;
41};
42
43typedef unsigned long (*clk_calc_rate)(struct clk_hw *hw, unsigned long prate,
44 int index);
45
46/* clk register routines */
47struct clk *clk_register_vco_pll(const char *vco_name, const char *pll_name,
48 const char *vco_gate_name, const char *parent_name,
49 unsigned long flags, void __iomem *mode_reg, void __iomem
50 *cfg_reg, struct pll_rate_tbl *rtbl, u8 rtbl_cnt,
51 spinlock_t *lock, struct clk **pll_clk,
52 struct clk **vco_gate_clk);
53
54long clk_round_rate_index(struct clk_hw *hw, unsigned long drate,
55 unsigned long parent_rate, clk_calc_rate calc_rate, u8 rtbl_cnt,
56 int *index);
57
58#endif /* __SPEAR_CLK_H */