diff options
author | Yadwinder Singh Brar <yadi.brar@samsung.com> | 2013-06-11 15:01:12 +0530 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2013-08-02 13:22:09 -0700 |
commit | 3ff6e0d8d64d594a551b5c4904e4b617bf7eee22 (patch) | |
tree | f0eaf7340c495e131a1b1c2e083b1af224f434af /drivers/clk/samsung/clk-pll.c | |
parent | 5ca8fbd8d1b2650608d0c79bdf5e3f643a2f10e3 (diff) |
clk: samsung: Add support to register rate_table for samsung plls
This patch defines a common rate_table which will contain recommended p, m, s,
k values for supported rates that needs to be changed for changing
corresponding PLL's rate.
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/samsung/clk-pll.c')
-rw-r--r-- | drivers/clk/samsung/clk-pll.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c index dd948f2ffdf7..83942318df13 100644 --- a/drivers/clk/samsung/clk-pll.c +++ b/drivers/clk/samsung/clk-pll.c @@ -18,6 +18,8 @@ struct samsung_clk_pll { void __iomem *lock_reg; void __iomem *con_reg; enum samsung_pll_type type; + unsigned int rate_count; + const struct samsung_pll_rate_table *rate_table; }; #define to_clk_pll(_hw) container_of(_hw, struct samsung_clk_pll, hw) @@ -350,7 +352,7 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk, struct samsung_clk_pll *pll; struct clk *clk; struct clk_init_data init; - int ret; + int ret, len; pll = kzalloc(sizeof(*pll), GFP_KERNEL); if (!pll) { @@ -364,6 +366,21 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk, init.parent_names = &pll_clk->parent_name; init.num_parents = 1; + if (pll_clk->rate_table) { + /* find count of rates in rate_table */ + for (len = 0; pll_clk->rate_table[len].rate != 0; ) + len++; + + pll->rate_count = len; + pll->rate_table = kmemdup(pll_clk->rate_table, + pll->rate_count * + sizeof(struct samsung_pll_rate_table), + GFP_KERNEL); + WARN(!pll->rate_table, + "%s: could not allocate rate table for %s\n", + __func__, pll_clk->name); + } + switch (pll_clk->type) { /* clk_ops for 35xx and 2550 are similar */ case pll_35xx: |