Commit 27966ffe authored by Sebastian Hesselbarth's avatar Sebastian Hesselbarth

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: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: default avatarBarry Song <baohua.song@csr.com>
Acked-by: default avatarMike Turquette <mturquette@linaro.org>
parent 74227e65
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Licensed under GPLv2 or later. * Licensed under GPLv2 or later.
*/ */
#include <linux/clk-provider.h>
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -23,8 +24,7 @@ void __init sirfsoc_init_late(void) ...@@ -23,8 +24,7 @@ void __init sirfsoc_init_late(void)
static __init void sirfsoc_init_time(void) static __init void sirfsoc_init_time(void)
{ {
/* initialize clocking early, we want to set the OS timer */ of_clk_init(NULL);
sirfsoc_of_clk_init();
clocksource_of_init(); clocksource_of_init();
} }
......
...@@ -23,7 +23,6 @@ extern void sirfsoc_secondary_startup(void); ...@@ -23,7 +23,6 @@ extern void sirfsoc_secondary_startup(void);
extern void sirfsoc_cpu_die(unsigned int cpu); extern void sirfsoc_cpu_die(unsigned int cpu);
extern void __init sirfsoc_of_irq_init(void); 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 void sirfsoc_restart(enum reboot_mode, const char *);
extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs); extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs);
......
...@@ -1015,16 +1015,6 @@ static struct clk_std clk_usb1 = { ...@@ -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 { enum prima2_clk_index {
/* 0 1 2 3 4 5 6 7 8 9 */ /* 0 1 2 3 4 5 6 7 8 9 */
rtc, osc, pll1, pll2, pll3, mem, sys, security, dsp, gps, rtc, osc, pll1, pll2, pll3, mem, sys, security, dsp, gps,
...@@ -1082,24 +1072,16 @@ static struct clk_hw *prima2_clk_hw_array[maxclk] __initdata = { ...@@ -1082,24 +1072,16 @@ static struct clk_hw *prima2_clk_hw_array[maxclk] __initdata = {
static struct clk *prima2_clks[maxclk]; static struct clk *prima2_clks[maxclk];
static struct clk_onecell_data clk_data; 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; int i;
np = of_find_matching_node(NULL, rsc_ids); rscnp = of_find_compatible_node(NULL, NULL, "sirf,prima2-rsc");
if (!np) sirfsoc_rsc_vbase = of_iomap(rscnp, 0);
panic("unable to find compatible rsc node in dtb\n");
sirfsoc_rsc_vbase = of_iomap(np, 0);
if (!sirfsoc_rsc_vbase) if (!sirfsoc_rsc_vbase)
panic("unable to map rsc registers\n"); panic("unable to map rsc registers\n");
of_node_put(rscnp);
of_node_put(np);
np = of_find_matching_node(NULL, clkc_ids);
if (!np)
return;
sirfsoc_clk_vbase = of_iomap(np, 0); sirfsoc_clk_vbase = of_iomap(np, 0);
if (!sirfsoc_clk_vbase) if (!sirfsoc_clk_vbase)
...@@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void) ...@@ -1124,3 +1106,4 @@ void __init sirfsoc_of_clk_init(void)
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
} }
CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment