blob: 5d81a23943c6237cd3222646bc707f25c188de51 [file] [log] [blame]
Dong Aishengbc3a59c2012-03-31 21:26:57 +08001/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 * Copyright 2012 Linaro Ltd.
4 *
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:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
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>
24
25static int __init mxs_icoll_add_irq_domain(struct device_node *np,
26 struct device_node *interrupt_parent)
27{
28 irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL);
29
30 return 0;
31}
32
33static const struct of_device_id mxs_irq_match[] __initconst = {
34 { .compatible = "fsl,mxs-icoll", .data = mxs_icoll_add_irq_domain, },
35 { /* sentinel */ }
36};
37
38static void __init mxs_dt_init_irq(void)
39{
40 icoll_init_irq();
41 of_irq_init(mxs_irq_match);
42}
43
44static void __init imx28_timer_init(void)
45{
46 mx28_clocks_init();
47}
48
49static struct sys_timer imx28_timer = {
50 .init = imx28_timer_init,
51};
52
53static void __init imx28_evk_init(void)
54{
55 struct clk *clk;
56
57 /* Enable fec phy clock */
58 clk = clk_get_sys("enet_out", NULL);
59 if (!IS_ERR(clk))
60 clk_prepare_enable(clk);
61}
62
63static void __init mxs_machine_init(void)
64{
65 if (of_machine_is_compatible("fsl,imx28-evk"))
66 imx28_evk_init();
67
68 of_platform_populate(NULL, of_default_bus_match_table,
69 NULL, NULL);
70}
71
72static const char *imx28_dt_compat[] __initdata = {
73 "fsl,imx28-evk",
74 "fsl,imx28",
75 NULL,
76};
77
78DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
79 .map_io = mx28_map_io,
80 .init_irq = mxs_dt_init_irq,
81 .timer = &imx28_timer,
82 .init_machine = mxs_machine_init,
83 .dt_compat = imx28_dt_compat,
84 .restart = mxs_restart,
85MACHINE_END