Commit 74227e65 authored by Sebastian Hesselbarth's avatar Sebastian Hesselbarth

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: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarMike Turquette <mturquette@linaro.org>
parent ea25a900
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/platform_data/clk-nomadik.h> #include <linux/clk-provider.h>
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
...@@ -115,8 +115,7 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd) ...@@ -115,8 +115,7 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
static void __init cpu8815_timer_init_of(void) static void __init cpu8815_timer_init_of(void)
{ {
/* We need this to be up now */ of_clk_init(NULL);
nomadik_clk_init();
clocksource_of_init(); clocksource_of_init();
} }
......
...@@ -512,6 +512,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np) ...@@ -512,6 +512,9 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
const char *parent_name; const char *parent_name;
u32 pll_id; u32 pll_id;
if (!src_base)
nomadik_src_init();
if (of_property_read_u32(np, "pll-id", &pll_id)) { if (of_property_read_u32(np, "pll-id", &pll_id)) {
pr_err("%s: PLL \"%s\" missing pll-id property\n", pr_err("%s: PLL \"%s\" missing pll-id property\n",
__func__, clk_name); __func__, clk_name);
...@@ -522,6 +525,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np) ...@@ -522,6 +525,8 @@ static void __init of_nomadik_pll_setup(struct device_node *np)
if (!IS_ERR(clk)) if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, 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) 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) ...@@ -529,6 +534,9 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
const char *clk_name = np->name; const char *clk_name = np->name;
const char *parent_name; const char *parent_name;
if (!src_base)
nomadik_src_init();
parent_name = of_clk_get_parent_name(np, 0); parent_name = of_clk_get_parent_name(np, 0);
/* /*
* The HCLK divides PLL1 with 1 (passthru), 2, 3 or 4. * 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) ...@@ -541,6 +549,8 @@ static void __init of_nomadik_hclk_setup(struct device_node *np)
if (!IS_ERR(clk)) if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, 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) 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) ...@@ -549,6 +559,9 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
const char *parent_name; const char *parent_name;
u32 clk_id; u32 clk_id;
if (!src_base)
nomadik_src_init();
if (of_property_read_u32(np, "clock-id", &clk_id)) { if (of_property_read_u32(np, "clock-id", &clk_id)) {
pr_err("%s: SRC clock \"%s\" missing clock-id property\n", pr_err("%s: SRC clock \"%s\" missing clock-id property\n",
__func__, clk_name); __func__, clk_name);
...@@ -559,33 +572,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np) ...@@ -559,33 +572,5 @@ static void __init of_nomadik_src_clk_setup(struct device_node *np)
if (!IS_ERR(clk)) if (!IS_ERR(clk))
of_clk_add_provider(np, of_clk_src_simple_get, clk); of_clk_add_provider(np, of_clk_src_simple_get, clk);
} }
CLK_OF_DECLARE(nomadik_src_clk,
static const struct of_device_id nomadik_src_clk_match[] __initconst = { "st,nomadik-src-clock", of_nomadik_src_clk_setup);
{
.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);
}
/* Minimal platform data header */
void nomadik_clk_init(void);
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