aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/socfpga/clk.c
diff options
context:
space:
mode:
authorDinh Nguyen <dinguyen@altera.com>2013-12-09 18:16:38 -0500
committerMike Turquette <mturquette@linaro.org>2014-02-18 17:08:07 -0500
commit6a7e71221d4e6cd185a51e2659f279da67f2e22d (patch)
tree9d498dd18b323f6cdacb93869ebed76ba4f0b69d /drivers/clk/socfpga/clk.c
parent6d0abeca3242a88cab8232e4acd7e2bf088f3bc2 (diff)
clk: socfpga: Map the clk manager base address in the clock driver
The clk manager's base address was being mapped in SOCFPGA's arch code and being extern'ed out to the clock driver. This method is not correct, and the arch code was not really doing anything with that clk manager anyways. This patch moves the mapping of the clk manager's base address in the clock driver itself. Cleans up CLK_OF_DECLARE() into a single registration of all the clocks. Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Dinh Nguyen <dinguyen@altera.com> Acked-by: Arnd Bergmann <arnd@arndb.de> --- v2: Use a static declaration for the clk_mgr_base_addr. Clean up the CLK_OF_DECLARE() as suggested by Arnd.
Diffstat (limited to 'drivers/clk/socfpga/clk.c')
-rw-r--r--drivers/clk/socfpga/clk.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/clk/socfpga/clk.c b/drivers/clk/socfpga/clk.c
index 5983a26a8c5f..4fb52e1fc848 100644
--- a/drivers/clk/socfpga/clk.c
+++ b/drivers/clk/socfpga/clk.c
@@ -22,6 +22,7 @@
22#include <linux/clk-provider.h> 22#include <linux/clk-provider.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/of_address.h>
25 26
26/* Clock Manager offsets */ 27/* Clock Manager offsets */
27#define CLKMGR_CTRL 0x0 28#define CLKMGR_CTRL 0x0
@@ -55,7 +56,7 @@
55#define div_mask(width) ((1 << (width)) - 1) 56#define div_mask(width) ((1 << (width)) - 1)
56#define streq(a, b) (strcmp((a), (b)) == 0) 57#define streq(a, b) (strcmp((a), (b)) == 0)
57 58
58extern void __iomem *clk_mgr_base_addr; 59static void __iomem *clk_mgr_base_addr;
59 60
60struct socfpga_clk { 61struct socfpga_clk {
61 struct clk_gate hw; 62 struct clk_gate hw;
@@ -320,19 +321,30 @@ static void __init socfpga_pll_init(struct device_node *node)
320{ 321{
321 socfpga_clk_init(node, &clk_pll_ops); 322 socfpga_clk_init(node, &clk_pll_ops);
322} 323}
323CLK_OF_DECLARE(socfpga_pll, "altr,socfpga-pll-clock", socfpga_pll_init);
324 324
325static void __init socfpga_periph_init(struct device_node *node) 325static void __init socfpga_periph_init(struct device_node *node)
326{ 326{
327 socfpga_clk_init(node, &periclk_ops); 327 socfpga_clk_init(node, &periclk_ops);
328} 328}
329CLK_OF_DECLARE(socfpga_periph, "altr,socfpga-perip-clk", socfpga_periph_init);
330 329
331static void __init socfpga_gate_init(struct device_node *node) 330static void __init socfpga_gate_init(struct device_node *node)
332{ 331{
333 socfpga_gate_clk_init(node, &gateclk_ops); 332 socfpga_gate_clk_init(node, &gateclk_ops);
334} 333}
335CLK_OF_DECLARE(socfpga_gate, "altr,socfpga-gate-clk", socfpga_gate_init); 334
335static struct of_device_id socfpga_child_clocks[] = {
336 { .compatible = "altr,socfpga-pll-clock", socfpga_pll_init, },
337 { .compatible = "altr,socfpga-perip-clk", socfpga_periph_init, },
338 { .compatible = "altr,socfpga-gate-clk", socfpga_gate_init, },
339 {},
340};
341
342static void __init socfpga_clkmgr_init(struct device_node *node)
343{
344 clk_mgr_base_addr = of_iomap(node, 0);
345 of_clk_init(socfpga_child_clocks);
346}
347CLK_OF_DECLARE(socfpga_mgr, "altr,clk-mgr", socfpga_clkmgr_init);
336 348
337void __init socfpga_init_clocks(void) 349void __init socfpga_init_clocks(void)
338{ 350{