xref: /openbmc/linux/drivers/clk/socfpga/clk.c (revision afb46f79)
1 /*
2  *  Copyright 2011-2012 Calxeda, Inc.
3  *  Copyright (C) 2012-2013 Altera Corporation <www.altera.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * Based from clk-highbank.c
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <linux/clk.h>
21 #include <linux/clkdev.h>
22 #include <linux/clk-provider.h>
23 #include <linux/io.h>
24 #include <linux/of.h>
25 #include <linux/of_address.h>
26 
27 #include "clk.h"
28 
29 void __iomem *clk_mgr_base_addr;
30 
31 static const struct of_device_id socfpga_child_clocks[] __initconst = {
32 	{ .compatible = "altr,socfpga-pll-clock", socfpga_pll_init, },
33 	{ .compatible = "altr,socfpga-perip-clk", socfpga_periph_init, },
34 	{ .compatible = "altr,socfpga-gate-clk", socfpga_gate_init, },
35 	{},
36 };
37 
38 static void __init socfpga_clkmgr_init(struct device_node *node)
39 {
40 	clk_mgr_base_addr = of_iomap(node, 0);
41 	of_clk_init(socfpga_child_clocks);
42 }
43 CLK_OF_DECLARE(socfpga_mgr, "altr,clk-mgr", socfpga_clkmgr_init);
44 
45