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>
16 #include <linux/of_platform.h>
17 #include <linux/clk-provider.h>
18 #include <linux/dma-mapping.h>
19 #include <linux/irqchip.h>
20 #include <linux/kexec.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/map.h>
23 #include <mach/bridge-regs.h>
24 #include <linux/platform_data/usb-ehci-orion.h>
26 #include <plat/common.h>
30 * There are still devices that doesn't know about DT yet. Get clock
31 * gates here and add a clock lookup alias, so that old platform
35 static void __init kirkwood_legacy_clk_init(void)
38 struct device_node *np = of_find_compatible_node(
39 NULL, NULL, "marvell,kirkwood-gating-clock");
40 struct of_phandle_args clkspec;
44 clkspec.args_count = 1;
46 clkspec.args[0] = CGC_BIT_PEX0;
47 orion_clkdev_add("0", "pcie",
48 of_clk_get_from_provider(&clkspec));
50 clkspec.args[0] = CGC_BIT_PEX1;
51 orion_clkdev_add("1", "pcie",
52 of_clk_get_from_provider(&clkspec));
55 * The ethernet interfaces forget the MAC address assigned by
56 * u-boot if the clocks are turned off. Until proper DT support
57 * is available we always enable them for now.
59 clkspec.args[0] = CGC_BIT_GE0;
60 clk = of_clk_get_from_provider(&clkspec);
61 clk_prepare_enable(clk);
63 clkspec.args[0] = CGC_BIT_GE1;
64 clk = of_clk_get_from_provider(&clkspec);
65 clk_prepare_enable(clk);
68 static void __init kirkwood_dt_init_early(void)
70 mvebu_mbus_init("marvell,kirkwood-mbus",
71 BRIDGE_WINS_BASE, BRIDGE_WINS_SZ,
72 DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ);
75 static void __init kirkwood_dt_init(void)
77 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
80 * Disable propagation of mbus errors to the CPU local bus,
81 * as this causes mbus errors (which can occur for example
82 * for PCI aborts) to throw CPU aborts, which we're not set
85 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
87 BUG_ON(mvebu_mbus_dt_init());
91 kirkwood_cpufreq_init();
93 /* Setup clocks for legacy devices */
94 kirkwood_legacy_clk_init();
96 kirkwood_cpuidle_init();
99 kexec_reinit = kirkwood_enable_pcie;
102 if (of_machine_is_compatible("marvell,mv88f6281gtw-ge"))
103 mv88f6281gtw_ge_init();
105 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
108 static const char * const kirkwood_dt_board_compat[] = {
113 DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
114 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
115 .map_io = kirkwood_map_io,
116 .init_early = kirkwood_dt_init_early,
117 .init_machine = kirkwood_dt_init,
118 .restart = kirkwood_restart,
119 .dt_compat = kirkwood_dt_board_compat,