aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk-bcm2835.c8
-rw-r--r--drivers/clk/clk-highbank.c10
-rw-r--r--drivers/clk/clk-nomadik.c182
-rw-r--r--drivers/clk/clk-prima2.c29
-rw-r--r--drivers/clk/clk-vt8500.c34
-rw-r--r--drivers/clk/mvebu/armada-370.c4
-rw-r--r--drivers/clk/mxs/clk-imx23.c15
-rw-r--r--drivers/clk/mxs/clk-imx28.c16
-rw-r--r--drivers/clk/socfpga/clk.c2
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c11
-rw-r--r--drivers/clk/versatile/clk-icst.c2
11 files changed, 159 insertions, 154 deletions
diff --git a/drivers/clk/clk-bcm2835.c b/drivers/clk/clk-bcm2835.c
index 5fb4ff53d088..6b950ca8b711 100644
--- a/drivers/clk/clk-bcm2835.c
+++ b/drivers/clk/clk-bcm2835.c
@@ -20,14 +20,8 @@
20#include <linux/clk-provider.h> 20#include <linux/clk-provider.h>
21#include <linux/clkdev.h> 21#include <linux/clkdev.h>
22#include <linux/clk/bcm2835.h> 22#include <linux/clk/bcm2835.h>
23#include <linux/clk-provider.h>
24#include <linux/of.h> 23#include <linux/of.h>
25 24
26static const struct of_device_id clk_match[] __initconst = {
27 { .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
28 { }
29};
30
31/* 25/*
32 * These are fixed clocks. They're probably not all root clocks and it may 26 * These are fixed clocks. They're probably not all root clocks and it may
33 * be possible to turn them on and off but until this is mapped out better 27 * be possible to turn them on and off but until this is mapped out better
@@ -63,6 +57,4 @@ void __init bcm2835_init_clocks(void)
63 ret = clk_register_clkdev(clk, NULL, "20215000.uart"); 57 ret = clk_register_clkdev(clk, NULL, "20215000.uart");
64 if (ret) 58 if (ret)
65 pr_err("uart1_pclk alias not registered\n"); 59 pr_err("uart1_pclk alias not registered\n");
66
67 of_clk_init(clk_match);
68} 60}
diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c
index 2e08cb001936..2e7e9d9798cb 100644
--- a/drivers/clk/clk-highbank.c
+++ b/drivers/clk/clk-highbank.c
@@ -20,8 +20,7 @@
20#include <linux/clk-provider.h> 20#include <linux/clk-provider.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/of.h> 22#include <linux/of.h>
23 23#include <linux/of_address.h>
24extern void __iomem *sregs_base;
25 24
26#define HB_PLL_LOCK_500 0x20000000 25#define HB_PLL_LOCK_500 0x20000000
27#define HB_PLL_LOCK 0x10000000 26#define HB_PLL_LOCK 0x10000000
@@ -280,6 +279,7 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
280 const char *clk_name = node->name; 279 const char *clk_name = node->name;
281 const char *parent_name; 280 const char *parent_name;
282 struct clk_init_data init; 281 struct clk_init_data init;
282 struct device_node *srnp;
283 int rc; 283 int rc;
284 284
285 rc = of_property_read_u32(node, "reg", &reg); 285 rc = of_property_read_u32(node, "reg", &reg);
@@ -290,7 +290,11 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
290 if (WARN_ON(!hb_clk)) 290 if (WARN_ON(!hb_clk))
291 return NULL; 291 return NULL;
292 292
293 hb_clk->reg = sregs_base + reg; 293 /* Map system registers */
294 srnp = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
295 hb_clk->reg = of_iomap(srnp, 0);
296 BUG_ON(!hb_clk->reg);
297 hb_clk->reg += reg;
294 298
295 of_property_read_string(node, "clock-output-names", &clk_name); 299 of_property_read_string(node, "clock-output-names", &clk_name);
296 300
diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
index 51410c2ac2cb..6a934a5296bd 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -27,6 +27,14 @@
27 */ 27 */
28 28
29#define SRC_CR 0x00U 29#define SRC_CR 0x00U
30#define SRC_CR_T0_ENSEL BIT(15)
31#define SRC_CR_T1_ENSEL BIT(17)
32#define SRC_CR_T2_ENSEL BIT(19)
33#define SRC_CR_T3_ENSEL BIT(21)
34#define SRC_CR_T4_ENSEL BIT(23)
35#define SRC_CR_T5_ENSEL BIT(25)
36#define SRC_CR_T6_ENSEL BIT(27)
37#define SRC_CR_T7_ENSEL BIT(29)
30#define SRC_XTALCR 0x0CU 38#define SRC_XTALCR 0x0CU
31#define SRC_XTALCR_XTALTIMEN BIT(20) 39#define SRC_XTALCR_XTALTIMEN BIT(20)
32#define SRC_XTALCR_SXTALDIS BIT(19) 40#define SRC_XTALCR_SXTALDIS BIT(19)
@@ -54,6 +62,79 @@ static DEFINE_SPINLOCK(src_lock);
54/* Base address of the SRC */ 62/* Base address of the SRC */
55static void __iomem *src_base; 63static void __iomem *src_base;
56 64
65static int nomadik_clk_reboot_handler(struct notifier_block *this,
66 unsigned long code,
67 void *unused)
68{
69 u32 val;
70
71 /* The main chrystal need to be enabled for reboot to work */
72 val = readl(src_base + SRC_XTALCR);
73 val &= ~SRC_XTALCR_MXTALOVER;
74 val |= SRC_XTALCR_MXTALEN;
75 pr_crit("force-enabling MXTALO\n");
76 writel(val, src_base + SRC_XTALCR);
77 return NOTIFY_OK;
78}
79
80static struct notifier_block nomadik_clk_reboot_notifier = {
81 .notifier_call = nomadik_clk_reboot_handler,
82};
83
84static const struct of_device_id nomadik_src_match[] __initconst = {
85 { .compatible = "stericsson,nomadik-src" },
86 { /* sentinel */ }
87};
88
89static void __init nomadik_src_init(void)
90{
91 struct device_node *np;
92 u32 val;
93
94 np = of_find_matching_node(NULL, nomadik_src_match);
95 if (!np) {
96 pr_crit("no matching node for SRC, aborting clock init\n");
97 return;
98 }
99 src_base = of_iomap(np, 0);
100 if (!src_base) {
101 pr_err("%s: must have src parent node with REGS (%s)\n",
102 __func__, np->name);
103 return;
104 }
105
106 /* Set all timers to use the 2.4 MHz TIMCLK */
107 val = readl(src_base + SRC_CR);
108 val |= SRC_CR_T0_ENSEL;
109 val |= SRC_CR_T1_ENSEL;
110 val |= SRC_CR_T2_ENSEL;
111 val |= SRC_CR_T3_ENSEL;
112 val |= SRC_CR_T4_ENSEL;
113 val |= SRC_CR_T5_ENSEL;
114 val |= SRC_CR_T6_ENSEL;
115 val |= SRC_CR_T7_ENSEL;
116 writel(val, src_base + SRC_CR);
117
118 val = readl(src_base + SRC_XTALCR);
119 pr_info("SXTALO is %s\n",
120 (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
121 pr_info("MXTAL is %s\n",
122 (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
123 if (of_property_read_bool(np, "disable-sxtalo")) {
124 /* The machine uses an external oscillator circuit */
125 val |= SRC_XTALCR_SXTALDIS;
126 pr_info("disabling SXTALO\n");
127 }
128 if (of_property_read_bool(np, "disable-mxtalo")) {
129 /* Disable this too: also run by external oscillator */
130 val |= SRC_XTALCR_MXTALOVER;
131 val &= ~SRC_XTALCR_MXTALEN;
132 pr_info("disabling MXTALO\n");
133 }
134 writel(val, src_base + SRC_XTALCR);
135 register_reboot_notifier(&nomadik_clk_reboot_notifier);
136}
137
57/** 138/**
58 * struct clk_pll1 - Nomadik PLL1 clock 139 * struct clk_pll1 - Nomadik PLL1 clock
59 * @hw: corresponding clock hardware entry 140 * @hw: corresponding clock hardware entry
@@ -431,6 +512,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
431 const char *parent_name; 512 const char *parent_name;
432 u32 pll_id; 513 u32 pll_id;
433 514
515 if (!src_base)
516 nomadik_src_init();
517
434 if (of_property_read_u32(np, "pll-id", &pll_id)) { 518 if (of_property_read_u32(np, "pll-id", &pll_id)) {
435 pr_err("%s: PLL \"%s\" missing pll-id property\n", 519 pr_err("%s: PLL \"%s\" missing pll-id property\n",
436 __func__, clk_name); 520 __func__, clk_name);
@@ -441,6 +525,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
441 if (!IS_ERR(clk)) 525 if (!IS_ERR(clk))
442 of_clk_add_provider(np, of_clk_src_simple_get, clk); 526 of_clk_add_provider(np, of_clk_src_simple_get, clk);
443} 527}
528CLK_OF_DECLARE(nomadik_pll_clk,
529 "st,nomadik-pll-clock", of_nomadik_pll_setup);
444 530
445static void __init of_nomadik_hclk_setup(struct device_node *np) 531static void __init of_nomadik_hclk_setup(struct device_node *np)
446{ 532{
@@ -448,6 +534,9 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
448 const char *clk_name = np->name; 534 const char *clk_name = np->name;
449 const char *parent_name; 535 const char *parent_name;
450 536
537 if (!src_base)
538 nomadik_src_init();
539
451 parent_name = of_clk_get_parent_name(np, 0); 540 parent_name = of_clk_get_parent_name(np, 0);
452 /* 541 /*
453 * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4. 542 * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4.
@@ -460,6 +549,8 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
460 if (!IS_ERR(clk)) 549 if (!IS_ERR(clk))
461 of_clk_add_provider(np, of_clk_src_simple_get, clk); 550 of_clk_add_provider(np, of_clk_src_simple_get, clk);
462} 551}
552CLK_OF_DECLARE(nomadik_hclk_clk,
553 "st,nomadik-hclk-clock", of_nomadik_hclk_setup);
463 554
464static void __init of_nomadik_src_clk_setup(struct device_node *np) 555static void __init of_nomadik_src_clk_setup(struct device_node *np)
465{ 556{
@@ -468,6 +559,9 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
468 const char *parent_name; 559 const char *parent_name;
469 u32 clk_id; 560 u32 clk_id;
470 561
562 if (!src_base)
563 nomadik_src_init();
564
471 if (of_property_read_u32(np, "clock-id", &clk_id)) { 565 if (of_property_read_u32(np, "clock-id", &clk_id)) {
472 pr_err("%s: SRC clock \"%s\" missing clock-id property\n", 566 pr_err("%s: SRC clock \"%s\" missing clock-id property\n",
473 __func__, clk_name); 567 __func__, clk_name);
@@ -478,89 +572,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
478 if (!IS_ERR(clk)) 572 if (!IS_ERR(clk))
479 of_clk_add_provider(np, of_clk_src_simple_get, clk); 573 of_clk_add_provider(np, of_clk_src_simple_get, clk);
480} 574}
481 575CLK_OF_DECLARE(nomadik_src_clk,
482static const struct of_device_id nomadik_src_match[] __initconst = { 576 "st,nomadik-src-clock", of_nomadik_src_clk_setup);
483 { .compatible = "stericsson,nomadik-src" },
484 { /* sentinel */ }
485};
486
487static const struct of_device_id nomadik_src_clk_match[] __initconst = {
488 {
489 .compatible = "fixed-clock",
490 .data = of_fixed_clk_setup,
491 },
492 {
493 .compatible = "fixed-factor-clock",
494 .data = of_fixed_factor_clk_setup,
495 },
496 {
497 .compatible = "st,nomadik-pll-clock",
498 .data = of_nomadik_pll_setup,
499 },
500 {
501 .compatible = "st,nomadik-hclk-clock",
502 .data = of_nomadik_hclk_setup,
503 },
504 {
505 .compatible = "st,nomadik-src-clock",
506 .data = of_nomadik_src_clk_setup,
507 },
508 { /* sentinel */ }
509};
510
511static int nomadik_clk_reboot_handler(struct notifier_block *this,
512 unsigned long code,
513 void *unused)
514{
515 u32 val;
516
517 /* The main chrystal need to be enabled for reboot to work */
518 val = readl(src_base + SRC_XTALCR);
519 val &= ~SRC_XTALCR_MXTALOVER;
520 val |= SRC_XTALCR_MXTALEN;
521 pr_crit("force-enabling MXTALO\n");
522 writel(val, src_base + SRC_XTALCR);
523 return NOTIFY_OK;
524}
525
526static struct notifier_block nomadik_clk_reboot_notifier = {
527 .notifier_call = nomadik_clk_reboot_handler,
528};
529
530void __init nomadik_clk_init(void)
531{
532 struct device_node *np;
533 u32 val;
534
535 np = of_find_matching_node(NULL, nomadik_src_match);
536 if (!np) {
537 pr_crit("no matching node for SRC, aborting clock init\n");
538 return;
539 }
540 src_base = of_iomap(np, 0);
541 if (!src_base) {
542 pr_err("%s: must have src parent node with REGS (%s)\n",
543 __func__, np->name);
544 return;
545 }
546 val = readl(src_base + SRC_XTALCR);
547 pr_info("SXTALO is %s\n",
548 (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
549 pr_info("MXTAL is %s\n",
550 (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
551 if (of_property_read_bool(np, "disable-sxtalo")) {
552 /* The machine uses an external oscillator circuit */
553 val |= SRC_XTALCR_SXTALDIS;
554 pr_info("disabling SXTALO\n");
555 }
556 if (of_property_read_bool(np, "disable-mxtalo")) {
557 /* Disable this too: also run by external oscillator */
558 val |= SRC_XTALCR_MXTALOVER;
559 val &= ~SRC_XTALCR_MXTALEN;
560 pr_info("disabling MXTALO\n");
561 }
562 writel(val, src_base + SRC_XTALCR);
563 register_reboot_notifier(&nomadik_clk_reboot_notifier);
564
565 of_clk_init(nomadik_src_clk_match);
566}
diff --git a/drivers/clk/clk-prima2.c b/drivers/clk/clk-prima2.c
index 5ab95f1ad579..6c15e3316137 100644
--- a/drivers/clk/clk-prima2.c
+++ b/drivers/clk/clk-prima2.c
@@ -1015,16 +1015,6 @@ static struct clk_std clk_usb1 = {
1015 }, 1015 },
1016}; 1016};
1017 1017
1018static struct of_device_id clkc_ids[] = {
1019 { .compatible = "sirf,prima2-clkc" },
1020 {},
1021};
1022
1023static struct of_device_id rsc_ids[] = {
1024 { .compatible = "sirf,prima2-rsc" },
1025 {},
1026};
1027
1028enum prima2_clk_index { 1018enum prima2_clk_index {
1029 /* 0 1 2 3 4 5 6 7 8 9 */ 1019 /* 0 1 2 3 4 5 6 7 8 9 */
1030 rtc, osc, pll1, pll2, pll3, mem, sys, security, dsp, gps, 1020 rtc, osc, pll1, pll2, pll3, mem, sys, security, dsp, gps,
@@ -1082,24 +1072,16 @@ static struct clk_hw *prima2_clk_hw_array[maxclk] __initdata = {
1082static struct clk *prima2_clks[maxclk]; 1072static struct clk *prima2_clks[maxclk];
1083static struct clk_onecell_data clk_data; 1073static struct clk_onecell_data clk_data;
1084 1074
1085void __init sirfsoc_of_clk_init(void) 1075static void __init sirfsoc_clk_init(struct device_node *np)
1086{ 1076{
1087 struct device_node *np; 1077 struct device_node *rscnp;
1088 int i; 1078 int i;
1089 1079
1090 np = of_find_matching_node(NULL, rsc_ids); 1080 rscnp = of_find_compatible_node(NULL, NULL, "sirf,prima2-rsc");
1091 if (!np) 1081 sirfsoc_rsc_vbase = of_iomap(rscnp, 0);
1092 panic("unable to find compatible rsc node in dtb\n");
1093
1094 sirfsoc_rsc_vbase = of_iomap(np, 0);
1095 if (!sirfsoc_rsc_vbase) 1082 if (!sirfsoc_rsc_vbase)
1096 panic("unable to map rsc registers\n"); 1083 panic("unable to map rsc registers\n");
1097 1084 of_node_put(rscnp);
1098 of_node_put(np);
1099
1100 np = of_find_matching_node(NULL, clkc_ids);
1101 if (!np)
1102 return;
1103 1085
1104 sirfsoc_clk_vbase = of_iomap(np, 0); 1086 sirfsoc_clk_vbase = of_iomap(np, 0);
1105 if (!sirfsoc_clk_vbase) 1087 if (!sirfsoc_clk_vbase)
@@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)
1124 1106
1125 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 1107 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
1126} 1108}
1109CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index 82306f5fb9c2..7fd5c5e9e25d 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -15,11 +15,14 @@
15 15
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_address.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <linux/bitops.h> 20#include <linux/bitops.h>
20#include <linux/clkdev.h> 21#include <linux/clkdev.h>
21#include <linux/clk-provider.h> 22#include <linux/clk-provider.h>
22 23
24#define LEGACY_PMC_BASE 0xD8130000
25
23/* All clocks share the same lock as none can be changed concurrently */ 26/* All clocks share the same lock as none can be changed concurrently */
24static DEFINE_SPINLOCK(_lock); 27static DEFINE_SPINLOCK(_lock);
25 28
@@ -53,6 +56,21 @@ struct clk_pll {
53 56
54static void __iomem *pmc_base; 57static void __iomem *pmc_base;
55 58
59static __init void vtwm_set_pmc_base(void)
60{
61 struct device_node *np =
62 of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
63
64 if (np)
65 pmc_base = of_iomap(np, 0);
66 else
67 pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000);
68 of_node_put(np);
69
70 if (!pmc_base)
71 pr_err("%s:of_iomap(pmc) failed\n", __func__);
72}
73
56#define to_clk_device(_hw) container_of(_hw, struct clk_device, hw) 74#define to_clk_device(_hw) container_of(_hw, struct clk_device, hw)
57 75
58#define VT8500_PMC_BUSY_MASK 0x18 76#define VT8500_PMC_BUSY_MASK 0x18
@@ -222,6 +240,9 @@ static __init void vtwm_device_clk_init(struct device_node *node)
222 int rc; 240 int rc;
223 int clk_init_flags = 0; 241 int clk_init_flags = 0;
224 242
243 if (!pmc_base)
244 vtwm_set_pmc_base();
245
225 dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL); 246 dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL);
226 if (WARN_ON(!dev_clk)) 247 if (WARN_ON(!dev_clk))
227 return; 248 return;
@@ -636,6 +657,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
636 struct clk_init_data init; 657 struct clk_init_data init;
637 int rc; 658 int rc;
638 659
660 if (!pmc_base)
661 vtwm_set_pmc_base();
662
639 rc = of_property_read_u32(node, "reg", &reg); 663 rc = of_property_read_u32(node, "reg", &reg);
640 if (WARN_ON(rc)) 664 if (WARN_ON(rc))
641 return; 665 return;
@@ -694,13 +718,3 @@ static void __init wm8850_pll_init(struct device_node *node)
694 vtwm_pll_clk_init(node, PLL_TYPE_WM8850); 718 vtwm_pll_clk_init(node, PLL_TYPE_WM8850);
695} 719}
696CLK_OF_DECLARE(wm8850_pll, "wm,wm8850-pll-clock", wm8850_pll_init); 720CLK_OF_DECLARE(wm8850_pll, "wm,wm8850-pll-clock", wm8850_pll_init);
697
698void __init vtwm_clk_init(void __iomem *base)
699{
700 if (!base)
701 return;
702
703 pmc_base = base;
704
705 of_clk_init(NULL);
706}
diff --git a/drivers/clk/mvebu/armada-370.c b/drivers/clk/mvebu/armada-370.c
index fc777bdc1886..81a202d12a7a 100644
--- a/drivers/clk/mvebu/armada-370.c
+++ b/drivers/clk/mvebu/armada-370.c
@@ -39,8 +39,8 @@ static const struct coreclk_ratio a370_coreclk_ratios[] __initconst = {
39}; 39};
40 40
41static const u32 a370_tclk_freqs[] __initconst = { 41static const u32 a370_tclk_freqs[] __initconst = {
42 16600000, 42 166000000,
43 20000000, 43 200000000,
44}; 44};
45 45
46static u32 __init a370_get_tclk_freq(void __iomem *sar) 46static u32 __init a370_get_tclk_freq(void __iomem *sar)
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index c396fe361589..9fc9359f5133 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -12,6 +12,7 @@
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/clk/mxs.h> 13#include <linux/clk/mxs.h>
14#include <linux/clkdev.h> 14#include <linux/clkdev.h>
15#include <linux/clk-provider.h>
15#include <linux/err.h> 16#include <linux/err.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/io.h> 18#include <linux/io.h>
@@ -100,16 +101,16 @@ static enum imx23_clk clks_init_on[] __initdata = {
100 cpu, hbus, xbus, emi, uart, 101 cpu, hbus, xbus, emi, uart,
101}; 102};
102 103
103int __init mx23_clocks_init(void) 104static void __init mx23_clocks_init(struct device_node *np)
104{ 105{
105 struct device_node *np; 106 struct device_node *dcnp;
106 u32 i; 107 u32 i;
107 108
108 np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl"); 109 dcnp = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl");
109 digctrl = of_iomap(np, 0); 110 digctrl = of_iomap(dcnp, 0);
110 WARN_ON(!digctrl); 111 WARN_ON(!digctrl);
112 of_node_put(dcnp);
111 113
112 np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
113 clkctrl = of_iomap(np, 0); 114 clkctrl = of_iomap(np, 0);
114 WARN_ON(!clkctrl); 115 WARN_ON(!clkctrl);
115 116
@@ -162,7 +163,7 @@ int __init mx23_clocks_init(void)
162 if (IS_ERR(clks[i])) { 163 if (IS_ERR(clks[i])) {
163 pr_err("i.MX23 clk %d: register failed with %ld\n", 164 pr_err("i.MX23 clk %d: register failed with %ld\n",
164 i, PTR_ERR(clks[i])); 165 i, PTR_ERR(clks[i]));
165 return PTR_ERR(clks[i]); 166 return;
166 } 167 }
167 168
168 clk_data.clks = clks; 169 clk_data.clks = clks;
@@ -172,5 +173,5 @@ int __init mx23_clocks_init(void)
172 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) 173 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
173 clk_prepare_enable(clks[clks_init_on[i]]); 174 clk_prepare_enable(clks[clks_init_on[i]]);
174 175
175 return 0;
176} 176}
177CLK_OF_DECLARE(imx23_clkctrl, "fsl,imx23-clkctrl", mx23_clocks_init);
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 4faf0afc44cd..a6c35010e4e5 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -12,6 +12,7 @@
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/clk/mxs.h> 13#include <linux/clk/mxs.h>
14#include <linux/clkdev.h> 14#include <linux/clkdev.h>
15#include <linux/clk-provider.h>
15#include <linux/err.h> 16#include <linux/err.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/io.h> 18#include <linux/io.h>
@@ -154,16 +155,16 @@ static enum imx28_clk clks_init_on[] __initdata = {
154 cpu, hbus, xbus, emi, uart, 155 cpu, hbus, xbus, emi, uart,
155}; 156};
156 157
157int __init mx28_clocks_init(void) 158static void __init mx28_clocks_init(struct device_node *np)
158{ 159{
159 struct device_node *np; 160 struct device_node *dcnp;
160 u32 i; 161 u32 i;
161 162
162 np = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl"); 163 dcnp = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl");
163 digctrl = of_iomap(np, 0); 164 digctrl = of_iomap(dcnp, 0);
164 WARN_ON(!digctrl); 165 WARN_ON(!digctrl);
166 of_node_put(dcnp);
165 167
166 np = of_find_compatible_node(NULL, NULL, "fsl,imx28-clkctrl");
167 clkctrl = of_iomap(np, 0); 168 clkctrl = of_iomap(np, 0);
168 WARN_ON(!clkctrl); 169 WARN_ON(!clkctrl);
169 170
@@ -239,7 +240,7 @@ int __init mx28_clocks_init(void)
239 if (IS_ERR(clks[i])) { 240 if (IS_ERR(clks[i])) {
240 pr_err("i.MX28 clk %d: register failed with %ld\n", 241 pr_err("i.MX28 clk %d: register failed with %ld\n",
241 i, PTR_ERR(clks[i])); 242 i, PTR_ERR(clks[i]));
242 return PTR_ERR(clks[i]); 243 return;
243 } 244 }
244 245
245 clk_data.clks = clks; 246 clk_data.clks = clks;
@@ -250,6 +251,5 @@ int __init mx28_clocks_init(void)
250 251
251 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) 252 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
252 clk_prepare_enable(clks[clks_init_on[i]]); 253 clk_prepare_enable(clks[clks_init_on[i]]);
253
254 return 0;
255} 254}
255CLK_OF_DECLARE(imx28_clkctrl, "fsl,imx28-clkctrl", mx28_clocks_init);
diff --git a/drivers/clk/socfpga/clk.c b/drivers/clk/socfpga/clk.c
index 5bb848cac6ec..81dd31a686df 100644
--- a/drivers/clk/socfpga/clk.c
+++ b/drivers/clk/socfpga/clk.c
@@ -49,7 +49,7 @@
49#define SOCFPGA_L4_SP_CLK "l4_sp_clk" 49#define SOCFPGA_L4_SP_CLK "l4_sp_clk"
50#define SOCFPGA_NAND_CLK "nand_clk" 50#define SOCFPGA_NAND_CLK "nand_clk"
51#define SOCFPGA_NAND_X_CLK "nand_x_clk" 51#define SOCFPGA_NAND_X_CLK "nand_x_clk"
52#define SOCFPGA_MMC_CLK "mmc_clk" 52#define SOCFPGA_MMC_CLK "sdmmc_clk"
53#define SOCFPGA_DB_CLK "gpio_db_clk" 53#define SOCFPGA_DB_CLK "gpio_db_clk"
54 54
55#define div_mask(width) ((1 << (width)) - 1) 55#define div_mask(width) ((1 << (width)) - 1)
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 34ee69f4d50c..9bbd03514540 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -16,7 +16,6 @@
16 16
17#include <linux/clk-provider.h> 17#include <linux/clk-provider.h>
18#include <linux/clkdev.h> 18#include <linux/clkdev.h>
19#include <linux/clk/sunxi.h>
20#include <linux/of.h> 19#include <linux/of.h>
21#include <linux/of_address.h> 20#include <linux/of_address.h>
22 21
@@ -617,11 +616,8 @@ static void __init of_sunxi_table_clock_setup(const struct of_device_id *clk_mat
617 } 616 }
618} 617}
619 618
620void __init sunxi_init_clocks(void) 619static void __init sunxi_init_clocks(struct device_node *np)
621{ 620{
622 /* Register all the simple and basic clocks on DT */
623 of_clk_init(NULL);
624
625 /* Register factor clocks */ 621 /* Register factor clocks */
626 of_sunxi_table_clock_setup(clk_factors_match, sunxi_factors_clk_setup); 622 of_sunxi_table_clock_setup(clk_factors_match, sunxi_factors_clk_setup);
627 623
@@ -634,3 +630,8 @@ void __init sunxi_init_clocks(void)
634 /* Register gate clocks */ 630 /* Register gate clocks */
635 of_sunxi_table_clock_setup(clk_gates_match, sunxi_gates_clk_setup); 631 of_sunxi_table_clock_setup(clk_gates_match, sunxi_gates_clk_setup);
636} 632}
633CLK_OF_DECLARE(sun4i_a10_clk_init, "allwinner,sun4i-a10", sunxi_init_clocks);
634CLK_OF_DECLARE(sun5i_a10s_clk_init, "allwinner,sun5i-a10s", sunxi_init_clocks);
635CLK_OF_DECLARE(sun5i_a13_clk_init, "allwinner,sun5i-a13", sunxi_init_clocks);
636CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sunxi_init_clocks);
637CLK_OF_DECLARE(sun7i_a20_clk_init, "allwinner,sun7i-a20", sunxi_init_clocks);
diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index 67ccf4aa7277..f5e4c21b301f 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -107,7 +107,7 @@ static int icst_set_rate(struct clk_hw *hw, unsigned long rate,
107 107
108 vco = icst_hz_to_vco(icst->params, rate); 108 vco = icst_hz_to_vco(icst->params, rate);
109 icst->rate = icst_hz(icst->params, vco); 109 icst->rate = icst_hz(icst->params, vco);
110 vco_set(icst->vcoreg, icst->lockreg, vco); 110 vco_set(icst->lockreg, icst->vcoreg, vco);
111 return 0; 111 return 0;
112} 112}
113 113