2 * Copyright 2012 Freescale Semiconductor, Inc.
3 * Copyright 2012 Linaro Ltd.
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
13 #include <linux/clk.h>
14 #include <linux/clkdev.h>
15 #include <linux/err.h>
16 #include <linux/init.h>
17 #include <linux/init.h>
18 #include <linux/irqdomain.h>
19 #include <linux/of_irq.h>
20 #include <linux/of_platform.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/time.h>
23 #include <mach/common.h>
25 static int __init mxs_icoll_add_irq_domain(struct device_node *np,
26 struct device_node *interrupt_parent)
28 irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL);
33 static int __init mxs_gpio_add_irq_domain(struct device_node *np,
34 struct device_node *interrupt_parent)
36 static int gpio_irq_base = MXS_GPIO_IRQ_START;
38 irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL);
44 static const struct of_device_id mxs_irq_match[] __initconst = {
45 { .compatible = "fsl,mxs-icoll", .data = mxs_icoll_add_irq_domain, },
46 { .compatible = "fsl,mxs-gpio", .data = mxs_gpio_add_irq_domain, },
50 static void __init mxs_dt_init_irq(void)
53 of_irq_init(mxs_irq_match);
56 static void __init imx23_timer_init(void)
61 static struct sys_timer imx23_timer = {
62 .init = imx23_timer_init,
65 static void __init imx28_timer_init(void)
70 static struct sys_timer imx28_timer = {
71 .init = imx28_timer_init,
74 static void __init imx28_evk_init(void)
78 /* Enable fec phy clock */
79 clk = clk_get_sys("enet_out", NULL);
81 clk_prepare_enable(clk);
84 static void __init mxs_machine_init(void)
86 if (of_machine_is_compatible("fsl,imx28-evk"))
89 of_platform_populate(NULL, of_default_bus_match_table,
93 static const char *imx23_dt_compat[] __initdata = {
99 static const char *imx28_dt_compat[] __initdata = {
105 DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)")
106 .map_io = mx23_map_io,
107 .init_irq = mxs_dt_init_irq,
108 .timer = &imx23_timer,
109 .init_machine = mxs_machine_init,
110 .dt_compat = imx23_dt_compat,
111 .restart = mxs_restart,
114 DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
115 .map_io = mx28_map_io,
116 .init_irq = mxs_dt_init_irq,
117 .timer = &imx28_timer,
118 .init_machine = mxs_machine_init,
119 .dt_compat = imx28_dt_compat,
120 .restart = mxs_restart,