]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm/mach-kirkwood/board-dt.c
Merge tag 'imx-dt-3.12' of git://git.linaro.org/people/shawnguo/linux-2.6 into next/soc
[karo-tx-linux.git] / arch / arm / mach-kirkwood / board-dt.c
1 /*
2  * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3  *
4  * arch/arm/mach-kirkwood/board-dt.c
5  *
6  * Flattened Device Tree board initialization
7  *
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.
11  */
12
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"
26
27 /*
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.
31 */
32
33 static void __init kirkwood_legacy_clk_init(void)
34 {
35
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;
40
41         clkspec.np = np;
42         clkspec.args_count = 1;
43
44         clkspec.args[0] = CGC_BIT_PEX0;
45         orion_clkdev_add("0", "pcie",
46                          of_clk_get_from_provider(&clkspec));
47
48         clkspec.args[0] = CGC_BIT_PEX1;
49         orion_clkdev_add("1", "pcie",
50                          of_clk_get_from_provider(&clkspec));
51
52         clkspec.args[0] = CGC_BIT_SDIO;
53         orion_clkdev_add(NULL, "mvsdio",
54                          of_clk_get_from_provider(&clkspec));
55
56         /*
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.
60          */
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);
65
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);
70 }
71
72 static void __init kirkwood_of_clk_init(void)
73 {
74         of_clk_init(NULL);
75         kirkwood_legacy_clk_init();
76 }
77
78 static void __init kirkwood_dt_init(void)
79 {
80         pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
81
82         /*
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.
87          */
88         writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
89
90         BUG_ON(mvebu_mbus_dt_init());
91         kirkwood_setup_wins();
92
93         kirkwood_l2_init();
94
95         kirkwood_cpufreq_init();
96
97         /* Setup root of clk tree */
98         kirkwood_of_clk_init();
99
100         kirkwood_cpuidle_init();
101
102 #ifdef CONFIG_KEXEC
103         kexec_reinit = kirkwood_enable_pcie;
104 #endif
105
106         if (of_machine_is_compatible("globalscale,dreamplug"))
107                 dreamplug_init();
108
109         if (of_machine_is_compatible("globalscale,guruplug"))
110                 guruplug_dt_init();
111
112         if (of_machine_is_compatible("globalscale,sheevaplug"))
113                 sheevaplug_dt_init();
114
115         if (of_machine_is_compatible("dlink,dns-kirkwood"))
116                 dnskw_init();
117
118         if (of_machine_is_compatible("iom,iconnect"))
119                 iconnect_init();
120
121         if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
122                 ib62x0_init();
123
124         if (of_machine_is_compatible("qnap,ts219"))
125                 qnap_dt_ts219_init();
126
127         if (of_machine_is_compatible("seagate,dockstar"))
128                 dockstar_dt_init();
129
130         if (of_machine_is_compatible("seagate,goflexnet"))
131                 goflexnet_init();
132
133         if (of_machine_is_compatible("buffalo,lsxl"))
134                 lsxl_init();
135
136         if (of_machine_is_compatible("iom,ix2-200"))
137                 iomega_ix2_200_init();
138
139         if (of_machine_is_compatible("keymile,km_kirkwood"))
140                 km_kirkwood_init();
141
142         if (of_machine_is_compatible("lacie,cloudbox") ||
143             of_machine_is_compatible("lacie,inetspace_v2") ||
144             of_machine_is_compatible("lacie,netspace_lite_v2") ||
145             of_machine_is_compatible("lacie,netspace_max_v2") ||
146             of_machine_is_compatible("lacie,netspace_mini_v2") ||
147             of_machine_is_compatible("lacie,netspace_v2"))
148                 ns2_init();
149
150         if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
151             of_machine_is_compatible("marvell,db-88f6282-bp"))
152                 db88f628x_init();
153
154         if (of_machine_is_compatible("mpl,cec4"))
155                 mplcec4_init();
156
157         if (of_machine_is_compatible("netgear,readynas-duo-v2"))
158                 netgear_readynas_init();
159
160         if (of_machine_is_compatible("plathome,openblocks-a6"))
161                 openblocks_a6_init();
162
163         if (of_machine_is_compatible("usi,topkick"))
164                 usi_topkick_init();
165
166         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
167 }
168
169 static const char * const kirkwood_dt_board_compat[] = {
170         "globalscale,dreamplug",
171         "globalscale,guruplug",
172         "globalscale,sheevaplug",
173         "dlink,dns-320",
174         "dlink,dns-325",
175         "iom,iconnect",
176         "raidsonic,ib-nas62x0",
177         "qnap,ts219",
178         "seagate,dockstar",
179         "seagate,goflexnet",
180         "buffalo,lsxl",
181         "iom,ix2-200",
182         "keymile,km_kirkwood",
183         "lacie,cloudbox",
184         "lacie,inetspace_v2",
185         "lacie,netspace_lite_v2",
186         "lacie,netspace_max_v2",
187         "lacie,netspace_mini_v2",
188         "lacie,netspace_v2",
189         "marvell,db-88f6281-bp",
190         "marvell,db-88f6282-bp",
191         "mpl,cec4",
192         "netgear,readynas-duo-v2",
193         "plathome,openblocks-a6",
194         "usi,topkick",
195         "zyxel,nsa310",
196         NULL
197 };
198
199 DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
200         /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
201         .map_io         = kirkwood_map_io,
202         .init_early     = kirkwood_init_early,
203         .init_irq       = orion_dt_init_irq,
204         .init_time      = kirkwood_timer_init,
205         .init_machine   = kirkwood_dt_init,
206         .restart        = kirkwood_restart,
207         .dt_compat      = kirkwood_dt_board_compat,
208 MACHINE_END