aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk-nomadik.c
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-09-16 18:32:34 -0400
committerSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-09-29 15:07:06 -0400
commit74227e65f9742f559f6e243ba2c9a983e1f1221d (patch)
tree4a14ec1caaaaa84ef29d76ef617d154727ba3ed4 /drivers/clk/clk-nomadik.c
parentea25a900f593cd34347ec884b3acac09ffe07667 (diff)
clk: nomadik: declare OF clock provider
Common clock framework allows to register clock providers to get called on of_clk_init() by using CLK_OF_DECLARE. This converts nomadik clock provider to make use of it and get rid of the mach specific clk init call. As clocks require system reset controller base address to be initialized each clock driver checks src_base and calls new nomadik_src_init if required. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/clk-nomadik.c')
-rw-r--r--drivers/clk/clk-nomadik.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
index 06b29c264dbe..ce2d6b32e3f5 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -512,6 +512,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
512 const char *parent_name; 512 const char *parent_name;
513 u32 pll_id; 513 u32 pll_id;
514 514
515 if (!src_base)
516 nomadik_src_init();
517
515 if (of_property_read_u32(np, "pll-id", &pll_id)) { 518 if (of_property_read_u32(np, "pll-id", &pll_id)) {
516 pr_err("%s: PLL \"%s\" missing pll-id property\n", 519 pr_err("%s: PLL \"%s\" missing pll-id property\n",
517 __func__, clk_name); 520 __func__, clk_name);
@@ -522,6 +525,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
522 if (!IS_ERR(clk)) 525 if (!IS_ERR(clk))
523 of_clk_add_provider(np, of_clk_src_simple_get, clk); 526 of_clk_add_provider(np, of_clk_src_simple_get, clk);
524} 527}
528CLK_OF_DECLARE(nomadik_pll_clk,
529 "st,nomadik-pll-clock", of_nomadik_pll_setup);
525 530
526static void __init of_nomadik_hclk_setup(struct device_node *np) 531static void __init of_nomadik_hclk_setup(struct device_node *np)
527{ 532{
@@ -529,6 +534,9 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
529 const char *clk_name = np->name; 534 const char *clk_name = np->name;
530 const char *parent_name; 535 const char *parent_name;
531 536
537 if (!src_base)
538 nomadik_src_init();
539
532 parent_name = of_clk_get_parent_name(np, 0); 540 parent_name = of_clk_get_parent_name(np, 0);
533 /* 541 /*
534 * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4. 542 * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4.
@@ -541,6 +549,8 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
541 if (!IS_ERR(clk)) 549 if (!IS_ERR(clk))
542 of_clk_add_provider(np, of_clk_src_simple_get, clk); 550 of_clk_add_provider(np, of_clk_src_simple_get, clk);
543} 551}
552CLK_OF_DECLARE(nomadik_hclk_clk,
553 "st,nomadik-hclk-clock", of_nomadik_hclk_setup);
544 554
545static void __init of_nomadik_src_clk_setup(struct device_node *np) 555static void __init of_nomadik_src_clk_setup(struct device_node *np)
546{ 556{
@@ -549,6 +559,9 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
549 const char *parent_name; 559 const char *parent_name;
550 u32 clk_id; 560 u32 clk_id;
551 561
562 if (!src_base)
563 nomadik_src_init();
564
552 if (of_property_read_u32(np, "clock-id", &clk_id)) { 565 if (of_property_read_u32(np, "clock-id", &clk_id)) {
553 pr_err("%s: SRC clock \"%s\" missing clock-id property\n", 566 pr_err("%s: SRC clock \"%s\" missing clock-id property\n",
554 __func__, clk_name); 567 __func__, clk_name);
@@ -559,33 +572,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
559 if (!IS_ERR(clk)) 572 if (!IS_ERR(clk))
560 of_clk_add_provider(np, of_clk_src_simple_get, clk); 573 of_clk_add_provider(np, of_clk_src_simple_get, clk);
561} 574}
562 575CLK_OF_DECLARE(nomadik_src_clk,
563static const struct of_device_id nomadik_src_clk_match[] __initconst = { 576 "st,nomadik-src-clock", of_nomadik_src_clk_setup);
564 {
565 .compatible = "fixed-clock",
566 .data = of_fixed_clk_setup,
567 },
568 {
569 .compatible = "fixed-factor-clock",
570 .data = of_fixed_factor_clk_setup,
571 },
572 {
573 .compatible = "st,nomadik-pll-clock",
574 .data = of_nomadik_pll_setup,
575 },
576 {
577 .compatible = "st,nomadik-hclk-clock",
578 .data = of_nomadik_hclk_setup,
579 },
580 {
581 .compatible = "st,nomadik-src-clock",
582 .data = of_nomadik_src_clk_setup,
583 },
584 { /* sentinel */ }
585};
586
587void __init nomadik_clk_init(void)
588{
589 nomadik_src_init();
590 of_clk_init(nomadik_src_clk_match);
591}