aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/samsung
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2013-08-26 13:09:06 -0400
committerMike Turquette <mturquette@linaro.org>2013-09-06 16:33:43 -0400
commitc50d11f35a021fc357922797a7638d4d6ca70b9e (patch)
treebdc0c3a42b4cb42e10feee7ae8d11f8fcd93b6d0 /drivers/clk/samsung
parentb4054ac6a26ee94a3a0f18e9ea585545d69e29c2 (diff)
clk: samsung: pll: Use new registration method for PLL46xx
This patch modifies PLL46xx support code and its users to use the recently introduced common PLL registration helper. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/samsung')
-rw-r--r--drivers/clk/samsung/clk-exynos4.c15
-rw-r--r--drivers/clk/samsung/clk-pll.c52
-rw-r--r--drivers/clk/samsung/clk-pll.h12
3 files changed, 14 insertions, 65 deletions
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
index fd0215d99c88..779c2069e632 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -985,11 +985,15 @@ static struct of_device_id ext_clk_match[] __initdata = {
985 {}, 985 {},
986}; 986};
987 987
988static struct samsung_pll_clock exynos4210_plls[] __initdata = { 988static struct samsung_pll_clock exynos4210_plls[nr_plls] __initdata = {
989 [apll] = PLL_A(pll_4508, fout_apll, "fout_apll", "fin_pll", APLL_LOCK, 989 [apll] = PLL_A(pll_4508, fout_apll, "fout_apll", "fin_pll", APLL_LOCK,
990 APLL_CON0, "fout_apll", NULL), 990 APLL_CON0, "fout_apll", NULL),
991 [mpll] = PLL_A(pll_4508, fout_mpll, "fout_mpll", "fin_pll", 991 [mpll] = PLL_A(pll_4508, fout_mpll, "fout_mpll", "fin_pll",
992 E4210_MPLL_LOCK, E4210_MPLL_CON0, "fout_mpll", NULL), 992 E4210_MPLL_LOCK, E4210_MPLL_CON0, "fout_mpll", NULL),
993 [epll] = PLL_A(pll_4600, fout_epll, "fout_epll", "fin_pll", EPLL_LOCK,
994 EPLL_CON0, "fout_epll", NULL),
995 [vpll] = PLL_A(pll_4650c, fout_vpll, "fout_vpll", "mout_vpllsrc",
996 VPLL_LOCK, VPLL_CON0, "fout_vpll", NULL),
993}; 997};
994 998
995static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = { 999static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = {
@@ -1008,8 +1012,6 @@ static void __init exynos4_clk_init(struct device_node *np,
1008 enum exynos4_soc exynos4_soc, 1012 enum exynos4_soc exynos4_soc,
1009 void __iomem *reg_base, unsigned long xom) 1013 void __iomem *reg_base, unsigned long xom)
1010{ 1014{
1011 struct clk *epll, *vpll;
1012
1013 reg_base = of_iomap(np, 0); 1015 reg_base = of_iomap(np, 0);
1014 if (!reg_base) 1016 if (!reg_base)
1015 panic("%s: failed to map registers\n", __func__); 1017 panic("%s: failed to map registers\n", __func__);
@@ -1032,13 +1034,6 @@ static void __init exynos4_clk_init(struct device_node *np,
1032 if (exynos4_soc == EXYNOS4210) { 1034 if (exynos4_soc == EXYNOS4210) {
1033 samsung_clk_register_pll(exynos4210_plls, 1035 samsung_clk_register_pll(exynos4210_plls,
1034 ARRAY_SIZE(exynos4210_plls), reg_base); 1036 ARRAY_SIZE(exynos4210_plls), reg_base);
1035 epll = samsung_clk_register_pll46xx("fout_epll", "fin_pll",
1036 reg_base + EPLL_CON0, pll_4600);
1037 vpll = samsung_clk_register_pll46xx("fout_vpll", "mout_vpllsrc",
1038 reg_base + VPLL_CON0, pll_4650c);
1039
1040 samsung_clk_add_lookup(epll, fout_epll);
1041 samsung_clk_add_lookup(vpll, fout_vpll);
1042 } else { 1037 } else {
1043 samsung_clk_register_pll(exynos4x12_plls, 1038 samsung_clk_register_pll(exynos4x12_plls,
1044 ARRAY_SIZE(exynos4x12_plls), reg_base); 1039 ARRAY_SIZE(exynos4x12_plls), reg_base);
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 4acd06169ae3..d963b3e88615 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -423,18 +423,10 @@ static const struct clk_ops samsung_pll45xx_clk_min_ops = {
423#define PLL4650C_KDIV_MASK (0xFFF) 423#define PLL4650C_KDIV_MASK (0xFFF)
424#define PLL46XX_KDIV_SHIFT (0) 424#define PLL46XX_KDIV_SHIFT (0)
425 425
426struct samsung_clk_pll46xx {
427 struct clk_hw hw;
428 enum pll46xx_type type;
429 const void __iomem *con_reg;
430};
431
432#define to_clk_pll46xx(_hw) container_of(_hw, struct samsung_clk_pll46xx, hw)
433
434static unsigned long samsung_pll46xx_recalc_rate(struct clk_hw *hw, 426static unsigned long samsung_pll46xx_recalc_rate(struct clk_hw *hw,
435 unsigned long parent_rate) 427 unsigned long parent_rate)
436{ 428{
437 struct samsung_clk_pll46xx *pll = to_clk_pll46xx(hw); 429 struct samsung_clk_pll *pll = to_clk_pll(hw);
438 u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1, shift; 430 u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1, shift;
439 u64 fvco = parent_rate; 431 u64 fvco = parent_rate;
440 432
@@ -458,43 +450,6 @@ static const struct clk_ops samsung_pll46xx_clk_ops = {
458 .recalc_rate = samsung_pll46xx_recalc_rate, 450 .recalc_rate = samsung_pll46xx_recalc_rate,
459}; 451};
460 452
461struct clk * __init samsung_clk_register_pll46xx(const char *name,
462 const char *pname, const void __iomem *con_reg,
463 enum pll46xx_type type)
464{
465 struct samsung_clk_pll46xx *pll;
466 struct clk *clk;
467 struct clk_init_data init;
468
469 pll = kzalloc(sizeof(*pll), GFP_KERNEL);
470 if (!pll) {
471 pr_err("%s: could not allocate pll clk %s\n", __func__, name);
472 return NULL;
473 }
474
475 init.name = name;
476 init.ops = &samsung_pll46xx_clk_ops;
477 init.flags = CLK_GET_RATE_NOCACHE;
478 init.parent_names = &pname;
479 init.num_parents = 1;
480
481 pll->hw.init = &init;
482 pll->con_reg = con_reg;
483 pll->type = type;
484
485 clk = clk_register(NULL, &pll->hw);
486 if (IS_ERR(clk)) {
487 pr_err("%s: failed to register pll clock %s\n", __func__,
488 name);
489 kfree(pll);
490 }
491
492 if (clk_register_clkdev(clk, name, NULL))
493 pr_err("%s: failed to register lookup for %s", __func__, name);
494
495 return clk;
496}
497
498/* 453/*
499 * PLL6552 Clock Type 454 * PLL6552 Clock Type
500 */ 455 */
@@ -717,6 +672,11 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk,
717 case pll_6553: 672 case pll_6553:
718 init.ops = &samsung_pll6553_clk_ops; 673 init.ops = &samsung_pll6553_clk_ops;
719 break; 674 break;
675 case pll_4600:
676 case pll_4650:
677 case pll_4650c:
678 init.ops = &samsung_pll46xx_clk_ops;
679 break;
720 default: 680 default:
721 pr_warn("%s: Unknown pll type for pll clk %s\n", 681 pr_warn("%s: Unknown pll type for pll clk %s\n",
722 __func__, pll_clk->name); 682 __func__, pll_clk->name);
diff --git a/drivers/clk/samsung/clk-pll.h b/drivers/clk/samsung/clk-pll.h
index 2c331291fe40..f3c85bf9cfaf 100644
--- a/drivers/clk/samsung/clk-pll.h
+++ b/drivers/clk/samsung/clk-pll.h
@@ -20,6 +20,9 @@ enum samsung_pll_type {
20 pll_4500, 20 pll_4500,
21 pll_4502, 21 pll_4502,
22 pll_4508, 22 pll_4508,
23 pll_4600,
24 pll_4650,
25 pll_4650c,
23 pll_6552, 26 pll_6552,
24 pll_6553, 27 pll_6553,
25}; 28};
@@ -61,15 +64,6 @@ struct samsung_pll_rate_table {
61 unsigned int afc; 64 unsigned int afc;
62}; 65};
63 66
64enum pll46xx_type {
65 pll_4600,
66 pll_4650,
67 pll_4650c,
68};
69
70extern struct clk * __init samsung_clk_register_pll46xx(const char *name,
71 const char *pname, const void __iomem *con_reg,
72 enum pll46xx_type type);
73extern struct clk * __init samsung_clk_register_pll2550x(const char *name, 67extern struct clk * __init samsung_clk_register_pll2550x(const char *name,
74 const char *pname, const void __iomem *reg_base, 68 const char *pname, const void __iomem *reg_base,
75 const unsigned long offset); 69 const unsigned long offset);