]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/arm/mach-kirkwood/board-dt.c
ARM: dove: update dove_defconfig with SI5351, PCI, and xHCI
[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         kirkwood_setup_wins();
91
92         kirkwood_l2_init();
93
94         kirkwood_cpufreq_init();
95
96         /* Setup root of clk tree */
97         kirkwood_of_clk_init();
98
99         kirkwood_cpuidle_init();
100
101 #ifdef CONFIG_KEXEC
102         kexec_reinit = kirkwood_enable_pcie;
103 #endif
104
105         if (of_machine_is_compatible("globalscale,dreamplug"))
106                 dreamplug_init();
107
108         if (of_machine_is_compatible("globalscale,guruplug"))
109                 guruplug_dt_init();
110
111         if (of_machine_is_compatible("globalscale,sheevaplug"))
112                 sheevaplug_dt_init();
113
114         if (of_machine_is_compatible("dlink,dns-kirkwood"))
115                 dnskw_init();
116
117         if (of_machine_is_compatible("iom,iconnect"))
118                 iconnect_init();
119
120         if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
121                 ib62x0_init();
122
123         if (of_machine_is_compatible("qnap,ts219"))
124                 qnap_dt_ts219_init();
125
126         if (of_machine_is_compatible("seagate,dockstar"))
127                 dockstar_dt_init();
128
129         if (of_machine_is_compatible("seagate,goflexnet"))
130                 goflexnet_init();
131
132         if (of_machine_is_compatible("buffalo,lsxl"))
133                 lsxl_init();
134
135         if (of_machine_is_compatible("iom,ix2-200"))
136                 iomega_ix2_200_init();
137
138         if (of_machine_is_compatible("keymile,km_kirkwood"))
139                 km_kirkwood_init();
140
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();
148
149         if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
150             of_machine_is_compatible("marvell,db-88f6282-bp"))
151                 db88f628x_init();
152
153         if (of_machine_is_compatible("mpl,cec4"))
154                 mplcec4_init();
155
156         if (of_machine_is_compatible("netgear,readynas-duo-v2"))
157                 netgear_readynas_init();
158
159         if (of_machine_is_compatible("plathome,openblocks-a6"))
160                 openblocks_a6_init();
161
162         if (of_machine_is_compatible("usi,topkick"))
163                 usi_topkick_init();
164
165         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
166 }
167
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
196 };
197
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