xref: /linux/drivers/clk/socfpga/clk.c (revision 97259e99bdc9144d071815536f1dbc2e41c6b5a8)
166314223SDinh Nguyen /*
256c5c13fSDinh Nguyen  *  Copyright 2011-2012 Calxeda, Inc.
356c5c13fSDinh Nguyen  *  Copyright (C) 2012-2013 Altera Corporation <www.altera.com>
466314223SDinh Nguyen  *
566314223SDinh Nguyen  * This program is free software; you can redistribute it and/or modify
666314223SDinh Nguyen  * it under the terms of the GNU General Public License as published by
766314223SDinh Nguyen  * the Free Software Foundation; either version 2 of the License, or
866314223SDinh Nguyen  * (at your option) any later version.
966314223SDinh Nguyen  *
1066314223SDinh Nguyen  * This program is distributed in the hope that it will be useful,
1166314223SDinh Nguyen  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1266314223SDinh Nguyen  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1366314223SDinh Nguyen  * GNU General Public License for more details.
1466314223SDinh Nguyen  *
1556c5c13fSDinh Nguyen  * Based from clk-highbank.c
1656c5c13fSDinh Nguyen  *
1766314223SDinh Nguyen  * You should have received a copy of the GNU General Public License
1866314223SDinh Nguyen  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
1966314223SDinh Nguyen  */
2066314223SDinh Nguyen #include <linux/clk.h>
2166314223SDinh Nguyen #include <linux/clkdev.h>
2266314223SDinh Nguyen #include <linux/clk-provider.h>
2356c5c13fSDinh Nguyen #include <linux/io.h>
2456c5c13fSDinh Nguyen #include <linux/of.h>
256a7e7122SDinh Nguyen #include <linux/of_address.h>
2666314223SDinh Nguyen 
27*97259e99SSteffen Trumtrar #include "clk.h"
2856c5c13fSDinh Nguyen 
29*97259e99SSteffen Trumtrar void __iomem *clk_mgr_base_addr;
306a7e7122SDinh Nguyen 
316a7e7122SDinh Nguyen static struct of_device_id socfpga_child_clocks[] = {
326a7e7122SDinh Nguyen 	{ .compatible = "altr,socfpga-pll-clock", socfpga_pll_init, },
336a7e7122SDinh Nguyen 	{ .compatible = "altr,socfpga-perip-clk", socfpga_periph_init, },
346a7e7122SDinh Nguyen 	{ .compatible = "altr,socfpga-gate-clk", socfpga_gate_init, },
356a7e7122SDinh Nguyen 	{},
366a7e7122SDinh Nguyen };
376a7e7122SDinh Nguyen 
386a7e7122SDinh Nguyen static void __init socfpga_clkmgr_init(struct device_node *node)
396a7e7122SDinh Nguyen {
406a7e7122SDinh Nguyen 	clk_mgr_base_addr = of_iomap(node, 0);
416a7e7122SDinh Nguyen 	of_clk_init(socfpga_child_clocks);
426a7e7122SDinh Nguyen }
436a7e7122SDinh Nguyen CLK_OF_DECLARE(socfpga_mgr, "altr,clk-mgr", socfpga_clkmgr_init);
44825f0c26SDinh Nguyen 
45