aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/kernel/time.c29
-rw-r--r--arch/arm/mach-bcm/board_bcm281xx.c1
-rw-r--r--arch/arm/mach-bcm2835/bcm2835.c2
-rw-r--r--arch/arm/mach-dove/board-dt.c11
-rw-r--r--arch/arm/mach-exynos/common.c8
-rw-r--r--arch/arm/mach-exynos/common.h1
-rw-r--r--arch/arm/mach-exynos/mach-exynos4-dt.c2
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c2
-rw-r--r--arch/arm/mach-highbank/highbank.c23
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c29
-rw-r--r--arch/arm/mach-imx/common.h4
-rw-r--r--arch/arm/mach-imx/imx51-dt.c6
-rw-r--r--arch/arm/mach-imx/mach-imx53.c6
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c14
-rw-r--r--arch/arm/mach-imx/mach-imx6sl.c7
-rw-r--r--arch/arm/mach-imx/mach-vf610.c9
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c8
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c13
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c36
-rw-r--r--arch/arm/mach-nspire/nspire.c9
-rw-r--r--arch/arm/mach-prima2/common.c11
-rw-r--r--arch/arm/mach-prima2/common.h1
-rw-r--r--arch/arm/mach-rockchip/rockchip.c9
-rw-r--r--arch/arm/mach-socfpga/socfpga.c2
-rw-r--r--arch/arm/mach-sti/board-dt.c10
-rw-r--r--arch/arm/mach-sunxi/sunxi.c10
-rw-r--r--arch/arm/mach-tegra/tegra.c9
-rw-r--r--arch/arm/mach-vexpress/v2m.c14
-rw-r--r--arch/arm/mach-vt8500/common.h24
-rw-r--r--arch/arm/mach-vt8500/vt8500.c6
-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/mxs/clk-imx23.c15
-rw-r--r--drivers/clk/mxs/clk-imx28.c16
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c11
-rw-r--r--include/linux/clk/mxs.h2
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/platform_data/clk-nomadik.h2
41 files changed, 197 insertions, 450 deletions
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 98aee3258398..829a96d4a179 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -11,25 +11,26 @@
11 * This file contains the ARM-specific time handling details: 11 * This file contains the ARM-specific time handling details:
12 * reading the RTC at bootup, etc... 12 * reading the RTC at bootup, etc...
13 */ 13 */
14#include <linux/clk-provider.h>
15#include <linux/clocksource.h>
16#include <linux/errno.h>
14#include <linux/export.h> 17#include <linux/export.h>
15#include <linux/kernel.h>
16#include <linux/interrupt.h>
17#include <linux/time.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/irq.h>
21#include <linux/kernel.h>
22#include <linux/profile.h>
19#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/sched_clock.h>
20#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/time.h>
21#include <linux/timex.h> 27#include <linux/timex.h>
22#include <linux/errno.h>
23#include <linux/profile.h>
24#include <linux/timer.h> 28#include <linux/timer.h>
25#include <linux/clocksource.h>
26#include <linux/irq.h>
27#include <linux/sched_clock.h>
28 29
29#include <asm/thread_info.h>
30#include <asm/stacktrace.h>
31#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
32#include <asm/mach/time.h> 31#include <asm/mach/time.h>
32#include <asm/stacktrace.h>
33#include <asm/thread_info.h>
33 34
34#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \ 35#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
35 defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) 36 defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
@@ -116,8 +117,12 @@ int __init register_persistent_clock(clock_access_fn read_boot,
116 117
117void __init time_init(void) 118void __init time_init(void)
118{ 119{
119 if (machine_desc->init_time) 120 if (machine_desc->init_time) {
120 machine_desc->init_time(); 121 machine_desc->init_time();
121 else 122 } else {
123#ifdef CONFIG_COMMON_CLK
124 of_clk_init(NULL);
125#endif
122 clocksource_of_init(); 126 clocksource_of_init();
127 }
123} 128}
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index 8d9f931164bb..26b2390492b8 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -68,7 +68,6 @@ static void __init board_init(void)
68static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, }; 68static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, };
69 69
70DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor") 70DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
71 .init_time = clocksource_of_init,
72 .init_machine = board_init, 71 .init_machine = board_init,
73 .restart = bcm_kona_restart, 72 .restart = bcm_kona_restart,
74 .dt_compat = bcm11351_dt_compat, 73 .dt_compat = bcm11351_dt_compat,
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
index 40686d7ef500..d50135be0c20 100644
--- a/arch/arm/mach-bcm2835/bcm2835.c
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -18,7 +18,6 @@
18#include <linux/of_address.h> 18#include <linux/of_address.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/clk/bcm2835.h> 20#include <linux/clk/bcm2835.h>
21#include <linux/clocksource.h>
22 21
23#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 23#include <asm/mach/map.h>
@@ -134,7 +133,6 @@ DT_MACHINE_START(BCM2835, "BCM2835")
134 .init_irq = bcm2835_init_irq, 133 .init_irq = bcm2835_init_irq,
135 .handle_irq = bcm2835_handle_irq, 134 .handle_irq = bcm2835_handle_irq,
136 .init_machine = bcm2835_init, 135 .init_machine = bcm2835_init,
137 .init_time = clocksource_of_init,
138 .restart = bcm2835_restart, 136 .restart = bcm2835_restart,
139 .dt_compat = bcm2835_compat 137 .dt_compat = bcm2835_compat
140MACHINE_END 138MACHINE_END
diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
index 49f72a848423..ddb86631f16a 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-dove/board-dt.c
@@ -10,17 +10,13 @@
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/clk-provider.h> 12#include <linux/clk-provider.h>
13#include <linux/clocksource.h>
14#include <linux/irqchip.h>
15#include <linux/of.h> 13#include <linux/of.h>
16#include <linux/of_platform.h> 14#include <linux/of_platform.h>
17#include <linux/platform_data/usb-ehci-orion.h>
18#include <asm/hardware/cache-tauros2.h> 15#include <asm/hardware/cache-tauros2.h>
19#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
20#include <mach/dove.h> 17#include <mach/dove.h>
21#include <mach/pm.h> 18#include <mach/pm.h>
22#include <plat/common.h> 19#include <plat/common.h>
23#include <plat/irq.h>
24#include "common.h" 20#include "common.h"
25 21
26/* 22/*
@@ -45,12 +41,6 @@ static void __init dove_legacy_clk_init(void)
45 of_clk_get_from_provider(&clkspec)); 41 of_clk_get_from_provider(&clkspec));
46} 42}
47 43
48static void __init dove_dt_time_init(void)
49{
50 of_clk_init(NULL);
51 clocksource_of_init();
52}
53
54static void __init dove_dt_init_early(void) 44static void __init dove_dt_init_early(void)
55{ 45{
56 mvebu_mbus_init("marvell,dove-mbus", 46 mvebu_mbus_init("marvell,dove-mbus",
@@ -84,7 +74,6 @@ static const char * const dove_dt_board_compat[] = {
84DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)") 74DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
85 .map_io = dove_map_io, 75 .map_io = dove_map_io,
86 .init_early = dove_dt_init_early, 76 .init_early = dove_dt_init_early,
87 .init_time = dove_dt_time_init,
88 .init_machine = dove_dt_init, 77 .init_machine = dove_dt_init,
89 .restart = dove_restart, 78 .restart = dove_restart,
90 .dt_compat = dove_dt_board_compat, 79 .dt_compat = dove_dt_board_compat,
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index ba95e5db2501..a4e7ba828810 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -26,8 +26,6 @@
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/irqdomain.h> 27#include <linux/irqdomain.h>
28#include <linux/of_address.h> 28#include <linux/of_address.h>
29#include <linux/clocksource.h>
30#include <linux/clk-provider.h>
31#include <linux/irqchip/arm-gic.h> 29#include <linux/irqchip/arm-gic.h>
32#include <linux/irqchip/chained_irq.h> 30#include <linux/irqchip/chained_irq.h>
33 31
@@ -367,12 +365,6 @@ static void __init exynos5_map_io(void)
367 iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc)); 365 iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
368} 366}
369 367
370void __init exynos_init_time(void)
371{
372 of_clk_init(NULL);
373 clocksource_of_init();
374}
375
376struct bus_type exynos_subsys = { 368struct bus_type exynos_subsys = {
377 .name = "exynos-core", 369 .name = "exynos-core",
378 .dev_name = "exynos-core", 370 .dev_name = "exynos-core",
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 8646a141ae46..f0fa2050d08d 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -16,7 +16,6 @@
16#include <linux/of.h> 16#include <linux/of.h>
17 17
18void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1); 18void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
19void exynos_init_time(void);
20 19
21struct map_desc; 20struct map_desc;
22void exynos_init_io(void); 21void exynos_init_io(void);
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 0099c6c13bba..6858d73dcf48 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -16,7 +16,6 @@
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <linux/serial_core.h> 17#include <linux/serial_core.h>
18#include <linux/memblock.h> 18#include <linux/memblock.h>
19#include <linux/clocksource.h>
20 19
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22#include <plat/mfc.h> 21#include <plat/mfc.h>
@@ -54,7 +53,6 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
54 .init_early = exynos_firmware_init, 53 .init_early = exynos_firmware_init,
55 .init_machine = exynos4_dt_machine_init, 54 .init_machine = exynos4_dt_machine_init,
56 .init_late = exynos_init_late, 55 .init_late = exynos_init_late,
57 .init_time = exynos_init_time,
58 .dt_compat = exynos4_dt_compat, 56 .dt_compat = exynos4_dt_compat,
59 .restart = exynos4_restart, 57 .restart = exynos4_restart,
60 .reserve = exynos4_reserve, 58 .reserve = exynos4_reserve,
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index f874b773ca13..bac21054cec8 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -13,7 +13,6 @@
13#include <linux/of_fdt.h> 13#include <linux/of_fdt.h>
14#include <linux/memblock.h> 14#include <linux/memblock.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/clocksource.h>
17 16
18#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
19#include <mach/regs-pmu.h> 18#include <mach/regs-pmu.h>
@@ -76,7 +75,6 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
76 .map_io = exynos_init_io, 75 .map_io = exynos_init_io,
77 .init_machine = exynos5_dt_machine_init, 76 .init_machine = exynos5_dt_machine_init,
78 .init_late = exynos_init_late, 77 .init_late = exynos_init_late,
79 .init_time = exynos_init_time,
80 .dt_compat = exynos5_dt_compat, 78 .dt_compat = exynos5_dt_compat,
81 .restart = exynos5_restart, 79 .restart = exynos5_restart,
82 .reserve = exynos5_reserve, 80 .reserve = exynos5_reserve,
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 0c49beb37cee..b3d7e5634b83 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -24,7 +24,6 @@
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/of_address.h> 25#include <linux/of_address.h>
26#include <linux/amba/bus.h> 26#include <linux/amba/bus.h>
27#include <linux/clk-provider.h>
28#include <linux/platform_device.h> 27#include <linux/platform_device.h>
29 28
30#include <asm/psci.h> 29#include <asm/psci.h>
@@ -71,20 +70,6 @@ static void __init highbank_init_irq(void)
71 } 70 }
72} 71}
73 72
74static void __init highbank_timer_init(void)
75{
76 struct device_node *np;
77
78 /* Map system registers */
79 np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
80 sregs_base = of_iomap(np, 0);
81 WARN_ON(!sregs_base);
82
83 of_clk_init(NULL);
84
85 clocksource_of_init();
86}
87
88static void highbank_power_off(void) 73static void highbank_power_off(void)
89{ 74{
90 highbank_set_pwr_shutdown(); 75 highbank_set_pwr_shutdown();
@@ -147,6 +132,13 @@ static struct platform_device highbank_cpuidle_device = {
147 132
148static void __init highbank_init(void) 133static void __init highbank_init(void)
149{ 134{
135 struct device_node *np;
136
137 /* Map system registers */
138 np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
139 sregs_base = of_iomap(np, 0);
140 WARN_ON(!sregs_base);
141
150 pm_power_off = highbank_power_off; 142 pm_power_off = highbank_power_off;
151 highbank_pm_init(); 143 highbank_pm_init();
152 144
@@ -170,7 +162,6 @@ DT_MACHINE_START(HIGHBANK, "Highbank")
170 .dma_zone_size = (4ULL * SZ_1G), 162 .dma_zone_size = (4ULL * SZ_1G),
171#endif 163#endif
172 .init_irq = highbank_init_irq, 164 .init_irq = highbank_init_irq,
173 .init_time = highbank_timer_init,
174 .init_machine = highbank_init, 165 .init_machine = highbank_init,
175 .dt_compat = highbank_match, 166 .dt_compat = highbank_match,
176 .restart = highbank_restart, 167 .restart = highbank_restart,
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 7c0dc4540aa4..ceaac9cd7b42 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -11,6 +11,7 @@
11#include <linux/clk.h> 11#include <linux/clk.h>
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/clkdev.h> 13#include <linux/clkdev.h>
14#include <linux/clk-provider.h>
14#include <linux/of.h> 15#include <linux/of.h>
15#include <linux/err.h> 16#include <linux/err.h>
16 17
@@ -131,8 +132,6 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
131{ 132{
132 int i; 133 int i;
133 134
134 of_clk_init(NULL);
135
136 clk[dummy] = imx_clk_fixed("dummy", 0); 135 clk[dummy] = imx_clk_fixed("dummy", 0);
137 clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil); 136 clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil);
138 clk[osc] = imx_obtain_fixed_clock("osc", rate_osc); 137 clk[osc] = imx_obtain_fixed_clock("osc", rate_osc);
@@ -465,12 +464,16 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
465 return 0; 464 return 0;
466} 465}
467 466
468int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, 467static void __init mx51_clocks_init_dt(struct device_node *np)
469 unsigned long rate_ckih1, unsigned long rate_ckih2) 468{
469 mx51_clocks_init(0, 0, 0, 0);
470}
471CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init_dt);
472
473static void __init mx53_clocks_init(struct device_node *np)
470{ 474{
471 int i; 475 int i;
472 unsigned long r; 476 unsigned long r;
473 struct device_node *np;
474 477
475 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 478 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
476 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE); 479 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
@@ -529,12 +532,11 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
529 pr_err("i.MX53 clk %d: register failed with %ld\n", 532 pr_err("i.MX53 clk %d: register failed with %ld\n",
530 i, PTR_ERR(clk[i])); 533 i, PTR_ERR(clk[i]));
531 534
532 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-ccm");
533 clk_data.clks = clk; 535 clk_data.clks = clk;
534 clk_data.clk_num = ARRAY_SIZE(clk); 536 clk_data.clk_num = ARRAY_SIZE(clk);
535 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 537 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
536 538
537 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2); 539 mx5_clocks_common_init(0, 0, 0, 0);
538 540
539 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0"); 541 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0");
540 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2"); 542 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
@@ -566,16 +568,5 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
566 568
567 r = clk_round_rate(clk[usboh3_per_gate], 54000000); 569 r = clk_round_rate(clk[usboh3_per_gate], 54000000);
568 clk_set_rate(clk[usboh3_per_gate], r); 570 clk_set_rate(clk[usboh3_per_gate], r);
569
570 return 0;
571}
572
573int __init mx51_clocks_init_dt(void)
574{
575 return mx51_clocks_init(0, 0, 0, 0);
576}
577
578int __init mx53_clocks_init_dt(void)
579{
580 return mx53_clocks_init(0, 0, 0, 0);
581} 571}
572CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 4517fd760bfc..28e8ca0871e8 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -63,13 +63,9 @@ extern int mx31_clocks_init(unsigned long fref);
63extern int mx35_clocks_init(void); 63extern int mx35_clocks_init(void);
64extern int mx51_clocks_init(unsigned long ckil, unsigned long osc, 64extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
65 unsigned long ckih1, unsigned long ckih2); 65 unsigned long ckih1, unsigned long ckih2);
66extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
67 unsigned long ckih1, unsigned long ckih2);
68extern int mx25_clocks_init_dt(void); 66extern int mx25_clocks_init_dt(void);
69extern int mx27_clocks_init_dt(void); 67extern int mx27_clocks_init_dt(void);
70extern int mx31_clocks_init_dt(void); 68extern int mx31_clocks_init_dt(void);
71extern int mx51_clocks_init_dt(void);
72extern int mx53_clocks_init_dt(void);
73extern struct platform_device *mxc_register_gpio(char *name, int id, 69extern struct platform_device *mxc_register_gpio(char *name, int id,
74 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); 70 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
75extern void mxc_set_cpu_type(unsigned int type); 71extern void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 53e43e579dd7..bece8a65e6f0 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -34,17 +34,11 @@ static const char *imx51_dt_board_compat[] __initdata = {
34 NULL 34 NULL
35}; 35};
36 36
37static void __init imx51_timer_init(void)
38{
39 mx51_clocks_init_dt();
40}
41
42DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)") 37DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
43 .map_io = mx51_map_io, 38 .map_io = mx51_map_io,
44 .init_early = imx51_init_early, 39 .init_early = imx51_init_early,
45 .init_irq = mx51_init_irq, 40 .init_irq = mx51_init_irq,
46 .handle_irq = imx51_handle_irq, 41 .handle_irq = imx51_handle_irq,
47 .init_time = imx51_timer_init,
48 .init_machine = imx51_dt_init, 42 .init_machine = imx51_dt_init,
49 .init_late = imx51_init_late, 43 .init_late = imx51_init_late,
50 .dt_compat = imx51_dt_board_compat, 44 .dt_compat = imx51_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 98c58944015a..c9c4d8d96931 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -36,17 +36,11 @@ static const char *imx53_dt_board_compat[] __initdata = {
36 NULL 36 NULL
37}; 37};
38 38
39static void __init imx53_timer_init(void)
40{
41 mx53_clocks_init_dt();
42}
43
44DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)") 39DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
45 .map_io = mx53_map_io, 40 .map_io = mx53_map_io,
46 .init_early = imx53_init_early, 41 .init_early = imx53_init_early,
47 .init_irq = mx53_init_irq, 42 .init_irq = mx53_init_irq,
48 .handle_irq = imx53_handle_irq, 43 .handle_irq = imx53_handle_irq,
49 .init_time = imx53_timer_init,
50 .init_machine = imx53_dt_init, 44 .init_machine = imx53_dt_init,
51 .init_late = imx53_init_late, 45 .init_late = imx53_init_late,
52 .dt_compat = imx53_dt_board_compat, 46 .dt_compat = imx53_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 90372a21087f..3be0fa0e9796 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -11,9 +11,7 @@
11 */ 11 */
12 12
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/clk-provider.h>
15#include <linux/clkdev.h> 14#include <linux/clkdev.h>
16#include <linux/clocksource.h>
17#include <linux/cpu.h> 15#include <linux/cpu.h>
18#include <linux/delay.h> 16#include <linux/delay.h>
19#include <linux/export.h> 17#include <linux/export.h>
@@ -192,6 +190,9 @@ static void __init imx6q_1588_init(void)
192 190
193static void __init imx6q_init_machine(void) 191static void __init imx6q_init_machine(void)
194{ 192{
193 imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
194 imx6q_revision());
195
195 imx6q_enet_phy_init(); 196 imx6q_enet_phy_init();
196 197
197 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 198 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
@@ -293,14 +294,6 @@ static void __init imx6q_init_irq(void)
293 irqchip_init(); 294 irqchip_init();
294} 295}
295 296
296static void __init imx6q_timer_init(void)
297{
298 of_clk_init(NULL);
299 clocksource_of_init();
300 imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
301 imx6q_revision());
302}
303
304static const char *imx6q_dt_compat[] __initdata = { 297static const char *imx6q_dt_compat[] __initdata = {
305 "fsl,imx6dl", 298 "fsl,imx6dl",
306 "fsl,imx6q", 299 "fsl,imx6q",
@@ -311,7 +304,6 @@ DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)")
311 .smp = smp_ops(imx_smp_ops), 304 .smp = smp_ops(imx_smp_ops),
312 .map_io = imx6q_map_io, 305 .map_io = imx6q_map_io,
313 .init_irq = imx6q_init_irq, 306 .init_irq = imx6q_init_irq,
314 .init_time = imx6q_timer_init,
315 .init_machine = imx6q_init_machine, 307 .init_machine = imx6q_init_machine,
316 .init_late = imx6q_init_late, 308 .init_late = imx6q_init_late,
317 .dt_compat = imx6q_dt_compat, 309 .dt_compat = imx6q_dt_compat,
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index 0d75dc54f715..c70bd7c64974 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -7,7 +7,6 @@
7 * 7 *
8 */ 8 */
9 9
10#include <linux/clk-provider.h>
11#include <linux/irqchip.h> 10#include <linux/irqchip.h>
12#include <linux/of.h> 11#include <linux/of.h>
13#include <linux/of_platform.h> 12#include <linux/of_platform.h>
@@ -31,11 +30,6 @@ static void __init imx6sl_init_irq(void)
31 irqchip_init(); 30 irqchip_init();
32} 31}
33 32
34static void __init imx6sl_timer_init(void)
35{
36 of_clk_init(NULL);
37}
38
39static const char *imx6sl_dt_compat[] __initdata = { 33static const char *imx6sl_dt_compat[] __initdata = {
40 "fsl,imx6sl", 34 "fsl,imx6sl",
41 NULL, 35 NULL,
@@ -44,7 +38,6 @@ static const char *imx6sl_dt_compat[] __initdata = {
44DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)") 38DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
45 .map_io = debug_ll_io_init, 39 .map_io = debug_ll_io_init,
46 .init_irq = imx6sl_init_irq, 40 .init_irq = imx6sl_init_irq,
47 .init_time = imx6sl_timer_init,
48 .init_machine = imx6sl_init_machine, 41 .init_machine = imx6sl_init_machine,
49 .dt_compat = imx6sl_dt_compat, 42 .dt_compat = imx6sl_dt_compat,
50 .restart = mxc_restart, 43 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c
index 816991deb9b8..af0cb8a9dc48 100644
--- a/arch/arm/mach-imx/mach-vf610.c
+++ b/arch/arm/mach-imx/mach-vf610.c
@@ -8,9 +8,7 @@
8 */ 8 */
9 9
10#include <linux/of_platform.h> 10#include <linux/of_platform.h>
11#include <linux/clocksource.h>
12#include <linux/irqchip.h> 11#include <linux/irqchip.h>
13#include <linux/clk-provider.h>
14#include <asm/mach/arch.h> 12#include <asm/mach/arch.h>
15#include <asm/hardware/cache-l2x0.h> 13#include <asm/hardware/cache-l2x0.h>
16 14
@@ -28,12 +26,6 @@ static void __init vf610_init_irq(void)
28 irqchip_init(); 26 irqchip_init();
29} 27}
30 28
31static void __init vf610_init_time(void)
32{
33 of_clk_init(NULL);
34 clocksource_of_init();
35}
36
37static const char *vf610_dt_compat[] __initdata = { 29static const char *vf610_dt_compat[] __initdata = {
38 "fsl,vf610", 30 "fsl,vf610",
39 NULL, 31 NULL,
@@ -41,7 +33,6 @@ static const char *vf610_dt_compat[] __initdata = {
41 33
42DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)") 34DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)")
43 .init_irq = vf610_init_irq, 35 .init_irq = vf610_init_irq,
44 .init_time = vf610_init_time,
45 .init_machine = vf610_init_machine, 36 .init_machine = vf610_init_machine,
46 .dt_compat = vf610_dt_compat, 37 .dt_compat = vf610_dt_compat,
47 .restart = mxc_restart, 38 .restart = mxc_restart,
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 27c1877e6dda..c9f6fd2d90f5 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -17,7 +17,6 @@
17#include <linux/of_net.h> 17#include <linux/of_net.h>
18#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19#include <linux/clk-provider.h> 19#include <linux/clk-provider.h>
20#include <linux/clocksource.h>
21#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
22#include <linux/irqchip.h> 21#include <linux/irqchip.h>
23#include <linux/kexec.h> 22#include <linux/kexec.h>
@@ -139,12 +138,6 @@ eth_fixup_skip:
139 } 138 }
140} 139}
141 140
142static void __init kirkwood_dt_time_init(void)
143{
144 of_clk_init(NULL);
145 clocksource_of_init();
146}
147
148static void __init kirkwood_dt_init(void) 141static void __init kirkwood_dt_init(void)
149{ 142{
150 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); 143 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
@@ -188,7 +181,6 @@ static const char * const kirkwood_dt_board_compat[] = {
188DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") 181DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
189 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ 182 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
190 .map_io = kirkwood_map_io, 183 .map_io = kirkwood_map_io,
191 .init_time = kirkwood_dt_time_init,
192 .init_machine = kirkwood_dt_init, 184 .init_machine = kirkwood_dt_init,
193 .restart = kirkwood_restart, 185 .restart = kirkwood_restart,
194 .dt_compat = kirkwood_dt_board_compat, 186 .dt_compat = kirkwood_dt_board_compat,
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 98f6e2adb53e..cc511a4890a3 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -13,8 +13,6 @@
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/clk/mxs.h> 14#include <linux/clk/mxs.h>
15#include <linux/clkdev.h> 15#include <linux/clkdev.h>
16#include <linux/clocksource.h>
17#include <linux/clk-provider.h>
18#include <linux/delay.h> 16#include <linux/delay.h>
19#include <linux/err.h> 17#include <linux/err.h>
20#include <linux/gpio.h> 18#include <linux/gpio.h>
@@ -490,16 +488,6 @@ static void mxs_restart(enum reboot_mode mode, const char *cmd)
490 soft_restart(0); 488 soft_restart(0);
491} 489}
492 490
493static void __init mxs_timer_init(void)
494{
495 if (of_machine_is_compatible("fsl,imx23"))
496 mx23_clocks_init();
497 else
498 mx28_clocks_init();
499 of_clk_init(NULL);
500 clocksource_of_init();
501}
502
503static const char *mxs_dt_compat[] __initdata = { 491static const char *mxs_dt_compat[] __initdata = {
504 "fsl,imx28", 492 "fsl,imx28",
505 "fsl,imx23", 493 "fsl,imx23",
@@ -508,7 +496,6 @@ static const char *mxs_dt_compat[] __initdata = {
508 496
509DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)") 497DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)")
510 .handle_irq = icoll_handle_irq, 498 .handle_irq = icoll_handle_irq,
511 .init_time = mxs_timer_init,
512 .init_machine = mxs_machine_init, 499 .init_machine = mxs_machine_init,
513 .init_late = mxs_pm_init, 500 .init_late = mxs_pm_init,
514 .dt_compat = mxs_dt_compat, 501 .dt_compat = mxs_dt_compat,
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 13e0df9c11ce..53fbf63c8b66 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -25,8 +25,6 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/platform_data/clk-nomadik.h>
29#include <linux/clocksource.h>
30#include <linux/of_irq.h> 28#include <linux/of_irq.h>
31#include <linux/of_gpio.h> 29#include <linux/of_gpio.h>
32#include <linux/of_address.h> 30#include <linux/of_address.h>
@@ -113,39 +111,6 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
113 writel(1, srcbase + 0x18); 111 writel(1, srcbase + 0x18);
114} 112}
115 113
116/* Initial value for SRC control register: all timers use MXTAL/8 source */
117#define SRC_CR_INIT_MASK 0x00007fff
118#define SRC_CR_INIT_VAL 0x2aaa8000
119
120static void __init cpu8815_timer_init_of(void)
121{
122 struct device_node *mtu;
123 void __iomem *base;
124 int irq;
125 u32 src_cr;
126
127 /* We need this to be up now */
128 nomadik_clk_init();
129
130 mtu = of_find_node_by_path("/mtu@101e2000");
131 if (!mtu)
132 return;
133 base = of_iomap(mtu, 0);
134 if (WARN_ON(!base))
135 return;
136 irq = irq_of_parse_and_map(mtu, 0);
137
138 pr_info("Remapped MTU @ %p, irq: %d\n", base, irq);
139
140 /* Configure timer sources in "system reset controller" ctrl reg */
141 src_cr = readl(base);
142 src_cr &= SRC_CR_INIT_MASK;
143 src_cr |= SRC_CR_INIT_VAL;
144 writel(src_cr, base);
145
146 clocksource_of_init();
147}
148
149static struct fsmc_nand_timings cpu8815_nand_timings = { 114static struct fsmc_nand_timings cpu8815_nand_timings = {
150 .thiz = 0, 115 .thiz = 0,
151 .thold = 0x10, 116 .thold = 0x10,
@@ -259,7 +224,6 @@ static const char * cpu8815_board_compat[] = {
259 224
260DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815") 225DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815")
261 .map_io = cpu8815_map_io, 226 .map_io = cpu8815_map_io,
262 .init_time = cpu8815_timer_init_of,
263 .init_machine = cpu8815_init_of, 227 .init_machine = cpu8815_init_of,
264 .restart = cpu8815_restart, 228 .restart = cpu8815_restart,
265 .dt_compat = cpu8815_board_compat, 229 .dt_compat = cpu8815_board_compat,
diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
index 99e26092a9f7..4b2ed2e8352f 100644
--- a/arch/arm/mach-nspire/nspire.c
+++ b/arch/arm/mach-nspire/nspire.c
@@ -14,11 +14,9 @@
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15#include <linux/irqchip.h> 15#include <linux/irqchip.h>
16#include <linux/irqchip/arm-vic.h> 16#include <linux/irqchip/arm-vic.h>
17#include <linux/clk-provider.h>
18#include <linux/clkdev.h> 17#include <linux/clkdev.h>
19#include <linux/amba/bus.h> 18#include <linux/amba/bus.h>
20#include <linux/amba/clcd.h> 19#include <linux/amba/clcd.h>
21#include <linux/clocksource.h>
22 20
23#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
24#include <asm/mach-types.h> 22#include <asm/mach-types.h>
@@ -65,12 +63,6 @@ static void __init nspire_init(void)
65 nspire_auxdata, NULL); 63 nspire_auxdata, NULL);
66} 64}
67 65
68static void __init nspire_init_time(void)
69{
70 of_clk_init(NULL);
71 clocksource_of_init();
72}
73
74static void nspire_restart(char mode, const char *cmd) 66static void nspire_restart(char mode, const char *cmd)
75{ 67{
76 void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K); 68 void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K);
@@ -83,7 +75,6 @@ static void nspire_restart(char mode, const char *cmd)
83DT_MACHINE_START(NSPIRE, "TI-NSPIRE") 75DT_MACHINE_START(NSPIRE, "TI-NSPIRE")
84 .dt_compat = nspire_dt_match, 76 .dt_compat = nspire_dt_match,
85 .map_io = nspire_map_io, 77 .map_io = nspire_map_io,
86 .init_time = nspire_init_time,
87 .init_machine = nspire_init, 78 .init_machine = nspire_init,
88 .restart = nspire_restart, 79 .restart = nspire_restart,
89MACHINE_END 80MACHINE_END
diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index e110b6d4ae8c..d49aff74de98 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -6,7 +6,6 @@
6 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2 or later.
7 */ 7 */
8 8
9#include <linux/clocksource.h>
10#include <linux/init.h> 9#include <linux/init.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
12#include <asm/sizes.h> 11#include <asm/sizes.h>
@@ -21,13 +20,6 @@ void __init sirfsoc_init_late(void)
21 sirfsoc_pm_init(); 20 sirfsoc_pm_init();
22} 21}
23 22
24static __init void sirfsoc_init_time(void)
25{
26 /* initialize clocking early, we want to set the OS timer */
27 sirfsoc_of_clk_init();
28 clocksource_of_init();
29}
30
31static __init void sirfsoc_map_io(void) 23static __init void sirfsoc_map_io(void)
32{ 24{
33 sirfsoc_map_lluart(); 25 sirfsoc_map_lluart();
@@ -43,7 +35,6 @@ static const char *atlas6_dt_match[] __initdata = {
43DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)") 35DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)")
44 /* Maintainer: Barry Song <baohua.song@csr.com> */ 36 /* Maintainer: Barry Song <baohua.song@csr.com> */
45 .map_io = sirfsoc_map_io, 37 .map_io = sirfsoc_map_io,
46 .init_time = sirfsoc_init_time,
47 .init_late = sirfsoc_init_late, 38 .init_late = sirfsoc_init_late,
48 .dt_compat = atlas6_dt_match, 39 .dt_compat = atlas6_dt_match,
49 .restart = sirfsoc_restart, 40 .restart = sirfsoc_restart,
@@ -59,7 +50,6 @@ static const char *prima2_dt_match[] __initdata = {
59DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)") 50DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)")
60 /* Maintainer: Barry Song <baohua.song@csr.com> */ 51 /* Maintainer: Barry Song <baohua.song@csr.com> */
61 .map_io = sirfsoc_map_io, 52 .map_io = sirfsoc_map_io,
62 .init_time = sirfsoc_init_time,
63 .dma_zone_size = SZ_256M, 53 .dma_zone_size = SZ_256M,
64 .init_late = sirfsoc_init_late, 54 .init_late = sirfsoc_init_late,
65 .dt_compat = prima2_dt_match, 55 .dt_compat = prima2_dt_match,
@@ -77,7 +67,6 @@ DT_MACHINE_START(MARCO_DT, "Generic MARCO (Flattened Device Tree)")
77 /* Maintainer: Barry Song <baohua.song@csr.com> */ 67 /* Maintainer: Barry Song <baohua.song@csr.com> */
78 .smp = smp_ops(sirfsoc_smp_ops), 68 .smp = smp_ops(sirfsoc_smp_ops),
79 .map_io = sirfsoc_map_io, 69 .map_io = sirfsoc_map_io,
80 .init_time = sirfsoc_init_time,
81 .init_late = sirfsoc_init_late, 70 .init_late = sirfsoc_init_late,
82 .dt_compat = marco_dt_match, 71 .dt_compat = marco_dt_match,
83 .restart = sirfsoc_restart, 72 .restart = sirfsoc_restart,
diff --git a/arch/arm/mach-prima2/common.h b/arch/arm/mach-prima2/common.h
index a6304858474a..4b768060a858 100644
--- a/arch/arm/mach-prima2/common.h
+++ b/arch/arm/mach-prima2/common.h
@@ -23,7 +23,6 @@ extern void sirfsoc_secondary_startup(void);
23extern void sirfsoc_cpu_die(unsigned int cpu); 23extern void sirfsoc_cpu_die(unsigned int cpu);
24 24
25extern void __init sirfsoc_of_irq_init(void); 25extern void __init sirfsoc_of_irq_init(void);
26extern void __init sirfsoc_of_clk_init(void);
27extern void sirfsoc_restart(enum reboot_mode, const char *); 26extern void sirfsoc_restart(enum reboot_mode, const char *);
28extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs); 27extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs);
29 28
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 724d2d81f976..82c0b0709712 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -19,18 +19,10 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <linux/irqchip.h> 21#include <linux/irqchip.h>
22#include <linux/dw_apb_timer.h>
23#include <linux/clk-provider.h>
24#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 23#include <asm/mach/map.h>
26#include <asm/hardware/cache-l2x0.h> 24#include <asm/hardware/cache-l2x0.h>
27 25
28static void __init rockchip_timer_init(void)
29{
30 of_clk_init(NULL);
31 clocksource_of_init();
32}
33
34static void __init rockchip_dt_init(void) 26static void __init rockchip_dt_init(void)
35{ 27{
36 l2x0_of_init(0, ~0UL); 28 l2x0_of_init(0, ~0UL);
@@ -47,6 +39,5 @@ static const char * const rockchip_board_dt_compat[] = {
47 39
48DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)") 40DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
49 .init_machine = rockchip_dt_init, 41 .init_machine = rockchip_dt_init,
50 .init_time = rockchip_timer_init,
51 .dt_compat = rockchip_board_dt_compat, 42 .dt_compat = rockchip_board_dt_compat,
52MACHINE_END 43MACHINE_END
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index bfce9641e32f..dd0d49cdbe09 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -14,7 +14,6 @@
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17#include <linux/clk-provider.h>
18#include <linux/irqchip.h> 17#include <linux/irqchip.h>
19#include <linux/of_address.h> 18#include <linux/of_address.h>
20#include <linux/of_irq.h> 19#include <linux/of_irq.h>
@@ -107,7 +106,6 @@ static void __init socfpga_cyclone5_init(void)
107{ 106{
108 l2x0_of_init(0, ~0UL); 107 l2x0_of_init(0, ~0UL);
109 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 108 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
110 of_clk_init(NULL);
111 socfpga_init_clocks(); 109 socfpga_init_clocks();
112} 110}
113 111
diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
index 8fe6f0c46480..1217fb598cfd 100644
--- a/arch/arm/mach-sti/board-dt.c
+++ b/arch/arm/mach-sti/board-dt.c
@@ -7,9 +7,8 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 */ 8 */
9 9
10#include <linux/clk-provider.h>
11#include <linux/clocksource.h>
12#include <linux/irq.h> 10#include <linux/irq.h>
11#include <linux/of_platform.h>
13#include <asm/hardware/cache-l2x0.h> 12#include <asm/hardware/cache-l2x0.h>
14#include <asm/mach/arch.h> 13#include <asm/mach/arch.h>
15 14
@@ -28,11 +27,10 @@ void __init stih41x_l2x0_init(void)
28 l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK); 27 l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK);
29} 28}
30 29
31static void __init stih41x_timer_init(void) 30static void __init stih41x_machine_init(void)
32{ 31{
33 of_clk_init(NULL);
34 clocksource_of_init();
35 stih41x_l2x0_init(); 32 stih41x_l2x0_init();
33 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
36} 34}
37 35
38static const char *stih41x_dt_match[] __initdata = { 36static const char *stih41x_dt_match[] __initdata = {
@@ -42,7 +40,7 @@ static const char *stih41x_dt_match[] __initdata = {
42}; 40};
43 41
44DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree") 42DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree")
45 .init_time = stih41x_timer_init, 43 .init_machine = stih41x_machine_init,
46 .smp = smp_ops(sti_smp_ops), 44 .smp = smp_ops(sti_smp_ops),
47 .dt_compat = stih41x_dt_match, 45 .dt_compat = stih41x_dt_match,
48MACHINE_END 46MACHINE_END
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index e79fb3469341..90dda6228510 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -10,7 +10,6 @@
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12
13#include <linux/clocksource.h>
14#include <linux/delay.h> 13#include <linux/delay.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/init.h> 15#include <linux/init.h>
@@ -20,8 +19,6 @@
20#include <linux/io.h> 19#include <linux/io.h>
21#include <linux/reboot.h> 20#include <linux/reboot.h>
22 21
23#include <linux/clk/sunxi.h>
24
25#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 23#include <asm/mach/map.h>
27#include <asm/system_misc.h> 24#include <asm/system_misc.h>
@@ -116,12 +113,6 @@ static void sunxi_setup_restart(void)
116 arm_pm_restart = of_id->data; 113 arm_pm_restart = of_id->data;
117} 114}
118 115
119static void __init sunxi_timer_init(void)
120{
121 sunxi_init_clocks();
122 clocksource_of_init();
123}
124
125static void __init sunxi_dt_init(void) 116static void __init sunxi_dt_init(void)
126{ 117{
127 sunxi_setup_restart(); 118 sunxi_setup_restart();
@@ -140,6 +131,5 @@ static const char * const sunxi_board_dt_compat[] = {
140 131
141DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") 132DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
142 .init_machine = sunxi_dt_init, 133 .init_machine = sunxi_dt_init,
143 .init_time = sunxi_timer_init,
144 .dt_compat = sunxi_board_dt_compat, 134 .dt_compat = sunxi_board_dt_compat,
145MACHINE_END 135MACHINE_END
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 80b801a94677..ce553d557c31 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -16,7 +16,6 @@
16 * 16 *
17 */ 17 */
18 18
19#include <linux/clocksource.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/platform_device.h> 21#include <linux/platform_device.h>
@@ -33,7 +32,6 @@
33#include <linux/slab.h> 32#include <linux/slab.h>
34#include <linux/sys_soc.h> 33#include <linux/sys_soc.h>
35#include <linux/usb/tegra_usb_phy.h> 34#include <linux/usb/tegra_usb_phy.h>
36#include <linux/clk-provider.h>
37#include <linux/clk/tegra.h> 35#include <linux/clk/tegra.h>
38#include <linux/irqchip.h> 36#include <linux/irqchip.h>
39 37
@@ -145,12 +143,6 @@ out:
145 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 143 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
146} 144}
147 145
148static void __init tegra_dt_init_time(void)
149{
150 of_clk_init(NULL);
151 clocksource_of_init();
152}
153
154static void __init paz00_init(void) 146static void __init paz00_init(void)
155{ 147{
156 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) 148 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
@@ -193,7 +185,6 @@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
193 .smp = smp_ops(tegra_smp_ops), 185 .smp = smp_ops(tegra_smp_ops),
194 .init_early = tegra_init_early, 186 .init_early = tegra_init_early,
195 .init_irq = tegra_dt_init_irq, 187 .init_irq = tegra_dt_init_irq,
196 .init_time = tegra_dt_init_time,
197 .init_machine = tegra_dt_init, 188 .init_machine = tegra_dt_init,
198 .init_late = tegra_dt_init_late, 189 .init_late = tegra_dt_init_late,
199 .restart = tegra_pmc_restart, 190 .restart = tegra_pmc_restart,
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 95a469e23e37..4f8b8cb17ff5 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -1,12 +1,10 @@
1/* 1/*
2 * Versatile Express V2M Motherboard Support 2 * Versatile Express V2M Motherboard Support
3 */ 3 */
4#include <linux/clocksource.h>
5#include <linux/device.h> 4#include <linux/device.h>
6#include <linux/amba/bus.h> 5#include <linux/amba/bus.h>
7#include <linux/amba/mmci.h> 6#include <linux/amba/mmci.h>
8#include <linux/io.h> 7#include <linux/io.h>
9#include <linux/clocksource.h>
10#include <linux/smp.h> 8#include <linux/smp.h>
11#include <linux/init.h> 9#include <linux/init.h>
12#include <linux/of_address.h> 10#include <linux/of_address.h>
@@ -22,7 +20,6 @@
22#include <linux/regulator/fixed.h> 20#include <linux/regulator/fixed.h>
23#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
24#include <linux/vexpress.h> 22#include <linux/vexpress.h>
25#include <linux/clk-provider.h>
26#include <linux/clkdev.h> 23#include <linux/clkdev.h>
27 24
28#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -422,16 +419,8 @@ void __init v2m_dt_init_early(void)
422 pr_warning("vexpress: DT HBI (%x) is not matching " 419 pr_warning("vexpress: DT HBI (%x) is not matching "
423 "hardware (%x)!\n", dt_hbi, hbi); 420 "hardware (%x)!\n", dt_hbi, hbi);
424 } 421 }
425}
426
427static void __init v2m_dt_timer_init(void)
428{
429 of_clk_init(NULL);
430 422
431 clocksource_of_init(); 423 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000);
432
433 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
434 24000000);
435} 424}
436 425
437static const struct of_device_id v2m_dt_bus_match[] __initconst = { 426static const struct of_device_id v2m_dt_bus_match[] __initconst = {
@@ -458,6 +447,5 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
458 .smp_init = smp_init_ops(vexpress_smp_init_ops), 447 .smp_init = smp_init_ops(vexpress_smp_init_ops),
459 .map_io = v2m_dt_map_io, 448 .map_io = v2m_dt_map_io,
460 .init_early = v2m_dt_init_early, 449 .init_early = v2m_dt_init_early,
461 .init_time = v2m_dt_timer_init,
462 .init_machine = v2m_dt_init, 450 .init_machine = v2m_dt_init,
463MACHINE_END 451MACHINE_END
diff --git a/arch/arm/mach-vt8500/common.h b/arch/arm/mach-vt8500/common.h
deleted file mode 100644
index 087787af62f1..000000000000
--- a/arch/arm/mach-vt8500/common.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* linux/arch/arm/mach-vt8500/dt_common.h
2 *
3 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __ARCH_ARM_MACH_VT8500_DT_COMMON_H
17#define __ARCH_ARM_MACH_VT8500_DT_COMMON_H
18
19#include <linux/of.h>
20
21/* defined in drivers/clk/clk-vt8500.c */
22void __init vtwm_clk_init(void __iomem *pmc_base);
23
24#endif
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index eefaa60d6614..4a73464cb11b 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -18,7 +18,6 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#include <linux/clocksource.h>
22#include <linux/io.h> 21#include <linux/io.h>
23#include <linux/pm.h> 22#include <linux/pm.h>
24#include <linux/reboot.h> 23#include <linux/reboot.h>
@@ -33,8 +32,6 @@
33#include <linux/of_irq.h> 32#include <linux/of_irq.h>
34#include <linux/of_platform.h> 33#include <linux/of_platform.h>
35 34
36#include "common.h"
37
38#define LEGACY_GPIO_BASE 0xD8110000 35#define LEGACY_GPIO_BASE 0xD8110000
39#define LEGACY_PMC_BASE 0xD8130000 36#define LEGACY_PMC_BASE 0xD8130000
40 37
@@ -162,8 +159,6 @@ void __init vt8500_init(void)
162 else 159 else
163 pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__); 160 pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
164 161
165 vtwm_clk_init(pmc_base);
166
167 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 162 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
168} 163}
169 164
@@ -180,7 +175,6 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
180 .dt_compat = vt8500_dt_compat, 175 .dt_compat = vt8500_dt_compat,
181 .map_io = vt8500_map_io, 176 .map_io = vt8500_map_io,
182 .init_machine = vt8500_init, 177 .init_machine = vt8500_init,
183 .init_time = clocksource_of_init,
184 .restart = vt8500_restart, 178 .restart = vt8500_restart,
185MACHINE_END 179MACHINE_END
186 180
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..ce2d6b32e3f5 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 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/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);
diff --git a/include/linux/clk/mxs.h b/include/linux/clk/mxs.h
index 90c30dc3efc7..5138a90e018c 100644
--- a/include/linux/clk/mxs.h
+++ b/include/linux/clk/mxs.h
@@ -9,8 +9,6 @@
9#ifndef __LINUX_CLK_MXS_H 9#ifndef __LINUX_CLK_MXS_H
10#define __LINUX_CLK_MXS_H 10#define __LINUX_CLK_MXS_H
11 11
12int mx23_clocks_init(void);
13int mx28_clocks_init(void);
14int mxs_saif_clkmux_select(unsigned int clkmux); 12int mxs_saif_clkmux_select(unsigned int clkmux);
15 13
16#endif 14#endif
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
deleted file mode 100644
index e074fdd5a236..000000000000
--- a/include/linux/clk/sunxi.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_CLK_SUNXI_H_
18#define __LINUX_CLK_SUNXI_H_
19
20void __init sunxi_init_clocks(void);
21
22#endif
diff --git a/include/linux/platform_data/clk-nomadik.h b/include/linux/platform_data/clk-nomadik.h
deleted file mode 100644
index 5713c87b2477..000000000000
--- a/include/linux/platform_data/clk-nomadik.h
+++ /dev/null
@@ -1,2 +0,0 @@
1/* Minimal platform data header */
2void nomadik_clk_init(void);