Linux 3.11-rc4
[linux-2.6.git] / arch / arm / mach-kirkwood / board-dt.c
blob6e122ed3282f514d51f9c6cfc6d04f3be39cf3b9
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/kexec.h>
19 #include <asm/mach/arch.h>
20 #include <asm/mach/map.h>
21 #include <mach/bridge-regs.h>
22 #include <linux/platform_data/usb-ehci-orion.h>
23 #include <plat/irq.h>
24 #include <plat/common.h>
25 #include "common.h"
28 * There are still devices that doesn't know about DT yet. Get clock
29 * gates here and add a clock lookup alias, so that old platform
30 * devices still work.
33 static void __init kirkwood_legacy_clk_init(void)
36 struct device_node *np = of_find_compatible_node(
37 NULL, NULL, "marvell,kirkwood-gating-clock");
38 struct of_phandle_args clkspec;
39 struct clk *clk;
41 clkspec.np = np;
42 clkspec.args_count = 1;
44 clkspec.args[0] = CGC_BIT_PEX0;
45 orion_clkdev_add("0", "pcie",
46 of_clk_get_from_provider(&clkspec));
48 clkspec.args[0] = CGC_BIT_PEX1;
49 orion_clkdev_add("1", "pcie",
50 of_clk_get_from_provider(&clkspec));
52 clkspec.args[0] = CGC_BIT_SDIO;
53 orion_clkdev_add(NULL, "mvsdio",
54 of_clk_get_from_provider(&clkspec));
57 * The ethernet interfaces forget the MAC address assigned by
58 * u-boot if the clocks are turned off. Until proper DT support
59 * is available we always enable them for now.
61 clkspec.args[0] = CGC_BIT_GE0;
62 clk = of_clk_get_from_provider(&clkspec);
63 orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
64 clk_prepare_enable(clk);
66 clkspec.args[0] = CGC_BIT_GE1;
67 clk = of_clk_get_from_provider(&clkspec);
68 orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
69 clk_prepare_enable(clk);
72 static void __init kirkwood_of_clk_init(void)
74 of_clk_init(NULL);
75 kirkwood_legacy_clk_init();
78 static void __init kirkwood_dt_init(void)
80 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
83 * Disable propagation of mbus errors to the CPU local bus,
84 * as this causes mbus errors (which can occur for example
85 * for PCI aborts) to throw CPU aborts, which we're not set
86 * up to deal with.
88 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
90 kirkwood_setup_wins();
92 kirkwood_l2_init();
94 kirkwood_cpufreq_init();
96 /* Setup root of clk tree */
97 kirkwood_of_clk_init();
99 kirkwood_cpuidle_init();
101 #ifdef CONFIG_KEXEC
102 kexec_reinit = kirkwood_enable_pcie;
103 #endif
105 if (of_machine_is_compatible("globalscale,dreamplug"))
106 dreamplug_init();
108 if (of_machine_is_compatible("globalscale,guruplug"))
109 guruplug_dt_init();
111 if (of_machine_is_compatible("globalscale,sheevaplug"))
112 sheevaplug_dt_init();
114 if (of_machine_is_compatible("dlink,dns-kirkwood"))
115 dnskw_init();
117 if (of_machine_is_compatible("iom,iconnect"))
118 iconnect_init();
120 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
121 ib62x0_init();
123 if (of_machine_is_compatible("qnap,ts219"))
124 qnap_dt_ts219_init();
126 if (of_machine_is_compatible("seagate,dockstar"))
127 dockstar_dt_init();
129 if (of_machine_is_compatible("seagate,goflexnet"))
130 goflexnet_init();
132 if (of_machine_is_compatible("buffalo,lsxl"))
133 lsxl_init();
135 if (of_machine_is_compatible("iom,ix2-200"))
136 iomega_ix2_200_init();
138 if (of_machine_is_compatible("keymile,km_kirkwood"))
139 km_kirkwood_init();
141 if (of_machine_is_compatible("lacie,cloudbox") ||
142 of_machine_is_compatible("lacie,inetspace_v2") ||
143 of_machine_is_compatible("lacie,netspace_lite_v2") ||
144 of_machine_is_compatible("lacie,netspace_max_v2") ||
145 of_machine_is_compatible("lacie,netspace_mini_v2") ||
146 of_machine_is_compatible("lacie,netspace_v2"))
147 ns2_init();
149 if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
150 of_machine_is_compatible("marvell,db-88f6282-bp"))
151 db88f628x_init();
153 if (of_machine_is_compatible("mpl,cec4"))
154 mplcec4_init();
156 if (of_machine_is_compatible("netgear,readynas-duo-v2"))
157 netgear_readynas_init();
159 if (of_machine_is_compatible("plathome,openblocks-a6"))
160 openblocks_a6_init();
162 if (of_machine_is_compatible("usi,topkick"))
163 usi_topkick_init();
165 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
168 static const char * const kirkwood_dt_board_compat[] = {
169 "globalscale,dreamplug",
170 "globalscale,guruplug",
171 "globalscale,sheevaplug",
172 "dlink,dns-320",
173 "dlink,dns-325",
174 "iom,iconnect",
175 "raidsonic,ib-nas62x0",
176 "qnap,ts219",
177 "seagate,dockstar",
178 "seagate,goflexnet",
179 "buffalo,lsxl",
180 "iom,ix2-200",
181 "keymile,km_kirkwood",
182 "lacie,cloudbox",
183 "lacie,inetspace_v2",
184 "lacie,netspace_lite_v2",
185 "lacie,netspace_max_v2",
186 "lacie,netspace_mini_v2",
187 "lacie,netspace_v2",
188 "marvell,db-88f6281-bp",
189 "marvell,db-88f6282-bp",
190 "mpl,cec4",
191 "netgear,readynas-duo-v2",
192 "plathome,openblocks-a6",
193 "usi,topkick",
194 "zyxel,nsa310",
195 NULL
198 DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
199 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
200 .map_io = kirkwood_map_io,
201 .init_early = kirkwood_init_early,
202 .init_irq = orion_dt_init_irq,
203 .init_time = kirkwood_timer_init,
204 .init_machine = kirkwood_dt_init,
205 .restart = kirkwood_restart,
206 .dt_compat = kirkwood_dt_board_compat,
207 MACHINE_END