diff options
author | Tomasz Figa <tomasz.figa@gmail.com> | 2013-08-20 20:33:21 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2013-08-26 21:09:56 -0400 |
commit | 40ef723c8bf3c675aa210d98fc411e347911829c (patch) | |
tree | 56e0835fdc5495c4b975aee02551c11029a694fd /drivers/clk | |
parent | 5cfe9614f365915d9e75d110d4008b06a5c0b99e (diff) |
clk: samsung: pll: Use new registration method for PLL6552 and PLL6553
This patch modifies PLL6552 and PLL6553 clock drivers to use recently
added common Samsung PLL registration method.
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/samsung/clk-pll.c | 105 | ||||
-rw-r--r-- | drivers/clk/samsung/clk-pll.h | 6 |
2 files changed, 13 insertions, 98 deletions
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c index 077555416ce1..7572d1d4fac1 100644 --- a/drivers/clk/samsung/clk-pll.c +++ b/drivers/clk/samsung/clk-pll.c | |||
@@ -441,9 +441,6 @@ struct clk * __init samsung_clk_register_pll46xx(const char *name, | |||
441 | * PLL6552 Clock Type | 441 | * PLL6552 Clock Type |
442 | */ | 442 | */ |
443 | 443 | ||
444 | #define PLL6552_LOCK_REG 0x00 | ||
445 | #define PLL6552_CON_REG 0x0c | ||
446 | |||
447 | #define PLL6552_MDIV_MASK 0x3ff | 444 | #define PLL6552_MDIV_MASK 0x3ff |
448 | #define PLL6552_PDIV_MASK 0x3f | 445 | #define PLL6552_PDIV_MASK 0x3f |
449 | #define PLL6552_SDIV_MASK 0x7 | 446 | #define PLL6552_SDIV_MASK 0x7 |
@@ -451,21 +448,14 @@ struct clk * __init samsung_clk_register_pll46xx(const char *name, | |||
451 | #define PLL6552_PDIV_SHIFT 8 | 448 | #define PLL6552_PDIV_SHIFT 8 |
452 | #define PLL6552_SDIV_SHIFT 0 | 449 | #define PLL6552_SDIV_SHIFT 0 |
453 | 450 | ||
454 | struct samsung_clk_pll6552 { | ||
455 | struct clk_hw hw; | ||
456 | void __iomem *reg_base; | ||
457 | }; | ||
458 | |||
459 | #define to_clk_pll6552(_hw) container_of(_hw, struct samsung_clk_pll6552, hw) | ||
460 | |||
461 | static unsigned long samsung_pll6552_recalc_rate(struct clk_hw *hw, | 451 | static unsigned long samsung_pll6552_recalc_rate(struct clk_hw *hw, |
462 | unsigned long parent_rate) | 452 | unsigned long parent_rate) |
463 | { | 453 | { |
464 | struct samsung_clk_pll6552 *pll = to_clk_pll6552(hw); | 454 | struct samsung_clk_pll *pll = to_clk_pll(hw); |
465 | u32 mdiv, pdiv, sdiv, pll_con; | 455 | u32 mdiv, pdiv, sdiv, pll_con; |
466 | u64 fvco = parent_rate; | 456 | u64 fvco = parent_rate; |
467 | 457 | ||
468 | pll_con = __raw_readl(pll->reg_base + PLL6552_CON_REG); | 458 | pll_con = __raw_readl(pll->con_reg); |
469 | mdiv = (pll_con >> PLL6552_MDIV_SHIFT) & PLL6552_MDIV_MASK; | 459 | mdiv = (pll_con >> PLL6552_MDIV_SHIFT) & PLL6552_MDIV_MASK; |
470 | pdiv = (pll_con >> PLL6552_PDIV_SHIFT) & PLL6552_PDIV_MASK; | 460 | pdiv = (pll_con >> PLL6552_PDIV_SHIFT) & PLL6552_PDIV_MASK; |
471 | sdiv = (pll_con >> PLL6552_SDIV_SHIFT) & PLL6552_SDIV_MASK; | 461 | sdiv = (pll_con >> PLL6552_SDIV_SHIFT) & PLL6552_SDIV_MASK; |
@@ -480,48 +470,10 @@ static const struct clk_ops samsung_pll6552_clk_ops = { | |||
480 | .recalc_rate = samsung_pll6552_recalc_rate, | 470 | .recalc_rate = samsung_pll6552_recalc_rate, |
481 | }; | 471 | }; |
482 | 472 | ||
483 | struct clk * __init samsung_clk_register_pll6552(const char *name, | ||
484 | const char *pname, void __iomem *base) | ||
485 | { | ||
486 | struct samsung_clk_pll6552 *pll; | ||
487 | struct clk *clk; | ||
488 | struct clk_init_data init; | ||
489 | |||
490 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
491 | if (!pll) { | ||
492 | pr_err("%s: could not allocate pll clk %s\n", __func__, name); | ||
493 | return NULL; | ||
494 | } | ||
495 | |||
496 | init.name = name; | ||
497 | init.ops = &samsung_pll6552_clk_ops; | ||
498 | init.parent_names = &pname; | ||
499 | init.num_parents = 1; | ||
500 | |||
501 | pll->hw.init = &init; | ||
502 | pll->reg_base = base; | ||
503 | |||
504 | clk = clk_register(NULL, &pll->hw); | ||
505 | if (IS_ERR(clk)) { | ||
506 | pr_err("%s: failed to register pll clock %s\n", __func__, | ||
507 | name); | ||
508 | kfree(pll); | ||
509 | } | ||
510 | |||
511 | if (clk_register_clkdev(clk, name, NULL)) | ||
512 | pr_err("%s: failed to register lookup for %s", __func__, name); | ||
513 | |||
514 | return clk; | ||
515 | } | ||
516 | |||
517 | /* | 473 | /* |
518 | * PLL6553 Clock Type | 474 | * PLL6553 Clock Type |
519 | */ | 475 | */ |
520 | 476 | ||
521 | #define PLL6553_LOCK_REG 0x00 | ||
522 | #define PLL6553_CON0_REG 0x0c | ||
523 | #define PLL6553_CON1_REG 0x10 | ||
524 | |||
525 | #define PLL6553_MDIV_MASK 0xff | 477 | #define PLL6553_MDIV_MASK 0xff |
526 | #define PLL6553_PDIV_MASK 0x3f | 478 | #define PLL6553_PDIV_MASK 0x3f |
527 | #define PLL6553_SDIV_MASK 0x7 | 479 | #define PLL6553_SDIV_MASK 0x7 |
@@ -531,22 +483,15 @@ struct clk * __init samsung_clk_register_pll6552(const char *name, | |||
531 | #define PLL6553_SDIV_SHIFT 0 | 483 | #define PLL6553_SDIV_SHIFT 0 |
532 | #define PLL6553_KDIV_SHIFT 0 | 484 | #define PLL6553_KDIV_SHIFT 0 |
533 | 485 | ||
534 | struct samsung_clk_pll6553 { | ||
535 | struct clk_hw hw; | ||
536 | void __iomem *reg_base; | ||
537 | }; | ||
538 | |||
539 | #define to_clk_pll6553(_hw) container_of(_hw, struct samsung_clk_pll6553, hw) | ||
540 | |||
541 | static unsigned long samsung_pll6553_recalc_rate(struct clk_hw *hw, | 486 | static unsigned long samsung_pll6553_recalc_rate(struct clk_hw *hw, |
542 | unsigned long parent_rate) | 487 | unsigned long parent_rate) |
543 | { | 488 | { |
544 | struct samsung_clk_pll6553 *pll = to_clk_pll6553(hw); | 489 | struct samsung_clk_pll *pll = to_clk_pll(hw); |
545 | u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1; | 490 | u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1; |
546 | u64 fvco = parent_rate; | 491 | u64 fvco = parent_rate; |
547 | 492 | ||
548 | pll_con0 = __raw_readl(pll->reg_base + PLL6553_CON0_REG); | 493 | pll_con0 = __raw_readl(pll->con_reg); |
549 | pll_con1 = __raw_readl(pll->reg_base + PLL6553_CON1_REG); | 494 | pll_con1 = __raw_readl(pll->con_reg + 0x4); |
550 | mdiv = (pll_con0 >> PLL6553_MDIV_SHIFT) & PLL6553_MDIV_MASK; | 495 | mdiv = (pll_con0 >> PLL6553_MDIV_SHIFT) & PLL6553_MDIV_MASK; |
551 | pdiv = (pll_con0 >> PLL6553_PDIV_SHIFT) & PLL6553_PDIV_MASK; | 496 | pdiv = (pll_con0 >> PLL6553_PDIV_SHIFT) & PLL6553_PDIV_MASK; |
552 | sdiv = (pll_con0 >> PLL6553_SDIV_SHIFT) & PLL6553_SDIV_MASK; | 497 | sdiv = (pll_con0 >> PLL6553_SDIV_SHIFT) & PLL6553_SDIV_MASK; |
@@ -563,40 +508,6 @@ static const struct clk_ops samsung_pll6553_clk_ops = { | |||
563 | .recalc_rate = samsung_pll6553_recalc_rate, | 508 | .recalc_rate = samsung_pll6553_recalc_rate, |
564 | }; | 509 | }; |
565 | 510 | ||
566 | struct clk * __init samsung_clk_register_pll6553(const char *name, | ||
567 | const char *pname, void __iomem *base) | ||
568 | { | ||
569 | struct samsung_clk_pll6553 *pll; | ||
570 | struct clk *clk; | ||
571 | struct clk_init_data init; | ||
572 | |||
573 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
574 | if (!pll) { | ||
575 | pr_err("%s: could not allocate pll clk %s\n", __func__, name); | ||
576 | return NULL; | ||
577 | } | ||
578 | |||
579 | init.name = name; | ||
580 | init.ops = &samsung_pll6553_clk_ops; | ||
581 | init.parent_names = &pname; | ||
582 | init.num_parents = 1; | ||
583 | |||
584 | pll->hw.init = &init; | ||
585 | pll->reg_base = base; | ||
586 | |||
587 | clk = clk_register(NULL, &pll->hw); | ||
588 | if (IS_ERR(clk)) { | ||
589 | pr_err("%s: failed to register pll clock %s\n", __func__, | ||
590 | name); | ||
591 | kfree(pll); | ||
592 | } | ||
593 | |||
594 | if (clk_register_clkdev(clk, name, NULL)) | ||
595 | pr_err("%s: failed to register lookup for %s", __func__, name); | ||
596 | |||
597 | return clk; | ||
598 | } | ||
599 | |||
600 | /* | 511 | /* |
601 | * PLL2550x Clock Type | 512 | * PLL2550x Clock Type |
602 | */ | 513 | */ |
@@ -732,6 +643,12 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk, | |||
732 | else | 643 | else |
733 | init.ops = &samsung_pll36xx_clk_ops; | 644 | init.ops = &samsung_pll36xx_clk_ops; |
734 | break; | 645 | break; |
646 | case pll_6552: | ||
647 | init.ops = &samsung_pll6552_clk_ops; | ||
648 | break; | ||
649 | case pll_6553: | ||
650 | init.ops = &samsung_pll6553_clk_ops; | ||
651 | break; | ||
735 | default: | 652 | default: |
736 | pr_warn("%s: Unknown pll type for pll clk %s\n", | 653 | pr_warn("%s: Unknown pll type for pll clk %s\n", |
737 | __func__, pll_clk->name); | 654 | __func__, pll_clk->name); |
diff --git a/drivers/clk/samsung/clk-pll.h b/drivers/clk/samsung/clk-pll.h index 2f70e88d6104..cd1103784f71 100644 --- a/drivers/clk/samsung/clk-pll.h +++ b/drivers/clk/samsung/clk-pll.h | |||
@@ -17,6 +17,8 @@ enum samsung_pll_type { | |||
17 | pll_36xx, | 17 | pll_36xx, |
18 | pll_2550, | 18 | pll_2550, |
19 | pll_2650, | 19 | pll_2650, |
20 | pll_6552, | ||
21 | pll_6553, | ||
20 | }; | 22 | }; |
21 | 23 | ||
22 | #define PLL_35XX_RATE(_rate, _m, _p, _s) \ | 24 | #define PLL_35XX_RATE(_rate, _m, _p, _s) \ |
@@ -64,10 +66,6 @@ extern struct clk * __init samsung_clk_register_pll45xx(const char *name, | |||
64 | extern struct clk * __init samsung_clk_register_pll46xx(const char *name, | 66 | extern struct clk * __init samsung_clk_register_pll46xx(const char *name, |
65 | const char *pname, const void __iomem *con_reg, | 67 | const char *pname, const void __iomem *con_reg, |
66 | enum pll46xx_type type); | 68 | enum pll46xx_type type); |
67 | extern struct clk *samsung_clk_register_pll6552(const char *name, | ||
68 | const char *pname, void __iomem *base); | ||
69 | extern struct clk *samsung_clk_register_pll6553(const char *name, | ||
70 | const char *pname, void __iomem *base); | ||
71 | extern struct clk * __init samsung_clk_register_pll2550x(const char *name, | 69 | extern struct clk * __init samsung_clk_register_pll2550x(const char *name, |
72 | const char *pname, const void __iomem *reg_base, | 70 | const char *pname, const void __iomem *reg_base, |
73 | const unsigned long offset); | 71 | const unsigned long offset); |