x86/xen: resume timer irqs early
[linux/fpc-iii.git] / arch / arm / mach-kirkwood / board-dt.c
blob82d3ad8e87cf91395c0c706b48ef7df684e1e644
1 /*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
4 * arch/arm/mach-kirkwood/board-dt.c
6 * Flattened Device Tree board initialization
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/of.h>
16 #include <linux/of_platform.h>
17 #include <linux/clk-provider.h>
18 #include <linux/clocksource.h>
19 #include <linux/dma-mapping.h>
20 #include <linux/irqchip.h>
21 #include <linux/kexec.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/map.h>
24 #include <mach/bridge-regs.h>
25 #include <linux/platform_data/usb-ehci-orion.h>
26 #include <plat/irq.h>
27 #include <plat/common.h>
28 #include "common.h"
31 * There are still devices that doesn't know about DT yet. Get clock
32 * gates here and add a clock lookup alias, so that old platform
33 * devices still work.
36 static void __init kirkwood_legacy_clk_init(void)
39 struct device_node *np = of_find_compatible_node(
40 NULL, NULL, "marvell,kirkwood-gating-clock");
41 struct of_phandle_args clkspec;
42 struct clk *clk;
44 clkspec.np = np;
45 clkspec.args_count = 1;
47 clkspec.args[0] = CGC_BIT_PEX0;
48 orion_clkdev_add("0", "pcie",
49 of_clk_get_from_provider(&clkspec));
51 clkspec.args[0] = CGC_BIT_PEX1;
52 orion_clkdev_add("1", "pcie",
53 of_clk_get_from_provider(&clkspec));
56 * The ethernet interfaces forget the MAC address assigned by
57 * u-boot if the clocks are turned off. Until proper DT support
58 * is available we always enable them for now.
60 clkspec.args[0] = CGC_BIT_GE0;
61 clk = of_clk_get_from_provider(&clkspec);
62 clk_prepare_enable(clk);
64 clkspec.args[0] = CGC_BIT_GE1;
65 clk = of_clk_get_from_provider(&clkspec);
66 clk_prepare_enable(clk);
69 static void __init kirkwood_dt_time_init(void)
71 of_clk_init(NULL);
72 clocksource_of_init();
75 static void __init kirkwood_dt_init_early(void)
77 mvebu_mbus_init("marvell,kirkwood-mbus",
78 BRIDGE_WINS_BASE, BRIDGE_WINS_SZ,
79 DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ);
82 static void __init kirkwood_dt_init(void)
84 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
87 * Disable propagation of mbus errors to the CPU local bus,
88 * as this causes mbus errors (which can occur for example
89 * for PCI aborts) to throw CPU aborts, which we're not set
90 * up to deal with.
92 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
94 BUG_ON(mvebu_mbus_dt_init());
95 kirkwood_setup_wins();
97 kirkwood_l2_init();
99 kirkwood_cpufreq_init();
101 /* Setup clocks for legacy devices */
102 kirkwood_legacy_clk_init();
104 kirkwood_cpuidle_init();
106 #ifdef CONFIG_KEXEC
107 kexec_reinit = kirkwood_enable_pcie;
108 #endif
110 if (of_machine_is_compatible("marvell,mv88f6281gtw-ge"))
111 mv88f6281gtw_ge_init();
113 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
116 static const char * const kirkwood_dt_board_compat[] = {
117 "marvell,kirkwood",
118 NULL
121 DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
122 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
123 .map_io = kirkwood_map_io,
124 .init_early = kirkwood_dt_init_early,
125 .init_time = kirkwood_dt_time_init,
126 .init_machine = kirkwood_dt_init,
127 .restart = kirkwood_restart,
128 .dt_compat = kirkwood_dt_board_compat,
129 MACHINE_END