aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-11 02:42:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-11 02:42:43 -0500
commit21604cdcdcf9ea8c16b1656f78e2eff097244d66 (patch)
tree5469eb93e673f749c1caf9dd5536fb6855658f89 /drivers/clk
parentbeb5bfe424fdc15be6cf9a56e182192c1a7c7982 (diff)
parentf3372c01816ec9e974e449cf7233408a31647dd3 (diff)
Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups from Olof Johansson: "This branch contains code cleanups, moves and removals for 3.13. Qualcomm msm targets had a bunch of code removal for legacy non-DT platforms. Nomadik saw more device tree conversions and cleanup of old code. Tegra has some code refactoring, etc. One longish patch series from Sebastian Hasselbarth changes the init_time hooks and tries to use a generic implementation for most platforms, since they were all doing more or less the same things. Finally the "shark" platform is removed in this release. It's been abandoned for a while and nobody seems to care enough to keep it around. If someone comes along and wants to resurrect it, the removal can easily be reverted and code brought back. Beyond this, mostly a bunch of removals of stale content across the board, etc" * tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (79 commits) ARM: gemini: convert to GENERIC_CLOCKEVENTS ARM: EXYNOS: remove CONFIG_MACH_EXYNOS[4, 5]_DT config options ARM: OMAP3: control: add API for setting IVA bootmode ARM: OMAP3: CM/control: move CM scratchpad save to CM driver ARM: OMAP3: McBSP: do not access CM register directly ARM: OMAP3: clock: add API to enable/disable autoidle for a single clock ARM: OMAP2: CM/PM: remove direct register accesses outside CM code MAINTAINERS: Add patterns for DTS files for AT91 ARM: at91: remove init_machine() as default is suitable ARM: at91/dt: split sama5d3 peripheral definitions ARM: at91/dt: split sam9x5 peripheral definitions ARM: Remove temporary sched_clock.h header ARM: clps711x: Use linux/sched_clock.h MAINTAINERS: Add DTS files to patterns for Samsung platform ARM: EXYNOS: remove unnecessary header inclusions from exynos4/5 dt machine file ARM: tegra: fix ARCH_TEGRA_114_SOC select sort order clk: nomadik: fix missing __init on nomadik_src_init ARM: drop explicit selection of HAVE_CLK and CLKDEV_LOOKUP ARM: S3C64XX: Kill CONFIG_PLAT_S3C64XX ASoC: samsung: Use CONFIG_ARCH_S3C64XX to check for S3C64XX support ...
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.c187
-rw-r--r--drivers/clk/clk-prima2.c29
-rw-r--r--drivers/clk/clk-vt8500.c34
-rw-r--r--drivers/clk/mxs/clk-imx23.c15
-rw-r--r--drivers/clk/mxs/clk-imx28.c16
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c11
8 files changed, 147 insertions, 163 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 4d978a3c88f7..6a934a5296bd 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -62,6 +62,79 @@ static DEFINE_SPINLOCK(src_lock);
62/* Base address of the SRC */ 62/* Base address of the SRC */
63static void __iomem *src_base; 63static void __iomem *src_base;
64 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
65/** 138/**
66 * struct clk_pll1 - Nomadik PLL1 clock 139 * struct clk_pll1 - Nomadik PLL1 clock
67 * @hw: corresponding clock hardware entry 140 * @hw: corresponding clock hardware entry
@@ -439,6 +512,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
439 const char *parent_name; 512 const char *parent_name;
440 u32 pll_id; 513 u32 pll_id;
441 514
515 if (!src_base)
516 nomadik_src_init();
517
442 if (of_property_read_u32(np, "pll-id", &pll_id)) { 518 if (of_property_read_u32(np, "pll-id", &pll_id)) {
443 pr_err("%s: PLL \"%s\" missing pll-id property\n", 519 pr_err("%s: PLL \"%s\" missing pll-id property\n",
444 __func__, clk_name); 520 __func__, clk_name);
@@ -449,6 +525,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
449 if (!IS_ERR(clk)) 525 if (!IS_ERR(clk))
450 of_clk_add_provider(np, of_clk_src_simple_get, clk); 526 of_clk_add_provider(np, of_clk_src_simple_get, clk);
451} 527}
528CLK_OF_DECLARE(nomadik_pll_clk,
529 "st,nomadik-pll-clock", of_nomadik_pll_setup);
452 530
453static void __init of_nomadik_hclk_setup(struct device_node *np) 531static void __init of_nomadik_hclk_setup(struct device_node *np)
454{ 532{
@@ -456,6 +534,9 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
456 const char *clk_name = np->name; 534 const char *clk_name = np->name;
457 const char *parent_name; 535 const char *parent_name;
458 536
537 if (!src_base)
538 nomadik_src_init();
539
459 parent_name = of_clk_get_parent_name(np, 0); 540 parent_name = of_clk_get_parent_name(np, 0);
460 /* 541 /*
461 * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4. 542 * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4.
@@ -468,6 +549,8 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
468 if (!IS_ERR(clk)) 549 if (!IS_ERR(clk))
469 of_clk_add_provider(np, of_clk_src_simple_get, clk); 550 of_clk_add_provider(np, of_clk_src_simple_get, clk);
470} 551}
552CLK_OF_DECLARE(nomadik_hclk_clk,
553 "st,nomadik-hclk-clock", of_nomadik_hclk_setup);
471 554
472static void __init of_nomadik_src_clk_setup(struct device_node *np) 555static void __init of_nomadik_src_clk_setup(struct device_node *np)
473{ 556{
@@ -476,6 +559,9 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
476 const char *parent_name; 559 const char *parent_name;
477 u32 clk_id; 560 u32 clk_id;
478 561
562 if (!src_base)
563 nomadik_src_init();
564
479 if (of_property_read_u32(np, "clock-id", &clk_id)) { 565 if (of_property_read_u32(np, "clock-id", &clk_id)) {
480 pr_err("%s: SRC clock \"%s\" missing clock-id property\n", 566 pr_err("%s: SRC clock \"%s\" missing clock-id property\n",
481 __func__, clk_name); 567 __func__, clk_name);
@@ -486,102 +572,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
486 if (!IS_ERR(clk)) 572 if (!IS_ERR(clk))
487 of_clk_add_provider(np, of_clk_src_simple_get, clk); 573 of_clk_add_provider(np, of_clk_src_simple_get, clk);
488} 574}
489 575CLK_OF_DECLARE(nomadik_src_clk,
490static const struct of_device_id nomadik_src_match[] __initconst = { 576 "st,nomadik-src-clock", of_nomadik_src_clk_setup);
491 { .compatible = "stericsson,nomadik-src" },
492 { /* sentinel */ }
493};
494
495static const struct of_device_id nomadik_src_clk_match[] __initconst = {
496 {
497 .compatible = "fixed-clock",
498 .data = of_fixed_clk_setup,
499 },
500 {
501 .compatible = "fixed-factor-clock",
502 .data = of_fixed_factor_clk_setup,
503 },
504 {
505 .compatible = "st,nomadik-pll-clock",
506 .data = of_nomadik_pll_setup,
507 },
508 {
509 .compatible = "st,nomadik-hclk-clock",
510 .data = of_nomadik_hclk_setup,
511 },
512 {
513 .compatible = "st,nomadik-src-clock",
514 .data = of_nomadik_src_clk_setup,
515 },
516 { /* sentinel */ }
517};
518
519static int nomadik_clk_reboot_handler(struct notifier_block *this,
520 unsigned long code,
521 void *unused)
522{
523 u32 val;
524
525 /* The main chrystal need to be enabled for reboot to work */
526 val = readl(src_base + SRC_XTALCR);
527 val &= ~SRC_XTALCR_MXTALOVER;
528 val |= SRC_XTALCR_MXTALEN;
529 pr_crit("force-enabling MXTALO\n");
530 writel(val, src_base + SRC_XTALCR);
531 return NOTIFY_OK;
532}
533
534static struct notifier_block nomadik_clk_reboot_notifier = {
535 .notifier_call = nomadik_clk_reboot_handler,
536};
537
538void __init nomadik_clk_init(void)
539{
540 struct device_node *np;
541 u32 val;
542
543 np = of_find_matching_node(NULL, nomadik_src_match);
544 if (!np) {
545 pr_crit("no matching node for SRC, aborting clock init\n");
546 return;
547 }
548 src_base = of_iomap(np, 0);
549 if (!src_base) {
550 pr_err("%s: must have src parent node with REGS (%s)\n",
551 __func__, np->name);
552 return;
553 }
554
555 /* Set all timers to use the 2.4 MHz TIMCLK */
556 val = readl(src_base + SRC_CR);
557 val |= SRC_CR_T0_ENSEL;
558 val |= SRC_CR_T1_ENSEL;
559 val |= SRC_CR_T2_ENSEL;
560 val |= SRC_CR_T3_ENSEL;
561 val |= SRC_CR_T4_ENSEL;
562 val |= SRC_CR_T5_ENSEL;
563 val |= SRC_CR_T6_ENSEL;
564 val |= SRC_CR_T7_ENSEL;
565 writel(val, src_base + SRC_CR);
566
567 val = readl(src_base + SRC_XTALCR);
568 pr_info("SXTALO is %s\n",
569 (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
570 pr_info("MXTAL is %s\n",
571 (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
572 if (of_property_read_bool(np, "disable-sxtalo")) {
573 /* The machine uses an external oscillator circuit */
574 val |= SRC_XTALCR_SXTALDIS;
575 pr_info("disabling SXTALO\n");
576 }
577 if (of_property_read_bool(np, "disable-mxtalo")) {
578 /* Disable this too: also run by external oscillator */
579 val |= SRC_XTALCR_MXTALOVER;
580 val &= ~SRC_XTALCR_MXTALEN;
581 pr_info("disabling MXTALO\n");
582 }
583 writel(val, src_base + SRC_XTALCR);
584 register_reboot_notifier(&nomadik_clk_reboot_notifier);
585
586 of_clk_init(nomadik_src_clk_match);
587}
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/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/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);