From eb6b036dde364c528807f53ee8c8e5c9b0e46c34 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 13 Sep 2013 21:45:51 +0200 Subject: [PATCH 01/28] clk: nomadik: set all timers to use 2.4 MHz TIMCLK This fixes a regression for the Nomadik on the main system timers. The Nomadik seemed a bit slow and its heartbeat wasn't looking healthy. And it was not strange, because it has been connected to the 32768 Hz clock at boot, while being told by the clock driver that it was 2.4MHz. Actually connect the TIMCLK to 2.4MHz by default as this is what we want for nice scheduling, clocksource and clock event. Cc: stable@vger.kernel.org Signed-off-by: Linus Walleij --- drivers/clk/clk-nomadik.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index 51410c2ac2cb..4d978a3c88f7 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c @@ -27,6 +27,14 @@ */ #define SRC_CR 0x00U +#define SRC_CR_T0_ENSEL BIT(15) +#define SRC_CR_T1_ENSEL BIT(17) +#define SRC_CR_T2_ENSEL BIT(19) +#define SRC_CR_T3_ENSEL BIT(21) +#define SRC_CR_T4_ENSEL BIT(23) +#define SRC_CR_T5_ENSEL BIT(25) +#define SRC_CR_T6_ENSEL BIT(27) +#define SRC_CR_T7_ENSEL BIT(29) #define SRC_XTALCR 0x0CU #define SRC_XTALCR_XTALTIMEN BIT(20) #define SRC_XTALCR_SXTALDIS BIT(19) @@ -543,6 +551,19 @@ void __init nomadik_clk_init(void) __func__, np->name); return; } + + /* Set all timers to use the 2.4 MHz TIMCLK */ + val = readl(src_base + SRC_CR); + val |= SRC_CR_T0_ENSEL; + val |= SRC_CR_T1_ENSEL; + val |= SRC_CR_T2_ENSEL; + val |= SRC_CR_T3_ENSEL; + val |= SRC_CR_T4_ENSEL; + val |= SRC_CR_T5_ENSEL; + val |= SRC_CR_T6_ENSEL; + val |= SRC_CR_T7_ENSEL; + writel(val, src_base + SRC_CR); + val = readl(src_base + SRC_XTALCR); pr_info("SXTALO is %s\n", (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled"); From 4db7634336156254b179b66f6a9fe90d75c44ee4 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 18:31:14 +0200 Subject: [PATCH 02/28] ARM: nomadik: remove mtu initalization from .init_time Nomadik clock initialization is properly done in clk-nomadik since patch "clk: nomadik: set all timers to use 2.4 MHz TIMCLK". Therefore, this patch removes now redundant mtu initialization from .init_time callback. Signed-off-by: Sebastian Hesselbarth Acked-by: Linus Walleij --- arch/arm/mach-nomadik/cpu-8815.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index 13e0df9c11ce..0fcb14966d5a 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c @@ -113,36 +113,10 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd) writel(1, srcbase + 0x18); } -/* Initial value for SRC control register: all timers use MXTAL/8 source */ -#define SRC_CR_INIT_MASK 0x00007fff -#define SRC_CR_INIT_VAL 0x2aaa8000 - static void __init cpu8815_timer_init_of(void) { - struct device_node *mtu; - void __iomem *base; - int irq; - u32 src_cr; - /* We need this to be up now */ nomadik_clk_init(); - - mtu = of_find_node_by_path("/mtu@101e2000"); - if (!mtu) - return; - base = of_iomap(mtu, 0); - if (WARN_ON(!base)) - return; - irq = irq_of_parse_and_map(mtu, 0); - - pr_info("Remapped MTU @ %p, irq: %d\n", base, irq); - - /* Configure timer sources in "system reset controller" ctrl reg */ - src_cr = readl(base); - src_cr &= SRC_CR_INIT_MASK; - src_cr |= SRC_CR_INIT_VAL; - writel(src_cr, base); - clocksource_of_init(); } From ea25a900f593cd34347ec884b3acac09ffe07667 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Sun, 22 Sep 2013 18:17:28 +0200 Subject: [PATCH 03/28] clk: nomadik: move src init out of nomadik_clk_init nomadik_clk_init currently also maps system reset controller base address used by clocks and registers a reboot notifier. To allow further cleanup of nomadik clk setup, this moves system reset controller setup from nomadik_clk_init to its own function. Signed-off-by: Sebastian Hesselbarth Acked-by: Linus Walleij Acked-by: Mike Turquette --- drivers/clk/clk-nomadik.c | 144 ++++++++++++++++++++------------------ 1 file changed, 74 insertions(+), 70 deletions(-) diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index 4d978a3c88f7..06b29c264dbe 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c @@ -62,6 +62,79 @@ static DEFINE_SPINLOCK(src_lock); /* Base address of the SRC */ static void __iomem *src_base; +static int nomadik_clk_reboot_handler(struct notifier_block *this, + unsigned long code, + void *unused) +{ + u32 val; + + /* The main chrystal need to be enabled for reboot to work */ + val = readl(src_base + SRC_XTALCR); + val &= ~SRC_XTALCR_MXTALOVER; + val |= SRC_XTALCR_MXTALEN; + pr_crit("force-enabling MXTALO\n"); + writel(val, src_base + SRC_XTALCR); + return NOTIFY_OK; +} + +static struct notifier_block nomadik_clk_reboot_notifier = { + .notifier_call = nomadik_clk_reboot_handler, +}; + +static const struct of_device_id nomadik_src_match[] __initconst = { + { .compatible = "stericsson,nomadik-src" }, + { /* sentinel */ } +}; + +static void nomadik_src_init(void) +{ + struct device_node *np; + u32 val; + + np = of_find_matching_node(NULL, nomadik_src_match); + if (!np) { + pr_crit("no matching node for SRC, aborting clock init\n"); + return; + } + src_base = of_iomap(np, 0); + if (!src_base) { + pr_err("%s: must have src parent node with REGS (%s)\n", + __func__, np->name); + return; + } + + /* Set all timers to use the 2.4 MHz TIMCLK */ + val = readl(src_base + SRC_CR); + val |= SRC_CR_T0_ENSEL; + val |= SRC_CR_T1_ENSEL; + val |= SRC_CR_T2_ENSEL; + val |= SRC_CR_T3_ENSEL; + val |= SRC_CR_T4_ENSEL; + val |= SRC_CR_T5_ENSEL; + val |= SRC_CR_T6_ENSEL; + val |= SRC_CR_T7_ENSEL; + writel(val, src_base + SRC_CR); + + val = readl(src_base + SRC_XTALCR); + pr_info("SXTALO is %s\n", + (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled"); + pr_info("MXTAL is %s\n", + (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled"); + if (of_property_read_bool(np, "disable-sxtalo")) { + /* The machine uses an external oscillator circuit */ + val |= SRC_XTALCR_SXTALDIS; + pr_info("disabling SXTALO\n"); + } + if (of_property_read_bool(np, "disable-mxtalo")) { + /* Disable this too: also run by external oscillator */ + val |= SRC_XTALCR_MXTALOVER; + val &= ~SRC_XTALCR_MXTALEN; + pr_info("disabling MXTALO\n"); + } + writel(val, src_base + SRC_XTALCR); + register_reboot_notifier(&nomadik_clk_reboot_notifier); +} + /** * struct clk_pll1 - Nomadik PLL1 clock * @hw: corresponding clock hardware entry @@ -487,11 +560,6 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np) of_clk_add_provider(np, of_clk_src_simple_get, clk); } -static const struct of_device_id nomadik_src_match[] __initconst = { - { .compatible = "stericsson,nomadik-src" }, - { /* sentinel */ } -}; - static const struct of_device_id nomadik_src_clk_match[] __initconst = { { .compatible = "fixed-clock", @@ -516,72 +584,8 @@ static const struct of_device_id nomadik_src_clk_match[] __initconst = { { /* sentinel */ } }; -static int nomadik_clk_reboot_handler(struct notifier_block *this, - unsigned long code, - void *unused) -{ - u32 val; - - /* The main chrystal need to be enabled for reboot to work */ - val = readl(src_base + SRC_XTALCR); - val &= ~SRC_XTALCR_MXTALOVER; - val |= SRC_XTALCR_MXTALEN; - pr_crit("force-enabling MXTALO\n"); - writel(val, src_base + SRC_XTALCR); - return NOTIFY_OK; -} - -static struct notifier_block nomadik_clk_reboot_notifier = { - .notifier_call = nomadik_clk_reboot_handler, -}; - void __init nomadik_clk_init(void) { - struct device_node *np; - u32 val; - - np = of_find_matching_node(NULL, nomadik_src_match); - if (!np) { - pr_crit("no matching node for SRC, aborting clock init\n"); - return; - } - src_base = of_iomap(np, 0); - if (!src_base) { - pr_err("%s: must have src parent node with REGS (%s)\n", - __func__, np->name); - return; - } - - /* Set all timers to use the 2.4 MHz TIMCLK */ - val = readl(src_base + SRC_CR); - val |= SRC_CR_T0_ENSEL; - val |= SRC_CR_T1_ENSEL; - val |= SRC_CR_T2_ENSEL; - val |= SRC_CR_T3_ENSEL; - val |= SRC_CR_T4_ENSEL; - val |= SRC_CR_T5_ENSEL; - val |= SRC_CR_T6_ENSEL; - val |= SRC_CR_T7_ENSEL; - writel(val, src_base + SRC_CR); - - val = readl(src_base + SRC_XTALCR); - pr_info("SXTALO is %s\n", - (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled"); - pr_info("MXTAL is %s\n", - (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled"); - if (of_property_read_bool(np, "disable-sxtalo")) { - /* The machine uses an external oscillator circuit */ - val |= SRC_XTALCR_SXTALDIS; - pr_info("disabling SXTALO\n"); - } - if (of_property_read_bool(np, "disable-mxtalo")) { - /* Disable this too: also run by external oscillator */ - val |= SRC_XTALCR_MXTALOVER; - val &= ~SRC_XTALCR_MXTALEN; - pr_info("disabling MXTALO\n"); - } - writel(val, src_base + SRC_XTALCR); - register_reboot_notifier(&nomadik_clk_reboot_notifier); - + nomadik_src_init(); of_clk_init(nomadik_src_clk_match); } From 74227e65f9742f559f6e243ba2c9a983e1f1221d Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 17 Sep 2013 00:32:34 +0200 Subject: [PATCH 04/28] clk: nomadik: declare OF clock provider Common clock framework allows to register clock providers to get called on of_clk_init() by using CLK_OF_DECLARE. This converts nomadik clock provider to make use of it and get rid of the mach specific clk init call. As clocks require system reset controller base address to be initialized each clock driver checks src_base and calls new nomadik_src_init if required. Signed-off-by: Sebastian Hesselbarth Acked-by: Linus Walleij Acked-by: Mike Turquette --- arch/arm/mach-nomadik/cpu-8815.c | 5 +-- drivers/clk/clk-nomadik.c | 45 ++++++++--------------- include/linux/platform_data/clk-nomadik.h | 2 - 3 files changed, 17 insertions(+), 35 deletions(-) delete mode 100644 include/linux/platform_data/clk-nomadik.h diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index 0fcb14966d5a..2be38a00a3d9 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -115,8 +115,7 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd) static void __init cpu8815_timer_init_of(void) { - /* We need this to be up now */ - nomadik_clk_init(); + of_clk_init(NULL); clocksource_of_init(); } diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index 06b29c264dbe..ce2d6b32e3f5 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c @@ -512,6 +512,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np) const char *parent_name; u32 pll_id; + if (!src_base) + nomadik_src_init(); + if (of_property_read_u32(np, "pll-id", &pll_id)) { pr_err("%s: PLL \"%s\" missing pll-id property\n", __func__, clk_name); @@ -522,6 +525,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np) if (!IS_ERR(clk)) of_clk_add_provider(np, of_clk_src_simple_get, clk); } +CLK_OF_DECLARE(nomadik_pll_clk, + "st,nomadik-pll-clock", of_nomadik_pll_setup); static void __init of_nomadik_hclk_setup(struct device_node *np) { @@ -529,6 +534,9 @@ static void __init of_nomadik_hclk_setup(struct device_node *np) const char *clk_name = np->name; const char *parent_name; + if (!src_base) + nomadik_src_init(); + parent_name = of_clk_get_parent_name(np, 0); /* * The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4. @@ -541,6 +549,8 @@ static void __init of_nomadik_hclk_setup(struct device_node *np) if (!IS_ERR(clk)) of_clk_add_provider(np, of_clk_src_simple_get, clk); } +CLK_OF_DECLARE(nomadik_hclk_clk, + "st,nomadik-hclk-clock", of_nomadik_hclk_setup); static void __init of_nomadik_src_clk_setup(struct device_node *np) { @@ -549,6 +559,9 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np) const char *parent_name; u32 clk_id; + if (!src_base) + nomadik_src_init(); + if (of_property_read_u32(np, "clock-id", &clk_id)) { pr_err("%s: SRC clock \"%s\" missing clock-id property\n", __func__, clk_name); @@ -559,33 +572,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np) if (!IS_ERR(clk)) of_clk_add_provider(np, of_clk_src_simple_get, clk); } - -static const struct of_device_id nomadik_src_clk_match[] __initconst = { - { - .compatible = "fixed-clock", - .data = of_fixed_clk_setup, - }, - { - .compatible = "fixed-factor-clock", - .data = of_fixed_factor_clk_setup, - }, - { - .compatible = "st,nomadik-pll-clock", - .data = of_nomadik_pll_setup, - }, - { - .compatible = "st,nomadik-hclk-clock", - .data = of_nomadik_hclk_setup, - }, - { - .compatible = "st,nomadik-src-clock", - .data = of_nomadik_src_clk_setup, - }, - { /* sentinel */ } -}; - -void __init nomadik_clk_init(void) -{ - nomadik_src_init(); - of_clk_init(nomadik_src_clk_match); -} +CLK_OF_DECLARE(nomadik_src_clk, + "st,nomadik-src-clock", of_nomadik_src_clk_setup); 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 @@ -/* Minimal platform data header */ -void nomadik_clk_init(void); From 27966ffe43d412483f0823b15b8c035db04969c7 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 14:21:18 +0200 Subject: [PATCH 05/28] clk: prima2: declare OF clock provider Common clock framework allows to register clock providers to get called on of_clk_init() by using CLK_OF_DECLARE. This converts prima2 clock provider to make use of it and get rid of the mach specific clk init call. Signed-off-by: Sebastian Hesselbarth Acked-by: Barry Song Acked-by: Mike Turquette --- arch/arm/mach-prima2/common.c | 4 ++-- arch/arm/mach-prima2/common.h | 1 - drivers/clk/clk-prima2.c | 29 ++++++----------------------- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c index e110b6d4ae8c..9b7663d9096f 100644 --- a/arch/arm/mach-prima2/common.c +++ b/arch/arm/mach-prima2/common.c @@ -6,6 +6,7 @@ * Licensed under GPLv2 or later. */ +#include #include #include #include @@ -23,8 +24,7 @@ void __init sirfsoc_init_late(void) static __init void sirfsoc_init_time(void) { - /* initialize clocking early, we want to set the OS timer */ - sirfsoc_of_clk_init(); + of_clk_init(NULL); clocksource_of_init(); } 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); extern void sirfsoc_cpu_die(unsigned int cpu); extern void __init sirfsoc_of_irq_init(void); -extern void __init sirfsoc_of_clk_init(void); extern void sirfsoc_restart(enum reboot_mode, const char *); extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs); 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 = { }, }; -static struct of_device_id clkc_ids[] = { - { .compatible = "sirf,prima2-clkc" }, - {}, -}; - -static struct of_device_id rsc_ids[] = { - { .compatible = "sirf,prima2-rsc" }, - {}, -}; - enum prima2_clk_index { /* 0 1 2 3 4 5 6 7 8 9 */ rtc, osc, pll1, pll2, pll3, mem, sys, security, dsp, gps, @@ -1082,24 +1072,16 @@ static struct clk_hw *prima2_clk_hw_array[maxclk] __initdata = { static struct clk *prima2_clks[maxclk]; static struct clk_onecell_data clk_data; -void __init sirfsoc_of_clk_init(void) +static void __init sirfsoc_clk_init(struct device_node *np) { - struct device_node *np; + struct device_node *rscnp; int i; - np = of_find_matching_node(NULL, rsc_ids); - if (!np) - panic("unable to find compatible rsc node in dtb\n"); - - sirfsoc_rsc_vbase = of_iomap(np, 0); + rscnp = of_find_compatible_node(NULL, NULL, "sirf,prima2-rsc"); + sirfsoc_rsc_vbase = of_iomap(rscnp, 0); if (!sirfsoc_rsc_vbase) panic("unable to map rsc registers\n"); - - of_node_put(np); - - np = of_find_matching_node(NULL, clkc_ids); - if (!np) - return; + of_node_put(rscnp); sirfsoc_clk_vbase = of_iomap(np, 0); if (!sirfsoc_clk_vbase) @@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void) of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); } +CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init); From 8e7b25f1aa9accb8e4c80d0c019d769c979f2ec6 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 13:35:50 +0200 Subject: [PATCH 06/28] ARM: socfgpa: prepare for arch-wide .init_time callback Current socfpga board init calls of_clk_init() from .machine_init. To allow consolidation of DT driven .time_init, move of_clock_init() to a temporary .time_init that will be removed when arch-wide callback is available. Signed-off-by: Sebastian Hesselbarth Acked-by: Dinh Nguyen --- arch/arm/mach-socfpga/socfpga.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c index bfce9641e32f..6df7bb9fe64a 100644 --- a/arch/arm/mach-socfpga/socfpga.c +++ b/arch/arm/mach-socfpga/socfpga.c @@ -15,6 +15,7 @@ * along with this program. If not, see . */ #include +#include #include #include #include @@ -90,6 +91,12 @@ static void __init socfpga_init_irq(void) socfpga_sysmgr_init(); } +static void __init socfpga_init_time(void) +{ + of_clk_init(NULL); + clocksource_of_init(); +} + static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) { u32 temp; @@ -107,7 +114,6 @@ static void __init socfpga_cyclone5_init(void) { l2x0_of_init(0, ~0UL); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - of_clk_init(NULL); socfpga_init_clocks(); } @@ -120,6 +126,7 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA") .smp = smp_ops(socfpga_smp_ops), .map_io = socfpga_map_io, .init_irq = socfpga_init_irq, + .init_time = socfpga_init_time, .init_machine = socfpga_cyclone5_init, .restart = socfpga_cyclone5_restart, .dt_compat = altera_dt_match, From be0804513a506de96925f9ed1aa8dc1facd4c180 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Fri, 6 Sep 2013 14:59:57 +0200 Subject: [PATCH 07/28] clk: sunxi: declare OF clock provider Common clock framework allows to register clock providers to get called on of_clk_init() by using CLK_OF_DECLARE. This converts sunxi clock providers to make use of it and get rid of the mach specific clk init call. As sunxi has a bunch of independent clk provider nodes, we hook current clock init to board compatible to make it called once. Signed-off-by: Sebastian Hesselbarth Acked-by: Maxime Ripard Acked-by: Mike Turquette --- arch/arm/mach-sunxi/sunxi.c | 4 +--- drivers/clk/sunxi/clk-sunxi.c | 11 ++++++----- include/linux/clk/sunxi.h | 22 ---------------------- 3 files changed, 7 insertions(+), 30 deletions(-) delete mode 100644 include/linux/clk/sunxi.h diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index e79fb3469341..e5a69756427b 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c @@ -20,8 +20,6 @@ #include #include -#include - #include #include #include @@ -118,7 +116,7 @@ static void sunxi_setup_restart(void) static void __init sunxi_timer_init(void) { - sunxi_init_clocks(); + of_clk_init(NULL); clocksource_of_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 @@ #include #include -#include #include #include @@ -617,11 +616,8 @@ static void __init of_sunxi_table_clock_setup(const struct of_device_id *clk_mat } } -void __init sunxi_init_clocks(void) +static void __init sunxi_init_clocks(struct device_node *np) { - /* Register all the simple and basic clocks on DT */ - of_clk_init(NULL); - /* Register factor clocks */ of_sunxi_table_clock_setup(clk_factors_match, sunxi_factors_clk_setup); @@ -634,3 +630,8 @@ void __init sunxi_init_clocks(void) /* Register gate clocks */ of_sunxi_table_clock_setup(clk_gates_match, sunxi_gates_clk_setup); } +CLK_OF_DECLARE(sun4i_a10_clk_init, "allwinner,sun4i-a10", sunxi_init_clocks); +CLK_OF_DECLARE(sun5i_a10s_clk_init, "allwinner,sun5i-a10s", sunxi_init_clocks); +CLK_OF_DECLARE(sun5i_a13_clk_init, "allwinner,sun5i-a13", sunxi_init_clocks); +CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sunxi_init_clocks); +CLK_OF_DECLARE(sun7i_a20_clk_init, "allwinner,sun7i-a20", sunxi_init_clocks); 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 @@ -/* - * Copyright 2012 Maxime Ripard - * - * Maxime Ripard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef __LINUX_CLK_SUNXI_H_ -#define __LINUX_CLK_SUNXI_H_ - -void __init sunxi_init_clocks(void); - -#endif From f9e4a18de7398bc615f9d45250bdaf31eafc5af6 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 13:58:11 +0200 Subject: [PATCH 08/28] clk: vt8500: parse pmc_base from clock driver Currently, clock providers for vt8500 depend on machine_init providing pmc_base address before calling of_clk_init. With upcoming arch-wide .time_init calling of_clk_init, we should make clock providers independent of mach code. This adds a pmc_base parsing helper to current clock provider that gets called if there is no pmc_base set, yet. Signed-off-by: Sebastian Hesselbarth Acked-by: Tony Prisk Acked-by: Mike Turquette --- drivers/clk/clk-vt8500.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 82306f5fb9c2..39fe72aab1e5 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -15,11 +15,14 @@ #include #include +#include #include #include #include #include +#define LEGACY_PMC_BASE 0xD8130000 + /* All clocks share the same lock as none can be changed concurrently */ static DEFINE_SPINLOCK(_lock); @@ -53,6 +56,21 @@ struct clk_pll { static void __iomem *pmc_base; +static __init void vtwm_set_pmc_base(void) +{ + struct device_node *np = + of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); + + if (np) + pmc_base = of_iomap(np, 0); + else + pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); + of_node_put(np); + + if (!pmc_base) + pr_err("%s:of_iomap(pmc) failed\n", __func__); +} + #define to_clk_device(_hw) container_of(_hw, struct clk_device, hw) #define VT8500_PMC_BUSY_MASK 0x18 @@ -222,6 +240,9 @@ static __init void vtwm_device_clk_init(struct device_node *node) int rc; int clk_init_flags = 0; + if (!pmc_base) + vtwm_set_pmc_base(); + dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL); if (WARN_ON(!dev_clk)) return; @@ -636,6 +657,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) struct clk_init_data init; int rc; + if (!pmc_base) + vtwm_set_pmc_base(); + rc = of_property_read_u32(node, "reg", ®); if (WARN_ON(rc)) return; From f44089a7f41c88775428f09e90df8fb2b890058a Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 14:09:39 +0200 Subject: [PATCH 09/28] ARM: vt8500: prepare for arch-wide .init_time callback Current vt8500 board init calls of_clk_init() from vtwm_clk_init. To allow consolidation of DT driven .time_init, move of_clock_init() to a temporary .time_init callback that will be removed when arch-wide callback is available. With previous pmc_base parsing helper for vt8500 clock providers, we can also safely remove the call to vtwm_clk_init() and get rid of some includes. Signed-off-by: Sebastian Hesselbarth Acked-by: Tony Prisk Acked-by: Mike Turquette --- arch/arm/mach-vt8500/common.h | 24 ------------------------ arch/arm/mach-vt8500/vt8500.c | 13 ++++++++----- drivers/clk/clk-vt8500.c | 10 ---------- 3 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 arch/arm/mach-vt8500/common.h 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 @@ -/* linux/arch/arm/mach-vt8500/dt_common.h - * - * Copyright (C) 2012 Tony Prisk - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#ifndef __ARCH_ARM_MACH_VT8500_DT_COMMON_H -#define __ARCH_ARM_MACH_VT8500_DT_COMMON_H - -#include - -/* defined in drivers/clk/clk-vt8500.c */ -void __init vtwm_clk_init(void __iomem *pmc_base); - -#endif diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c index eefaa60d6614..504156351b3e 100644 --- a/arch/arm/mach-vt8500/vt8500.c +++ b/arch/arm/mach-vt8500/vt8500.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include @@ -33,8 +34,6 @@ #include #include -#include "common.h" - #define LEGACY_GPIO_BASE 0xD8110000 #define LEGACY_PMC_BASE 0xD8130000 @@ -75,6 +74,12 @@ static void vt8500_power_off(void) asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); } +static void __init vt8500_init_time(void) +{ + of_clk_init(NULL); + clocksource_of_init(); +} + void __init vt8500_init(void) { struct device_node *np; @@ -162,8 +167,6 @@ void __init vt8500_init(void) else pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__); - vtwm_clk_init(pmc_base); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } @@ -180,7 +183,7 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") .dt_compat = vt8500_dt_compat, .map_io = vt8500_map_io, .init_machine = vt8500_init, - .init_time = clocksource_of_init, + .init_time = vt8500_init_time, .restart = vt8500_restart, MACHINE_END diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 39fe72aab1e5..7fd5c5e9e25d 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -718,13 +718,3 @@ static void __init wm8850_pll_init(struct device_node *node) vtwm_pll_clk_init(node, PLL_TYPE_WM8850); } CLK_OF_DECLARE(wm8850_pll, "wm,wm8850-pll-clock", wm8850_pll_init); - -void __init vtwm_clk_init(void __iomem *base) -{ - if (!base) - return; - - pmc_base = base; - - of_clk_init(NULL); -} From 4178bac4f6e955869395b30246687d41183a5edb Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 12:24:03 +0200 Subject: [PATCH 10/28] ARM: call of_clk_init from default time_init handler Most DT ARM machs require common clock providers initialized before timers. Currently, arch/arm machs use .init_time to call of_clk_init right before clocksource_of_init. This prevents to remove that callback and use the default one instead. This patch adds a call to of_clk_init() to the default .init_time callback for COMMON_CLK enabled machs to allow to remove custom callbacks where applicable. While at it, also reorder includes alphabetically. Signed-off-by: Sebastian Hesselbarth --- arch/arm/kernel/time.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 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 @@ * This file contains the ARM-specific time handling details: * reading the RTC at bootup, etc... */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include +#include +#include +#include +#include #include +#include +#include +#include #include +#include +#include +#include +#include -#include -#include #include #include +#include +#include #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \ defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) @@ -116,8 +117,12 @@ int __init register_persistent_clock(clock_access_fn read_boot, void __init time_init(void) { - if (machine_desc->init_time) + if (machine_desc->init_time) { machine_desc->init_time(); - else + } else { +#ifdef CONFIG_COMMON_CLK + of_clk_init(NULL); +#endif clocksource_of_init(); + } } From 2881764d2a3638ec6e35e09df8f8e39338361ad7 Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Fri, 20 Sep 2013 15:16:14 -0400 Subject: [PATCH 11/28] ARM: bcm: provide common arch init for DT clocks With arch/arm calling of_clk_init(NULL) and clocksource_of_init() this is no longer needed. The former is useful because we can make use of dummy fixed clocks for drivers until the bcm281xx common clock driver is ready. Signed-off-by: Matt Porter Reviewed-by: Markus Mayer Acked-by: Christian Daudt --- arch/arm/mach-bcm/board_bcm281xx.c | 1 - 1 file changed, 1 deletion(-) 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) static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, }; DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor") - .init_time = clocksource_of_init, .init_machine = board_init, .restart = bcm_kona_restart, .dt_compat = bcm11351_dt_compat, From 9f1205d775b6be9cd6d19224e2916147815bc44a Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 17 Sep 2013 00:38:10 +0200 Subject: [PATCH 12/28] ARM: bcm2835: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Also remove call to of_clk_init from clk-bcm2835 with core fixed_clock match, as this has already been registered now. Signed-off-by: Sebastian Hesselbarth Acked-by: Stephen Warren Acked-by: Mike Turquette --- arch/arm/mach-bcm2835/bcm2835.c | 2 -- drivers/clk/clk-bcm2835.c | 8 -------- 2 files changed, 10 deletions(-) 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 @@ #include #include #include -#include #include #include @@ -134,7 +133,6 @@ DT_MACHINE_START(BCM2835, "BCM2835") .init_irq = bcm2835_init_irq, .handle_irq = bcm2835_handle_irq, .init_machine = bcm2835_init, - .init_time = clocksource_of_init, .restart = bcm2835_restart, .dt_compat = bcm2835_compat MACHINE_END 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 @@ #include #include #include -#include #include -static const struct of_device_id clk_match[] __initconst = { - { .compatible = "fixed-clock", .data = of_fixed_clk_setup, }, - { } -}; - /* * These are fixed clocks. They're probably not all root clocks and it may * 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) ret = clk_register_clkdev(clk, NULL, "20215000.uart"); if (ret) pr_err("uart1_pclk alias not registered\n"); - - of_clk_init(clk_match); } From 51e40f52d7b5254873eac6f76287b74accaecd64 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Fri, 6 Sep 2013 15:08:36 +0200 Subject: [PATCH 13/28] ARM: dove: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. While at it, also remove some obsolete includes. Signed-off-by: Sebastian Hesselbarth Tested-by: Andrew Lunn Acked-by: Jason Cooper --- arch/arm/mach-dove/board-dt.c | 11 ----------- 1 file changed, 11 deletions(-) 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 @@ #include #include -#include -#include #include #include -#include #include #include #include #include #include -#include #include "common.h" /* @@ -45,12 +41,6 @@ static void __init dove_legacy_clk_init(void) of_clk_get_from_provider(&clkspec)); } -static void __init dove_dt_time_init(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static void __init dove_dt_init_early(void) { mvebu_mbus_init("marvell,dove-mbus", @@ -84,7 +74,6 @@ static const char * const dove_dt_board_compat[] = { DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)") .map_io = dove_map_io, .init_early = dove_dt_init_early, - .init_time = dove_dt_time_init, .init_machine = dove_dt_init, .restart = dove_restart, .dt_compat = dove_dt_board_compat, From e8ecbc7c51a4c27030427db055597fb53e29d0db Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 12:45:59 +0200 Subject: [PATCH 14/28] ARM: exynos: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. While at it, also remove some now redundant includes. Signed-off-by: Sebastian Hesselbarth Reviewed-by: Tomasz Figa --- arch/arm/mach-exynos/common.c | 8 -------- arch/arm/mach-exynos/common.h | 1 - arch/arm/mach-exynos/mach-exynos4-dt.c | 2 -- arch/arm/mach-exynos/mach-exynos5-dt.c | 2 -- 4 files changed, 13 deletions(-) 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 @@ #include #include #include -#include -#include #include #include @@ -367,12 +365,6 @@ static void __init exynos5_map_io(void) iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc)); } -void __init exynos_init_time(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - struct bus_type exynos_subsys = { .name = "exynos-core", .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 @@ #include void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1); -void exynos_init_time(void); struct map_desc; void 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 @@ #include #include #include -#include #include #include @@ -54,7 +53,6 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") .init_early = exynos_firmware_init, .init_machine = exynos4_dt_machine_init, .init_late = exynos_init_late, - .init_time = exynos_init_time, .dt_compat = exynos4_dt_compat, .restart = exynos4_restart, .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 @@ #include #include #include -#include #include #include @@ -76,7 +75,6 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") .map_io = exynos_init_io, .init_machine = exynos5_dt_machine_init, .init_late = exynos_init_late, - .init_time = exynos_init_time, .dt_compat = exynos5_dt_compat, .restart = exynos5_restart, .reserve = exynos5_reserve, From 26cae166cff9148cd2cab40f64ed548ba1189a8e Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 27 Aug 2013 14:42:06 +0200 Subject: [PATCH 15/28] ARM: highbank: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Highbank clock provider need a reference to system registers, as a workaround current clk driver maps those independent of arch code now. Signed-off-by: Sebastian Hesselbarth Acked-by: Rob Herring Acked-by: Mike Turquette --- arch/arm/mach-highbank/highbank.c | 23 +++++++---------------- drivers/clk/clk-highbank.c | 10 +++++++--- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 8e63ccdb0de3..e6d6eacea9d0 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -83,20 +82,6 @@ static void __init highbank_init_irq(void) } } -static void __init highbank_timer_init(void) -{ - struct device_node *np; - - /* Map system registers */ - np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); - sregs_base = of_iomap(np, 0); - WARN_ON(!sregs_base); - - of_clk_init(NULL); - - clocksource_of_init(); -} - static void highbank_power_off(void) { highbank_set_pwr_shutdown(); @@ -155,6 +140,13 @@ static struct notifier_block highbank_platform_nb = { static void __init highbank_init(void) { + struct device_node *np; + + /* Map system registers */ + np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); + sregs_base = of_iomap(np, 0); + WARN_ON(!sregs_base); + pm_power_off = highbank_power_off; highbank_pm_init(); @@ -176,7 +168,6 @@ DT_MACHINE_START(HIGHBANK, "Highbank") #endif .smp = smp_ops(highbank_smp_ops), .init_irq = highbank_init_irq, - .init_time = highbank_timer_init, .init_machine = highbank_init, .dt_compat = highbank_match, .restart = highbank_restart, 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 @@ #include #include #include - -extern void __iomem *sregs_base; +#include #define HB_PLL_LOCK_500 0x20000000 #define HB_PLL_LOCK 0x10000000 @@ -280,6 +279,7 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk const char *clk_name = node->name; const char *parent_name; struct clk_init_data init; + struct device_node *srnp; int rc; rc = of_property_read_u32(node, "reg", ®); @@ -290,7 +290,11 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk if (WARN_ON(!hb_clk)) return NULL; - hb_clk->reg = sregs_base + reg; + /* Map system registers */ + srnp = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); + hb_clk->reg = of_iomap(srnp, 0); + BUG_ON(!hb_clk->reg); + hb_clk->reg += reg; of_property_read_string(node, "clock-output-names", &clk_name); From 4d9d18a560a50920691865c1efdad6577616eaa9 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 27 Aug 2013 14:50:00 +0200 Subject: [PATCH 16/28] ARM: imx: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Shawn Guo --- arch/arm/mach-imx/clk-imx51-imx53.c | 29 ++++++++++------------------- arch/arm/mach-imx/common.h | 4 ---- arch/arm/mach-imx/imx51-dt.c | 6 ------ arch/arm/mach-imx/mach-imx53.c | 6 ------ arch/arm/mach-imx/mach-imx6q.c | 14 +++----------- arch/arm/mach-imx/mach-imx6sl.c | 7 ------- arch/arm/mach-imx/mach-vf610.c | 9 --------- 7 files changed, 13 insertions(+), 62 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index 1a56a3319997..1b796db7652c 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -131,8 +132,6 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, { int i; - of_clk_init(NULL); - clk[dummy] = imx_clk_fixed("dummy", 0); clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil); 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, return 0; } -int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, - unsigned long rate_ckih1, unsigned long rate_ckih2) +static void __init mx51_clocks_init_dt(struct device_node *np) +{ + mx51_clocks_init(0, 0, 0, 0); +} +CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init_dt); + +static void __init mx53_clocks_init(struct device_node *np) { int i; unsigned long r; - struct device_node *np; clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 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, pr_err("i.MX53 clk %d: register failed with %ld\n", i, PTR_ERR(clk[i])); - np = of_find_compatible_node(NULL, NULL, "fsl,imx53-ccm"); clk_data.clks = clk; clk_data.clk_num = ARRAY_SIZE(clk); of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); - mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2); + mx5_clocks_common_init(0, 0, 0, 0); clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0"); 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, r = clk_round_rate(clk[usboh3_per_gate], 54000000); clk_set_rate(clk[usboh3_per_gate], r); - - return 0; -} - -int __init mx51_clocks_init_dt(void) -{ - return mx51_clocks_init(0, 0, 0, 0); -} - -int __init mx53_clocks_init_dt(void) -{ - return mx53_clocks_init(0, 0, 0, 0); } +CLK_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); extern int mx35_clocks_init(void); extern int mx51_clocks_init(unsigned long ckil, unsigned long osc, unsigned long ckih1, unsigned long ckih2); -extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, - unsigned long ckih1, unsigned long ckih2); extern int mx25_clocks_init_dt(void); extern int mx27_clocks_init_dt(void); extern int mx31_clocks_init_dt(void); -extern int mx51_clocks_init_dt(void); -extern int mx53_clocks_init_dt(void); extern struct platform_device *mxc_register_gpio(char *name, int id, resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); extern 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 = { NULL }; -static void __init imx51_timer_init(void) -{ - mx51_clocks_init_dt(); -} - DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)") .map_io = mx51_map_io, .init_early = imx51_init_early, .init_irq = mx51_init_irq, .handle_irq = imx51_handle_irq, - .init_time = imx51_timer_init, .init_machine = imx51_dt_init, .init_late = imx51_init_late, .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 = { NULL }; -static void __init imx53_timer_init(void) -{ - mx53_clocks_init_dt(); -} - DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)") .map_io = mx53_map_io, .init_early = imx53_init_early, .init_irq = mx53_init_irq, .handle_irq = imx53_handle_irq, - .init_time = imx53_timer_init, .init_machine = imx53_dt_init, .init_late = imx53_init_late, .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 85a1b51346c8..47ebc36636a7 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -11,9 +11,7 @@ */ #include -#include #include -#include #include #include #include @@ -192,6 +190,9 @@ static void __init imx6q_1588_init(void) static void __init imx6q_init_machine(void) { + imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q", + imx6q_revision()); + imx6q_enet_phy_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); @@ -288,14 +289,6 @@ static void __init imx6q_init_irq(void) irqchip_init(); } -static void __init imx6q_timer_init(void) -{ - of_clk_init(NULL); - clocksource_of_init(); - imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q", - imx6q_revision()); -} - static const char *imx6q_dt_compat[] __initdata = { "fsl,imx6dl", "fsl,imx6q", @@ -306,7 +299,6 @@ DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)") .smp = smp_ops(imx_smp_ops), .map_io = imx6q_map_io, .init_irq = imx6q_init_irq, - .init_time = imx6q_timer_init, .init_machine = imx6q_init_machine, .init_late = imx6q_init_late, .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 @@ * */ -#include #include #include #include @@ -31,11 +30,6 @@ static void __init imx6sl_init_irq(void) irqchip_init(); } -static void __init imx6sl_timer_init(void) -{ - of_clk_init(NULL); -} - static const char *imx6sl_dt_compat[] __initdata = { "fsl,imx6sl", NULL, @@ -44,7 +38,6 @@ static const char *imx6sl_dt_compat[] __initdata = { DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)") .map_io = debug_ll_io_init, .init_irq = imx6sl_init_irq, - .init_time = imx6sl_timer_init, .init_machine = imx6sl_init_machine, .dt_compat = imx6sl_dt_compat, .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 @@ */ #include -#include #include -#include #include #include @@ -28,12 +26,6 @@ static void __init vf610_init_irq(void) irqchip_init(); } -static void __init vf610_init_time(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static const char *vf610_dt_compat[] __initdata = { "fsl,vf610", NULL, @@ -41,7 +33,6 @@ static const char *vf610_dt_compat[] __initdata = { DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)") .init_irq = vf610_init_irq, - .init_time = vf610_init_time, .init_machine = vf610_init_machine, .dt_compat = vf610_dt_compat, .restart = mxc_restart, From a169e3aa37f33ca88131168e46bf23a317de6ace Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 27 Aug 2013 15:10:16 +0200 Subject: [PATCH 17/28] ARM: kirkwood: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Tested-by: Andrew Lunn Acked-by: Jason Cooper --- arch/arm/mach-kirkwood/board-dt.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index 82d3ad8e87cf..a32a3e507a9d 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -66,12 +65,6 @@ static void __init kirkwood_legacy_clk_init(void) clk_prepare_enable(clk); } -static void __init kirkwood_dt_time_init(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static void __init kirkwood_dt_init_early(void) { mvebu_mbus_init("marvell,kirkwood-mbus", @@ -122,7 +115,6 @@ DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") /* Maintainer: Jason Cooper */ .map_io = kirkwood_map_io, .init_early = kirkwood_dt_init_early, - .init_time = kirkwood_dt_time_init, .init_machine = kirkwood_dt_init, .restart = kirkwood_restart, .dt_compat = kirkwood_dt_board_compat, From dd03ee9ae5bc080297175c921b1a693d0de1e8b0 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 13:16:01 +0200 Subject: [PATCH 18/28] ARM: mxs: remove custom .init_time hook This patch converts clk-imx2[38] clocksource_of_init compatible init associated with fsl,imx2[38]-clkctrl. With arch/arm calling of_clk_init(NULL) from time_init(), we can now also remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Mike Turquette Acked-by: Shawn Guo --- arch/arm/mach-mxs/mach-mxs.c | 13 ------------- drivers/clk/mxs/clk-imx23.c | 15 ++++++++------- drivers/clk/mxs/clk-imx28.c | 16 ++++++++-------- include/linux/clk/mxs.h | 2 -- 4 files changed, 16 insertions(+), 30 deletions(-) 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 @@ #include #include #include -#include -#include #include #include #include @@ -490,16 +488,6 @@ static void mxs_restart(enum reboot_mode mode, const char *cmd) soft_restart(0); } -static void __init mxs_timer_init(void) -{ - if (of_machine_is_compatible("fsl,imx23")) - mx23_clocks_init(); - else - mx28_clocks_init(); - of_clk_init(NULL); - clocksource_of_init(); -} - static const char *mxs_dt_compat[] __initdata = { "fsl,imx28", "fsl,imx23", @@ -508,7 +496,6 @@ static const char *mxs_dt_compat[] __initdata = { DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)") .handle_irq = icoll_handle_irq, - .init_time = mxs_timer_init, .init_machine = mxs_machine_init, .init_late = mxs_pm_init, .dt_compat = mxs_dt_compat, 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 @@ #include #include #include +#include #include #include #include @@ -100,16 +101,16 @@ static enum imx23_clk clks_init_on[] __initdata = { cpu, hbus, xbus, emi, uart, }; -int __init mx23_clocks_init(void) +static void __init mx23_clocks_init(struct device_node *np) { - struct device_node *np; + struct device_node *dcnp; u32 i; - np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl"); - digctrl = of_iomap(np, 0); + dcnp = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl"); + digctrl = of_iomap(dcnp, 0); WARN_ON(!digctrl); + of_node_put(dcnp); - np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl"); clkctrl = of_iomap(np, 0); WARN_ON(!clkctrl); @@ -162,7 +163,7 @@ int __init mx23_clocks_init(void) if (IS_ERR(clks[i])) { pr_err("i.MX23 clk %d: register failed with %ld\n", i, PTR_ERR(clks[i])); - return PTR_ERR(clks[i]); + return; } clk_data.clks = clks; @@ -172,5 +173,5 @@ int __init mx23_clocks_init(void) for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) clk_prepare_enable(clks[clks_init_on[i]]); - return 0; } +CLK_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 @@ #include #include #include +#include #include #include #include @@ -154,16 +155,16 @@ static enum imx28_clk clks_init_on[] __initdata = { cpu, hbus, xbus, emi, uart, }; -int __init mx28_clocks_init(void) +static void __init mx28_clocks_init(struct device_node *np) { - struct device_node *np; + struct device_node *dcnp; u32 i; - np = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl"); - digctrl = of_iomap(np, 0); + dcnp = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl"); + digctrl = of_iomap(dcnp, 0); WARN_ON(!digctrl); + of_node_put(dcnp); - np = of_find_compatible_node(NULL, NULL, "fsl,imx28-clkctrl"); clkctrl = of_iomap(np, 0); WARN_ON(!clkctrl); @@ -239,7 +240,7 @@ int __init mx28_clocks_init(void) if (IS_ERR(clks[i])) { pr_err("i.MX28 clk %d: register failed with %ld\n", i, PTR_ERR(clks[i])); - return PTR_ERR(clks[i]); + return; } clk_data.clks = clks; @@ -250,6 +251,5 @@ int __init mx28_clocks_init(void) for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) clk_prepare_enable(clks[clks_init_on[i]]); - - return 0; } +CLK_OF_DECLARE(imx28_clkctrl, "fsl,imx28-clkctrl", mx28_clocks_init); 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 @@ #ifndef __LINUX_CLK_MXS_H #define __LINUX_CLK_MXS_H -int mx23_clocks_init(void); -int mx28_clocks_init(void); int mxs_saif_clkmux_select(unsigned int clkmux); #endif From e70ded64e6e08d7d35932b4a66a791480edfc0d1 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 19:09:21 +0200 Subject: [PATCH 19/28] ARM: nomadik: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Linus Walleij --- arch/arm/mach-nomadik/cpu-8815.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index 2be38a00a3d9..53fbf63c8b66 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include #include #include @@ -113,12 +111,6 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd) writel(1, srcbase + 0x18); } -static void __init cpu8815_timer_init_of(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static struct fsmc_nand_timings cpu8815_nand_timings = { .thiz = 0, .thold = 0x10, @@ -232,7 +224,6 @@ static const char * cpu8815_board_compat[] = { DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815") .map_io = cpu8815_map_io, - .init_time = cpu8815_timer_init_of, .init_machine = cpu8815_init_of, .restart = cpu8815_restart, .dt_compat = cpu8815_board_compat, From 638085eea1cb218bc9267d8629fb1982e1ff7c3b Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 27 Aug 2013 15:19:10 +0200 Subject: [PATCH 20/28] ARM: nspire: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth --- arch/arm/mach-nspire/nspire.c | 9 --------- 1 file changed, 9 deletions(-) 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 @@ #include #include #include -#include #include #include #include -#include #include #include @@ -65,12 +63,6 @@ static void __init nspire_init(void) nspire_auxdata, NULL); } -static void __init nspire_init_time(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static void nspire_restart(char mode, const char *cmd) { void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K); @@ -83,7 +75,6 @@ static void nspire_restart(char mode, const char *cmd) DT_MACHINE_START(NSPIRE, "TI-NSPIRE") .dt_compat = nspire_dt_match, .map_io = nspire_map_io, - .init_time = nspire_init_time, .init_machine = nspire_init, .restart = nspire_restart, MACHINE_END From 50432501fc6fabd57e86b968f0a4d5099e074c6f Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 14:23:55 +0200 Subject: [PATCH 21/28] ARM: prima2: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Barry Song --- arch/arm/mach-prima2/common.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c index 9b7663d9096f..d49aff74de98 100644 --- a/arch/arm/mach-prima2/common.c +++ b/arch/arm/mach-prima2/common.c @@ -6,8 +6,6 @@ * Licensed under GPLv2 or later. */ -#include -#include #include #include #include @@ -22,12 +20,6 @@ void __init sirfsoc_init_late(void) sirfsoc_pm_init(); } -static __init void sirfsoc_init_time(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static __init void sirfsoc_map_io(void) { sirfsoc_map_lluart(); @@ -43,7 +35,6 @@ static const char *atlas6_dt_match[] __initdata = { DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)") /* Maintainer: Barry Song */ .map_io = sirfsoc_map_io, - .init_time = sirfsoc_init_time, .init_late = sirfsoc_init_late, .dt_compat = atlas6_dt_match, .restart = sirfsoc_restart, @@ -59,7 +50,6 @@ static const char *prima2_dt_match[] __initdata = { DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)") /* Maintainer: Barry Song */ .map_io = sirfsoc_map_io, - .init_time = sirfsoc_init_time, .dma_zone_size = SZ_256M, .init_late = sirfsoc_init_late, .dt_compat = prima2_dt_match, @@ -77,7 +67,6 @@ DT_MACHINE_START(MARCO_DT, "Generic MARCO (Flattened Device Tree)") /* Maintainer: Barry Song */ .smp = smp_ops(sirfsoc_smp_ops), .map_io = sirfsoc_map_io, - .init_time = sirfsoc_init_time, .init_late = sirfsoc_init_late, .dt_compat = marco_dt_match, .restart = sirfsoc_restart, From 2ab38d9343416f0de93bfeafbd2470fcc994f8ab Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 27 Aug 2013 15:19:46 +0200 Subject: [PATCH 22/28] ARM: rockchip: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Heiko Stuebner --- arch/arm/mach-rockchip/rockchip.c | 9 --------- 1 file changed, 9 deletions(-) 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 @@ #include #include #include -#include -#include #include #include #include -static void __init rockchip_timer_init(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static void __init rockchip_dt_init(void) { l2x0_of_init(0, ~0UL); @@ -47,6 +39,5 @@ static const char * const rockchip_board_dt_compat[] = { DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)") .init_machine = rockchip_dt_init, - .init_time = rockchip_timer_init, .dt_compat = rockchip_board_dt_compat, MACHINE_END From dc8105817f634d50a91cea9464bbc73ebb36182e Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 13:38:00 +0200 Subject: [PATCH 23/28] ARM: socfpga: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Dinh Nguyen --- arch/arm/mach-socfpga/socfpga.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c index 6df7bb9fe64a..dd0d49cdbe09 100644 --- a/arch/arm/mach-socfpga/socfpga.c +++ b/arch/arm/mach-socfpga/socfpga.c @@ -14,8 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include -#include #include #include #include @@ -91,12 +89,6 @@ static void __init socfpga_init_irq(void) socfpga_sysmgr_init(); } -static void __init socfpga_init_time(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) { u32 temp; @@ -126,7 +118,6 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA") .smp = smp_ops(socfpga_smp_ops), .map_io = socfpga_map_io, .init_irq = socfpga_init_irq, - .init_time = socfpga_init_time, .init_machine = socfpga_cyclone5_init, .restart = socfpga_cyclone5_restart, .dt_compat = altera_dt_match, From 28fbb151d5afe15a2fabfe2fe8585b610b022f5b Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 27 Aug 2013 15:23:07 +0200 Subject: [PATCH 24/28] ARM: sti: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. To get rid of it, move l2cc init to .init_machine hook instead. Signed-off-by: Sebastian Hesselbarth Acked-by: Srinivas Kandagatla --- arch/arm/mach-sti/board-dt.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 @@ * published by the Free Software Foundation. */ -#include -#include #include +#include #include #include @@ -28,11 +27,10 @@ void __init stih41x_l2x0_init(void) l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK); } -static void __init stih41x_timer_init(void) +static void __init stih41x_machine_init(void) { - of_clk_init(NULL); - clocksource_of_init(); stih41x_l2x0_init(); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char *stih41x_dt_match[] __initdata = { @@ -42,7 +40,7 @@ static const char *stih41x_dt_match[] __initdata = { }; DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree") - .init_time = stih41x_timer_init, + .init_machine = stih41x_machine_init, .smp = smp_ops(sti_smp_ops), .dt_compat = stih41x_dt_match, MACHINE_END From b39e0249830a1b88cc213d1e9d3d1ca1f40df3b8 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Fri, 6 Sep 2013 15:11:01 +0200 Subject: [PATCH 25/28] ARM: sunxi: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Maxime Ripard --- arch/arm/mach-sunxi/sunxi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index e5a69756427b..90dda6228510 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c @@ -10,7 +10,6 @@ * warranty of any kind, whether express or implied. */ -#include #include #include #include @@ -114,12 +113,6 @@ static void sunxi_setup_restart(void) arm_pm_restart = of_id->data; } -static void __init sunxi_timer_init(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static void __init sunxi_dt_init(void) { sunxi_setup_restart(); @@ -138,6 +131,5 @@ static const char * const sunxi_board_dt_compat[] = { DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") .init_machine = sunxi_dt_init, - .init_time = sunxi_timer_init, .dt_compat = sunxi_board_dt_compat, MACHINE_END From 41136b664ad11d542e8378c757dac9ab174b0805 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 13:42:55 +0200 Subject: [PATCH 26/28] ARM: tegra: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Stephen Warren --- arch/arm/mach-tegra/tegra.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index 4da271df2e6c..2e2192807830 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c @@ -16,7 +16,6 @@ * */ -#include #include #include #include @@ -33,7 +32,6 @@ #include #include #include -#include #include #include @@ -84,12 +82,6 @@ out: of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); } -static void __init tegra_dt_init_time(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - static void __init paz00_init(void) { if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) @@ -129,7 +121,6 @@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)") .smp = smp_ops(tegra_smp_ops), .init_early = tegra_init_early, .init_irq = tegra_dt_init_irq, - .init_time = tegra_dt_init_time, .init_machine = tegra_dt_init, .init_late = tegra_dt_init_late, .restart = tegra_assert_system_reset, From 56e89cf55c47288f906bd769cb3d6d4736db548a Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Tue, 27 Aug 2013 15:34:12 +0200 Subject: [PATCH 27/28] ARM: vexpress: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. The call to versatile_sched_clock_init is moved to .init_early instead, were it is also for non-DT boards. Signed-off-by: Sebastian Hesselbarth Tested-by: Jon Medhurst (Tixy) Acked-by: Pawel Moll --- arch/arm/mach-vexpress/v2m.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) 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 @@ /* * Versatile Express V2M Motherboard Support */ -#include #include #include #include #include -#include #include #include #include @@ -22,7 +20,6 @@ #include #include #include -#include #include #include @@ -422,16 +419,8 @@ void __init v2m_dt_init_early(void) pr_warning("vexpress: DT HBI (%x) is not matching " "hardware (%x)!\n", dt_hbi, hbi); } -} -static void __init v2m_dt_timer_init(void) -{ - of_clk_init(NULL); - - clocksource_of_init(); - - versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), - 24000000); + versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000); } static const struct of_device_id v2m_dt_bus_match[] __initconst = { @@ -458,6 +447,5 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express") .smp_init = smp_init_ops(vexpress_smp_init_ops), .map_io = v2m_dt_map_io, .init_early = v2m_dt_init_early, - .init_time = v2m_dt_timer_init, .init_machine = v2m_dt_init, MACHINE_END From 64cc69abbb32e17aa44d2c696eca65cb6f9364ca Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 4 Sep 2013 14:12:46 +0200 Subject: [PATCH 28/28] ARM: vt8500: remove custom .init_time hook With arch/arm calling of_clk_init(NULL) from time_init(), we can now remove custom .init_time hooks. Signed-off-by: Sebastian Hesselbarth Acked-by: Tony Prisk --- arch/arm/mach-vt8500/vt8500.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c index 504156351b3e..4a73464cb11b 100644 --- a/arch/arm/mach-vt8500/vt8500.c +++ b/arch/arm/mach-vt8500/vt8500.c @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include #include #include #include @@ -74,12 +72,6 @@ static void vt8500_power_off(void) asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); } -static void __init vt8500_init_time(void) -{ - of_clk_init(NULL); - clocksource_of_init(); -} - void __init vt8500_init(void) { struct device_node *np; @@ -183,7 +175,6 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") .dt_compat = vt8500_dt_compat, .map_io = vt8500_map_io, .init_machine = vt8500_init, - .init_time = vt8500_init_time, .restart = vt8500_restart, MACHINE_END